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.
209 lines
6.3 KiB
209 lines
6.3 KiB
2 years ago
|
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 '../../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: 16.w),
|
||
|
child:Column(
|
||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
if(widget?.vipCardHome!=null)
|
||
|
(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(
|
||
|
"回乡VIP卡专享权益",
|
||
|
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(
|
||
|
"开通回乡VIP卡获取更多权益",
|
||
|
style: TextStyle(
|
||
|
color: Colors.black,
|
||
|
fontSize:15.sp,
|
||
|
fontWeight: MyFontWeight.semi_bold,
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
vipGoodsRecommend(),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
Widget vipGoodsRecommend(){
|
||
|
return Container(
|
||
|
margin: EdgeInsets.only(top: 10.h),
|
||
|
height: 200.h,
|
||
|
width: double.infinity,
|
||
|
padding: EdgeInsets.all(16.w),
|
||
|
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: [
|
||
|
Text(
|
||
|
"会员专享价格",
|
||
|
style: TextStyle(
|
||
|
color: Colors.black,
|
||
|
fontSize:15.sp,
|
||
|
fontWeight: MyFontWeight.semi_bold,
|
||
|
),
|
||
|
),
|
||
|
SizedBox(height:20.h,),
|
||
|
vipGoodsRecommendList(),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
Widget vipGoodsRecommendList(){
|
||
|
return Container(
|
||
|
height: 126.h,
|
||
|
child: ListView.builder(
|
||
|
scrollDirection: Axis.horizontal,
|
||
|
physics: BouncingScrollPhysics(),
|
||
|
itemCount: widget.vipCardHome?.productVips?.length ?? 0,
|
||
|
itemBuilder: (context, position) {
|
||
|
return GestureDetector(
|
||
|
onTap: () {
|
||
|
Navigator.of(context)
|
||
|
.pushNamed('/router/shop_details_page', arguments: {
|
||
|
"id": widget?.vipCardHome?.productVips[position].id,
|
||
|
"storeId": widget?.vipCardHome?.productVips[position].storeId,
|
||
|
});
|
||
|
},
|
||
|
child: vipGoodsRecommendItem(widget.vipCardHome.productVips[position]),
|
||
|
);
|
||
|
},
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
Widget vipGoodsRecommendItem(ProductVips productVips){
|
||
|
return Container(
|
||
|
width: 70.w,
|
||
|
margin: EdgeInsets.only(right:10.w,left:6.w),
|
||
|
child: Column(
|
||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||
|
children: [
|
||
|
Stack(
|
||
|
alignment: Alignment.bottomCenter,
|
||
|
children: [
|
||
|
MImage(
|
||
|
productVips.thumbnailImg ?? "",
|
||
|
width: 70,
|
||
|
height: 70,
|
||
|
fit: BoxFit.cover,
|
||
|
errorSrc: "assets/image/default_1.webp",
|
||
|
fadeSrc: "assets/image/default_1.webp",
|
||
|
),
|
||
|
if(productVips.vipDiscount != "0.00")
|
||
|
Container(
|
||
|
width: 70,
|
||
|
padding: EdgeInsets.symmetric(vertical:2.h),
|
||
|
alignment: Alignment.center,
|
||
|
decoration: BoxDecoration(
|
||
|
borderRadius: BorderRadius.only(
|
||
|
bottomRight: Radius.circular(4.r),
|
||
|
bottomLeft: Radius.circular(4.r),
|
||
|
),
|
||
|
color: Color(0xff32A060),
|
||
|
),
|
||
|
child: Text(
|
||
|
"省${productVips.vipDiscount ?? ""}元",
|
||
|
style: TextStyle(
|
||
|
color: Colors.white,
|
||
|
fontSize:13.sp,
|
||
|
fontWeight: MyFontWeight.regular,
|
||
|
),),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
Padding(padding:EdgeInsets.only(top:6.h,bottom: 4.h),
|
||
|
child: Text(
|
||
|
productVips.productName ?? "",
|
||
|
maxLines: 1,
|
||
|
overflow: TextOverflow.ellipsis,
|
||
|
style: TextStyle(
|
||
|
color: Color(0xff0D0D0D),
|
||
|
fontSize:14.sp,
|
||
|
fontWeight: MyFontWeight.regular,
|
||
|
),),
|
||
|
),
|
||
|
Text(
|
||
|
"¥${productVips.vipPrice ?? ""}",
|
||
|
style: TextStyle(
|
||
|
color: Color(0xff0D0D0D),
|
||
|
fontSize:15.sp,
|
||
|
fontWeight: MyFontWeight.medium,
|
||
|
),)
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|