|
|
@ -44,32 +44,31 @@ class _VipPageState extends State<VipPage> with AutomaticKeepAliveClientMixin { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
queryVipHome() async { |
|
|
|
queryVipHome() async { |
|
|
|
if (apiService == null) { |
|
|
|
try{ |
|
|
|
SharedPreferences value = await SharedPreferences.getInstance(); |
|
|
|
if (apiService == null) { |
|
|
|
apiService = ApiService( |
|
|
|
SharedPreferences value = await SharedPreferences.getInstance(); |
|
|
|
Dio(), |
|
|
|
apiService = ApiService( |
|
|
|
context: context, |
|
|
|
Dio(), |
|
|
|
token: value.getString("token"), |
|
|
|
context: context, |
|
|
|
showLoading: true |
|
|
|
token: value.getString("token"), |
|
|
|
); |
|
|
|
showLoading: true |
|
|
|
} |
|
|
|
); |
|
|
|
BaseData<VipCardHome> baseData = |
|
|
|
} |
|
|
|
await apiService.vipCardIndex().catchError((onError) { |
|
|
|
BaseData<VipCardHome> baseData = |
|
|
|
_refreshController.refreshFailed();}); |
|
|
|
await apiService.vipCardIndex().catchError((onError) { |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
_refreshController.refreshFailed();}); |
|
|
|
vipHome = baseData.data; |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
_refreshController.refreshCompleted(); |
|
|
|
vipHome = baseData.data; |
|
|
|
}else{ |
|
|
|
_refreshController.refreshCompleted(); |
|
|
|
_refreshController.refreshFailed(); |
|
|
|
}else{ |
|
|
|
SmartDialog.showToast(baseData.msg ?? "", alignment: Alignment.center); |
|
|
|
_refreshController.refreshFailed(); |
|
|
|
|
|
|
|
SmartDialog.showToast(baseData.msg ?? "", alignment: Alignment.center); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}finally{ |
|
|
|
|
|
|
|
setState((){}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_onRefresh() { |
|
|
|
|
|
|
|
queryVipHome(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
Widget build(BuildContext context) { |
|
|
|
super.build(context); |
|
|
|
super.build(context); |
|
|
@ -77,39 +76,32 @@ class _VipPageState extends State<VipPage> with AutomaticKeepAliveClientMixin { |
|
|
|
backgroundColor: Color(0xFFF9FAF7), |
|
|
|
backgroundColor: Color(0xFFF9FAF7), |
|
|
|
body: Container( |
|
|
|
body: Container( |
|
|
|
padding: EdgeInsets.only(bottom: 76.h), |
|
|
|
padding: EdgeInsets.only(bottom: 76.h), |
|
|
|
child: Container( |
|
|
|
child: SmartRefresher( |
|
|
|
child: FutureBuilder( |
|
|
|
controller: _refreshController, |
|
|
|
future:queryVipHome(), |
|
|
|
enablePullDown: true, |
|
|
|
builder: (context, snapshot) { |
|
|
|
enablePullUp: false, |
|
|
|
return SmartRefresher( |
|
|
|
header: MyHeader(), |
|
|
|
controller: _refreshController, |
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
enablePullDown: true, |
|
|
|
onRefresh: () { |
|
|
|
enablePullUp: false, |
|
|
|
queryVipHome(); |
|
|
|
header: MyHeader(), |
|
|
|
}, |
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
child: SingleChildScrollView( |
|
|
|
onRefresh: () { |
|
|
|
child: Container( |
|
|
|
setState(() { |
|
|
|
child:Column( |
|
|
|
_onRefresh(); |
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
}); |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
}, |
|
|
|
children: [ |
|
|
|
child: SingleChildScrollView( |
|
|
|
VipTop(vipHome,(){ |
|
|
|
child: Container( |
|
|
|
queryVipHome(); |
|
|
|
child:Column( |
|
|
|
}), |
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
VipTop(vipHome,_onRefresh()), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(vipHome !=null) |
|
|
|
if(vipHome !=null) |
|
|
|
VipGoodsDiscount(vipHome), |
|
|
|
VipGoodsDiscount(vipHome), |
|
|
|
|
|
|
|
|
|
|
|
ExclusiveCoupon(), |
|
|
|
ExclusiveCoupon(), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|