Browse Source

点单例表滑动优化;

商城商品展示改瀑布流;
zyh
w-R 3 years ago
parent
commit
d6a09fc7d6
  1. 6
      lib/store/shopping/shopping_home/activity_banner.dart
  2. 274
      lib/store/shopping/shopping_home/recommend_goods_list_view.dart
  3. 267
      lib/store/shopping/shopping_home/search_page.dart
  4. 9
      lib/store/store_order.dart
  5. 16
      lib/store/store_view/shop_goods.dart
  6. 51
      lib/store/store_view/store_order_list.dart
  7. 35
      lib/utils/flutter_utils.dart
  8. 2
      pubspec.yaml

6
lib/store/shopping/shopping_home/activity_banner.dart

@ -38,7 +38,7 @@ class _ActivityBanner extends State<ActivityBanner> {
return Container( return Container(
margin: EdgeInsets.only(bottom:10), margin: EdgeInsets.only(bottom:10),
child: AspectRatio( child: AspectRatio(
aspectRatio: 1.27, aspectRatio: 1.32,
child: Swiper( child: Swiper(
viewportFraction: 0.9, viewportFraction: 0.9,
scale: 0.7, scale: 0.7,
@ -77,7 +77,7 @@ class _ActivityBanner extends State<ActivityBanner> {
) )
), ),
Container( Container(
height: 143, height: 145.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.vertical(bottom: Radius.circular(8)), borderRadius: BorderRadius.vertical(bottom: Radius.circular(8)),
@ -85,7 +85,7 @@ class _ActivityBanner extends State<ActivityBanner> {
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(horizontal: 12), padding: EdgeInsets.symmetric(horizontal: 12.w),
itemCount:widget?.specialArea[position]?.productList?.length ?? 0, itemCount:widget?.specialArea[position]?.productList?.length ?? 0,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return GestureDetector( return GestureDetector(

274
lib/store/shopping/shopping_home/recommend_goods_list_view.dart

@ -1,6 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:huixiang/retrofit/data/home_recommend_list.dart'; import 'package:huixiang/retrofit/data/home_recommend_list.dart';
import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -47,43 +47,72 @@ class _RecommendGoodsListView extends State<RecommendGoodsListView> {
width: 35.w, width: 35.w,
height: 5.h, height: 5.h,
), ),
GridView.builder( // GridView.builder(
itemCount:widget.homeRecommendList == null ? 0 : widget.homeRecommendList.length, // itemCount:widget.homeRecommendList == null ? 0 : widget.homeRecommendList.length,
padding: EdgeInsets.only( // padding: EdgeInsets.only(
left: 16.w, // left: 16.w,
right: 16.w, // right: 16.w,
top: 13.h, // top: 13.h,
bottom: 16.h, // bottom: 16.h,
), // ),
// shrinkWrap: true,
// physics: NeverScrollableScrollPhysics(),
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
// //Widget数量
// crossAxisCount: 2,
// //Widget之间间距
// crossAxisSpacing: 11.w,
// //Widget之间间距
// mainAxisSpacing: 16.w,
// //Widget宽高比例 0.59
// childAspectRatio:
// 185 / (281 / 2 + (281 / 2) * AppUtils.textScale(context)),
// ),
// itemBuilder: (context, index) {
// return GestureDetector(
// onTap: () {
// Navigator.of(context).pushNamed(
// '/router/shopping_goods_details',
// arguments: {
// "id":widget.homeRecommendList[index].id,
// "storeId":widget.storeId,
// "tenant":widget.tenant,
// },
// );
// },
// child: goodsListItem(widget.homeRecommendList[index]),
// );
// },
// ),
StaggeredGridView.countBuilder(
crossAxisCount: 2,
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), itemCount: widget.homeRecommendList.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( mainAxisSpacing: 8,
//Widget数量 crossAxisSpacing: 8,
crossAxisCount: 2, padding: EdgeInsets.all(16),
//Widget之间间距 physics: BouncingScrollPhysics(),
crossAxisSpacing: 11.w, // scrollDirection: Axis.vertical,
//Widget之间间距 itemBuilder: (context, position) {
mainAxisSpacing: 16.w,
//Widget宽高比例 0.59
childAspectRatio:
185 / (281 / 2 + (281 / 2) * AppUtils.textScale(context)),
),
itemBuilder: (context, index) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: (){
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/shopping_goods_details', '/router/shopping_goods_details',
arguments: { arguments: {
"id":widget.homeRecommendList[index].id, "id":widget.homeRecommendList[position].id,
"storeId":widget.storeId, "storeId":widget.storeId,
"tenant":widget.tenant, "tenant":widget.tenant,
}, },
); );
}, },
child: goodsListItem(widget.homeRecommendList[index]), child: goodsListItem(widget.homeRecommendList[position]),
); );
}, },
) staggeredTileBuilder: (position) {
// return StaggeredTile.count(1,position==0?1:1.2);
return StaggeredTile.fit(1);
},
),
], ],
); );
} }
@ -91,9 +120,7 @@ class _RecommendGoodsListView extends State<RecommendGoodsListView> {
Widget goodsListItem(HomeRecommendList homeRecommendList) { Widget goodsListItem(HomeRecommendList homeRecommendList) {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.vertical( borderRadius: BorderRadius.circular(4),
top: Radius.circular(8),
),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.black.withAlpha(10), color: Colors.black.withAlpha(10),
@ -110,117 +137,110 @@ class _RecommendGoodsListView extends State<RecommendGoodsListView> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( ClipRRect(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(10),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
),
child: child:
MImage( MImage(
homeRecommendList.imgs[0], homeRecommendList.imgs[0],
width: double.infinity, width: double.infinity,
height: 166, height: 166,
fit: BoxFit.cover, fit: BoxFit.cover,
errorSrc: "assets/image/default_1.webp", errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp", fadeSrc: "assets/image/default_1.webp",
), ),
borderRadius: BorderRadius.vertical(
top: Radius.circular(4),
),
), ),
Expanded( Container(
child: Container( padding: EdgeInsets.only(left: 12.w, right: 12.w,bottom:15.h),
padding: EdgeInsets.only(left: 12.w, right: 12.w), child: Column(
child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Row(
Row( mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end, children: [
children: [ Container(
Container( margin: EdgeInsets.only(top: 8, right: 8),
margin: EdgeInsets.only(top: 8, right: 8), padding: EdgeInsets.only(left: 2, right: 2),
padding: EdgeInsets.only(left: 2, right: 2), height: 18.h,
height: 18.h, alignment: Alignment.center,
alignment: Alignment.center, decoration: BoxDecoration(
decoration: BoxDecoration( borderRadius: BorderRadius.circular(2),
borderRadius: BorderRadius.circular(2), color: Color(0xFF5A5A5A),
color: Color(0xFF5A5A5A),
),
child: Text(
AppUtils.textSubStr(homeRecommendList?.supplierName ?? "",8),
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),
), ),
Text( child: Text(
"已售${homeRecommendList?.sellCount ?? 0}", AppUtils.textSubStr(homeRecommendList?.supplierName ?? "",8),
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 10.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: Color(0xFF5D5D5D), color: Colors.white,
), ),
), ),
],
),
Text(
homeRecommendList?.productName ?? "",
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF353535),
), ),
Text(
"已售${homeRecommendList?.sellCount ?? 0}",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF5D5D5D),
),
),
],
),
SizedBox(height: 7.h,),
Text(
homeRecommendList?.productName ?? "",
// maxLines: 2,
// overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 16.sp,
height: 1.2.h,
fontWeight: MyFontWeight.medium,
color: Color(0xFF353535),
), ),
Row( ),
mainAxisAlignment: MainAxisAlignment.spaceBetween, SizedBox(height: 7.h,),
crossAxisAlignment: CrossAxisAlignment.end, Row(
children: [ mainAxisAlignment: MainAxisAlignment.spaceBetween,
Text.rich( crossAxisAlignment: CrossAxisAlignment.end,
TextSpan( children: [
children: [ Text.rich(
TextSpan( TextSpan(
text: "", children: [
style: TextStyle( TextSpan(
fontSize: 12.sp, text: "",
fontWeight: MyFontWeight.semi_bold, style: TextStyle(
color: Color(0xFF32A060), fontSize: 12.sp,
), fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF32A060),
), ),
TextSpan( ),
text:homeRecommendList?.price ??"", TextSpan(
style: TextStyle( text:homeRecommendList?.price ??"",
fontSize: 18.sp, style: TextStyle(
fontWeight: MyFontWeight.semi_bold, fontSize: 18.sp,
color: Color(0xFF32A060), fontWeight: MyFontWeight.semi_bold,
), color: Color(0xFF32A060),
), ),
], ),
), ],
), ),
Text( ),
"¥283.00", Text(
style: TextStyle( "¥283.00",
fontSize: 14.sp, style: TextStyle(
decoration: TextDecoration.lineThrough, fontSize: 14.sp,
decorationColor: Color(0xFF585858), decoration: TextDecoration.lineThrough,
fontWeight: MyFontWeight.regular, decorationColor: Color(0xFF585858),
color: Color(0xFFA2A2A2), fontWeight: MyFontWeight.regular,
), color: Color(0xFFA2A2A2),
), ),
], ),
), ],
], ),
), ],
), ),
) )
], ],

