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.
196 lines
6.8 KiB
196 lines
6.8 KiB
import 'package:flutter/material.dart'; |
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
import 'package:huixiang/generated/l10n.dart'; |
|
import 'package:huixiang/retrofit/data/login_info.dart'; |
|
import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
class NewPeopleReward extends StatefulWidget { |
|
final List<FirstLoginCouponList> firstLoginCouponList; |
|
|
|
NewPeopleReward(this.firstLoginCouponList); |
|
|
|
@override |
|
State<StatefulWidget> createState() { |
|
return _NewPeopleReward(); |
|
} |
|
} |
|
|
|
class _NewPeopleReward extends State<NewPeopleReward> { |
|
@override |
|
Widget build(BuildContext context) { |
|
return Container( |
|
margin: EdgeInsets.only(top: 70.h), |
|
child: Column( |
|
children: [ |
|
Container( |
|
width: double.infinity, |
|
height: 500.h, |
|
padding: EdgeInsets.only(top: 210.h), |
|
margin: EdgeInsets.only(top: 20.h, left: 20.w, right: 20.w), |
|
decoration: BoxDecoration( |
|
image: DecorationImage( |
|
fit: BoxFit.fill, |
|
image: AssetImage("assets/image/xin_ren.webp"), |
|
), |
|
), |
|
child: Column( |
|
children: [ |
|
Expanded( |
|
child: reward(), |
|
), |
|
GestureDetector( |
|
onTap: () { |
|
Navigator.of(context).pop(); |
|
SmartDialog.showToast("领取成功",alignment: Alignment.center); |
|
}, |
|
child: Container( |
|
margin: EdgeInsets.only( |
|
left: 60.w, right: 60.w, top: 20.h, bottom: 10.h), |
|
decoration: BoxDecoration( |
|
gradient: new LinearGradient( |
|
begin: Alignment.centerLeft, |
|
end: Alignment.centerRight, |
|
colors: [ |
|
Color(0xFFFFDCA1), |
|
Color(0xFFFAE4C0), |
|
]), |
|
borderRadius: BorderRadius.circular(22.5), |
|
), |
|
width: MediaQuery.of(context).size.width, |
|
height: 40.h, |
|
alignment: Alignment.center, |
|
child: Text( |
|
S.of(context).lijilingqu, |
|
style: TextStyle( |
|
fontWeight: FontWeight.bold, |
|
fontSize: 14.sp, |
|
color: Color(0xFF4A4748), |
|
), |
|
), |
|
), |
|
), |
|
], |
|
), |
|
), |
|
SizedBox(height: 35.h), |
|
GestureDetector( |
|
onTap: () { |
|
setState(() { |
|
Navigator.of(context).pop(); |
|
}); |
|
}, |
|
child: Image.asset( |
|
"assets/image/yq_qx.webp", |
|
width: 34.h, |
|
height: 34.h, |
|
), |
|
) |
|
], |
|
), |
|
); |
|
} |
|
|
|
Widget reward() { |
|
return ListView.builder( |
|
padding: EdgeInsets.zero, |
|
itemCount: widget.firstLoginCouponList.length, |
|
scrollDirection: Axis.vertical, |
|
shrinkWrap: true, |
|
physics: BouncingScrollPhysics(), |
|
itemBuilder: (context, position) { |
|
return GestureDetector( |
|
onTap: () {}, |
|
child: rewardItem(widget.firstLoginCouponList[position]), |
|
); |
|
}, |
|
); |
|
} |
|
|
|
Widget rewardItem(FirstLoginCouponList firstLoginCouponList) { |
|
return Container( |
|
// height:90.h, |
|
width: double.infinity, |
|
decoration: BoxDecoration( |
|
image: DecorationImage( |
|
fit: BoxFit.fill, |
|
image: AssetImage("assets/image/xin_rq.webp"), |
|
), |
|
), |
|
margin: EdgeInsets.symmetric(horizontal: 50.w, vertical: 5.h), |
|
padding: EdgeInsets.only(left: 16.w, right: 25.w), |
|
child: Row( |
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
children: [ |
|
Text.rich( |
|
TextSpan( |
|
children: [ |
|
TextSpan( |
|
text: "¥", |
|
style: TextStyle( |
|
fontSize: 25.sp, |
|
fontWeight: MyFontWeight.semi_bold, |
|
color: Color(0xFFDE5F3B), |
|
), |
|
), |
|
TextSpan( |
|
text: double.tryParse( |
|
"${firstLoginCouponList.discountAmount}" ?? "0") |
|
.toInt() |
|
.toString() ?? |
|
"", |
|
style: TextStyle( |
|
fontSize: 35.sp, |
|
fontWeight: MyFontWeight.semi_bold, |
|
color: Color(0xFFDE5F3B), |
|
), |
|
), |
|
], |
|
), |
|
), |
|
Expanded(child:Padding( |
|
padding: EdgeInsets.only(top: 4.h, bottom: 4.h,left:30.w), |
|
child: Column( |
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
children: [ |
|
Text( |
|
firstLoginCouponList.couponName, |
|
overflow: TextOverflow.ellipsis, |
|
maxLines: 2, |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
fontWeight: MyFontWeight.semi_bold, |
|
color: Color(0xFF181818), |
|
), |
|
), |
|
Text( |
|
firstLoginCouponList.storeName, |
|
overflow: TextOverflow.ellipsis, |
|
maxLines: 1, |
|
style: TextStyle( |
|
fontSize: 12.sp, |
|
fontWeight: MyFontWeight.medium, |
|
color: Color(0xFFD3623D), |
|
), |
|
), |
|
Text( |
|
"有效期至:${(firstLoginCouponList.useEndTime != null && firstLoginCouponList.useEndTime != "") |
|
? firstLoginCouponList.useEndTime.split(" ")[0] |
|
: "$firstLoginCouponList.useEndTime"}", |
|
overflow: TextOverflow.ellipsis, |
|
maxLines: 2, |
|
style: TextStyle( |
|
fontSize: 10.sp, |
|
fontWeight: MyFontWeight.regular, |
|
color: Color(0xFF727272), |
|
), |
|
) |
|
], |
|
))), |
|
], |
|
), |
|
); |
|
} |
|
}
|
|
|