diff --git a/lib/mine/mine_shop_details.dart b/lib/mine/mine_shop_details.dart index ffbfbf16..c8aa883f 100644 --- a/lib/mine/mine_shop_details.dart +++ b/lib/mine/mine_shop_details.dart @@ -21,6 +21,7 @@ import 'package:huixiang/view_widget/my_footer.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:shimmer/shimmer.dart'; class MineShopDetails extends StatefulWidget { final Map arguments; @@ -37,6 +38,7 @@ class _MineShopDetails extends State { ApiService apiService; int selectType = 0; List userBill = []; + int networkStatus = 0; @override void dispose() { @@ -71,10 +73,13 @@ class _MineShopDetails extends State { "id": widget.arguments["id"], "latitude": "$latitude", "longitude": "$longitude", - }).catchError((onError) {}); + }).catchError((onError) { + networkStatus= -1; + }); if (baseData != null && baseData.isSuccess) { vipCard = baseData.data; refreshController.loadComplete(); + networkStatus = 1; } else { refreshController.loadFailed(); } @@ -113,6 +118,7 @@ class _MineShopDetails extends State { "size": 10, "sort": "id" }).catchError((onError) { + networkStatus == -1; refreshController.refreshFailed(); refreshController.loadFailed(); consumeRefreshController.refreshFailed(); @@ -133,6 +139,7 @@ class _MineShopDetails extends State { } else { current += 1; } + networkStatus= 1; } else { refreshController.refreshFailed(); refreshController.loadFailed(); @@ -152,7 +159,7 @@ class _MineShopDetails extends State { brightness: Brightness.dark, leadingColor: Colors.black, ), - body: Column( + body: networkStatus == 0 ? skeletonScreen():Column( children: [ buildVipCard(), Container( @@ -399,6 +406,219 @@ class _MineShopDetails extends State { ); } + ///整体骨架屏 + Widget skeletonScreen() { + return Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(bottom: 24.h, top: 14.h, left: 14.w, right: 14.w), + child:Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + decoration: BoxDecoration( + borderRadius:BorderRadius.only( + topLeft: Radius.circular(6), + topRight: Radius.circular(6), + ), + color: Color(0XFFD8D8D8), + ), + height: 62.h, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(6), + topRight: Radius.circular(6), + ), + color: Colors.white, + ), + padding: EdgeInsets.all(12.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 68.w, + height: 17.h, + ), + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 120.w, + height: 17.h, + ), + ), + ], + ), + SizedBox( + height: 4.h, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 99.w, + height: 34.h, + ), + ), + ], + ), + ), + ], + ) + ), + Padding(padding:EdgeInsets.only(left: 14.w), + child:Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 52.w, + height: 17.h, + ), + )), + SizedBox( + height: 8.h, + ), + Container( + margin: EdgeInsets.only(left: 14.w), + width: 52.w, + height: 2.h, + color: Color(0XFFD8D8D8), + ), + ListView.builder( + itemCount: 4, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return Container( + decoration: BoxDecoration( + borderRadius: new BorderRadius.circular(6), + color: Colors.white, + ), + padding: EdgeInsets.all(12), + margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 178.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 24.w, + height: 17.h, + ), + ), + Icon( + Icons.chevron_right, + color: Color(0XFFD8D8D8), + size: 16, + ), + ], + ), + SizedBox( + height: 8.h, + ), + Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 28.w, + height: 17.h, + ), + ), + SizedBox(width: 4.w,), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 213.w, + height: 17.h, + ), + ), + ], + ), + SizedBox( + height: 4.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 52.w, + height: 17.h, + ), + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 69.w, + height: 17.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 52.w, + height: 17.h, + ), + ), + ], + ), + ], + ), + ); + }, + ), + ], + )); + } + Widget shopItem(StoreListBean store) { return Container( decoration: BoxDecoration( diff --git a/lib/mine/mine_shop_page.dart b/lib/mine/mine_shop_page.dart index 60fcc8e2..3a496fd4 100644 --- a/lib/mine/mine_shop_page.dart +++ b/lib/mine/mine_shop_page.dart @@ -20,6 +20,7 @@ import 'package:huixiang/view_widget/round_button.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:shimmer/shimmer.dart'; class MineShopPage extends StatefulWidget { @override @@ -41,6 +42,7 @@ class _MineShopPage extends State with WidgetsBindingObserver{ FocusNode _focusNode = FocusNode(); bool hasFocus = true; int priceOrder = 0; + int networkStatus = 0; @override void initState() { @@ -93,12 +95,14 @@ class _MineShopPage extends State with WidgetsBindingObserver{ await apiService.vipList({ "keywords":editingController.text, }).catchError((error) { + networkStatus = -1; refreshController.refreshFailed(); }); if (baseData != null && baseData.isSuccess) { coupons.clear(); coupons.addAll(baseData.data); refreshController.refreshCompleted(); + networkStatus = 1; } else { refreshController.refreshFailed(); } @@ -118,7 +122,7 @@ class _MineShopPage extends State with WidgetsBindingObserver{ child: Scaffold( resizeToAvoidBottomInset: false, appBar: MyAppBar( - title: "店铺充值", + title: S.of(context).dianpuchongzhi, titleColor: Colors.black, background: Colors.white, leadingColor: Colors.black, @@ -128,7 +132,7 @@ class _MineShopPage extends State with WidgetsBindingObserver{ Container( color: Colors.white, padding: EdgeInsets.only(top:10.h,bottom:18.h,), - child: searchShopItem(), + child: searchShop(), ), Expanded(child: SmartRefresher( enablePullDown: true, @@ -142,7 +146,14 @@ class _MineShopPage extends State with WidgetsBindingObserver{ controller: refreshController, onRefresh: queryVipCard, physics: BouncingScrollPhysics(), - child: (coupons != null && coupons.length > 0) + child: networkStatus == 0 ? ListView.builder( + itemCount: 10, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return shopItemSm(); + }, + ):((coupons != null && coupons.length > 0) ? ListView.builder( padding: EdgeInsets.symmetric(vertical: 8.h), itemBuilder: (context, position) { @@ -169,7 +180,7 @@ class _MineShopPage extends State with WidgetsBindingObserver{ text: "还没有会员卡~", fontSize: 16.sp, margin: EdgeInsets.only(top: 120.h), - ), + )), ),) ], ), @@ -177,7 +188,7 @@ class _MineShopPage extends State with WidgetsBindingObserver{ ); } - Widget searchShopItem() { + Widget searchShop() { return Container( margin: EdgeInsets.fromLTRB(14.w, 0, 14.w, 0), padding: EdgeInsets.symmetric(vertical: 6.h), @@ -237,7 +248,6 @@ class _MineShopPage extends State with WidgetsBindingObserver{ Widget shopItem(VipCard vipCard) { return Container( width:double.infinity, - // height:140.h, margin: EdgeInsets.only(bottom: 12.h,top: 14.h,left: 14.w,right: 14.w), child: Column( mainAxisAlignment: MainAxisAlignment.start, @@ -350,4 +360,123 @@ class _MineShopPage extends State with WidgetsBindingObserver{ ); } + Widget shopItemSm(){ + return Container( + width:double.infinity, + margin: EdgeInsets.only(bottom: 12.h,top: 14.h,left: 14.w,right: 14.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: new BorderRadius.only( + topLeft: Radius.circular(6), + topRight: Radius.circular(6), + ), + color: Color(0XFFD8D8D8), + ), + padding: EdgeInsets.only(left: 12.w), + height: 62.h, + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 38.h, + height: 38.h, + ), + ), + SizedBox(width: 6,), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 111.w, + height: 21.h, + ), + ), + ], + ), + ), + Container( + decoration: BoxDecoration( + borderRadius: new BorderRadius.only( + bottomRight: Radius.circular(6), + topRight: Radius.circular(6), + ), + color: Colors.white, + ), + padding: EdgeInsets.all(12.h), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 68.w, + height: 17.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 120.w, + height: 17.h, + ), + ), + ], + ), + SizedBox(height:4.h,), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 98.w, + height: 33.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 48.w, + height: 17.h, + ), + ), + SizedBox(width: 2,), + Image.asset( + "assets/image/icon_right_z.webp", + width: 16, + height: 16, + color: Color(0xFF262626), + ) + ], + ), + ], + ), + ), + ], + ), + ); + } + } diff --git a/lib/mine/mine_shop_recharge.dart b/lib/mine/mine_shop_recharge.dart index 3699879a..6e16e407 100644 --- a/lib/mine/mine_shop_recharge.dart +++ b/lib/mine/mine_shop_recharge.dart @@ -17,6 +17,7 @@ import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:shimmer/shimmer.dart'; import '../retrofit/data/member_recharge_list.dart'; import '../retrofit/data/rechargeActLists.dart'; @@ -55,6 +56,7 @@ class _MineShopRecharge extends State { String storeId; String minToken; final RefreshController refreshController = RefreshController(); + int networkStatus = 0; @override void dispose() { @@ -87,9 +89,12 @@ class _MineShopRecharge extends State { "id": widget.arguments["id"], "latitude": "", "longitude": "", - }).catchError((onError) {}); + }).catchError((onError) { + networkStatus = -1; + }); if (baseData != null && baseData.isSuccess) { vipCard = baseData.data; + networkStatus = 1; } } finally { if (isSingle) @@ -129,9 +134,12 @@ class _MineShopRecharge extends State { queryRechargeActList() async { try { BaseData> baseData = - await minService.memberRechargeList().catchError((onError) {}); + await minService.memberRechargeList().catchError((onError) { + networkStatus = -1; + }); if (baseData != null && baseData.isSuccess) { memberRechargeList = baseData.data; + networkStatus = 1; } } finally { addLoadCount(); @@ -224,7 +232,7 @@ class _MineShopRecharge extends State { Widget build(BuildContext context) { return Scaffold( appBar: MyAppBar( - title: "店铺充值", + title: S.of(context).dianpuchongzhi, titleColor: Colors.black, background: Colors.white, brightness: Brightness.dark, @@ -242,158 +250,163 @@ class _MineShopRecharge extends State { controller: refreshController, onRefresh: _onRefresh, physics: BouncingScrollPhysics(), - child: Column( - children: [ - shopRechargeCard(), - (memberRechargeList != null && - (memberRechargeList?.length ?? 0) > 0) - ? Expanded( - child: ListView.builder( - padding: EdgeInsets.zero, - itemCount: (memberRechargeList != null && - (memberRechargeList?.length ?? 0) > 0) - ? memberRechargeList.length - : 0, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - setState(() { - selectIndex = position; - }); + child: networkStatus == 0 + ? skeletonScreen() + : Column( + children: [ + shopRechargeCard(), + (memberRechargeList != null && + (memberRechargeList?.length ?? 0) > 0) + ? Expanded( + child: ListView.builder( + padding: EdgeInsets.zero, + itemCount: (memberRechargeList != null && + (memberRechargeList?.length ?? 0) > 0) + ? memberRechargeList.length + : 0, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + setState(() { + selectIndex = position; + }); + }, + child: rechargeItem( + memberRechargeList[position], position)); }, - child: rechargeItem( - memberRechargeList[position], position)); - }, - )) - : NoDataView( - src: "assets/image/xiao_fei.webp", - isShowBtn: false, - text: "当前店铺暂无充值套餐~", - fontSize: 16.sp, - margin: - EdgeInsets.only(top: 90.h, left: 60.w, right: 60.w), - ), - if (memberRechargeList != null && - (memberRechargeList?.length ?? 0) > 0) - Container( - width: double.infinity, - margin: EdgeInsets.only(left: 16, right: 16), - padding: EdgeInsets.only( - top: 20.h, - bottom: 24.h, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(bottom: 16.h), - child: Text( - S.of(context).zhifufangshi, - style: TextStyle( + )) + : NoDataView( + src: "assets/image/xiao_fei.webp", + isShowBtn: false, + text: "当前店铺暂无充值套餐~", fontSize: 16.sp, - color: Colors.black, - fontWeight: FontWeight.bold, + margin: EdgeInsets.only( + top: 90.h, left: 60.w, right: 60.w), ), + if (memberRechargeList != null && + (memberRechargeList?.length ?? 0) > 0) + Container( + width: double.infinity, + margin: EdgeInsets.only(left: 16, right: 16), + padding: EdgeInsets.only( + top: 20.h, + bottom: 24.h, ), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - checkIndex = 2; - }); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset("assets/image/icon_we_chat.webp"), - Expanded( - flex: 1, - child: Padding( - padding: EdgeInsets.only(left: 8.w), - child: Text( - S.of(context).weixinzhifu, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), - ), + Padding( + padding: EdgeInsets.only(bottom: 16.h), + child: Text( + S.of(context).zhifufangshi, + style: TextStyle( + fontSize: 16.sp, + color: Colors.black, + fontWeight: FontWeight.bold, ), ), ), - checkView(2), - ], - ), - ), - SizedBox(height: 10.h), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - checkIndex = 3; - }); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset("assets/image/icon_alipay.webp"), - Expanded( - flex: 1, - child: Padding( - padding: EdgeInsets.only(left: 8.w), - child: Text( - S.of(context).zhifubao, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + checkIndex = 2; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset("assets/image/icon_we_chat.webp"), + Expanded( + flex: 1, + child: Padding( + padding: EdgeInsets.only(left: 8.w), + child: Text( + S.of(context).weixinzhifu, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), + ), + ), + ), ), - ), + checkView(2), + ], + ), + ), + SizedBox(height: 10.h), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + checkIndex = 3; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset("assets/image/icon_alipay.webp"), + Expanded( + flex: 1, + child: Padding( + padding: EdgeInsets.only(left: 8.w), + child: Text( + S.of(context).zhifubao, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), + ), + ), + ), + ), + checkView(3), + ], ), ), - checkView(3), ], ), ), - ], - ), - ), - if (memberRechargeList != null && - (memberRechargeList?.length ?? 0) > 0) - Align( - alignment: Alignment.bottomCenter, - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - shopRecharge(); - }, - child: Container( - height: 56.h, - width: double.infinity, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Color(0xFF32A060), - borderRadius: BorderRadius.circular(27), - ), - margin: EdgeInsets.only( - top: 12.h, left: 16.w, right: 16.w, bottom: 21.h), - child: Text( - S.of(context).querenchongzhi, - style: TextStyle( - fontSize: 16.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, + if (memberRechargeList != null && + (memberRechargeList?.length ?? 0) > 0) + Align( + alignment: Alignment.bottomCenter, + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + shopRecharge(); + }, + child: Container( + height: 56.h, + width: double.infinity, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(27), + ), + margin: EdgeInsets.only( + top: 12.h, + left: 16.w, + right: 16.w, + bottom: 21.h), + child: Text( + S.of(context).querenchongzhi, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), ), - ), - ), - ), - ) - ], - ), + ) + ], + ), )); } @@ -410,6 +423,334 @@ class _MineShopRecharge extends State { return 0xFF32A060; } + ///整体骨架屏 + Widget skeletonScreen() { + return Container( + child: Column( + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: new BorderRadius.only( + topLeft: Radius.circular(6), + topRight: Radius.circular(6), + ), + color: Color(0XFFD8D8D8), + ), + height: 62.h, + ), + Container( + decoration: BoxDecoration( + borderRadius: new BorderRadius.only( + bottomRight: Radius.circular(6), + topRight: Radius.circular(6), + ), + color: Colors.white, + ), + padding: EdgeInsets.all(12.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 68.w, + height: 17.h, + ), + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 120.w, + height: 17.h, + ), + ), + ], + ), + SizedBox( + height: 4.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 99.w, + height: 34.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 48.w, + height: 17.h, + ), + ), + SizedBox( + width: 2, + ), + Image.asset( + "assets/image/icon_right_z.webp", + width: 16, + height: 16, + color: Color(0xFF262626), + ) + ], + ), + ], + ), + ), + ], + ), + Expanded( + child: ListView.builder( + itemCount: 4, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return Container( + width: double.infinity, + height: 69.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + color: Colors.white), + margin: EdgeInsets.only(bottom: 14.h, left: 14.w, right: 14.w), + padding: EdgeInsets.only(left: 16), + child: Flex( + direction: Axis.horizontal, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 20.w, + height: 15.h, + ), + ), + SizedBox( + width: 10.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 50.w, + height: 25.h, + ), + ), + ], + ), + Container( + width: 1.w, + height: 37.h, + color: Color(0xFF979797), + margin: EdgeInsets.only(right: 16.w, left: 12), + ), + Expanded( + flex: 2, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 50.w, + height: 17.h, + ), + ), + SizedBox( + width: 10.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 48.w, + height: 25.h, + ), + ), + ], + ), + SizedBox( + height: 4.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 50.w, + height: 17.h, + ), + ), + Icon( + Icons.chevron_right, + size: 20, + color: Color(0xFF868686), + ), + ], + ) + ], + )) + ], + )); + }, + )), + Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 16.h), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 64.w, + height: 21.h, + ), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 20.h, + height: 20.h, + ), + ), + Padding( + padding: EdgeInsets.only(left: 8.w), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 51.w, + height: 17.h, + ), + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(100), + ), + width: 15.h, + height: 15.h, + ), + ), + ], + ), + SizedBox(height: 10.h), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 20.h, + height: 20.h, + ), + ), + Padding( + padding: EdgeInsets.only(left: 8.w), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 51.w, + height: 17.h, + ), + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(100), + ), + width: 15.h, + height: 15.h, + ), + ), + ], + ), + ], + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + height: 56.h, + width: double.infinity, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(27), + ), + margin: EdgeInsets.only( + top: 12.h, left: 16.w, right: 16.w, bottom: 21.h), + ), + ) + ], + )); + } + ///卡片详情 Widget shopRechargeCard() { return GestureDetector( @@ -617,9 +958,7 @@ class _MineShopRecharge extends State { ), TextSpan( text: - "${((memberRechargeList?.limitNum ?? 0) != 0 && ((memberRechargeList?.limitNum ?? 0) - (memberRechargeList?.useNum ?? 0) <= 0)) ? - (AppUtils.calculateDouble(double.tryParse(memberRechargeList.rechargeMoney) ?? 0)) : - (AppUtils.calculateDouble((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) + (double.tryParse(memberRechargeList.giftdMoney) ?? 0) + ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) - ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) * (discount / 100)))))}元", + "${((memberRechargeList?.limitNum ?? 0) != 0 && ((memberRechargeList?.limitNum ?? 0) - (memberRechargeList?.useNum ?? 0) <= 0)) ? (AppUtils.calculateDouble(double.tryParse(memberRechargeList.rechargeMoney) ?? 0)) : (AppUtils.calculateDouble((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) + (double.tryParse(memberRechargeList.giftdMoney) ?? 0) + ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) - ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) * (discount / 100)))))}元", style: TextStyle( fontSize: 18.sp, fontFamily: 'JDZhengHT', @@ -677,7 +1016,7 @@ class _MineShopRecharge extends State { checkIndex != index ? "assets/image/icon_radio_unselected.webp" : "assets/image/icon_radio_selected.webp", - width: 15.w, + width: 15.h, height: 15.h, ), ); diff --git a/lib/order/exchange_history_page.dart b/lib/order/exchange_history_page.dart index 4dda3bd1..7b5e5859 100644 --- a/lib/order/exchange_history_page.dart +++ b/lib/order/exchange_history_page.dart @@ -19,6 +19,7 @@ import 'package:huixiang/view_widget/round_button.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:shimmer/shimmer.dart'; class ExchangeHistoryPage extends StatefulWidget { @override @@ -130,6 +131,7 @@ class _ExchangeHistoryList extends State RefreshController(initialRefresh: false); int pageNum = 1; List orders = []; + int networkStatus = 0; @override void initState() { @@ -159,6 +161,7 @@ class _ExchangeHistoryList extends State } BaseData> baseData = await apiService.creditOrderList(map).catchError((error) { + networkStatus = -1; _refreshController.loadFailed(); _refreshController.refreshFailed(); }); @@ -174,6 +177,7 @@ class _ExchangeHistoryList extends State } else { pageNum += 1; } + networkStatus = 1; } else { _refreshController.refreshFailed(); _refreshController.loadFailed(); @@ -205,20 +209,29 @@ class _ExchangeHistoryList extends State onLoading: () { queryHistory(isLoading: false); }, - child: orders == null || orders.length == 0 - ? NoDataView( - src: "assets/image/ding_dan.webp", - isShowBtn: false, - text: "目前暂无记录,手上那么多积分要赶紧用掉哦~", - fontSize: 16.sp, - margin: EdgeInsets.only(top: 120.h, left: 72, right: 72), - ) - : ListView.builder( - itemCount: orders == null ? 0 : orders.length, + child: networkStatus == 0 + ? ListView.builder( + itemCount: 10, + physics: BouncingScrollPhysics(), + shrinkWrap: true, itemBuilder: (context, position) { - return buildOrder(orders[position]); + return buildOrderSm(); }, - ), + ) + : (orders == null || orders.length == 0 + ? NoDataView( + src: "assets/image/ding_dan.webp", + isShowBtn: false, + text: "目前暂无记录,手上那么多积分要赶紧用掉哦~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h, left: 72, right: 72), + ) + : ListView.builder( + itemCount: orders == null ? 0 : orders.length, + itemBuilder: (context, position) { + return buildOrder(orders[position]); + }, + )), ); } @@ -571,6 +584,221 @@ class _ExchangeHistoryList extends State ); } + Widget buildOrderSm() { + return Container( + margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h), + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ]), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 153.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 44.w, + height: 20.h, + ), + ) + ], + ), + SizedBox( + height: 16.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 50.w, + height: 17.h, + ), + ), + SizedBox( + width: 9.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 225.w, + height: 17.h, + ), + ) + ], + ), + SizedBox( + height: 10.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 50.w, + height: 17.h, + ), + ), + SizedBox( + width: 10.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 164.w, + height: 17.h, + ), + ) + ], + ), + SizedBox( + height: 16.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 66.h, + height: 66.h, + ), + ), + SizedBox( + width: 12.w, + ), + Expanded( + child: Container( + height: 66.h, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 44.w, + height: 20.h, + ), + ), + SizedBox( + height: 5.h, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 213.w, + height: 20.h, + ), + ), + ], + ), + ), + flex: 1, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 17.w, + height: 20.h, + ), + ) + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 91.w, + height: 20.h, + ), + ), + ], + ), + SizedBox( + height: 12.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + color: Color(0XFFD8D8D8), + width: 135.w, + height: 17.h, + ), + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(10), + ), + width:72.w, + height: 25.h, + ), + ) + ], + ) + ], + ), + ); + } + receive2Card(id) async { BaseData baseData = await apiService.creditOrderReceive(id); if (baseData != null && baseData.isSuccess) { diff --git a/lib/order/order_history_page.dart b/lib/order/order_history_page.dart index 075fcc04..452c9df0 100644 --- a/lib/order/order_history_page.dart +++ b/lib/order/order_history_page.dart @@ -350,10 +350,7 @@ class _OrderHistoryList extends State physics: BouncingScrollPhysics(), shrinkWrap: true, itemBuilder: (context, position) { - return GestureDetector( - onTap: () {}, - child: orderItemSm(), - ); + return orderItemSm(); }, ) : ((orderInfos != null && orderInfos.length > 0) ? ListView.builder(