267
lib/store/shopping/shopping_home/search_page.dart

@ -2,6 +2,7 @@ import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/findMiNiGroupList.dart'; import 'package:huixiang/retrofit/data/findMiNiGroupList.dart';
import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/retrofit/min_api.dart';
@ -644,7 +645,6 @@ class _SearchPage extends State<SearchPage>
// ), // ),
], ],
), ),
SizedBox(height: 16.h),
(productListBeans == null || productListBeans?.length == 0) (productListBeans == null || productListBeans?.length == 0)
? NoDataView( ? NoDataView(
src: "assets/image/ding_dan.webp", src: "assets/image/ding_dan.webp",
@ -653,37 +653,66 @@ class _SearchPage extends State<SearchPage>
fontSize: 16.sp, fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h, left: 60.w, right: 60.w), margin: EdgeInsets.only(top: 120.h, left: 60.w, right: 60.w),
) )
: GridView.builder( :
itemCount: productListBeans?.length ?? 0, // GridView.builder(
shrinkWrap: true, // itemCount: productListBeans?.length ?? 0,
physics: NeverScrollableScrollPhysics(), // shrinkWrap: true,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( // physics: NeverScrollableScrollPhysics(),
//Widget数量 // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, // //Widget数量
//Widget之间间距 // crossAxisCount: 2,
crossAxisSpacing: 11.w, // //Widget之间间距
//Widget之间间距 // crossAxisSpacing: 11.w,
mainAxisSpacing: 16.w, // //Widget之间间距
//Widget宽高比例 0.59 // mainAxisSpacing: 16.w,
childAspectRatio: 185 / // //Widget宽高比例 0.59
(281 / 2 + (281 / 2) * AppUtils.textScale(context)), // childAspectRatio: 185 /
), // (281 / 2 + (281 / 2) * AppUtils.textScale(context)),
itemBuilder: (context, index) { // ),
return GestureDetector( // itemBuilder: (context, index) {
onTap: () { // return GestureDetector(
Navigator.of(context).pushNamed( // onTap: () {
'/router/shopping_goods_details', // Navigator.of(context).pushNamed(
arguments: { // '/router/shopping_goods_details',
"id": productListBeans[index].id, // arguments: {
"storeId": widget.arguments["storeId"], // "id": productListBeans[index].id,
"tenant": widget.arguments["tenant"], // "storeId": widget.arguments["storeId"],
}, // "tenant": widget.arguments["tenant"],
); // },
}, // );
child: searchListItem(productListBeans[index]), // },
); // child: searchListItem(productListBeans[index]),
}, // );
) // },
// )
StaggeredGridView.countBuilder(
crossAxisCount: 2,
shrinkWrap: true,
itemCount: productListBeans.length,
mainAxisSpacing: 8,
crossAxisSpacing: 8,
physics: BouncingScrollPhysics(),
// scrollDirection: Axis.vertical,
itemBuilder: (context, position) {
return GestureDetector(
onTap: (){
Navigator.of(context).pushNamed(
'/router/shopping_goods_details',
arguments: {
"id": productListBeans[position].id,
"storeId": widget.arguments["storeId"],
"tenant": widget.arguments["tenant"],
},
);
},
child: searchListItem(productListBeans[position]),
);
},
staggeredTileBuilder: (position) {
// return StaggeredTile.count(1,position==0?1:1.2);
return StaggeredTile.fit(1);
},
),
], ],
), ),
); );
@ -709,19 +738,9 @@ class _SearchPage extends State<SearchPage>
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( ClipRRect(
decoration: BoxDecoration( child:
borderRadius: BorderRadius.circular(4), MImage(
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(10),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
),
child: MImage(
productListBeans?.imgPath ?? "", productListBeans?.imgPath ?? "",
width: double.infinity, width: double.infinity,
height: 166, height: 166,
@ -729,96 +748,98 @@ class _SearchPage extends State<SearchPage>
errorSrc: "assets/image/default_1.webp", errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp", fadeSrc: "assets/image/default_1.webp",
), ),
borderRadius: BorderRadius.vertical(
top: Radius.circular(4),
),
), ),
Expanded( Container(
child: Container( padding: EdgeInsets.only(left: 8.w, right: 8.w,bottom: 15.h),
padding: EdgeInsets.only(left: 8.w, right: 8.w), child: Column(
child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Row(
Row( mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end, children: [
children: [ Container(
Container( margin: EdgeInsets.only(top: 8, right: 8),
margin: EdgeInsets.only(top: 8, right: 8), padding: EdgeInsets.only(left: 2, right: 2),
padding: EdgeInsets.only(left: 2, right: 2), height: 18.h,
height: 18.h, alignment: Alignment.center,
alignment: Alignment.center, decoration: BoxDecoration(
decoration: BoxDecoration( borderRadius: BorderRadius.circular(2),
borderRadius: BorderRadius.circular(2), color: Color(0xFF5A5A5A),
color: Color(0xFF5A5A5A),
),
child: Text(
AppUtils.textSubStr( productListBeans.supplierName ?? "",8),
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),
), ),
Text( child: Text(
"已售${productListBeans?.sellCount ?? 0}", AppUtils.textSubStr( productListBeans.supplierName ?? "",8),
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 10.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: Color(0xFF5D5D5D), color: Colors.white,
), ),
), ),
],
),
Text(
productListBeans?.productName ?? "",
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF353535),
), ),
Text(
"已售${productListBeans?.sellCount ?? 0}",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF5D5D5D),
),
),
],
),
SizedBox(height: 7.h,),
Text(
productListBeans?.productName ?? "",
style: TextStyle(
fontSize: 16.sp,
height: 1.2.h,
fontWeight: MyFontWeight.medium,
color: Color(0xFF353535),
), ),
Row( ),
mainAxisAlignment: MainAxisAlignment.spaceBetween, SizedBox(height: 7.h,),
crossAxisAlignment: CrossAxisAlignment.end, Row(
children: [ mainAxisAlignment: MainAxisAlignment.spaceBetween,
Text.rich( crossAxisAlignment: CrossAxisAlignment.end,
TextSpan( children: [
children: [ Text.rich(
TextSpan( TextSpan(
text: "", children: [
style: TextStyle( TextSpan(
fontSize: 12.sp, text: "",
fontWeight: MyFontWeight.semi_bold, style: TextStyle(
color: Color(0xFF32A060), fontSize: 12.sp,
), fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF32A060),
), ),
TextSpan( ),
text: productListBeans?.price ?? "", TextSpan(
style: TextStyle( text: productListBeans?.price ?? "",
fontSize: 18.sp, style: TextStyle(
fontWeight: MyFontWeight.semi_bold, fontSize: 18.sp,
color: Color(0xFF32A060), fontWeight: MyFontWeight.semi_bold,
), color: Color(0xFF32A060),
), ),
], ),
), ],
), ),
Text( ),
"¥283.00", Text(
style: TextStyle( "¥283.00",
fontSize: 14.sp, style: TextStyle(
decoration: TextDecoration.lineThrough, fontSize: 14.sp,
decorationColor: Color(0xFF585858), decoration: TextDecoration.lineThrough,
fontWeight: MyFontWeight.regular, decorationColor: Color(0xFF585858),
color: Color(0xFFA2A2A2), fontWeight: MyFontWeight.regular,
), color: Color(0xFFA2A2A2),
), ),
], ),
), ],
], ),
), ],
), ),
) )
], ],

