0 purchases
smartrefresh
Add Refresh Controller #
final RefreshController _refreshController = RefreshController();
copied to clipboard
add code #
PullToRefresh(
onRefresh: _handleRefresh,
showChildOpacityTransition: false,
backgroundColor: Colors.transparent,
tColor: Colors.grey,
onFail: failedIndicator(),
onComplete: completeindicator(),
onLoading: loadingindicator(),
refreshController: _refreshController,
child: StreamBuilder<int>(
stream: counterStream,
builder: (context, snapshot) {
return ListView.builder(...);
},
),
)
copied to clipboard
loadingindicator() {
return const Text('Refreshing..',
style: TextStyle(
color: Colors.grey, fontFamily: 'SourceSansPro-SemiBold'));
}
completeindicator() {
return Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
Icon(
Icons.done,
color: Colors.grey,
),
SizedBox(
width: 10,
),
Text('Refresh Completed',
style: TextStyle(
color: Colors.grey, fontFamily: 'SourceSansPro-SemiBold'))
],
);
}
failedIndicator() {
return Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
Icon(
Icons.close,
color: Colors.grey,
),
SizedBox(
width: 10,
),
Text('Failed',
style: TextStyle(
color: Colors.grey, fontFamily: 'SourceSansPro-SemiBold'))
],
);
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.