Browse Source

Merge remote-tracking branch 'origin/new_revision_app' into new_revision_app

zyh
fmk 3 years ago
parent
commit
546fe43b76
  1. 6
      lib/store/shopping/shopping_home/activity_banner.dart
  2. 114
      lib/store/shopping/shopping_home/recommend_goods_list_view.dart
  3. 99
      lib/store/shopping/shopping_home/search_page.dart
  4. 7
      lib/store/store_order.dart
  5. 16
      lib/store/store_view/shop_goods.dart
  6. 33
      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(
margin: EdgeInsets.only(bottom:10),
child: AspectRatio(
aspectRatio: 1.27,
aspectRatio: 1.32,
child: Swiper(
viewportFraction: 0.9,
scale: 0.7,
@ -77,7 +77,7 @@ class _ActivityBanner extends State<ActivityBanner> {
)
),
Container(
height: 143,
height: 145.h,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(bottom: Radius.circular(8)),
@ -85,7 +85,7 @@ class _ActivityBanner extends State<ActivityBanner> {
child: ListView.builder(
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(horizontal: 12),
padding: EdgeInsets.symmetric(horizontal: 12.w),
itemCount:widget?.specialArea[position]?.productList?.length ?? 0,
itemBuilder: (context, index) {
return GestureDetector(

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

@ -1,6 +1,6 @@
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/store_info.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -47,43 +47,72 @@ class _RecommendGoodsListView extends State<RecommendGoodsListView> {
width: 35.w,
height: 5.h,
),
GridView.builder(
itemCount:widget.homeRecommendList == null ? 0 : widget.homeRecommendList.length,
padding: EdgeInsets.only(
left: 16.w,
right: 16.w,
top: 13.h,
bottom: 16.h,
),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
//Widget数量
// GridView.builder(
// itemCount:widget.homeRecommendList == null ? 0 : widget.homeRecommendList.length,
// padding: EdgeInsets.only(
// left: 16.w,
// right: 16.w,
// top: 13.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,
//Widget之间间距
crossAxisSpacing: 11.w,
//Widget之间间距
mainAxisSpacing: 16.w,
//Widget宽高比例 0.59
childAspectRatio:
185 / (281 / 2 + (281 / 2) * AppUtils.textScale(context)),
),
itemBuilder: (context, index) {
shrinkWrap: true,
itemCount: widget.homeRecommendList.length,
mainAxisSpacing: 8,
crossAxisSpacing: 8,
padding: EdgeInsets.all(16),
physics: BouncingScrollPhysics(),
// scrollDirection: Axis.vertical,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
onTap: (){
Navigator.of(context).pushNamed(
'/router/shopping_goods_details',
arguments: {
"id":widget.homeRecommendList[index].id,
"id":widget.homeRecommendList[position].id,
"storeId":widget.storeId,
"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) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.vertical(
top: Radius.circular(8),
),
borderRadius: BorderRadius.circular(4),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(10),
@ -110,18 +137,7 @@ class _RecommendGoodsListView extends State<RecommendGoodsListView> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(10),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
),
ClipRRect(
child:
MImage(
homeRecommendList.imgs[0],
@ -131,10 +147,12 @@ class _RecommendGoodsListView extends State<RecommendGoodsListView> {
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
borderRadius: BorderRadius.vertical(
top: Radius.circular(4),
),
),
Expanded(
child: Container(
padding: EdgeInsets.only(left: 12.w, right: 12.w),
Container(
padding: EdgeInsets.only(left: 12.w, right: 12.w,bottom:15.h),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
@ -171,16 +189,19 @@ class _RecommendGoodsListView extends State<RecommendGoodsListView> {
),
],
),
SizedBox(height: 7.h,),
Text(
homeRecommendList?.productName ?? "",
maxLines: 2,
overflow: TextOverflow.ellipsis,
// maxLines: 2,
// overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 16.sp,
height: 1.2.h,
fontWeight: MyFontWeight.medium,
color: Color(0xFF353535),
),
),
SizedBox(height: 7.h,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
@ -221,7 +242,6 @@ class _RecommendGoodsListView extends State<RecommendGoodsListView> {
),
],
),
),
)
],
),

99
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_baidu_mapapi_base/flutter_baidu_mapapi_base.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/findMiNiGroupList.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)
? NoDataView(
src: "assets/image/ding_dan.webp",
@ -653,37 +653,66 @@ class _SearchPage extends State<SearchPage>
fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h, left: 60.w, right: 60.w),
)
: GridView.builder(
itemCount: productListBeans?.length ?? 0,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
//Widget数量
:
// GridView.builder(
// itemCount: productListBeans?.length ?? 0,
// 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": productListBeans[index].id,
// "storeId": widget.arguments["storeId"],
// "tenant": widget.arguments["tenant"],
// },
// );
// },
// child: searchListItem(productListBeans[index]),
// );
// },
// )
StaggeredGridView.countBuilder(
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) {
shrinkWrap: true,
itemCount: productListBeans.length,
mainAxisSpacing: 8,
crossAxisSpacing: 8,
physics: BouncingScrollPhysics(),
// scrollDirection: Axis.vertical,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
onTap: (){
Navigator.of(context).pushNamed(
'/router/shopping_goods_details',
arguments: {
"id": productListBeans[index].id,
"id": productListBeans[position].id,
"storeId": widget.arguments["storeId"],
"tenant": widget.arguments["tenant"],
},
);
},
child: searchListItem(productListBeans[index]),
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(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(10),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
),
child: MImage(
ClipRRect(
child:
MImage(
productListBeans?.imgPath ?? "",
width: double.infinity,
height: 166,
@ -729,10 +748,12 @@ class _SearchPage extends State<SearchPage>
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
borderRadius: BorderRadius.vertical(
top: Radius.circular(4),
),
Expanded(
child: Container(
padding: EdgeInsets.only(left: 8.w, right: 8.w),
),
Container(
padding: EdgeInsets.only(left: 8.w, right: 8.w,bottom: 15.h),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
@ -769,16 +790,17 @@ class _SearchPage extends State<SearchPage>
),
],
),
SizedBox(height: 7.h,),
Text(
productListBeans?.productName ?? "",
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 16.sp,
height: 1.2.h,
fontWeight: MyFontWeight.medium,
color: Color(0xFF353535),
),
),
SizedBox(height: 7.h,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
@ -819,7 +841,6 @@ class _SearchPage extends State<SearchPage>
),
],
),
),
)
],
),

7
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_info.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/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_tab.dart';
import 'package:huixiang/view_widget/receive_success.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:shared_preferences/shared_preferences.dart';
@ -498,7 +500,12 @@ class _StoreOrderPage extends State<StoreOrderPage>
Spacer(),
GestureDetector(
onTap: () {
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(
width: 103.w,

16
lib/store/store_view/shop_goods.dart

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

33
lib/store/store_view/store_order_list.dart

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

35
lib/utils/flutter_utils.dart

@ -239,4 +239,39 @@ class AppUtils {
if (length < 0 || input.length < length) return input;
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
version: 2.0.35+23
version: 2.0.36+24
environment:
sdk: ">=2.7.0 <3.0.0"

Loading…
Cancel
Save