패키지, 저장소 및 앱 카테고리 검색

modal_progress_hud_nsn 표지
패키지 상세v0.5.1

modal_progress_hud_nsn

사운드 null 안전성을 갖춘 모달 진행 표시 위젯. https://github.com/mmcc007/modal_progress_hud의 포크

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
1.3만
좋아요
302
Pub 점수
160

패키지 설치

flutter pub add modal_progress_hud_nsn

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Sound Null Safety를 갖춘 모달 진행률 표시 위젯을 제공하는 플러터 패키지로, 기존 UI 요소 위에 로딩 오버레이를 표시하도록 설계되었습니다. 현대적인 Dart 실천 사례에 최적화된 원본 modal_progress_hud의 유지 보수된 포크입니다. 위젯은 로딩 중 사용자 상호작용을 차단할 수 있으며 부울 플래그를 통해 쉽게 제어할 수 있습니다. 네트워크 요청 또는 장시간 실행 작업 중 로딩 상태를 여러 플랫폼에서 표시하는 데 이상적입니다.

사용 사례

  • API 호출 중 로딩 상태 표시
  • 폼 제출 중에 UI 차단
  • 백그라운드 작업에서 진행 상황 표시
  • 데이터 가져오기 중 사용자 경험 향상
  • 로그인 흐름에서 시각적 피드백 제공

주요 기능

  • Sound Null Safety 지원
  • 가시성용 간단한 불리언 제어
  • 하위 UI를 비활성화하는 모달 오버레이
  • 크로스 플랫폼 호환성
  • 기존 위젯과의 간편한 통합
  • 사용자 정의 가능한 로딩 표시기

적합한 대상

  • 널 안전성을 갖춘 플러터 사용 개발자
  • 명확한 로딩 피드백이 필요한 앱
  • 경량 진행 표시기가 필요한 프로젝트
  • 업데이트된 종속성을 가진 레거시 코드베이스를 유지 관리하는 팀
  • 자주 비동기 작업을 수행하는 UI 중심 애플리케이션

고려 사항

  • 중첩 오버레이의 수동 처리가 필요할 수 있습니다
  • 비모달 로딩 시나리오에 적합하지 않습니다
  • 기본 스타일링을 초과한 사용자 정의는 제한적입니다
  • 부모 위젯의 레이아웃 제약 조건에 따라 다릅니다
  • 한 번에 하나의 활성 로딩 상태만 사용하는 것이 가장 좋습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

modal_progress_hud_nsn

pub package

A simple widget wrapper to enable modal progress HUD (a modal progress indicator, HUD = Heads Up Display)

A fork of the original modal_progress_hud by mmcc007 with Null Safety and additional features.

Usage

Add the modal_progress_hud_nsn to dependencies in pubspec.yaml.

dependencies:
    modal_progress_hud_nsn: ^0.5.1

Next, import the library into your app.

import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';

Now, wrap your widget as a child of ModalProgressHUD, typically a form, together with a boolean variable that is maintained in local state.

...
bool _saving = false
...

@override
Widget build(BuildContext context) {
  return Scaffold(
     body: ModalProgressHUD(child: Container(
       Form(...)
     ), inAsyncCall: _saving),
  );
}

Options

Below parameters can be customised accordingly.

ModalProgressHUD(
  @required inAsyncCall: bool,
  @required child: Widget,
  opacity: double,
  color: Color,
  progressIndicator: CircularProgressIndicator,
  offset: double
  dismissible: bool,
  blur: double,
);

Example

An example app that demonstrates the usage.

  1. On initial load, _saving defaults to false which causes your child widget to display.
  2. When the form is submitted, _saving is set to true, which will display the modal.
  3. Once the async call is complete, _saving is set back to false, hiding the modal.
Example Code
class SettingsPage extends StatefulWidget {
  @override
  _SettingsPageState createState() => new _SettingsPageState();
}

class _SettingsPageState extends State<SettingsPage> {
  bool _saving = false;

  void _submit() {

    setState(() {
      _saving = true;
    });

    //Simulate a service call
    print('submitting to backend...');
    new Future.delayed(new Duration(seconds: 4), () {
      setState(() {
        _saving = false;
      });
    });
  }

  Widget _buildWidget() {
    return new Form(
      child: new Column(
        children: [
          new SwitchListTile(
            title: const Text('Bedroom'),
            value: _bedroom,
            onChanged: (bool value) {
              setState(() {
                _bedroom = value;
              });
            },
            secondary: const Icon(Icons.hotel),
          ),
          new RaisedButton(
            onPressed: _submit,
            child: new Text('Save'),
          ),
        ],
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('Flutter Progress Indicator Demo'),
        backgroundColor: Colors.blue,
      ),
      body: ModalProgressHUD(child: _buildWidget(), inAsyncCall: _saving),
    );
  }
}

Similar Alternatives

Useful Resources

See this article on Medium about async form validation

See the example application source for a complete sample app using the modal progress HUD. Included in the example is a method for using a form's validators while making async calls (see flutter/issues/9688 for details).

Issues and feedback

Please file issues to send feedback, request features or report a bug. Thank you!

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트