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(