パッケージ、リポジトリ、アプリカテゴリを検索

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 を備えたモーダルプログレスインジケーターウィジェットを提供する Flutter パッケージで、既存の UI 要素の上にロードオーバーレイを表示することを目的としています。これは元の modal_progress_hud のメンテナンスされたフォークであり、現代的な Dart の実践に最適化されています。ウィジェットはロード中にユーザー操作をブロックでき、ブールフラグによって簡単に制御できます。ネットワークリクエストや長時間実行される操作中のロード状態を、複数のプラットフォームで表示するのに最適です。

用途

  • API 呼び出し中にロード状態を表示する
  • フォーム送信中にUIをブロックする
  • バックグラウンドタスクでの進行状況の表示
  • データ取得中のユーザーエクスペリエンスの向上
  • ログインフローでの視覚的フィードバックの提供

主な機能

  • Sound Null Safety のサポート
  • 可視性用のシンプルなブール制御
  • 下部のUIを無効にするモーダルオーバーレイ
  • クロスプラットフォーム互換性
  • 既存のウィジェットとの簡単な統合
  • カスタマイズ可能な読み込みインジケーター

適している対象

  • null安全性を備えたFlutterを使用する開発者
  • 明確な読み込みフィードバックを必要とするアプリ
  • 軽量な進行状況インジケータが必要なプロジェクト
  • 更新された依存関係を持つレガシーコードベースを維持するチーム
  • 頻繁な非同期操作を伴うUI重視のアプリケーション

注意事項

  • ネストされたオーバーレイの手動処理が必要になる場合があります
  • モーダルでない読み込みシナリオには適していません
  • 基本的なスタイリングを超えるカスタマイズは限られている
  • 親ウィジェットのレイアウト制約に依存します
  • 一度に1つのアクティブな読み込み状態のみを使用するのが最適です

元の 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!

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト