overlay_loading_progress
A flutter package of overlay kit.
Content
- Loading Progress
- Toast Message
- Future Extension
Usage
1- add this line to pubspec.yaml
dependencies:
overlay_kit: ^1.0.7
2- import package
import 'package:overlay_kit/overlay_kit.dart';
3- Wrap your MaterialApp with OverlayKit
@override
Widget build(BuildContext context) {
return OverlayKit(
child: MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
),
);
}
1. Loading Progress
Start it with
OverlayLoadingProgress.start();
Stop it with
OverlayLoadingProgress.stop();
Complete Example
OverlayLoadingProgress.start();
await Future.delayed(const Duration(seconds: 3));
OverlayLoadingProgress.stop();
Use With Gif
OverlayLoadingProgress.start(gifOrImagePath: 'assets/loading.gif');
await Future.delayed(const Duration(seconds: 3));
OverlayLoadingProgress.stop();
Use With Custom Widget
OverlayLoadingProgress.start(
widget: Container(
width: MediaQuery.of(context).size.width / 4,
padding: EdgeInsets.all(MediaQuery.of(context).size.width / 13),
child: const AspectRatio(
aspectRatio: 1,
child: const CircularProgressIndicator(),
),
),
);
await Future.delayed(const Duration(seconds: 3));
OverlayLoadingProgress.stop();
2- Toast Message
Show it with
OverlayToastMessage.show(textMessage: 'Dismiss All And Show Toast');
Use With Custom Widget
OverlayToastMessage.show(
widget: yourWidget,
);
2- Future Extension
Show Loading Progress with Extension.
Future.delayed(const Duration(seconds: 5)).callWithProgress();