flutter_overlay_loader
一個簡單的 Flutter 套件,用於在取得遠端資料或任何長時間執行的非同步任務時管理覆蓋式載入。Flutter 覆蓋載入器易於使用。
一個新的Flutter套件,供想要在完成未來任務時顯示覆蓋層載入器或進度指示器的開發者使用。
{"sdk":"flutter"}{"sdk":"flutter"}^2.0.0以下為英文專案原文快照,最新內容請造訪 GitHub。
Build Passing Pub Version Pub Likes Pub Points Pub Popularity GitHub forks GitHub stars GitHub issues GitHub followers Twitter GitHub license
A simple Flutter package for managing loader when fetching remote data or any long running async task. Flutter overlay loader is easy to use. You can show loader using only write two lines of code.
Overlay loader without overlaying Appbar
drawing drawing
Overlay Loader without overlaying BottomAppBar and also overlaying AppBar
drawing
dependencies:
flutter_overlay_loader: ^1.0.8
import 'package:flutter_overlay_loader/flutter_overlay_loader.dart';
When start network call then call this line of code..
Loader.show(context,progressIndicator:LinearProgressIndicator());
After finished network call then call :
Loader.hide();
You can customize this loader..
Loader.show(context,
isSafeAreaOverlay: false,
isBottomBarOverlay: false,
overlayFromBottom: 80,
overlayColor: Colors.black26,
progressIndicator: CircularProgressIndicator(backgroundColor: Colors.red),
themeData: Theme.of(context)
.copyWith(colorScheme: ColorScheme.fromSwatch().copyWith(secondary: Colors.green))
);
You can also check loader is showing or not using the property : Loader.isShown and you can
prevent back pressed like this snippet:
WillPopScope(
child: //TODO ,
onWillPop:()async => !Loader.isShown
)
Finally dispose call hide method on dispose method :
@override
void dispose() {
Loader.hide();
super.dispose();
}