提交 a9a48cfe authored 作者: yueweilu's avatar yueweilu

更改 返回刷新方式

上级 0d02b31f
...@@ -20,12 +20,7 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid ...@@ -20,12 +20,7 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GetBuilder<BookDetailController>( return GetBuilder<BookDetailController>(
init:BookDetailController(widget.bookId), init:BookDetailController(widget.bookId),
builder: (controller)=> WillPopScope( builder: (controller)=> Scaffold(
onWillPop: () async {
context.pop(true);
return false;
},
child: Scaffold(
appBar: CustomAppBar( appBar: CustomAppBar(
backgroundColor: const Color(0xFFAB1941).withOpacity(0.02), backgroundColor: const Color(0xFFAB1941).withOpacity(0.02),
title: const Text('详情',style: TextStyle(fontSize: 17),), title: const Text('详情',style: TextStyle(fontSize: 17),),
...@@ -108,10 +103,10 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid ...@@ -108,10 +103,10 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
); );
buy.add(model); buy.add(model);
final result = await context.pushNamed(Routes.bookPay,extra: buy); context.pushNamed(Routes.bookPay,extra: buy).then((value) {
if (result == true) {
controller.getBookDetails(); controller.getBookDetails();
} });
}else{ }else{
final PopBackModel? backModel = await context.pushNamed(Routes.web,queryParameters: {'book_id': controller.bookDetails.bookId.toString(),'chapter_id': chapterModel.id.toString(),'chapter_name':chapterModel.name.toString(),'note_id':'0'},extra: controller.bookDetails); final PopBackModel? backModel = await context.pushNamed(Routes.web,queryParameters: {'book_id': controller.bookDetails.bookId.toString(),'chapter_id': chapterModel.id.toString(),'chapter_name':chapterModel.name.toString(),'note_id':'0'},extra: controller.bookDetails);
if (backModel!.back == true){ if (backModel!.back == true){
...@@ -240,10 +235,10 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid ...@@ -240,10 +235,10 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
); );
buy.add(model); buy.add(model);
final result = await context.pushNamed(Routes.bookPay,extra: buy); context.pushNamed(Routes.bookPay,extra: buy).then((value){
if (result == true) {
controller.getBookDetails(); controller.getBookDetails();
} });
} }
else{ else{
final String chapterId = await controller.getCurrentChapterId(); final String chapterId = await controller.getCurrentChapterId();
...@@ -290,7 +285,6 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid ...@@ -290,7 +285,6 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
), ),
), ),
), ),
),
); );
} }
......
...@@ -15,12 +15,7 @@ class _BookPayPageState extends State<BookPayPage> { ...@@ -15,12 +15,7 @@ class _BookPayPageState extends State<BookPayPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return GetBuilder<BookPayController>(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<BookPayController>(
init: BookPayController(buy: widget.buy,context: context), init: BookPayController(buy: widget.buy,context: context),
builder: (controller) => Stack( builder: (controller) => Stack(
children: [ children: [
...@@ -150,7 +145,6 @@ class _BookPayPageState extends State<BookPayPage> { ...@@ -150,7 +145,6 @@ class _BookPayPageState extends State<BookPayPage> {
):const SizedBox() ):const SizedBox()
], ],
) )
),
); );
} }
......
...@@ -52,10 +52,9 @@ class BuildCounter extends StatelessWidget { ...@@ -52,10 +52,9 @@ class BuildCounter extends StatelessWidget {
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
if (controller.num > 0){ if (controller.num > 0){
final result = await context.pushNamed(Routes.bookPay,extra: controller.buy); context.pushNamed(Routes.bookPay,extra: controller.buy).then((value){
if (result == true) {
controller.onRefresh(); controller.onRefresh();
} });
} }
}, },
child: Container( child: Container(
......
...@@ -38,10 +38,9 @@ class _CoursePageState extends State<CoursePage> { ...@@ -38,10 +38,9 @@ class _CoursePageState extends State<CoursePage> {
), ),
GestureDetector( GestureDetector(
onTap: () async{ onTap: () async{
final result = await context.pushNamed(Routes.msgs); context.pushNamed(Routes.msgs).then((value){
if (result == true) {
controller.getNums(); controller.getNums();
} });
}, },
child: badges.Badge( child: badges.Badge(
position: badges.BadgePosition.topEnd(top: -5.w, end: 0), position: badges.BadgePosition.topEnd(top: -5.w, end: 0),
...@@ -112,10 +111,9 @@ class _CoursePageState extends State<CoursePage> { ...@@ -112,10 +111,9 @@ class _CoursePageState extends State<CoursePage> {
onTapContinue: () async{ onTapContinue: () async{
BookDetailModel bookDetails = await controller.getBookDetails(model.bookId.toString()); BookDetailModel bookDetails = await controller.getBookDetails(model.bookId.toString());
if(context.mounted){ if(context.mounted){
final result = await context.pushNamed(Routes.web,queryParameters: {'book_id': bookDetails.bookId.toString(),'chapter_id': bookDetails.chapterId.toString(),'chapter_name':bookDetails.chapterName.toString()},extra:bookDetails); context.pushNamed(Routes.web,queryParameters: {'book_id': bookDetails.bookId.toString(),'chapter_id': bookDetails.chapterId.toString(),'chapter_name':bookDetails.chapterName.toString()},extra:bookDetails).then((value){
if (result == true){
controller.getNums(); controller.getNums();
} });
} }
}, },
), ),
......
...@@ -7,12 +7,7 @@ class CreditPointsPage extends StatelessWidget { ...@@ -7,12 +7,7 @@ class CreditPointsPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return GetBuilder<BookPayController>(
onWillPop: () async {
context.pop('111111');
return false;
},
child: GetBuilder<BookPayController>(
init: BookPayController(buy: [],context: context), init: BookPayController(buy: [],context: context),
builder:(controller)=> Scaffold( builder:(controller)=> Scaffold(
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
...@@ -148,7 +143,6 @@ class CreditPointsPage extends StatelessWidget { ...@@ -148,7 +143,6 @@ class CreditPointsPage extends StatelessWidget {
], ],
) )
), ),
),
); );
} }
} }
...@@ -43,11 +43,9 @@ class _MinePageState extends State<MinePage> { ...@@ -43,11 +43,9 @@ class _MinePageState extends State<MinePage> {
), ),
GestureDetector( GestureDetector(
onTap: () async{ onTap: () async{
final result = await context.pushNamed(Routes.msgs); context.pushNamed(Routes.msgs).then((value) {
print('---------------------------------1111$result');
if (result == true){
controller.getNums(); controller.getNums();
} });
}, },
child: badges.Badge( child: badges.Badge(
position: badges.BadgePosition.topEnd(top: -5.w, end: 0), position: badges.BadgePosition.topEnd(top: -5.w, end: 0),
...@@ -78,20 +76,18 @@ class _MinePageState extends State<MinePage> { ...@@ -78,20 +76,18 @@ class _MinePageState extends State<MinePage> {
Container( Container(
margin: EdgeInsets.symmetric(horizontal: 10.w), margin: EdgeInsets.symmetric(horizontal: 10.w),
child: BuildUser(userInfo:controller.userInfo,onTap: () async{ child: BuildUser(userInfo:controller.userInfo,onTap: () async{
final result = await context.pushNamed(Routes.userInfo,extra: controller.userInfo); context.pushNamed(Routes.userInfo,extra: controller.userInfo).then((value){
if (result == true){
controller.getInfo(); controller.getInfo();
} });
},), },),
), ),
Gaps.vGaps10, Gaps.vGaps10,
Container( Container(
margin: EdgeInsets.symmetric(horizontal: 2.2.w), margin: EdgeInsets.symmetric(horizontal: 2.2.w),
child: BuildRead(items: controller.reads,onTap: (ReadModel model) async{ child: BuildRead(items: controller.reads,onTap: (ReadModel model) async{
final result = await context.pushNamed(model.link??''); context.pushNamed(model.link??'').then((value){
if (result == true){
controller.getInfo(); controller.getInfo();
} });
}), }),
), ),
controller.ads.isNotEmpty?Gaps.vGaps5:const SizedBox(), controller.ads.isNotEmpty?Gaps.vGaps5:const SizedBox(),
...@@ -108,10 +104,9 @@ class _MinePageState extends State<MinePage> { ...@@ -108,10 +104,9 @@ class _MinePageState extends State<MinePage> {
):const SizedBox(), ):const SizedBox(),
Gaps.vGaps15, Gaps.vGaps15,
BuildAccount(items:controller.accounts,onTap: (ReadModel model) async{ BuildAccount(items:controller.accounts,onTap: (ReadModel model) async{
final result = await context.pushNamed(model.link??''); context.pushNamed(model.link??'').then((value){
if (result == true){
controller.getInfo(); controller.getInfo();
} });
},), },),
Gaps.vGaps10, Gaps.vGaps10,
Container( Container(
...@@ -134,10 +129,9 @@ class _MinePageState extends State<MinePage> { ...@@ -134,10 +129,9 @@ class _MinePageState extends State<MinePage> {
children: [ children: [
GestureDetector( GestureDetector(
onTap:() async { onTap:() async {
final result = await context.pushNamed(Routes.security,extra: controller.userInfo); context.pushNamed(Routes.security,extra: controller.userInfo).then((value){
if (result == true){
controller.getInfo(); controller.getInfo();
} });
}, child: _buildItem('账户安全') }, child: _buildItem('账户安全')
), ),
Container(color: Colours.cLine,margin: EdgeInsets.symmetric(horizontal: 15.w),height: 1.w,), Container(color: Colours.cLine,margin: EdgeInsets.symmetric(horizontal: 15.w),height: 1.w,),
......
...@@ -10,12 +10,7 @@ class UserCoinPage extends StatefulWidget { ...@@ -10,12 +10,7 @@ class UserCoinPage extends StatefulWidget {
class _UserCoinPageState extends State<UserCoinPage> { class _UserCoinPageState extends State<UserCoinPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return GetBuilder<UserCoinController>(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<UserCoinController>(
init: UserCoinController(), init: UserCoinController(),
builder: (controller) => Scaffold( builder: (controller) => Scaffold(
appBar: CustomAppBar( appBar: CustomAppBar(
...@@ -77,7 +72,6 @@ class _UserCoinPageState extends State<UserCoinPage> { ...@@ -77,7 +72,6 @@ class _UserCoinPageState extends State<UserCoinPage> {
), ),
), ),
), ),
),
); );
} }
} }
...@@ -11,12 +11,7 @@ class UserCouponPage extends StatefulWidget { ...@@ -11,12 +11,7 @@ class UserCouponPage extends StatefulWidget {
class _UserCouponPageState extends State<UserCouponPage> { class _UserCouponPageState extends State<UserCouponPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return GetBuilder<UserCouponController>(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<UserCouponController>(
init: UserCouponController(), init: UserCouponController(),
builder:(controller) => Scaffold( builder:(controller) => Scaffold(
appBar: AppBar( appBar: AppBar(
...@@ -63,7 +58,6 @@ class _UserCouponPageState extends State<UserCouponPage> { ...@@ -63,7 +58,6 @@ class _UserCouponPageState extends State<UserCouponPage> {
), ),
), ),
), ),
),
); );
} }
} }
...@@ -10,12 +10,7 @@ class UserDiscussPage extends StatefulWidget { ...@@ -10,12 +10,7 @@ class UserDiscussPage extends StatefulWidget {
class _UserDiscussPageState extends State<UserDiscussPage> { class _UserDiscussPageState extends State<UserDiscussPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return GetBuilder<UserDiscussController>(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<UserDiscussController>(
init: UserDiscussController(), init: UserDiscussController(),
builder:(controller)=> Scaffold( builder:(controller)=> Scaffold(
appBar: AppBar( appBar: AppBar(
...@@ -50,7 +45,6 @@ class _UserDiscussPageState extends State<UserDiscussPage> { ...@@ -50,7 +45,6 @@ class _UserDiscussPageState extends State<UserDiscussPage> {
], ],
), ),
), ),
),
); );
} }
} }
...@@ -20,12 +20,7 @@ class _UserGenderPageState extends State<UserGenderPage> { ...@@ -20,12 +20,7 @@ class _UserGenderPageState extends State<UserGenderPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return GetBuilder<UserGenderController>(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<UserGenderController>(
init: UserGenderController(widget.userInfo), init: UserGenderController(widget.userInfo),
builder: (controller) => Scaffold( builder: (controller) => Scaffold(
appBar: CustomAppBar( appBar: CustomAppBar(
...@@ -213,7 +208,6 @@ class _UserGenderPageState extends State<UserGenderPage> { ...@@ -213,7 +208,6 @@ class _UserGenderPageState extends State<UserGenderPage> {
), ),
), ),
)) ))
),
); );
} }
......
...@@ -10,12 +10,7 @@ class UserLovePage extends StatefulWidget { ...@@ -10,12 +10,7 @@ class UserLovePage extends StatefulWidget {
class _UserLovePageState extends State<UserLovePage> { class _UserLovePageState extends State<UserLovePage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return GetBuilder<UserLoveController>(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<UserLoveController>(
init: UserLoveController(), init: UserLoveController(),
builder:(controller) => Scaffold( builder:(controller) => Scaffold(
appBar: AppBar( appBar: AppBar(
...@@ -61,7 +56,6 @@ class _UserLovePageState extends State<UserLovePage> { ...@@ -61,7 +56,6 @@ class _UserLovePageState extends State<UserLovePage> {
), ),
), ),
), ),
),
); );
} }
} }
...@@ -7,12 +7,7 @@ class MsgPage extends StatelessWidget { ...@@ -7,12 +7,7 @@ class MsgPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return GetBuilder<MsgController>(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<MsgController>(
init: MsgController(), init: MsgController(),
builder:(controller) => Scaffold( builder:(controller) => Scaffold(
appBar: AppBar( appBar: AppBar(
...@@ -54,64 +49,45 @@ class MsgPage extends StatelessWidget { ...@@ -54,64 +49,45 @@ class MsgPage extends StatelessWidget {
if (orderInfo.status == 1){ if (orderInfo.status == 1){
// 书籍订单 // 书籍订单
if (orderInfo.types ==1){ if (orderInfo.types ==1){
final result = await context.pushNamed(Routes.orderAwaiting, context.pushNamed(Routes.orderAwaiting,
queryParameters: {'orderNum': model.urlId?.orderNum.toString()}); queryParameters: {'orderNum': model.urlId?.orderNum.toString()});
if (result == true){
// controller.onRefresh();
}
} }
// 充值订单 // 充值订单
else { else {
final result = await context.pushNamed(Routes.orderCoinAwaiting, context.pushNamed(Routes.orderCoinAwaiting,
queryParameters: {'orderNum': model.urlId?.orderNum.toString()}); queryParameters: {'orderNum': model.urlId?.orderNum.toString()});
if (result == true){
// controller.onRefresh();
}
} }
} }
// 已取消 // 已取消
else if (orderInfo.status ==2){ else if (orderInfo.status ==2){
if (orderInfo.types == 1){ if (orderInfo.types == 1){
final result = await context.pushNamed(Routes.orderCancel, context.pushNamed(Routes.orderCancel,
queryParameters: {'orderNum': model.urlId?.orderNum.toString()}); queryParameters: {'orderNum': model.urlId?.orderNum.toString()});
if (result == true){
// controller.onRefresh();
}
} }
else { else {
final result = await context.pushNamed(Routes.orderCoinCancel, context.pushNamed(Routes.orderCoinCancel,
queryParameters: {'orderNum': model.urlId?.orderNum.toString()}); queryParameters: {'orderNum': model.urlId?.orderNum.toString()});
if (result == true){
// controller.onRefresh();
}
} }
} }
// 已完成 // 已完成
else if (orderInfo.status ==3){ else if (orderInfo.status ==3){
if (orderInfo.types == 1){ if (orderInfo.types == 1){
final result = await context.pushNamed(Routes.orderCompleted, context.pushNamed(Routes.orderCompleted,
queryParameters: {'orderNum': model.urlId?.orderNum.toString()}); queryParameters: {'orderNum': model.urlId?.orderNum.toString()});
if (result == true){
// controller.onRefresh();
}
} }
else { else {
final result = await context.pushNamed(Routes.orderCoinCompleted, context.pushNamed(Routes.orderCoinCompleted,
queryParameters: {'orderNum': model.urlId?.orderNum.toString()}); queryParameters: {'orderNum': model.urlId?.orderNum.toString()});
if (result == true){
// controller.onRefresh();
}
} }
} }
// 已退款 // 已退款
else if (orderInfo.status == 4){ else if (orderInfo.status == 4){
if (orderInfo.types == 1){ if (orderInfo.types == 1){
final result = await context.pushNamed(Routes.orderRefunded, context.pushNamed(Routes.orderRefunded,
queryParameters: {'orderNum': model.urlId?.orderNum.toString()}); queryParameters: {'orderNum': model.urlId?.orderNum.toString()});
if (result == true){
// controller.onRefresh();
}
} }
} }
...@@ -120,13 +96,9 @@ class MsgPage extends StatelessWidget { ...@@ -120,13 +96,9 @@ class MsgPage extends StatelessWidget {
// 2 购买完成三天未评价(跳转订单列表--已完成) // 2 购买完成三天未评价(跳转订单列表--已完成)
final orderInfo = await controller.getOrderInfo(model.urlId?.orderNum??''); final orderInfo = await controller.getOrderInfo(model.urlId?.orderNum??'');
final result = await context.pushNamed(Routes.orderEvaluate,extra:orderInfo, context.pushNamed(Routes.orderEvaluate,extra:orderInfo,
queryParameters: {'orderNum':orderInfo.ordersnum}); queryParameters: {'orderNum':orderInfo.ordersnum});
// final result = await context.pushNamed(Routes.order);
// if (result == true){
// // controller.onRefresh();
// }
///TODO: ///TODO:
}else if (model.type == 3){ }else if (model.type == 3){
// 3 讨论有人回复的时候 (跳转我的讨论详情也) // 3 讨论有人回复的时候 (跳转我的讨论详情也)
...@@ -145,17 +117,11 @@ class MsgPage extends StatelessWidget { ...@@ -145,17 +117,11 @@ class MsgPage extends StatelessWidget {
} }
else if (model.type == 4){ else if (model.type == 4){
// 4 订单完成后有新的积分增加(跳转用户积分记录页) // 4 订单完成后有新的积分增加(跳转用户积分记录页)
final result = await context.pushNamed(Routes.point); context.pushNamed(Routes.point);
if (result == true){
// controller.onRefresh();
}
}else if (model.type == 5){ }else if (model.type == 5){
// 5后台直接发放给指定用户优惠券(跳转到用户优惠券页) // 5后台直接发放给指定用户优惠券(跳转到用户优惠券页)
final result = await context.pushNamed(Routes.coupon); context.pushNamed(Routes.coupon);
if (result == true){
// controller.onRefresh();
}
} }
}, },
...@@ -166,7 +132,6 @@ class MsgPage extends StatelessWidget { ...@@ -166,7 +132,6 @@ class MsgPage extends StatelessWidget {
), ),
), ),
), ),
),
); );
} }
......
...@@ -10,12 +10,7 @@ class UserNotePage extends StatefulWidget { ...@@ -10,12 +10,7 @@ class UserNotePage extends StatefulWidget {
class _UserNotePageState extends State<UserNotePage> { class _UserNotePageState extends State<UserNotePage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return GetBuilder<UserNoteController>(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<UserNoteController>(
init: UserNoteController(), init: UserNoteController(),
builder:(controller)=> Scaffold( builder:(controller)=> Scaffold(
appBar: AppBar( appBar: AppBar(
...@@ -55,7 +50,6 @@ class _UserNotePageState extends State<UserNotePage> { ...@@ -55,7 +50,6 @@ class _UserNotePageState extends State<UserNotePage> {
], ],
), ),
), ),
),
); );
} }
} }
...@@ -22,12 +22,7 @@ class _UserNotesDesPageState extends State<UserNotesDesPage> { ...@@ -22,12 +22,7 @@ class _UserNotesDesPageState extends State<UserNotesDesPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return Scaffold(
onWillPop: () async {
context.pop(true);
return false;
},
child: Scaffold(
appBar: AppBar( appBar: AppBar(
centerTitle: true, centerTitle: true,
title: const Text('笔记详情'), title: const Text('笔记详情'),
...@@ -72,7 +67,6 @@ class _UserNotesDesPageState extends State<UserNotesDesPage> { ...@@ -72,7 +67,6 @@ class _UserNotesDesPageState extends State<UserNotesDesPage> {
], ],
) )
), ),
),
); );
} }
} }
...@@ -43,12 +43,7 @@ class _UserOrderState extends State<UserOrderPage> ...@@ -43,12 +43,7 @@ class _UserOrderState extends State<UserOrderPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return Scaffold(
onWillPop: () async {
context.pop(true);
return false;
},
child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Container( title: Container(
padding: EdgeInsets.only(right: 10.w), padding: EdgeInsets.only(right: 10.w),
...@@ -65,7 +60,6 @@ class _UserOrderState extends State<UserOrderPage> ...@@ -65,7 +60,6 @@ class _UserOrderState extends State<UserOrderPage>
titleSpacing: 0, titleSpacing: 0,
), ),
body: _buildBody(), body: _buildBody(),
),
); );
} }
......
...@@ -12,10 +12,10 @@ class BuiltAwaiting extends StatelessWidget { ...@@ -12,10 +12,10 @@ class BuiltAwaiting extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
final result = await context.pushNamed(Routes.orderAwaiting, context.pushNamed(Routes.orderAwaiting,
queryParameters: {'orderNum': model.ordersnum}); queryParameters: {'orderNum': model.ordersnum}).then((value){
if (result == true) { controller.onRefresh();
controller.onRefresh(); } });
}, },
child: Container( child: Container(
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 10.w), margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 10.w),
......
...@@ -18,25 +18,22 @@ class BuiltCoin extends StatelessWidget { ...@@ -18,25 +18,22 @@ class BuiltCoin extends StatelessWidget {
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
if(model.status == 1){ if(model.status == 1){
final result = await context.pushNamed(Routes.orderCoinAwaiting, context.pushNamed(Routes.orderCoinAwaiting,
queryParameters: {'orderNum': model.ordersnum}); queryParameters: {'orderNum': model.ordersnum}).then((value){
if(result==true){
controller.onRefresh(); controller.onRefresh();
} });
} }
else if(model.status == 2){ else if(model.status == 2){
final result = await context.pushNamed(Routes.orderCoinCancel, context.pushNamed(Routes.orderCoinCancel,
queryParameters: {'orderNum': model.ordersnum}); queryParameters: {'orderNum': model.ordersnum}).then((value){
if(result==true){
controller.onRefresh(); controller.onRefresh();
} });
} }
else if(model.status == 3){ else if(model.status == 3){
final result = await context.pushNamed(Routes.orderCoinCompleted, context.pushNamed(Routes.orderCoinCompleted,
queryParameters: {'orderNum': model.ordersnum}); queryParameters: {'orderNum': model.ordersnum}).then((value){
if(result==true){
controller.onRefresh(); controller.onRefresh();
} });
} }
}, },
child: Container( child: Container(
......
...@@ -15,10 +15,10 @@ class BuiltCompleted extends StatelessWidget { ...@@ -15,10 +15,10 @@ class BuiltCompleted extends StatelessWidget {
return GestureDetector( return GestureDetector(
onTap: () onTap: ()
async { async {
final result = await context.pushNamed(Routes.orderCompleted, context.pushNamed(Routes.orderCompleted,
queryParameters: {'orderNum': model.ordersnum}); queryParameters: {'orderNum': model.ordersnum}).then((value){
if (result == true) { controller.onRefresh();
controller.onRefresh(); } });
}, },
child: Container( child: Container(
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 10.w), margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 10.w),
...@@ -165,14 +165,13 @@ class BuiltCompleted extends StatelessWidget { ...@@ -165,14 +165,13 @@ class BuiltCompleted extends StatelessWidget {
child: Center( child: Center(
child: GestureDetector( child: GestureDetector(
onTap: () async { onTap: () async {
final result = await context.pushNamed(Routes.orderEvaluate, context.pushNamed(Routes.orderEvaluate,
extra: OrderInfoModel(), extra: OrderInfoModel(),
queryParameters: { queryParameters: {
'orderNum': model.ordersnum 'orderNum': model.ordersnum
}); }).then((value){
if (result == true) {
controller.onRefresh(); controller.onRefresh();
} });
}, },
child: Text( child: Text(
judgeComments() == 1 ? '去评价' : "继续评价", judgeComments() == 1 ? '去评价' : "继续评价",
...@@ -307,14 +306,14 @@ class BuiltCompleted extends StatelessWidget { ...@@ -307,14 +306,14 @@ class BuiltCompleted extends StatelessWidget {
child: Center( child: Center(
child: GestureDetector( child: GestureDetector(
onTap: () async { onTap: () async {
final result = await context.pushNamed(Routes.orderEvaluate, context.pushNamed(Routes.orderEvaluate,
extra: OrderInfoModel(), extra: OrderInfoModel(),
queryParameters: { queryParameters: {
'orderNum': model.ordersnum 'orderNum': model.ordersnum
}); }).then((value){
if (result == true) {
controller.onRefresh(); controller.onRefresh();
} });
}, },
child: Text( child: Text(
judgeComments() == 1 ? '去评价' : "继续评价", judgeComments() == 1 ? '去评价' : "继续评价",
......
...@@ -21,12 +21,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> { ...@@ -21,12 +21,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return FutureBuilder(
onWillPop: () async {
context.pop(true);
return false;
},
child: FutureBuilder(
future: myController.getOrderInfo(), future: myController.getOrderInfo(),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) { if (snapshot.connectionState == ConnectionState.waiting) {
...@@ -37,12 +32,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> { ...@@ -37,12 +32,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
), ),
); );
} else { } else {
return WillPopScope( return Scaffold(
onWillPop: () async {
context.pop(true);
return false;
},
child: Scaffold(
appBar: CustomAppBar( appBar: CustomAppBar(
title: const Text('等待付款'), title: const Text('等待付款'),
actions: [], actions: [],
...@@ -309,11 +299,9 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> { ...@@ -309,11 +299,9 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
), ),
], ],
), ),
),
); );
} }
}, },
),
); );
} }
} }
...@@ -12,12 +12,7 @@ class UserOrderCancelDetailPage extends StatefulWidget { ...@@ -12,12 +12,7 @@ class UserOrderCancelDetailPage extends StatefulWidget {
class _UserOrderRefundedState extends State<UserOrderCancelDetailPage> { class _UserOrderRefundedState extends State<UserOrderCancelDetailPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return GetBuilder<UserOrderCancelDetailController>(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<UserOrderCancelDetailController>(
init: UserOrderCancelDetailController(widget.orderNum), init: UserOrderCancelDetailController(widget.orderNum),
builder: (controller) => Scaffold( builder: (controller) => Scaffold(
appBar: CustomAppBar( appBar: CustomAppBar(
...@@ -238,7 +233,6 @@ class _UserOrderRefundedState extends State<UserOrderCancelDetailPage> { ...@@ -238,7 +233,6 @@ class _UserOrderRefundedState extends State<UserOrderCancelDetailPage> {
// ), // ),
// ) // )
],), ],),
)), ));
);
} }
} }
...@@ -23,12 +23,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> { ...@@ -23,12 +23,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return FutureBuilder(
onWillPop: () async {
context.pop(true);
return false;
},
child: FutureBuilder(
future: myController.getOrderInfo(), future: myController.getOrderInfo(),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) { if (snapshot.connectionState == ConnectionState.waiting) {
...@@ -39,12 +34,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> { ...@@ -39,12 +34,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> {
), ),
); );
} else { } else {
return WillPopScope( return Scaffold(
onWillPop: () async {
context.pop(true);
return false;
},
child: Scaffold(
appBar: CustomAppBar( appBar: CustomAppBar(
title: const Text('待支付'), title: const Text('待支付'),
actions: [], actions: [],
...@@ -318,11 +308,9 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> { ...@@ -318,11 +308,9 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> {
), ),
], ],
), ),
),
); );
} }
}, },
),
); );
} }
} }
...@@ -23,12 +23,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinCancelPage> { ...@@ -23,12 +23,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinCancelPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return FutureBuilder(
onWillPop: () async {
context.pop(true);
return false;
},
child: FutureBuilder(
future: myController.getOrderInfo(), future: myController.getOrderInfo(),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) { if (snapshot.connectionState == ConnectionState.waiting) {
...@@ -39,12 +34,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinCancelPage> { ...@@ -39,12 +34,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinCancelPage> {
), ),
); );
} else { } else {
return WillPopScope( return Scaffold(
onWillPop: () async {
context.pop(true);
return false;
},
child: Scaffold(
appBar: CustomAppBar( appBar: CustomAppBar(
title: const Text('已取消'), title: const Text('已取消'),
actions: [], actions: [],
...@@ -183,11 +173,9 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinCancelPage> { ...@@ -183,11 +173,9 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinCancelPage> {
), ),
], ],
), ),
),
); );
} }
}, },
),
); );
} }
} }
...@@ -23,12 +23,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinCompletedPage> { ...@@ -23,12 +23,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinCompletedPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return FutureBuilder(
onWillPop: () async {
context.pop(true);
return false;
},
child: FutureBuilder(
future: myController.getOrderInfo(), future: myController.getOrderInfo(),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) { if (snapshot.connectionState == ConnectionState.waiting) {
...@@ -39,12 +34,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinCompletedPage> { ...@@ -39,12 +34,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinCompletedPage> {
), ),
); );
} else { } else {
return WillPopScope( return Scaffold(
onWillPop: () async {
context.pop(true);
return false;
},
child: Scaffold(
appBar: CustomAppBar( appBar: CustomAppBar(
title: const Text('已完成'), title: const Text('已完成'),
actions: [], actions: [],
...@@ -183,11 +173,9 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinCompletedPage> { ...@@ -183,11 +173,9 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinCompletedPage> {
), ),
], ],
), ),
),
); );
} }
}, },
),
); );
} }
} }
...@@ -19,12 +19,7 @@ class _UserOrderCompletedState extends State<UserOrderCompletedPage> { ...@@ -19,12 +19,7 @@ class _UserOrderCompletedState extends State<UserOrderCompletedPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return GetBuilder<UserOrderCompletedController>(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<UserOrderCompletedController>(
init: UserOrderCompletedController(widget.orderNum), init: UserOrderCompletedController(widget.orderNum),
builder: (controller) => Scaffold( builder: (controller) => Scaffold(
appBar: CustomAppBar( appBar: CustomAppBar(
...@@ -224,9 +219,9 @@ class _UserOrderCompletedState extends State<UserOrderCompletedPage> { ...@@ -224,9 +219,9 @@ class _UserOrderCompletedState extends State<UserOrderCompletedPage> {
child: GestureDetector( child: GestureDetector(
onTap: () async { onTap: () async {
final result = await context.pushNamed(Routes.orderEvaluate,extra:controller.model, final result = await context.pushNamed(Routes.orderEvaluate,extra:controller.model,
queryParameters: {'orderNum':controller.model.ordersnum}); queryParameters: {'orderNum':controller.model.ordersnum}).then((value){
if (result == true) { controller.getOrderInfo();
controller.getOrderInfo(); } });
}, },
child: Text(controller.judgeComments() ==1?'去评价':"继续评价", child: Text(controller.judgeComments() ==1?'去评价':"继续评价",
style: TextStyle( style: TextStyle(
...@@ -244,7 +239,6 @@ class _UserOrderCompletedState extends State<UserOrderCompletedPage> { ...@@ -244,7 +239,6 @@ class _UserOrderCompletedState extends State<UserOrderCompletedPage> {
], ],
), ),
), ),
))), )));
);
} }
} }
...@@ -29,12 +29,7 @@ class _UserOrderEvaluatePageState extends State<UserOrderEvaluatePage> with Auto ...@@ -29,12 +29,7 @@ class _UserOrderEvaluatePageState extends State<UserOrderEvaluatePage> with Auto
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// super.build(context); // super.build(context);
return WillPopScope( return GetBuilder<UserOrderEvaluateController>(
onWillPop: () async {
context.pop(true);
return false;
},
child:GetBuilder<UserOrderEvaluateController>(
init: UserOrderEvaluateController(widget.orderNum), init: UserOrderEvaluateController(widget.orderNum),
builder: (controller) => Scaffold( builder: (controller) => Scaffold(
appBar: AppBar( appBar: AppBar(
...@@ -95,7 +90,7 @@ class _UserOrderEvaluatePageState extends State<UserOrderEvaluatePage> with Auto ...@@ -95,7 +90,7 @@ class _UserOrderEvaluatePageState extends State<UserOrderEvaluatePage> with Auto
], ],
), ),
), ),
),),); ),);
} }
Widget listItem(BookListModel bookListModel,int index,UserOrderEvaluateController myController) { Widget listItem(BookListModel bookListModel,int index,UserOrderEvaluateController myController) {
......
...@@ -12,12 +12,7 @@ class UserOrderRefundedPage extends StatefulWidget { ...@@ -12,12 +12,7 @@ class UserOrderRefundedPage extends StatefulWidget {
class _UserOrderRefundedState extends State<UserOrderRefundedPage> { class _UserOrderRefundedState extends State<UserOrderRefundedPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return GetBuilder<UserOrderCRefundedController>(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<UserOrderCRefundedController>(
init: UserOrderCRefundedController(widget.orderNum), init: UserOrderCRefundedController(widget.orderNum),
builder: (controller) => Scaffold( builder: (controller) => Scaffold(
appBar: CustomAppBar( appBar: CustomAppBar(
...@@ -238,7 +233,6 @@ class _UserOrderRefundedState extends State<UserOrderRefundedPage> { ...@@ -238,7 +233,6 @@ class _UserOrderRefundedState extends State<UserOrderRefundedPage> {
), ),
) )
],), ],),
)), ));
);
} }
} }
...@@ -10,12 +10,7 @@ class UserPointPage extends StatefulWidget { ...@@ -10,12 +10,7 @@ class UserPointPage extends StatefulWidget {
class _UserPointPageState extends State<UserPointPage> { class _UserPointPageState extends State<UserPointPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return GetBuilder<UserPointController>(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<UserPointController>(
init: UserPointController(), init: UserPointController(),
builder: (controller) => Scaffold( builder: (controller) => Scaffold(
appBar: AppBar( appBar: AppBar(
...@@ -59,7 +54,6 @@ class _UserPointPageState extends State<UserPointPage> { ...@@ -59,7 +54,6 @@ class _UserPointPageState extends State<UserPointPage> {
), ),
), ),
), ),
),
); );
} }
} }
...@@ -12,12 +12,7 @@ class UserSecurityPage extends StatefulWidget { ...@@ -12,12 +12,7 @@ class UserSecurityPage extends StatefulWidget {
class _UserSecurityPageState extends State<UserSecurityPage> { class _UserSecurityPageState extends State<UserSecurityPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return Scaffold(
onWillPop: () async {
context.pop(true);
return false;
},
child: Scaffold(
appBar: AppBar( appBar: AppBar(
centerTitle: true, centerTitle: true,
title: const Text('账号安全'), title: const Text('账号安全'),
...@@ -185,7 +180,6 @@ class _UserSecurityPageState extends State<UserSecurityPage> { ...@@ -185,7 +180,6 @@ class _UserSecurityPageState extends State<UserSecurityPage> {
) )
], ],
), ),
),
); );
} }
......
...@@ -10,12 +10,7 @@ class UserWrongPage extends StatefulWidget { ...@@ -10,12 +10,7 @@ class UserWrongPage extends StatefulWidget {
class _UserWrongPageState extends State<UserWrongPage> { class _UserWrongPageState extends State<UserWrongPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return GetBuilder<UserWrongController>(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<UserWrongController>(
init: UserWrongController(), init: UserWrongController(),
builder:(controller)=> Scaffold( builder:(controller)=> Scaffold(
appBar: AppBar( appBar: AppBar(
...@@ -50,7 +45,6 @@ class _UserWrongPageState extends State<UserWrongPage> { ...@@ -50,7 +45,6 @@ class _UserWrongPageState extends State<UserWrongPage> {
], ],
), ),
), ),
),
); );
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论