From 3767305782cd2113666c43189f211d5cc42882d5 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Fri, 24 Nov 2023 15:08:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=91=E6=8D=A2=E5=8E=86=E5=8F=B2=EF=BC=8C?= =?UTF-8?q?=E9=97=A8=E5=BA=97=E5=85=85=E5=80=BC=E5=88=97=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E9=97=A8=E5=BA=97=E5=85=85=E5=80=BC=E9=A1=B5=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E4=BC=9A=E5=91=98=E5=8D=A1=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E9=AA=A8=E6=9E=B6=E5=B1=8F=EF=BC=9B?= =?UTF-8?q?=20=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8ui=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mine/mine_shop_details.dart | 224 +++++++++++++++++++++++++++++++- 1 file changed, 222 insertions(+), 2 deletions(-) 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(