flutter_overlay_loader
一个简单的 Flutter 包,用于在获取远程数据或任何长时间运行的异步任务时管理覆盖加载。Flutter 覆盖加载器易于使用。
一个适用于希望在完成未来任务时显示覆盖层加载器或进度指示器的开发者的全新Flutter包。
以下为英文项目原文快照,最新内容请访问 GitHub。
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


Overlay Loader without overlaying BottomAppBar and also overlaying AppBar

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();
}
依赖清单 3 项
{"sdk":"flutter"}{"sdk":"flutter"}^2.0.0先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