Homepage: https://github.com/pablo384/progress_hud
A clean and lightweight progress HUD for your Flutter app based on the original progress_hud: https://pub.dartlang.org/packages/progress_hud
class _MyHomePageState extends State<MyHomePage> {
ProgressHUD _progressHUD;
bool _loading = true;
@override
void initState() {
super.initState();
_progressHUD = new ProgressHUD(
backgroundColor: Colors.black12,
color: Colors.white,
containerColor: Colors.blue,
borderRadius: 5.0,
text: 'Loading...',
);
}
@override
Widget build(BuildContext context) {
void dismissProgressHUD() {
setState(() {
if (_loading) {
_progressHUD.state.dismiss();
} else {
_progressHUD.state.show();
}
_loading = !_loading;
});
}
return new Scaffold(
appBar: new AppBar(
title: new Text('ProgressHUD Demo'),
),
body: new Stack(
children: <Widget>[
new Text(
'A clean and lightweight progress HUD for your Flutter app'),
_progressHUD,
new Positioned(
child: new FlatButton(
onPressed: dismissProgressHUD,
child: new Text(_loading ? "Dismiss" : "Show")),
bottom: 30.0,
right: 10.0)
],
));
}
}
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:progress_hud_v2/progress_hud.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: new MyHomePage(title: 'Flutter Demo'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
ProgressHUD _progressHUD;
bool _loading = true;
@override
void initState() {
super.initState();
_progressHUD = new ProgressHUD(
backgroundColor: Colors.black12,
color: Colors.white,
containerColor: Colors.blue,
borderRadius: 5.0,
text: 'Loading...',
);
}
@override
Widget build(BuildContext context) {
void dismissProgressHUD() {
setState(() {
if (_loading) {
_progressHUD.state.dismiss();
} else {
_progressHUD.state.show();
}
_loading = !_loading;
});
}
return new Scaffold(
appBar: new AppBar(
title: new Text('ProgressHUD Demo'),
),
body: new Stack(
children: <Widget>[
new Text(
'A clean and lightweight progress HUD for your Flutter app'),
_progressHUD,
new Positioned(
child: new FlatButton(
onPressed: dismissProgressHUD,
child: new Text(_loading ? "Dismiss" : "Show")),
bottom: 30.0,
right: 10.0)
],
));
}
}
Add this to your package's pubspec.yaml file:
dependencies:
progress_hud_v2: ^2.0.0
You can install packages from the command line:
with Flutter:
$ flutter packages get
Alternatively, your editor might support flutter packages get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:progress_hud_v2/generated/i18n.dart';
import 'package:progress_hud_v2/progress_hud.dart';
Version | Uploaded | Documentation | Archive |
---|---|---|---|
2.0.0 | Sep 1, 2018 |
|
|
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
76
|
Health:
Code health derived from static analysis.
[more]
|
100
|
Maintenance:
Reflects how tidy and up-to-date the package is.
[more]
|
100
|
Overall:
Weighted score of the above.
[more]
|
88
|
We analyzed this package on Feb 14, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter
References Flutter, and has no conflicting libraries.
Fix lib/progress_hud.dart
. (-0.50 points)
Analysis of lib/progress_hud.dart
reported 1 hint:
line 5 col 7: This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: ProgressHUD.state
Format lib/generated/i18n.dart
.
Run flutter format
to format lib/generated/i18n.dart
.
Package | Constraint | Resolved | Available |
---|---|---|---|
Direct dependencies | |||
Dart SDK | >=1.23.0 <3.0.0 | ||
flutter | 0.0.0 | ||
Transitive dependencies | |||
collection | 1.14.11 | ||
meta | 1.1.6 | 1.1.7 | |
sky_engine | 0.0.99 | ||
typed_data | 1.1.6 | ||
vector_math | 2.0.8 | ||
Dev dependencies | |||
test | ^1.3.0 |