You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

225 lines
6.9 KiB

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../generated/l10n.dart';
import '../../retrofit/data/vip_card_home.dart';
import '../../view_widget/custom_image.dart';
class VipGoodsDiscount extends StatefulWidget {
final VipCardHome vipCardHome;
VipGoodsDiscount(this.vipCardHome);
@override
State<StatefulWidget> createState() {
return _VipGoodsDiscount();
}
}
class _VipGoodsDiscount extends State<VipGoodsDiscount> {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.symmetric(vertical: 25.h,horizontal: 14.w),
child:Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
(widget?.vipCardHome?.member?.isVip ?? false)?
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
"assets/image/vip_discount_left.webp",
width: 21.w,
height: 39.h,
fit: BoxFit.fill,
),
SizedBox(width: 11.w,),
Text(
S.of(context).huixiangvipkazhuanxiang,
style: TextStyle(
color: Color(0xff32A060),
fontSize:15.sp,
fontWeight: MyFontWeight.semi_bold,
),
),
SizedBox(width: 11.w,),
Image.asset(
"assets/image/vip_discount_right.webp",
width: 21.w,
height: 39.h,
fit: BoxFit.fill,
),
],):
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
"assets/image/vip_lock.webp",
width: 20,
height: 20,
fit: BoxFit.cover,
),
SizedBox(width: 2.w,),
Text(
S.of(context).kaitonghuixianghuoququanyi,
style: TextStyle(
color: Colors.black,
fontSize:15.sp,
fontWeight: MyFontWeight.semi_bold,
),
),
],
),
vipGoodsRecommend(),
],
),
);
}
Widget vipGoodsRecommend(){
return Container(
margin: EdgeInsets.only(top: 12.h),
2 years ago
height: 253.h,
width: double.infinity,
2 years ago
padding: EdgeInsets.only(top:20.h,left: 13.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.w),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
),
child:Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
SizedBox(width: 7.w,),
Image.asset(
"assets/image/vip_title.webp",
fit: BoxFit.fill, //填充剩余空间
height:13.h,
width: 27.w,
),
SizedBox(width: 4.w,),
Text(
S.of(context).huiyuanzhuanxiangjiage,
style: TextStyle(
color: Colors.black,
fontSize:15.sp,
fontWeight: MyFontWeight.semi_bold,
),
),
],
),
2 years ago
SizedBox(height:15.h,),
vipGoodsRecommendList(),
],
),
);
}
Widget vipGoodsRecommendList(){
return Container(
height: 200.h,
child: ListView.builder(
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
itemCount: widget.vipCardHome?.productVips?.length ?? 0,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
2 years ago
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {
"id":widget?.vipCardHome?.productVips[position].storeId,
"tenant": widget?.vipCardHome?.productVips[position].tenantCode,
"storeName": widget?.vipCardHome?.productVips[position].supplierName
},
);
},
child: vipGoodsRecommendItem(widget.vipCardHome.productVips[position]),
);
},
),
);
}
Widget vipGoodsRecommendItem(ProductVips productVips){
return Container(
2 years ago
width: 130.w,
// margin: EdgeInsets.only(right:13.w,left:6.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MImage(
2 years ago
productVips.image ?? "",
width: 116,
height: 116,
fit: BoxFit.cover,
radius: BorderRadius.circular(6),
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
2 years ago
Padding(padding:EdgeInsets.only(top:10.h,bottom:7.h),
child: Text(
productVips.productName ?? "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xff0D0D0D),
2 years ago
fontSize:13.sp,
fontWeight: MyFontWeight.regular,
),),
)),
Row(
children: [
Text(
"${productVips.vipPrice ?? "0.00"}",
style: TextStyle(
color: Color(0xff32A060),
fontSize:14.sp,
fontWeight: MyFontWeight.medium,
),),
if(productVips.vipDiscount != "0.00")
Container(
padding: EdgeInsets.symmetric(vertical: 2.h,horizontal:3.w),
margin: EdgeInsets.only(left: 5.w),
decoration: BoxDecoration(
color: Color(0xffF96519),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(10),
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(10),
),
),
child: Text(
"${productVips.vipDiscount ?? "0"}",
style: TextStyle(
color: Colors.white,
fontSize:13.sp,
fontWeight: MyFontWeight.regular,
),),
),
],
)
],
),
);
}
}