9
lib/store/store_order.dart

@ -22,12 +22,14 @@ import 'package:huixiang/store/store_view/shop_car.dart';
import 'package:huixiang/store/store_view/store_activity.dart'; import 'package:huixiang/store/store_view/store_activity.dart';
import 'package:huixiang/store/store_view/store_info.dart'; import 'package:huixiang/store/store_view/store_info.dart';
import 'package:huixiang/store/store_view/store_order_list.dart'; import 'package:huixiang/store/store_view/store_order_list.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_tab.dart'; import 'package:huixiang/view_widget/my_tab.dart';
import 'package:huixiang/view_widget/receive_success.dart'; import 'package:huixiang/view_widget/receive_success.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
import 'package:intl/intl.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -498,7 +500,12 @@ class _StoreOrderPage extends State<StoreOrderPage>
Spacer(), Spacer(),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
toDownOrder(); if(AppUtils.compareTime(storeInfo.openStartTime,DateFormat('HH:mm:ss').format(DateTime.now()))
&&(!AppUtils.compareTime(storeInfo.openEndTime,DateFormat('HH:mm:ss').format(DateTime.now())))){
toDownOrder();
}
else
SmartDialog.showToast("营业时间:${storeInfo.openStartTime}-${storeInfo.openEndTime}", alignment: Alignment.center);
}, },
child: RoundButton( child: RoundButton(
width: 103.w, width: 103.w,

16
lib/store/store_view/shop_goods.dart

@ -42,8 +42,8 @@ class _ShopGoods extends State<ShopGoods> {
padding: EdgeInsets.only( padding: EdgeInsets.only(
right: 16.w, right: 16.w,
// bottom: 20.h, // bottom: 20.h,
top: 10.h,
), ),
height: 120.h,
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -56,8 +56,8 @@ class _ShopGoods extends State<ShopGoods> {
: (widget.shoppingCartSkuItemListBean != null : (widget.shoppingCartSkuItemListBean != null
? widget.shoppingCartSkuItemListBean.skuImg ? widget.shoppingCartSkuItemListBean.skuImg
: ""), : ""),
width: 70, width: 70.h,
height: 70, height: 70.h,
radius: BorderRadius.circular(4), radius: BorderRadius.circular(4),
fit: BoxFit.cover, fit: BoxFit.cover,
errorSrc: "assets/image/default_1.webp", errorSrc: "assets/image/default_1.webp",
@ -103,7 +103,7 @@ class _ShopGoods extends State<ShopGoods> {
], ],
), ),
SizedBox( SizedBox(
height: 2, height: 2.h,
), ),
Row( Row(
children: [ children: [
@ -127,7 +127,7 @@ class _ShopGoods extends State<ShopGoods> {
], ],
), ),
SizedBox( SizedBox(
height: 7, height: 7.h,
), ),
Row( Row(
children: [ children: [
@ -195,7 +195,7 @@ class _ShopGoods extends State<ShopGoods> {
visible: widget.count > 0, visible: widget.count > 0,
child: RoundButton( child: RoundButton(
width: 17, width: 17,
height: 17, height: 17.h,
text: "${widget.count}", text: "${widget.count}",
textColor: Color(0xFF32A060), textColor: Color(0xFF32A060),
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -216,7 +216,7 @@ class _ShopGoods extends State<ShopGoods> {
child: Image.asset( child: Image.asset(
"assets/image/reduce.webp", "assets/image/reduce.webp",
width: 22, width: 22,
height: 22, height: 22.h,
), ),
), ),
if (widget.isShopCart || if (widget.isShopCart ||
@ -242,7 +242,7 @@ class _ShopGoods extends State<ShopGoods> {
child: Image.asset( child: Image.asset(
"assets/image/add.webp", "assets/image/add.webp",
width: 22, width: 22,
height: 22, height: 22.h,
), ),
), ),
], ],

51
lib/store/store_view/store_order_list.dart

@ -54,11 +54,13 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
List<ProductListBean> productListBeans = []; List<ProductListBean> productListBeans = [];
int currentIndex = 0; int currentIndex = 0;
final ScrollController controller = ScrollController(); final ScrollController controller = ScrollController();
double _viewportDimension = 0;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
controller.addListener(() { controller.addListener(() {
_viewportDimension = controller.position.viewportDimension;
for (int i = 0; i < appletProducts.length; i++) { for (int i = 0; i < appletProducts.length; i++) {
if (currentIndex != i && if (currentIndex != i &&
controller.offset >= appletProducts[i].goodsIndex && controller.offset >= appletProducts[i].goodsIndex &&
@ -100,7 +102,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
double goodsIndex = 0; double goodsIndex = 0;
appletProducts.forEach((element) { appletProducts.forEach((element) {
element.goodsIndex = goodsIndex; element.goodsIndex = goodsIndex;
element.height = ((element.productList.length ?? 0) * 90.h + 76.h); element.height = ((element.productList.length ?? 0) * 120.h + 50.h);
goodsIndex += element.height; goodsIndex += element.height;
}); });
}); });
@ -129,7 +131,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
// controller: controller, // controller: controller,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.only(top: 0, bottom: 25), padding: EdgeInsets.only(top: 0, bottom: 25.h),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
@ -146,7 +148,6 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
controller: controller, controller: controller,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.only(top: 0, bottom: 25),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return rightOrderItem(position); return rightOrderItem(position);
}, },
@ -191,7 +192,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
Widget orderItem(int index) { Widget orderItem(int index) {
int count = calculateItemCount(appletProducts[index]); int count = calculateItemCount(appletProducts[index]);
return Container( return Container(
width: 100, width: 100.w,
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
@ -199,6 +200,9 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
// productListBeans.clear(); // productListBeans.clear();
// productListBeans.addAll(appletProducts[index].productList); // productListBeans.addAll(appletProducts[index].productList);
controller.jumpTo(appletProducts[index].goodsIndex); controller.jumpTo(appletProducts[index].goodsIndex);
// controller.animateTo(appletProducts[index].goodsIndex,
// duration: Duration(milliseconds: 300),
// curve: Curves.ease);
}); });
}, },
child: Stack( child: Stack(
@ -215,25 +219,22 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
if (currentIndex == index) if (currentIndex == index)
Container( Container(
width: 2, width: 2,
height: 17, height: 17.h,
color: Color(0xFF32A060), color: Color(0xFF32A060),
margin: EdgeInsets.only(right: 10), margin: EdgeInsets.only(right:10.w),
), ),
Expanded( Expanded(child:Text(
child: Text( appletProducts[index].groupName,
appletProducts[index].groupName, textAlign: TextAlign.center,
textAlign: TextAlign.center, style: TextStyle(
style: TextStyle( color: currentIndex != index
color: currentIndex != index ? Color(0xFF4D4D4D)
? Color(0xFF4D4D4D) : Color(0xFF000000),
: Color(0xFF000000), fontSize: 12.sp,
fontSize: 12.sp, fontWeight: currentIndex != index
fontWeight: currentIndex != index ? MyFontWeight.medium : MyFontWeight.semi_bold ,
? MyFontWeight.medium : MyFontWeight.semi_bold ,
),
), ),
flex: 1, )),
),
], ],
), ),
), ),
@ -262,17 +263,17 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
Widget rightOrderItem(int rightIndex) { Widget rightOrderItem(int rightIndex) {
return Container( return Container(
color: Colors.white, color: Colors.white,
margin: EdgeInsets.only(bottom: (rightIndex == appletProducts.length -1)?(_viewportDimension > appletProducts[rightIndex].height?_viewportDimension-appletProducts[rightIndex].height:30.h):0),
padding: EdgeInsets.only( padding: EdgeInsets.only(
right: 16.w, right: 16.w,
bottom: 30.h,
top: 10.h,
), ),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox(height: 50.h,child:
Padding( Padding(
padding: EdgeInsets.only(left: 16.w, bottom: 24.h), padding: EdgeInsets.only(left: 16.w,top: 10.h),
child: Text( child: Text(
appletProducts[rightIndex].groupName, appletProducts[rightIndex].groupName,
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -282,7 +283,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
), ),
), ),
), ),),
Column( Column(
children: appletProducts[rightIndex].productList.map((e) { children: appletProducts[rightIndex].productList.map((e) {
return GestureDetector( return GestureDetector(
@ -298,7 +299,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
); );
}).toList() ?? }).toList() ??
[], [],
) ),
], ],
), ),
); );

35
lib/utils/flutter_utils.dart

@ -239,4 +239,39 @@ class AppUtils {
if (length < 0 || input.length < length) return input; if (length < 0 || input.length < length) return input;
return "${input.substring(0, length)}..."; return "${input.substring(0, length)}...";
} }
////
static bool compareTime(String time1, String time2) {
if (time1 == null || time2 == null) {
return false;
}
var time1List = time1.split(":");
var time2List = time2.split(":");
if (time1List.length != 3 || time2List.length != 3) {
return false;
}
var hour1 = int.parse(time1List[0]);
var hour2 = int.parse(time2List[0]);
var minute1 = int.parse(time1List[1]);
var minute2 = int.parse(time2List[1]);
var second1 = int.parse(time1List[2]);
var second2 = int.parse(time2List[2]);
if (hour1 > hour2) {
return false;
} else if (hour1 == hour2) {
if (minute1 > minute2) {
return false;
}else if (minute1 == minute2) {
if (second1 > second2) {
return false;
} else {
return true;
}
} else {
return true;
}
} else {
return true;
}
}
} }

2
pubspec.yaml

@ -3,7 +3,7 @@ description: 一心回乡.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 2.0.35+23 version: 2.0.36+24
environment: environment:
sdk: ">=2.7.0 <3.0.0" sdk: ">=2.7.0 <3.0.0"

Loading…
Cancel
Save