|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:huixiang/generated/l10n.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/coupon.dart';
|
|
|
|
import 'package:huixiang/view_widget/new_coupon_widget.dart';
|
|
|
|
|
|
|
|
class CouponsPage extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _CouponsPage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _CouponsPage extends State<CouponsPage> {
|
|
|
|
int btnStatus = 0;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Coupon> coupons = [
|
|
|
|
Coupon.test("",0,false),Coupon.test("",1,false),Coupon.test("",1,false),Coupon.test("",0,false),Coupon.test("",0,false)
|
|
|
|
];
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
body: Column(children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
width: 68,
|
|
|
|
height: 26,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
margin: EdgeInsets.only(left: 16, right: 12, top: 10, bottom: 14),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(2)),
|
|
|
|
color: btnStatus == 0 ? Colors.white : Color(0xffE5E5E5),
|
|
|
|
),
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
btnStatus = 0;
|
|
|
|
coupons = [Coupon.test("",0,false),Coupon.test("",1,false),Coupon.test("",1,false),Coupon.test("",0,false),Coupon.test("",0,false)];
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Text(
|
|
|
|
S.of(context).keyongquan,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
fontWeight: btnStatus == 0 ? FontWeight.bold : FontWeight.normal,
|
|
|
|
color: btnStatus == 0 ? Colors.black : Color(0xff727272),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: 68,
|
|
|
|
height: 26,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
margin: EdgeInsets.only(left: 16, top: 10, bottom: 14),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(2)),
|
|
|
|
color: btnStatus == 1 ? Colors.white : Color(0xffE5E5E5),
|
|
|
|
),
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
btnStatus = 1;
|
|
|
|
coupons = [Coupon.test("",2,false),Coupon.test("",2,false),Coupon.test("",2,false),Coupon.test("",2,false),Coupon.test("",2,false)];
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Text(
|
|
|
|
S.of(context).shixiaoquan,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
fontWeight: btnStatus == 1 ? FontWeight.bold : FontWeight.normal,
|
|
|
|
color: btnStatus == 1 ? Colors.black : Color(0xff727272),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Expanded(child: ListView.builder(
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
return GestureDetector(
|
|
|
|
child: NewCouponWidget(coupons[position],(){
|
|
|
|
|
|
|
|
},(){
|
|
|
|
setState(() {
|
|
|
|
coupons[position].isEx = !coupons[position].isEx;
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
itemCount: 5,
|
|
|
|
),)
|
|
|
|
]),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|