loading_progress_hud 0.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 63

loading_progress_hud #

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

Demo

Usage #

Add the package to your pubspec.yml file.

dependencies:
  loading_progress_hud: ^0.0.1

Next, import the library into your widget.

import 'package:loading_progress_hud/loading_progress_hud.dart';

eg:

    LELoadingController _controller;

  @override
  void initState() {
    _controller = LELoadingController(initType: LoadingOrgStatus.none);
    super.initState();
  }
  
  
  Future<LoadingOrgStatus> loadData() async {
    await Future.delayed(Duration(seconds: 2));
    return widget.netWorkEndType;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('Demo'),
          backgroundColor: Colors.blue,
        ),
        body: LELoadingProgressHUD(
          controller: _controller,
          loadingCallBack: loadData,
          child: new Container(
            child: Center(
              child: Text('loading demo 😁😁'),
            ),
          ),
        ));
  }

Options #

The current parameters are customizable in the constructor

LELoadingProgressHUD({
    Key key,
    @required this.controller,
    @required this.child,
    this.loadingCallBack,
    emptyIcon,
    this.textColor,
    this.bacgroundColor,
    this.progressIndicator = const CircularProgressIndicator(),
    this.loadingIndicator = const CircularProgressIndicator(),
  }) 

controller hud

LELoadingController({
    Key key,
    this.initType = LoadingOrgStatus.loading,
    this.emptyText = '暂无数据',//Empty Title
    this.refreshText = '重新获取数据',//refresh Title
    this.errorText = '数据错误',// error Title
    this.loadingText = '正在加载...',//loading title
  });

Issues and feedback #

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

[0.0.1]

  • add Initialization

[0.0.2]

  • fix bug

example/README.md

example #

Demo #

Demo

#example

class TestLoadingPage extends StatefulWidget {
  @override
  _TestLoadingPageState createState() => _TestLoadingPageState();
}

class _TestLoadingPageState extends State<TestLoadingPage> {
  LELoadingController _controller;

  @override
  void initState() {
    _controller = LELoadingController(initType: LoadingOrgStatus.none);
    super.initState();
  }

  void hudTest() async {
    _controller.show(hud: 'loading...');
    await Future.delayed(Duration(seconds: 2));
    _controller.hide();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('loading Progress HUD Demo'),
        backgroundColor: Colors.blue,
      ),
      body: LELoadingProgressHUD(
        controller: _controller,
        child: ListView.separated(
          itemBuilder: (context, index) {
            if (index == 0) {
              return SizedBox(
                height: 20,
              );
            }

            switch (index) {
              case 1:
                return CupertinoButton(
                  child: Text(
                    'loading + empty',
                    style: TextStyle(color: Colors.white),
                  ),
                  disabledColor: Color(0xffA9A9A9),
                  color: Colors.red,
                  onPressed: () {
                    Navigator.of(context)
                        .push(MaterialPageRoute(builder: (context) {
                      return FunctionDemo(
                        initType: LoadingOrgStatus.loading,
                        netWorkEndType: LoadingOrgStatus.empty,
                      );
                    }));
                  },
                );
              case 2:
                return CupertinoButton(
                  child: Text(
                    'loading + Error',
                    style: TextStyle(color: Colors.white),
                  ),
                  disabledColor: Color(0xffA9A9A9),
                  color: Colors.red,
                  onPressed: () {
                    Navigator.of(context)
                        .push(MaterialPageRoute(builder: (context) {
                      return FunctionDemo(
                        initType: LoadingOrgStatus.loading,
                        netWorkEndType: LoadingOrgStatus.error,
                      );
                    }));
                  },
                );
              case 3:
                return CupertinoButton(
                  padding:
                      EdgeInsets.only(left: 16, right: 16, top: 10, bottom: 10),
                  child: Text(
                    'loading + refresh',
                    style: TextStyle(color: Colors.white),
                  ),
                  disabledColor: Color(0xffA9A9A9),
                  color: Colors.red,
                  onPressed: () {
                    Navigator.of(context)
                        .push(MaterialPageRoute(builder: (context) {
                      return FunctionDemo(
                        initType: LoadingOrgStatus.loading,
                        netWorkEndType: LoadingOrgStatus.refresh,
                      );
                    }));
                  },
                );

              case 4:
                return CupertinoButton(
                  padding:
                      EdgeInsets.only(left: 16, right: 16, top: 10, bottom: 10),
                  child: Text(
                    'Hud',
                    style: TextStyle(color: Colors.white),
                  ),
                  disabledColor: Color(0xffA9A9A9),
                  color: Colors.red,
                  onPressed: () {
                    hudTest();
                  },
                );
              default:
            }
          },
          separatorBuilder: (context, index) {
            return Divider(
              height: 10,
            );
          },
          itemCount: 6,
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  loading_progress_hud: ^0.0.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:loading_progress_hud/loading_progress_hud.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
39
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
63
Learn more about scoring.

We analyzed this package on Dec 7, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/loading_progress_hud.dart.

Run flutter format to format lib/loading_progress_hud.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test