Want to add Loading to your app?
With Loading Mixin you get it in a simple, fast and customizable way
This package is for you to add loading to your application with just two words, adding this mixin to your class.
dependencies:
loading_mixin: any
import 'package:loading_mixin/loading_mixin.dart';
class LoadingMixinTest extends StatefulWidget {
@override
_LoadingMixinTestState createState() => _LoadingMixinTestState();
}
//State Class
class _LoadingMixinTestState extends State<LoadingMixinTest> with LoadingMixin {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Loading Mixin'),
),
body: buildBody(),
);
}
.
.
.
RaisedButton(onPressed: () async {
var result = await this.startAutomaticLoad(context, requestData);
result != null ? print('$result') : print('No data found!');
},
child: Text('Default Load',style: TextStyle(color: Colors.white),
),
)
//Async/HTTP request Example
static Future requestData() async {
await Future.delayed(Duration(milliseconds: 1500));
return 1844;
}
}
RaisedButton(onPressed: () async {
var customLoad = Container(
height: 50,
width: 50,
color: Colors.transparent,
child: Center(
child: CircularProgressIndicator(
valueColor: new AlwaysStoppedAnimation<Color>(Colors.yellow),
),
),
);
var result = await this.startAutomaticLoad(
context,
requestData,
loadingConfig: LoadingConfig(customLoad: customLoad),
);
result != null ? print('$result') : print('No data found!');
},
child: Text(
'Async',
style: TextStyle(color: Colors.white),
),
)
RaisedButton( onPressed: () async {
//Open Load
var ovelayEntry = this.startManualLoad(context);
//Your code
print('Put your code here!');
await Future.delayed(Duration(seconds: 2));
//Close Load
this.endManualLoad(context, ovelayEntry);
},
child: Text(
'Manual Load',
style: TextStyle(color: Colors.white),
),
)
Please send feature requests and bugs at the issue tracker.