Browse Source

福利中心优惠券更改

zyh
w-R 3 years ago
parent
commit
5e10d63e02
  1. BIN
      assets/image/2x/week_coupons.png
  2. BIN
      assets/image/2x/week_coupons.webp
  3. BIN
      assets/image/3x/week_coupons.png
  4. BIN
      assets/image/3x/week_coupons.webp
  5. BIN
      assets/image/week_coupons.png
  6. BIN
      assets/image/week_coupons.webp
  7. 108
      lib/home/welfare_page.dart
  8. 411
      lib/view_widget/new_coupon_widget.dart

BIN
assets/image/2x/week_coupons.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

BIN
assets/image/2x/week_coupons.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
assets/image/3x/week_coupons.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

BIN
assets/image/3x/week_coupons.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
assets/image/week_coupons.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

BIN
assets/image/week_coupons.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

108
lib/home/welfare_page.dart

@ -252,46 +252,14 @@ class _WelfarePage extends State<WelfarePage> {
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: AssetImage("assets/image/week_coupons.png"),
image: AssetImage("assets/image/week_coupons.webp"),
),
),
padding: EdgeInsets.symmetric(horizontal: 10.w,vertical: 10.h),
padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 12.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(child:
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(child: Text(
"百年川椒(哈乐城店)",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.bold,
color: Color(0xFF0D0D0D),
),
)),
Text(
"新人满减30元",
style: TextStyle(
fontSize: 11.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF4D4D4D),
),
),
SizedBox(height:4.h,),
Text(
"有效期至2022-09-10 12:00:00",
style: TextStyle(
fontSize: 11.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF4D4D4D),
),
),
],
)),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
@ -302,42 +270,80 @@ class _WelfarePage extends State<WelfarePage> {
TextSpan(
text: "¥",
style: TextStyle(
fontSize: 12.sp,
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFFFF4500),
color: Color(0xFF32A060),
),
),
TextSpan(
text: "30",
style: TextStyle(
fontSize: 24.sp,
fontSize: 26.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFFFF4500),
color: Color(0xFF32A060),
),
),
],
),
),
Expanded(child: Text(
Text(
"满30.1可用",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFFFF4500),
color: Color(0xFF32A060),
),
),
],
),
SizedBox(width: 30,),
Expanded(child:
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: Text(
"新人满减30元",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF353535),
),
)),
SizedBox(height:4.h,),
Text(
"有效期至2022-09-10 12:00:00",
style: TextStyle(
fontSize: 11.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF4D4D4D),
),
),
SizedBox(height:5.h,),
Row(
children: [
Text(
"使用详情",
style: TextStyle(
fontSize: 11.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF4D4D4D),
),
),
Icon(
Icons.keyboard_arrow_right,
color: Color(0xFF4D4D4D),
size: 20,
)
],
),
],
)),
Container(
width: 55.w,
width: 50.w,
height: 19.h,
decoration: BoxDecoration(
gradient: new LinearGradient(
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
colors: [
Color(0xFFFF4F00),
Color(0xFFFF2700),
]),
// border: Border.all(color: Colors.white,width: 0.5),
color: Color(0xFF32A060),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(3),
),
@ -353,8 +359,6 @@ class _WelfarePage extends State<WelfarePage> {
)
],
),
],
),
);
}

411
lib/view_widget/new_coupon_widget.dart

