fmk
3 years ago
7 changed files with 784 additions and 685 deletions
@ -0,0 +1,293 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/findMiNiGroupList.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:huixiang/store/store_view/store_order_list.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:huixiang/view_widget/round_button.dart'; |
||||
|
||||
class ProductSku extends StatefulWidget { |
||||
final ProductListBean productListBean; |
||||
|
||||
ProductSku(this.productListBean); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ProductSku(); |
||||
} |
||||
} |
||||
|
||||
class _ProductSku extends State<ProductSku> { |
||||
List<testModel> temperatureStoreList = [ |
||||
testModel("正常冰"), |
||||
testModel("少冰"), |
||||
testModel("多冰"), |
||||
testModel("去冰") |
||||
]; |
||||
List<testModel> sweetnessStoreList = [testModel("正常糖"), testModel("5分糖")]; |
||||
int isChoice = 0; |
||||
int tempClickIndex = 0; |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
alignment: Alignment.topCenter, |
||||
padding: EdgeInsets.only( |
||||
top: 16, |
||||
left: 16, |
||||
right: 16, |
||||
), |
||||
width: double.infinity, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFFAFAFA), |
||||
borderRadius: BorderRadius.only( |
||||
topLeft: Radius.circular(8), |
||||
topRight: Radius.circular(8), |
||||
), |
||||
), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
MImage( |
||||
widget.productListBean.imgPath, |
||||
width: 70, |
||||
height: 70, |
||||
fit: BoxFit.cover, |
||||
errorSrc: "assets/image/default_1.png", |
||||
fadeSrc: "assets/image/default_1.png", |
||||
), |
||||
SizedBox( |
||||
width: 10, |
||||
), |
||||
Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
widget.productListBean.productName, |
||||
style: TextStyle( |
||||
color: Colors.black, |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(top: 4, bottom: 7), |
||||
child: Text( |
||||
"已选:正常冰", |
||||
style: TextStyle( |
||||
color: Color(0xFF727272), |
||||
fontSize: 11.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
), |
||||
), |
||||
Row( |
||||
children: [ |
||||
Text( |
||||
S.of(context).huiyuanjia, |
||||
style: TextStyle( |
||||
color: Color(0xFFFF7A1A), |
||||
fontSize: 13.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
Text( |
||||
widget.productListBean.applyPrice, |
||||
style: TextStyle( |
||||
color: Color(0xFFFF7A1A), |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
) |
||||
], |
||||
), |
||||
], |
||||
), |
||||
Spacer(), |
||||
InkWell( |
||||
onTap: () { |
||||
Navigator.of(context).pop(); |
||||
}, |
||||
child: Image.asset( |
||||
"assets/image/icon_order_cancel.png", |
||||
width: 22, |
||||
height: 22, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
SizedBox( |
||||
height: 23, |
||||
), |
||||
Text( |
||||
"温度", |
||||
style: TextStyle( |
||||
color: Colors.black, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 15, |
||||
), |
||||
sweetnessStore( |
||||
() { |
||||
setState(() { |
||||
for (var i = 0; i < temperatureStoreList.length; i++) { |
||||
if (tempClickIndex == i) |
||||
temperatureStoreList[i].isSelected = true; |
||||
else |
||||
temperatureStoreList[i].isSelected = false; |
||||
} |
||||
}); |
||||
}, |
||||
temperatureStoreList, |
||||
), |
||||
SizedBox( |
||||
height: 24, |
||||
), |
||||
Text( |
||||
"甜度", |
||||
style: TextStyle( |
||||
color: Colors.black, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 15, |
||||
), |
||||
sweetnessStore( |
||||
() { |
||||
setState(() { |
||||
for (var i = 0; i < sweetnessStoreList.length; i++) { |
||||
if (tempClickIndex == i) |
||||
sweetnessStoreList[i].isSelected = true; |
||||
else |
||||
sweetnessStoreList[i].isSelected = false; |
||||
} |
||||
}); |
||||
}, |
||||
sweetnessStoreList, |
||||
), |
||||
SizedBox( |
||||
height: 24, |
||||
), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Expanded( |
||||
child: Text( |
||||
"数量", |
||||
style: TextStyle( |
||||
color: Colors.black, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
), |
||||
), |
||||
InkWell( |
||||
onTap: () {}, |
||||
child: Image.asset( |
||||
"assets/image/reduce.png", |
||||
width: 22, |
||||
height: 22, |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(left: 8, right: 8), |
||||
child: Text( |
||||
widget.productListBean.buyNum.toString(), |
||||
style: TextStyle( |
||||
color: Colors.black, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
), |
||||
InkWell( |
||||
onTap: () {}, |
||||
child: Image.asset( |
||||
"assets/image/add.png", |
||||
width: 22, |
||||
height: 22, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
SizedBox( |
||||
height: 24, |
||||
), |
||||
GestureDetector( |
||||
onTap: () {}, |
||||
child: RoundButton( |
||||
width: double.infinity, |
||||
height: 54.h, |
||||
text: "加入购物车", |
||||
textColor: Colors.white, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
radius: 27, |
||||
backgroup: Color(0xFF32A060), |
||||
fontSize: 16.sp, |
||||
// padding: EdgeInsets.symmetric(vertical: 5.h), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget sweetnessStore(Function fc, List<testModel> arrays) { |
||||
return GridView.builder( |
||||
itemCount: arrays.length, |
||||
shrinkWrap: true, |
||||
physics: NeverScrollableScrollPhysics(), |
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
||||
//一行的Widget数量 |
||||
crossAxisCount: 4, |
||||
//水平子Widget之间间距 |
||||
crossAxisSpacing: 6.w, |
||||
//垂直子Widget之间间距 |
||||
mainAxisSpacing: 12.w, |
||||
//垂直单个子Widget之间间距 |
||||
childAspectRatio: 3 / 1, |
||||
), |
||||
itemBuilder: (context, index) { |
||||
return GestureDetector( |
||||
onTap: () { |
||||
tempClickIndex = index; |
||||
fc(); |
||||
}, |
||||
child: sweetnessItem(arrays[index].name, arrays[index].isSelected), |
||||
); |
||||
}, |
||||
); |
||||
} |
||||
|
||||
Widget sweetnessItem(String name, bool isCheck) { |
||||
return Container( |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
RoundButton( |
||||
width: 68.w, |
||||
height: 29.h, |
||||
text: name, |
||||
textColor: !isCheck ? Color(0xFF727272) : Colors.white, |
||||
fontWeight: MyFontWeight.regular, |
||||
radius: 4, |
||||
backgroup: !isCheck ? Color(0xFFE5E5E5) : Color(0xFF32A060), |
||||
fontSize: 12.sp, |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,179 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/order_info.dart'; |
||||
import 'package:huixiang/store/store_view/shop_goods.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/round_button.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class ShopCar extends StatefulWidget { |
||||
|
||||
final List<ProductList> productLists; |
||||
|
||||
ShopCar(this.productLists); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ShopCar(); |
||||
} |
||||
|
||||
} |
||||
|
||||
class _ShopCar extends State<ShopCar> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
alignment: Alignment.topCenter, |
||||
width: double.infinity, |
||||
height: MediaQuery.of(context).size.height / 2, |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.only( |
||||
topLeft: Radius.circular(8), |
||||
topRight: Radius.circular(8), |
||||
), |
||||
), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Container( |
||||
padding: EdgeInsets.only( |
||||
top: 16, |
||||
left: 16, |
||||
right: 16, |
||||
bottom: 8, |
||||
), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
"已选商品", |
||||
style: TextStyle( |
||||
color: Colors.black, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
InkWell( |
||||
onTap: () {}, |
||||
child: Image.asset( |
||||
"assets/image/delete.png", |
||||
width: 22, |
||||
height: 22, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
padding: EdgeInsets.only( |
||||
top: 8, |
||||
left: 16, |
||||
right: 16, |
||||
), |
||||
child: ListView.builder( |
||||
itemCount: widget.productLists == null ? 0 : widget.productLists.length, |
||||
physics: BouncingScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
// return shoppGoodsItem(); |
||||
return GestureDetector( |
||||
onTap: () {}, |
||||
child: ShopGoods(widget.productLists[position], position), |
||||
); |
||||
}, |
||||
), |
||||
), |
||||
), |
||||
Stack( |
||||
alignment: Alignment.bottomLeft, |
||||
children: [ |
||||
Container( |
||||
height: 54.h, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFFAFAFA), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(8), |
||||
offset: Offset(0, -1), |
||||
blurRadius: 3, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Spacer(), |
||||
Text( |
||||
S.of(context).heji, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
Text( |
||||
"¥19.00", |
||||
style: TextStyle( |
||||
fontSize: 20.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF32A060), |
||||
), |
||||
), |
||||
Spacer(), |
||||
RoundButton( |
||||
width: 103.w, |
||||
height: 54.h, |
||||
text: S.current.jiesuan, |
||||
textColor: Colors.white, |
||||
fontWeight: MyFontWeight.regular, |
||||
backgroup: Color(0xFF32A060), |
||||
radius: 0, |
||||
fontSize: 16.sp, |
||||
padding: EdgeInsets.symmetric(vertical: 5.h), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Stack( |
||||
children: [ |
||||
InkWell( |
||||
onTap: () { |
||||
Navigator.of(context).pop(); |
||||
}, |
||||
child: Image.asset( |
||||
"assets/image/shopp.png", |
||||
width: 88, |
||||
height: 88, |
||||
), |
||||
), |
||||
Positioned( |
||||
right: 15, |
||||
top: 14, |
||||
child: RoundButton( |
||||
width: 17, |
||||
height: 17, |
||||
text: "1", |
||||
textColor: Colors.white, |
||||
fontWeight: MyFontWeight.regular, |
||||
backgroup: Color(0xFF32A060), |
||||
fontSize: 12.sp, |
||||
radius: 100, |
||||
callback: () { |
||||
Navigator.of(context) |
||||
.pushNamed('/router/test_page'); |
||||
}, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,138 @@
|
||||
|
||||
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/retrofit/data/order_info.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class ShopGoods extends StatefulWidget { |
||||
|
||||
final ProductList pro; |
||||
final int position; |
||||
|
||||
ShopGoods(this.pro, this.position); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ShopGoods(); |
||||
} |
||||
|
||||
} |
||||
|
||||
class _ShopGoods extends State<ShopGoods> { |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
padding: EdgeInsets.only(bottom: 10), |
||||
child: Row( |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/default_1.png", |
||||
width: 60, |
||||
height: 60, |
||||
fit: BoxFit.cover, |
||||
), |
||||
SizedBox(width: 10), |
||||
Expanded( |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
"手工啵啵奶茶", |
||||
style: TextStyle( |
||||
color: Colors.black, |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
SizedBox(height: 2), |
||||
Row( |
||||
children: [ |
||||
Text( |
||||
"无香精", |
||||
style: TextStyle( |
||||
color: Color(0xFF4C4C4C), |
||||
fontSize: 11.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
), |
||||
SizedBox(width: 10), |
||||
Text( |
||||
"无香精", |
||||
style: TextStyle( |
||||
color: Color(0xFF4C4C4C), |
||||
fontSize: 11.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
) |
||||
], |
||||
), |
||||
SizedBox(height: 6), |
||||
Row( |
||||
children: [ |
||||
Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Row( |
||||
children: [ |
||||
Text( |
||||
"会员价", |
||||
style: TextStyle( |
||||
color: Color(0xFFFF7A1A), |
||||
fontSize: 13.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
Text( |
||||
"¥19.00", |
||||
style: TextStyle( |
||||
color: Color(0xFFFF7A1A), |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
) |
||||
], |
||||
), |
||||
], |
||||
), |
||||
Spacer(), |
||||
InkWell( |
||||
onTap: () {}, |
||||
child: Image.asset( |
||||
"assets/image/reduce.png", |
||||
width: 22, |
||||
height: 22, |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(left: 8, right: 8), |
||||
child: Text( |
||||
"1", |
||||
style: TextStyle( |
||||
color: Colors.black, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
), |
||||
InkWell( |
||||
onTap: () {}, |
||||
child: Image.asset( |
||||
"assets/image/add.png", |
||||
width: 22, |
||||
height: 22, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
flex: 1, |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue