效果
属性
RefreshIndicator
是Material Design
风格的下拉刷新控件,所以同android
中的SwipeRefreshLayout
用法一样,嵌套在外层即可。
先了解一下属性:
const RefreshIndicator({Key key,@required this.child,this.displacement = 40.0,//指示器显示时距顶部位置@required this.onRefresh,//下拉刷新回调this.color,//指示器颜色,默认ThemeData.accentColorthis.backgroundColor,//指示器背景颜色,默认ThemeData.canvasColorthis.notificationPredicate = defaultScrollNotificationPredicate,this.semanticsLabel,this.semanticsValue,})
基本上只需要关心onRefresh
回调即可。
使用
@overrideWidget build(BuildContext context) {return Scaffold(body: RefreshIndicator(//指示器颜色color: Them