refresh_me

Last updated:

0 purchases

refresh_me Image
refresh_me Images
Add to Cart

Description:

refresh me

refresh_me #
Usage #
add this line to pubspec.yaml
dependencies:
refresh_me: ^2.0.0

copied to clipboard
import package
import 'package:refresh_me/refresh_me.dart';
copied to clipboard
Example


List<String> items = ["1", "2", "3", "4", "5", "6", "7", "8"];
final _refreshController = RefreshController(initialRefresh: false);

void _onRefresh() async{
await Future.delayed(Duration(milliseconds: 1000));
_refreshController.refreshCompleted();
}

void _onLoading() async{
await Future.delayed(Duration(milliseconds: 1000));
// if failed,use loadFailed(),if no data return,use LoadNodata()
items.add((items.length+1).toString());
if(mounted)
setState(() {

});
_refreshController.loadComplete();
}

@override
Widget build(BuildContext context) {
return Scaffold(
body: SmartRefresher(
enablePullDown: true,
enablePullUp: true,
header: WaterDropHeader(),
footer: CustomFooter(
builder: (BuildContext context,LoadStatus mode){
Widget body ;
if(mode==LoadStatus.idle){
body = Text("pull up load");
}
else if(mode==LoadStatus.loading){
body = CupertinoActivityIndicator();
}
else if(mode == LoadStatus.failed){
body = Text("Load Failed!Click retry!");
}
else if(mode == LoadStatus.canLoading){
body = Text("release to load more");
}
else{
body = Text("No more Data");
}
return Container(
height: 55.0,
child: Center(child:body),
);
},
),
controller: _refreshController,
onRefresh: _onRefresh,
onLoading: _onLoading,
child: ListView.builder(
itemBuilder: (c, i) => Card(child: Center(child: Text(items[i]))),
itemExtent: 100.0,
itemCount: items.length,
),
),
);
}

copied to clipboard
Thanks #
For Pull To Refresh #

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.