From c90120432ba9366d6a4ac6ceb673e93538340338 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Sat, 7 Oct 2023 18:34:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=EF=BC=9B=20=E5=88=97=E8=A1=A8=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8D=A0=E4=BD=8D=E7=AC=A6=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/goods_search_page.dart | 138 +++++- .../goods/off_shelf/off_shelf_page.dart | 128 +++++- .../goods/on_sale/goods_assort.dart | 81 +++- .../goods/on_sale/on_sale_page.dart | 404 ++++++++++++----- lib/business_system/home/flow_page.dart | 104 ++++- .../home/overview/trade_goods.dart | 59 ++- .../order/business_order_detail.dart | 409 +++++++++++++++++- lib/business_system/order/order_list.dart | 274 +++++++++++- lib/store/store_order.dart | 1 - 9 files changed, 1472 insertions(+), 126 deletions(-) diff --git a/lib/business_system/goods/goods_search_page.dart b/lib/business_system/goods/goods_search_page.dart index 632bbeb6..2e1b2738 100644 --- a/lib/business_system/goods/goods_search_page.dart +++ b/lib/business_system/goods/goods_search_page.dart @@ -7,6 +7,7 @@ import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shimmer/shimmer.dart'; import '../../generated/l10n.dart'; import '../../retrofit/business_api.dart'; import '../../retrofit/data/base_data.dart'; @@ -46,6 +47,7 @@ class _GoodsSearchPage extends State BusinessApiService businessService; List adminProductVoList = []; int goodsIndex = 0; + bool _shimmer =true; @override void didChangeMetrics() { @@ -90,6 +92,7 @@ class _GoodsSearchPage extends State status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); await queryGoodsList(); + _shimmer = false; EasyLoading.dismiss(); if (!mounted) return; if (refreshController.isRefresh) refreshController.refreshCompleted(); @@ -243,7 +246,17 @@ class _GoodsSearchPage extends State _pageIndex++; _onRefresh(isShowLoad: false); }, - child: (adminProductVoList == null || + child: (_shimmer)?ListView.builder( + padding: EdgeInsets.zero, + itemCount: 10, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return searchGoodsItemSm(); + }, + ): + ((adminProductVoList == null || adminProductVoList.length == 0) ? NoDataView( src: "assets/image/bs_no data_logo.webp", @@ -270,7 +283,7 @@ class _GoodsSearchPage extends State ); }, ), - ), + )), ), ), ) @@ -411,4 +424,125 @@ class _GoodsSearchPage extends State ), ); } + + Widget searchGoodsItemSm() { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + boxShadow: [ + BoxShadow( + color: Color(0x0F06152E).withAlpha(12), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ) + ], + ), + margin: EdgeInsets.only(bottom: 12.h, left: 16.w, right: 16.w), + padding: + EdgeInsets.only(left: 12.w, top: 12.h, bottom: 12.h, right: 24.w), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(4), + ), + width: 70.h, + height: 70.h, + ), + ), + SizedBox( + width: 12.w, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 11.h, top: 2.h), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 124.w, + height: 20.h, + ), + ), + ), + Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 43.w, + height: 18.h, + ), + ), + SizedBox( + width: 8.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 43.w, + height: 18.h, + ), + ), + ], + ), + SizedBox(height: 7.h,), + Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 28.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 24.w, + height: 18.h, + ), + ), + ], + ) + ], + )), + ], + ), + ); + } } diff --git a/lib/business_system/goods/off_shelf/off_shelf_page.dart b/lib/business_system/goods/off_shelf/off_shelf_page.dart index 3430f2dc..c39553c3 100644 --- a/lib/business_system/goods/off_shelf/off_shelf_page.dart +++ b/lib/business_system/goods/off_shelf/off_shelf_page.dart @@ -8,6 +8,7 @@ import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/my_footer.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shimmer/shimmer.dart'; import '../../../generated/l10n.dart'; import '../../../retrofit/business_api.dart'; @@ -40,6 +41,7 @@ class _OffShelfPage extends State { BusinessApiService businessService; List adminProductVoList = []; List productIds = []; + bool _shimmer = true; @override void dispose() { @@ -59,6 +61,7 @@ class _OffShelfPage extends State { status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); await queryGoodsList(); + _shimmer = false; EasyLoading.dismiss(); if (!mounted) return; if (_refreshController.isRefresh) _refreshController.refreshCompleted(); @@ -222,7 +225,18 @@ class _OffShelfPage extends State { }, child: Container( color: Colors.white, - child: (adminProductVoList == null || + child: (_shimmer)?ListView.builder( + itemCount:10, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return GestureDetector( + onTap: () {}, + child: shelfGoodsItemSm(), + ); + }, + ): + ((adminProductVoList == null || adminProductVoList.length == 0) ? NoDataView( src: "assets/image/bs_no data_logo.webp", @@ -242,7 +256,7 @@ class _OffShelfPage extends State { adminProductVoList[position]), ); }, - ), + )) )), ), ), @@ -551,4 +565,114 @@ class _OffShelfPage extends State { ), ); } + + Widget shelfGoodsItemSm() { + return Container( + margin: EdgeInsets.only(bottom: 22.h), + padding: EdgeInsets.only( + left: 5.w, + ), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 16.h, + height: 16.h, + ), + ), + SizedBox( + width: 18.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(4), + ), + width: 70.h, + height: 70.h, + ), + ), + SizedBox( + width: 12.w, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 11.h, top: 2.h), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 112.w, + height: 20.h, + ), + ), + ), + Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 43.w, + height: 18.h, + ), + ), + SizedBox( + width: 8.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 43.w, + height: 18.h, + ), + ), + ], + ), + SizedBox( + height: 7.h, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 28.w, + height: 20.h, + ), + ), + ], + )), + ], + ), + ); + } } diff --git a/lib/business_system/goods/on_sale/goods_assort.dart b/lib/business_system/goods/on_sale/goods_assort.dart index 0b481650..b3f37032 100644 --- a/lib/business_system/goods/on_sale/goods_assort.dart +++ b/lib/business_system/goods/on_sale/goods_assort.dart @@ -6,6 +6,7 @@ import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shimmer/shimmer.dart'; import '../../../generated/l10n.dart'; import '../../../retrofit/business_api.dart'; @@ -35,6 +36,7 @@ class _GoodsAssort extends State { final RefreshController refreshController = RefreshController(); BusinessApiService businessService; ProductGroupList productGroupList; + bool _shimmer = true; @override void initState() { @@ -48,6 +50,7 @@ class _GoodsAssort extends State { status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); await queryProductGroupList(); + _shimmer = false; EasyLoading.dismiss(); if (refreshController.isRefresh) refreshController.refreshCompleted(); if (mounted) @@ -138,7 +141,19 @@ class _GoodsAssort extends State { physics: BouncingScrollPhysics(), scrollController: ScrollController(), child: Container( - child: (productGroupList == null || + child: (_shimmer)?ListView.builder( + itemCount: 10, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: assortItemSm(), + ); + }, + ): + ((productGroupList == null || productGroupList.records.length == 0) ? NoDataView( src: "assets/image/bs_no data_logo.webp", @@ -158,7 +173,7 @@ class _GoodsAssort extends State { child: assortItem(productGroupList.records[position]), ); }, - ), + )), ), ), )), @@ -284,6 +299,68 @@ class _GoodsAssort extends State { ); } + Widget assortItemSm() { + return Container( + child: Column( + children: [ + Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 112.w, + height: 20.h, + ), + ), + Spacer(), + Padding( + padding: EdgeInsets.symmetric(horizontal: 17.w), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 28.w, + height: 20.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only(right: 16.w, left: 17.w), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 28.w, + height: 20.h, + ), + ), + ), + ], + ), + Container( + margin: EdgeInsets.symmetric(vertical: 16.h), + color: Color(0xFFEBEBEB), + height: 1.h, + width: double.infinity, + ) + ], + ), + ); + } + ///删除分组提示弹窗 showDelGroupDialog(id) { showDialog( diff --git a/lib/business_system/goods/on_sale/on_sale_page.dart b/lib/business_system/goods/on_sale/on_sale_page.dart index 19c80df9..f48ce332 100644 --- a/lib/business_system/goods/on_sale/on_sale_page.dart +++ b/lib/business_system/goods/on_sale/on_sale_page.dart @@ -8,6 +8,7 @@ import 'package:huixiang/view_widget/my_footer.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'; import '../../../generated/l10n.dart'; import '../../../retrofit/business_api.dart'; @@ -34,6 +35,7 @@ class OnSalePage extends StatefulWidget { class _OnSalePage extends State { final RefreshController _refreshController = RefreshController(); + final RefreshController refreshController = RefreshController(); ScrollPhysics scrollPhysics = NeverScrollableScrollPhysics(); final ScrollController controller = ScrollController(); BusinessApiService businessService; @@ -42,11 +44,13 @@ class _OnSalePage extends State { int _loadCount = 0; int _pageIndex = 1; int groupIndex = -1; + bool _shimmer = true; @override void dispose() { super.dispose(); _refreshController.dispose(); + refreshController.dispose(); } @override @@ -67,7 +71,9 @@ class _OnSalePage extends State { tenant: BusinessInstance.instance.businessTenant, storeId: widget.storeId); queryProductGroupList(); - queryGoodsList("", isSing: false); + queryGoodsList( + groupIndex != -1 ? productGroupList.records[groupIndex].id : "", + isSing: false); }); } @@ -75,8 +81,9 @@ class _OnSalePage extends State { _loadCount += 1; if (_loadCount == 2) { _loadCount = 0; + _shimmer = false; EasyLoading.dismiss(); - if (_refreshController.isRefresh) _refreshController.refreshCompleted(); + if (refreshController.isRefresh) refreshController.refreshCompleted(); if (!mounted) setState(() {}); } } @@ -93,8 +100,8 @@ class _OnSalePage extends State { }).catchError((error) { SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), alignment: Alignment.center); - _refreshController.refreshFailed(); - _refreshController.loadFailed(); + refreshController.refreshFailed(); + refreshController.loadFailed(); }); if (!mounted) return; if (baseData != null && baseData.isSuccess) { @@ -109,10 +116,10 @@ class _OnSalePage extends State { ///商品列表 queryGoodsList(groupId, {isSing = true}) async { - if(isSing) - EasyLoading.show( - status: S.current.zhengzaijiazai, - maskType: EasyLoadingMaskType.black); + if (isSing) + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); try { BaseData baseData = await businessService.findAdminProductLis({ @@ -125,18 +132,23 @@ class _OnSalePage extends State { }).catchError((error) { SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), alignment: Alignment.center); - _refreshController.refreshFailed(); - _refreshController.loadFailed(); + // _refreshController.refreshFailed(); + // _refreshController.loadFailed(); + refreshController.refreshFailed(); + refreshController.loadFailed(); }); if (!mounted) return; if (baseData != null && baseData.isSuccess) { adminProductVoList.addAll(baseData?.data?.adminProductVOList ?? []); widget.total(baseData.data.total.toString()); if ((baseData?.data?.adminProductVOList ?? []).isEmpty || - adminProductVoList.length == baseData.data.total) - _refreshController.loadNoData(); - else - _refreshController.loadComplete(); + adminProductVoList.length == baseData.data.total) { + // _refreshController.loadNoData(); + refreshController.loadNoData(); + } else { + // _refreshController.loadComplete(); + refreshController.loadComplete(); + } } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } @@ -151,7 +163,7 @@ class _OnSalePage extends State { } ///商品下架 - queryGoodsUpdate() async { + queryGoodsUpdate({isSing = true}) async { if (businessService == null) { businessService = BusinessApiService(Dio(), context: context, @@ -164,7 +176,11 @@ class _OnSalePage extends State { "sell": false, }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { - await queryGoodsList(groupIndex == -1?"":productGroupList?.records[groupIndex]?.id ?? ""); + _pageIndex = 1; + adminProductVoList.clear(); + await queryGoodsList(groupIndex == -1 + ? "" + : productGroupList?.records[groupIndex]?.id ?? ""); SmartDialog.showToast("商品下架成功", alignment: Alignment.center); } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); @@ -180,91 +196,144 @@ class _OnSalePage extends State { children: [ Column( children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - goodsSearch(), - Container( - color: Color(0xFFEBEBEB), - height: 1.h, - width: double.infinity, - ), - ], + goodsSearch(), + Container( + color: Color(0xFFEBEBEB), + height: 1.h, + width: double.infinity, ), Expanded( child: Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 100.w, - child: ListView.builder( - itemCount: productGroupList?.records?.length ?? 0, - physics: BouncingScrollPhysics(), - shrinkWrap: true, - itemBuilder: (context, position) { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - groupIndex = position; - _pageIndex = 1; - adminProductVoList.clear(); - queryGoodsList( - productGroupList?.records[position].id, - isSing: false); - }); - }, - child: leftItem( - productGroupList.records[position], position), - ); - }, - ), - ), - Container( - width: MediaQuery.of(context).size.width - 100.w, - child: SmartRefresher( - controller: _refreshController, - enablePullDown: false, - enablePullUp: adminProductVoList.length != 0 ?true:false, - header: MyHeader( - color: Color(0xFF30415B), - ), - physics: BouncingScrollPhysics(), - footer: CustomFooter( - builder: (context, mode) { - return MyFooter(mode); - }, - ), - onLoading: () { - _pageIndex++; - queryGoodsList(groupIndex == -1 ? "":productGroupList?.records[groupIndex].id); - }, - child: Container( - color: Colors.white, - child: (adminProductVoList == null || adminProductVoList.length == 0) - ? NoDataView( - src: "assets/image/bs_no data_logo.webp", - isShowBtn: false, - text: "该分组暂无添加商品", - fontSize: 16.sp, - margin: EdgeInsets.all(20.h), - ) - : ListView.builder( - itemCount: adminProductVoList?.length ?? 0, - controller: controller, - physics: BouncingScrollPhysics(), - shrinkWrap: true, - itemBuilder: (context, position) { - return rightGoodsItem( - adminProductVoList[position]); + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader( + color: Color(0xFF30415B), + ), + physics: BouncingScrollPhysics(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); }, ), - )), - ), - ], - ) + onRefresh: () { + _pageIndex = 1; + adminProductVoList.clear(); + _onRefresh(isShowLoad: false); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 100.w, + child: (_shimmer) + ? ListView.builder( + itemCount: 10, + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return leftItemSm(); + }, + ) + : ListView.builder( + itemCount: + productGroupList?.records?.length ?? + 0, + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + groupIndex = position; + _pageIndex = 1; + adminProductVoList.clear(); + queryGoodsList( + productGroupList + ?.records[position].id, + isSing: false); + }); + }, + child: leftItem( + productGroupList + .records[position], + position), + ); + }, + ), + ), + Container( + width: + MediaQuery.of(context).size.width - 100.w, + child: SmartRefresher( + controller: _refreshController, + enablePullDown: false, + enablePullUp: adminProductVoList.length != 0 + ? true + : false, + header: MyHeader( + color: Color(0xFF30415B), + ), + physics: BouncingScrollPhysics(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onLoading: () { + _pageIndex++; + queryGoodsList(groupIndex == -1 + ? "" + : productGroupList + ?.records[groupIndex].id); + }, + child: Container( + color: Colors.white, + child: (_shimmer) + ? ListView.builder( + itemCount: 10, + physics: + BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: + (context, position) { + return rightGoodsSm(); + }, + ) + : ((adminProductVoList == null || + adminProductVoList.length == + 0) + ? NoDataView( + src: + "assets/image/bs_no data_logo.webp", + isShowBtn: false, + text: "该分组暂无添加商品", + fontSize: 16.sp, + margin: + EdgeInsets.all(20.h), + ) + : ListView.builder( + itemCount: + adminProductVoList + ?.length ?? + 0, + controller: controller, + physics: + BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: + (context, position) { + return rightGoodsItem( + adminProductVoList[ + position]); + }, + )))), + ), + ], + )) // SmartRefresher( // controller: _refreshController, // enablePullDown: true, @@ -285,7 +354,7 @@ class _OnSalePage extends State { // }, // onLoading: () { // _pageIndex++; - // queryGoodsList(); + // queryGoodsList(groupIndex == -1 ? "" : productGroupList.records[groupIndex].id); // }, // child: Container( // color: Colors.white, @@ -303,7 +372,7 @@ class _OnSalePage extends State { // return GestureDetector( // behavior: HitTestBehavior.opaque, // onTap: () {}, - // child: leftItem(productGroupList.records[position]), + // child: leftItem(productGroupList.records[position],position), // ); // }, // ), @@ -511,9 +580,12 @@ class _OnSalePage extends State { records?.groupName ?? "", textAlign: TextAlign.center, style: TextStyle( - color: groupIndex == index ? Color(0xFF30415B):Color(0xFF626264), + color: + groupIndex == index ? Color(0xFF30415B) : Color(0xFF626264), fontSize: 12.sp, - fontWeight: groupIndex == index ? MyFontWeight.semi_bold : MyFontWeight.regular, + fontWeight: groupIndex == index + ? MyFontWeight.semi_bold + : MyFontWeight.regular, ), )), ], @@ -605,7 +677,7 @@ class _OnSalePage extends State { ), )), GestureDetector( - onTap: (){ + onTap: () { queryGoodsUpdate(); }, child: Container( @@ -618,7 +690,7 @@ class _OnSalePage extends State { ), ), padding: - EdgeInsets.symmetric(vertical: 2.h, horizontal: 12.w), + EdgeInsets.symmetric(vertical: 2.h, horizontal: 12.w), child: Text( "下架", style: TextStyle( @@ -637,4 +709,132 @@ class _OnSalePage extends State { ), ); } + + Widget leftItemSm() { + return Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 14.w), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 48.w, + height: 30.h, + ), + ), + ); + } + + Widget rightGoodsSm() { + return Container( + margin: EdgeInsets.only(bottom: 21.h, left: 16.w, right: 16.w, top: 10.h), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(4), + ), + width: 70.h, + height: 70.h, + ), + ), + SizedBox( + width: 12.w, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 11.h, top: 2.h), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 124.w, + height: 20.h, + ), + ), + ), + Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 43.w, + height: 18.h, + ), + ), + SizedBox( + width: 8.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 43.w, + height: 18.h, + ), + ), + ], + ), + SizedBox( + height: 7.h, + ), + Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 28.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 24.w, + height: 18.h, + ), + ), + ], + ) + ], + )), + ], + ), + ); + } } diff --git a/lib/business_system/home/flow_page.dart b/lib/business_system/home/flow_page.dart index d9c772eb..ba6060b6 100644 --- a/lib/business_system/home/flow_page.dart +++ b/lib/business_system/home/flow_page.dart @@ -8,6 +8,7 @@ import 'package:intl/intl.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'; import '../../generated/l10n.dart'; import '../../retrofit/business_api.dart'; @@ -38,7 +39,7 @@ class _FlowPage extends State { List dayFlowList = []; int _loadCount = 0; String _datetime; - + bool _shimmer = true; @override void initState() { @@ -56,7 +57,11 @@ class _FlowPage extends State { token: BusinessInstance.instance.businessToken, tenant: BusinessInstance.instance.businessTenant, storeId: storeId); - queryDayFlow(_datetime == null ? DateFormat("yyyy-MM-dd").format(DateTime.now()):(_datetime+"-01"), "0", + queryDayFlow( + _datetime == null + ? DateFormat("yyyy-MM-dd").format(DateTime.now()) + : (_datetime + "-01"), + "0", isSing: false); }); } @@ -65,6 +70,7 @@ class _FlowPage extends State { _loadCount += 1; if (_loadCount == 1) { _loadCount = 0; + _shimmer = false; EasyLoading.dismiss(); if (refreshController.isRefresh) refreshController.refreshCompleted(); if (mounted) setState(() {}); @@ -142,7 +148,9 @@ class _FlowPage extends State { child: Row( children: [ Text( - _datetime == null ? DateFormat("yyyy年MM月").format(DateTime.now()) : "${_datetime.replaceAll("-", "年")}日", + _datetime == null + ? DateFormat("yyyy年MM月").format(DateTime.now()) + : "${_datetime.replaceAll("-", "年")}日", style: TextStyle( fontSize: 15.sp, fontWeight: MyFontWeight.semi_bold, @@ -160,6 +168,7 @@ class _FlowPage extends State { SizedBox( height: 16.h, ), + if(!_shimmer) (dayFlowList == null || dayFlowList.length == 0) ? NoDataView( src: "assets/image/bs_no data_logo.webp", @@ -180,7 +189,18 @@ class _FlowPage extends State { child: billItem(dayFlowList[position]), ); }, - ) + ), + if(_shimmer) + ListView.builder( + padding: EdgeInsets.zero, + itemCount: 10, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return billItemSm(); + }, + ) ], ), ), @@ -269,6 +289,78 @@ class _FlowPage extends State { ); } + Widget billItemSm() { + return Container( + margin: EdgeInsets.only(bottom: 12.h), + padding: EdgeInsets.all(12), + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(6), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 50.w, + height: 20.h, + ), + ), + Spacer(), + Icon( + Icons.keyboard_arrow_down, + color: Color(0xFF0D0D0D), + size: 24, + ), + ], + ), + Padding( + padding: EdgeInsets.only( + top: 16.h, + ), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 114.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 38.w, + height: 20.h, + ), + ), + ], + )) + ], + ), + ); + } + ///月份账单明细 Widget billIDetailsItem(DayFlowList detailList) { return Container( @@ -332,7 +424,7 @@ class _FlowPage extends State { )); } - showDateSelector() async { + showDateSelector() async { String dateTime = await showModalBottomSheet( backgroundColor: Colors.transparent, context: context, @@ -341,7 +433,7 @@ class _FlowPage extends State { }); if (dateTime != null) { _datetime = dateTime; - queryDayFlow(_datetime+"-01", "0"); + queryDayFlow(_datetime + "-01", "0"); } } } diff --git a/lib/business_system/home/overview/trade_goods.dart b/lib/business_system/home/overview/trade_goods.dart index 1ec48dde..201dcf76 100644 --- a/lib/business_system/home/overview/trade_goods.dart +++ b/lib/business_system/home/overview/trade_goods.dart @@ -9,6 +9,7 @@ import 'package:intl/intl.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'; import '../../../generated/l10n.dart'; import '../../../retrofit/business_api.dart'; @@ -49,6 +50,7 @@ class _TradeGoods extends State { BusinessApiService businessService; List singleSalesList = []; List goodsTypeSalesList = []; + bool _shimmer = true; @override void dispose() { @@ -173,6 +175,7 @@ class _TradeGoods extends State { _loadCount += 1; if (_loadCount == 2) { _loadCount = 0; + _shimmer = false; EasyLoading.dismiss(); if (_refreshController.isRefresh) _refreshController.refreshCompleted(); if (mounted) setState(() {}); @@ -762,6 +765,7 @@ class _TradeGoods extends State { ], ), ), + if(!_shimmer) (goodsTypeSalesList == null || goodsTypeSalesList.length == 0) ? NoDataView( src: "assets/image/bs_no data_logo.webp", @@ -786,7 +790,18 @@ class _TradeGoods extends State { ); }, ), - ) + ), + if(_shimmer) + ListView.builder( + padding: EdgeInsets.zero, + itemCount: 9, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return goodsTypeItemSm(position); + }, + ) ], ), ), @@ -823,6 +838,48 @@ class _TradeGoods extends State { ); } + Widget goodsTypeItemSm(index) { + return Container( + margin: EdgeInsets.only(bottom: 12.h), + padding: EdgeInsets.only(top: 8.h, left: 11.w, right: 24.w, bottom: 7.h), + width: double.infinity, + decoration: BoxDecoration( + color: index % 2 == 0 ? Color(0xFFF9FAF8) : Colors.white, + borderRadius: BorderRadius.circular(6), + ), + child: + Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 50.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 50.w, + height: 20.h, + ), + ), + ], + ), + ); + } + ///单品销量报表 Widget singleSalesStatement() { return Container( diff --git a/lib/business_system/order/business_order_detail.dart b/lib/business_system/order/business_order_detail.dart index 2f9889f6..0eaf5eda 100644 --- a/lib/business_system/order/business_order_detail.dart +++ b/lib/business_system/order/business_order_detail.dart @@ -8,6 +8,7 @@ import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shimmer/shimmer.dart'; import '../../generated/l10n.dart'; import '../../retrofit/business_api.dart'; @@ -32,6 +33,7 @@ class _BusinessOrderDetail extends State { final RefreshController refreshController = RefreshController(); BusinessApiService businessService; BusinessOrderDetailInfo orderDetailInfo; + bool _shimmer = true; @override void initState() { @@ -69,6 +71,7 @@ class _BusinessOrderDetail extends State { SmartDialog.showToast(baseData?.msg ?? "", alignment: Alignment.center); } } finally { + _shimmer = false; EasyLoading.dismiss(); if (refreshController.isRefresh) refreshController.refreshCompleted(); setState(() {}); @@ -106,7 +109,7 @@ class _BusinessOrderDetail extends State { child: Container( margin: EdgeInsets.only(top: 16.h, left: 16.w, right: 16.w), child: Column( - children: [goodsInfo(), orderInfo()], + children: [goodsInfo(), (_shimmer)?orderInfoSm():orderInfo()], ), ), ), @@ -162,6 +165,16 @@ class _BusinessOrderDetail extends State { SizedBox( height: 12.h, ), + (_shimmer)?ListView.builder( + padding: EdgeInsets.zero, + itemCount: 3, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return goodsInfoSm(); + }, + ): ListView.builder( padding: EdgeInsets.zero, itemCount: orderDetailInfo?.orderProductDTOList?.length ?? 0, @@ -169,12 +182,10 @@ class _BusinessOrderDetail extends State { shrinkWrap: true, physics: BouncingScrollPhysics(), itemBuilder: (context, position) { - return GestureDetector( - onTap: () {}, - child: goodsInfoItem(orderDetailInfo.orderProductDTOList[position]), - ); + return goodsInfoItem(orderDetailInfo.orderProductDTOList[position]); }, ) + ], ), ); @@ -337,6 +348,394 @@ class _BusinessOrderDetail extends State { ); } + Widget goodsInfoSm(){ + return Container( + margin: EdgeInsets.only(bottom: 12.h), + height: 77.h, + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(4), + ), + width: 77.h, + height: 77.h, + ), + ), + SizedBox( + width: 12.w, + ), + Expanded(child:Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 117.w, + height: 20.h, + ), + ), + Spacer(), + Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 15.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 29.w, + height: 20.h, + ), + ), + ], + ) + ], + )) + ], + ), + ); + } + + Widget orderInfoSm(){ + return Container( + padding: EdgeInsets.all(12), + margin: EdgeInsets.only(top: 12.h,bottom:30.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular( + 2, + ), + boxShadow: [ + BoxShadow( + color: Color(0x0F06152E).withAlpha(12), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ) + ], + ), + child: Column( + children: [ + Row( + children: [ + Container( + width: 2.w, + height: 16.h, + color: Color(0xFF30415B), + margin: EdgeInsets.only(right: 4.w), + ), + Text( + "订单信息", + style: TextStyle( + fontSize: 16.sp, + color: Color(0xFF0D0D0D), + fontWeight: MyFontWeight.semi_bold), + ) + ], + ), + SizedBox( + height: 12.h, + ), + Padding(padding:EdgeInsets.only(top: 8.h, bottom: 8.h), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 42.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 171.w, + height: 20.h, + ), + ), + ], + )), + Padding(padding:EdgeInsets.only(top: 8.h, bottom: 8.h), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 56.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 147.w, + height: 20.h, + ), + ), + ], + )), + Padding(padding:EdgeInsets.only(top: 8.h, bottom: 8.h), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 28.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 70.w, + height: 20.h, + ), + ), + ], + )), + Padding(padding:EdgeInsets.only(top: 8.h, bottom: 8.h), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 42.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 34.w, + height: 20.h, + ), + ), + ], + )), + Padding(padding:EdgeInsets.only(top: 8.h, bottom: 8.h), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 42.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 84.w, + height: 20.h, + ), + ), + ], + )), + Padding(padding:EdgeInsets.only(top: 8.h, bottom: 8.h), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 56.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 25.w, + height: 20.h, + ), + ), + ], + )), + Padding(padding:EdgeInsets.only(top: 8.h, bottom: 8.h), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 56.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 38.w, + height: 20.h, + ), + ), + ], + )), + Padding(padding:EdgeInsets.only(top: 8.h, bottom: 8.h), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 56.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 55.w, + height: 20.h, + ), + ), + ], + )), + Padding(padding:EdgeInsets.only(top: 8.h, bottom: 8.h), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 56.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 147.w, + height: 20.h, + ), + ), + ], + )), + ], + ), + ); + } + Widget orderInfoItem(leftText, rightText) { return Container( margin: EdgeInsets.only(top: 8.h, bottom: 8.h), diff --git a/lib/business_system/order/order_list.dart b/lib/business_system/order/order_list.dart index 35b7ff3d..bfd27915 100644 --- a/lib/business_system/order/order_list.dart +++ b/lib/business_system/order/order_list.dart @@ -8,6 +8,7 @@ import 'package:huixiang/view_widget/my_footer.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'; import '../../../utils/font_weight.dart'; import '../../generated/l10n.dart'; @@ -40,6 +41,7 @@ class _OrderList extends State { BusinessApiService businessService; List adminOrderDTOList = []; int _pageIndex = 1; + bool _shimmer = true; @override void dispose() { @@ -59,6 +61,7 @@ class _OrderList extends State { status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); await queryOrderList(); + _shimmer = false; EasyLoading.dismiss(); if (!mounted) return; if (_refreshController.isRefresh) _refreshController.refreshCompleted(); @@ -68,7 +71,6 @@ class _OrderList extends State { ///订单列表 queryOrderList() async { if (businessService == null) { - SharedPreferences value = await SharedPreferences.getInstance(); businessService = BusinessApiService(Dio(), context: context, token: BusinessInstance.instance.businessToken, @@ -139,7 +141,16 @@ class _OrderList extends State { _pageIndex++; _onRefresh(isShowLoad: false); }, - child: (adminOrderDTOList == null || adminOrderDTOList.length == 0) + child: (_shimmer) ? ListView.builder( + padding: EdgeInsets.zero, + itemCount: 10, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return orderItemSm(); + }, + ): ((adminOrderDTOList == null || adminOrderDTOList.length == 0) ? NoDataView( src: "assets/image/bs_no data_logo.webp", isShowBtn: false, @@ -158,14 +169,18 @@ class _OrderList extends State { return GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { - Navigator.of(context) - .pushNamed('/router/business_order_detail',arguments: {"id":adminOrderDTOList[position].id,"storeId":widget.storeId}); + Navigator.of(context).pushNamed( + '/router/business_order_detail', + arguments: { + "id": adminOrderDTOList[position].id, + "storeId": widget.storeId + }); }, child: orderItem(adminOrderDTOList[position]), ); }, ), - ), + )), ); } @@ -404,4 +419,253 @@ class _OrderList extends State { ), ); } + + Widget orderItemSm() { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 16.h), + padding: EdgeInsets.symmetric(vertical: 12.h), + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(bottom: 12.h, left: 12.w, right: 12.w), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 16.h, + height: 16.h, + ), + ), + SizedBox( + width: 3.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 84.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 42.w, + height: 20.h, + ), + ), + ], + ), + ), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFF4F6F7), + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 12.w), + child: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 17.h, bottom: 13.h), + child: ListView.builder( + padding: EdgeInsets.zero, + itemCount: 5, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () {}, + child: orderGoodsSm(), + ); + }, + ), + ), + Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 20.h, + ), + ), + Padding( + padding: EdgeInsets.only(left: 14.w), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 118.w, + height: 20.h, + ), + ), + ), + ], + ), + SizedBox( + height: 4.h, + ), + Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 20.h, + ), + ), + SizedBox( + width: 14.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 73.w, + height: 20.h, + ), + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + margin: EdgeInsets.only(left: 4.w), + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 45.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 36.w, + height: 20.h, + ), + ), + ], + ), + SizedBox( + height: 20.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + margin: EdgeInsets.only(right: 20.w), + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 76.w, + height: 27.h, + ), + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 76.w, + height: 27.h, + ), + ), + ], + ) + ], + ), + ), + ], + ), + ); + } + + Widget orderGoodsSm() { + return Container( + margin: EdgeInsets.only(bottom: 13.h), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 84.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 17.w, + height: 20.h, + ), + ), + ], + ), + ); + } } diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index b56907f8..897dcee3 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -1054,7 +1054,6 @@ class _Title extends State { @override void initState() { super.initState(); - widget.controller.addListener(() { double maxScrollExtent = widget.controller.position.maxScrollExtent; double alphaHeight = (kToolbarHeight) / 2;