@ -16,9 +16,10 @@ class NewCouponWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return buildCoupon(context);
return homeCoupon(context);
}
///ui
Widget buildCoupon(BuildContext context) {
// if(coupon != null) {
// coupon.isEx = fa;
@ -368,6 +369,414 @@ class NewCouponWidget extends StatelessWidget {
);
}
///ui
Widget homeCoupon(BuildContext context) {
return Container(
height: 100.h,
width: double.infinity,
margin: EdgeInsets.fromLTRB(14.w, 6.h, 14.w, 6.h),
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: AssetImage("assets/image/week_coupons.webp"),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
child:Container(
margin: EdgeInsets.only(top: 12,bottom: 12),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: Container(
child:homeWidget(context),
)),
],
),
)),
Expanded(
flex: 2,
child:Container(
margin: EdgeInsets.only(top: 12,left: 12,bottom: 12),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child:
Text(
coupon != null ? coupon.couponName ?? "" : "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF353535),
),
)),
Expanded(child:
(coupon.useStartTime == null &&
coupon.useEndTime == null)?
Text(
S.of(context).quantian,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: coupon.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D),
),
):Text(
"有效期至 ${coupon?.useEndTime ?? ""}",
maxLines:1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: coupon.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D),
),
)),
GestureDetector(
onTap: (){
// showDeleteDialog();
},
child: Row(
children: [
Text(
"使用详情",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xFF4D4D4D),
),
),
Icon(
Icons.keyboard_arrow_right,
color: coupon.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D),
size: 20,
)
],
),
)
],
),
)),
Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Container(
margin: EdgeInsets.only(right:12.w,bottom: 12),
child: homeBtn(context),
)
],
)
],
),
);
}
Widget homeWidget(BuildContext context) {
if (coupon.bizType == 1) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
children: [
Text(
"¥",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
SizedBox(
height: 4.h,
),
Text(
coupon != null
? double.tryParse("${coupon.discountAmount}" ?? "0")
.toInt()
.toString()
: "",
style: TextStyle(
fontSize: 26.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
),
Text(
S.of(context).manyuankeyong(coupon != null
? ("${coupon.fullAmount}" ?? "0")
.toString()
: ""),
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
);
} else if (coupon.bizType == 3) {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
padding: EdgeInsets.only(bottom:10,top: 7),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
S.of(context).duihuanquan,
style: TextStyle(
fontSize: 26.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
),
),
Text(
S.of(context).xianshangshiyong,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
);
} else if (coupon.bizType == 5) {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
padding: EdgeInsets.only(bottom:10,top: 7),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
S.of(context).duihuanquan,
style: TextStyle(
fontSize: 26.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
),
),
Text(
S.of(context).xianxiashiyong,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
);
} else {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
children: [
Text(
coupon != null
? "${(coupon.discountPercent / 10.0 >= 10) ? 10 : coupon.discountPercent / 10.0}" ??
"0"
: "",
style: TextStyle(
fontSize: 40.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
SizedBox(
height: 4.h,
),
Text(
"",
style: TextStyle(
fontSize: 20.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
),
Text(
S.of(context).quanchangtongyong,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
);
}
}
Widget homeBtn(context) {
if (type == 1) {
if (coupon != null && coupon.status == 0) {
return Align(
alignment: Alignment.centerRight,
child: InkWell(
onTap: () {
callback(type);
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 14,vertical: 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: Color(0xFF32A060),
),
child: Text(
S.of(context).lingqu,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
),
),
);
} else {
return Align(
alignment: Alignment.centerRight,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 14,vertical: 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: Colors.grey,
),
child: Text(
S.of(context).yilingqu,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
),
);
}
} else {
if (coupon != null && coupon.status == 1) {
return Align(
alignment: Alignment.centerRight,
child: InkWell(
onTap: () {
callback(type);
},
child: Container(
width: 56.w,
height: 19.h,
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child:Text(
"立即使用",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFFFFFFFF),
),
),
),
// Container(
// padding: EdgeInsets.fromLTRB(16.w, 2.h, 16.w, 2.h),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(10.5),
// color: Color(0xFF32A060),
// ),
// child: Text(
// (coupon.bizType == 5 || coupon.bizType == 3)
// ? S.of(context).quhexiao
// : S.of(context).qushiyong,
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.white,
// ),
// ),
// ),
),
);
} else if (coupon != null && coupon.status == 2) {
return Align(
alignment: Alignment.centerRight,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 14,vertical: 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
// border: Border.all(
// width: 1, color: Color(0xFFA0A0A0), style: BorderStyle.solid)
color: Color(0xFFA0A0A0),
),
child: Text(
S.of(context).yishiyong,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
),
);
} else {
return Align(
alignment: Alignment.centerRight,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 14,vertical: 2),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(10.5),
// // border: Border.all(
// // width: 1, color: Color(0xFFA0A0A0), style: BorderStyle.solid)
// color: Color(0xFFA0A0A0),
// ),
child: Text(
S.of(context).yishixiao,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFFB3B3B3),
),
),
),
);
}
}
}
Widget priceWidget(BuildContext context) {
if (coupon.bizType == 1) {
return Column(

Loading…
Cancel
Save