|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.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, right: 20),
|
|
|
|
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("领取成功");
|
|
|
|
},
|
|
|
|
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,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Text(
|
|
|
|
"立即领取",
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
color: Color(0xFF4A4748),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height: 35),
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/image/yq_qx.webp",
|
|
|
|
width: 34,
|
|
|
|
height: 34,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
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: 60, vertical: 5),
|
|
|
|
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, bottom: 4,left:30),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
firstLoginCouponList.storeName,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
maxLines: 2,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
color: Color(0xFF181818),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
firstLoginCouponList.couponName,
|
|
|
|
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),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
))),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|