A simple mixin that manages the loader state for you just by calling showLoader and hideLoader
- Use the mixin in your widget's State
class MyHomePageState extends State<MyHomePage> with LoadingWidget {
//...
}
- Call mixin methods to show/hide a loader
showLoading(context);
//...
hideLoading();
- Override mixin methods only if needed, to customize the loader experience
class MyHomePageState extends State<MyHomePage> with LoadingWidget {
@override
bool get barrierDismissible => true;
@override
Widget get loaderWidget => CircularProgressIndicator();
//...
}