|
...
|
...
|
@@ -15,13 +15,15 @@ class CouponItem extends StatefulWidget { |
|
|
|
final VoidCallback onPressedSwich;
|
|
|
|
final CouponSunModel couponSonModel;
|
|
|
|
final bool showBtn;
|
|
|
|
final bool showCheck;
|
|
|
|
CouponItem(
|
|
|
|
{Key key,
|
|
|
|
this.from,
|
|
|
|
this.onPressed,
|
|
|
|
this.onPressedSwich,
|
|
|
|
this.couponSonModel,
|
|
|
|
this.showBtn = false})
|
|
|
|
this.showBtn = false,
|
|
|
|
this.showCheck = false})
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
...
|
...
|
@@ -29,6 +31,7 @@ class CouponItem extends StatefulWidget { |
|
|
|
}
|
|
|
|
|
|
|
|
class _CouponItemState extends State<CouponItem> {
|
|
|
|
// bool showText = false;
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
CouponSunModel sunModel = widget.couponSonModel;
|
|
...
|
...
|
@@ -38,6 +41,17 @@ class _CouponItemState extends State<CouponItem> { |
|
|
|
} else {
|
|
|
|
notSelect = sunModel.isOpenBool;
|
|
|
|
}
|
|
|
|
double explainH = 0.0;
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(sunModel.explain)) {
|
|
|
|
explainH = Utils.calculateTextHeight(
|
|
|
|
'说明:${sunModel.explain}',
|
|
|
|
ScreenUtil().setSp(24),
|
|
|
|
FontWeight.normal,
|
|
|
|
ScreenUtil.screenWidthDp - ScreenUtil().setWidth(92 * 2),
|
|
|
|
5,
|
|
|
|
context);
|
|
|
|
}
|
|
|
|
return InkWell(
|
|
|
|
onTap: widget.onPressed,
|
|
|
|
child: Stack(
|
|
...
|
...
|
@@ -49,137 +63,260 @@ class _CouponItemState extends State<CouponItem> { |
|
|
|
ScreenUtil().setWidth(0),
|
|
|
|
ScreenUtil().setWidth(40),
|
|
|
|
ScreenUtil().setWidth(30)),
|
|
|
|
padding: EdgeInsets.all(ScreenUtil().setWidth(30)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color:
|
|
|
|
notSelect ? MyColours.color_FFF0E5 : MyColours.color_EEF0F2,
|
|
|
|
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20))),
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: MyColours.color_EEF0F2,
|
|
|
|
blurRadius: ScreenUtil().setWidth(20))
|
|
|
|
],
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
bottomLeft: Radius.circular(ScreenUtil().setWidth(20)),
|
|
|
|
topLeft: Radius.circular(ScreenUtil().setWidth(20)),
|
|
|
|
topRight: Radius.circular(ScreenUtil().setWidth(20)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
width: ScreenUtil().setWidth(360),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
maxWidth: ScreenUtil().setWidth(190)),
|
|
|
|
child: Text(
|
|
|
|
sunModel.aname,
|
|
|
|
maxLines: 2,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
color: notSelect
|
|
|
|
? MyColours.color_F05522
|
|
|
|
: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(44),
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
width: ScreenUtil().setWidth(335 * 2 - 20),
|
|
|
|
padding: EdgeInsets.fromLTRB(
|
|
|
|
ScreenUtil().setWidth(30),
|
|
|
|
ScreenUtil().setWidth(26 * 2),
|
|
|
|
ScreenUtil().setWidth(10),
|
|
|
|
ScreenUtil().setWidth(20)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: notSelect
|
|
|
|
? MyColours.color_FFF0E5
|
|
|
|
: MyColours.color_f5f5f5,
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topLeft: Radius.circular(ScreenUtil().setWidth(20)),
|
|
|
|
topRight: Radius.circular(0),
|
|
|
|
bottomLeft: ObjectUtil.isNotEmpty(sunModel.explain)
|
|
|
|
? Radius.circular(0)
|
|
|
|
: Radius.circular(ScreenUtil().setWidth(20)),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
bottom: ScreenUtil().setWidth(6)),
|
|
|
|
child: Text('( ${sunModel.desc} )',
|
|
|
|
maxLines: 1,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
color: notSelect
|
|
|
|
? MyColours.color_F05522
|
|
|
|
: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(30),
|
|
|
|
fontWeight: FontWeight.normal)),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(ObjectUtil.isNotEmpty(sunModel.stime) &&
|
|
|
|
sunModel.stime != '0') ||
|
|
|
|
(ObjectUtil.isNotEmpty(sunModel.etime) &&
|
|
|
|
sunModel.etime != '0')
|
|
|
|
? Container(
|
|
|
|
padding:
|
|
|
|
EdgeInsets.only(top: ScreenUtil().setWidth(20)),
|
|
|
|
child: Text(
|
|
|
|
'有效期:${ObjectUtil.isNotEmpty(sunModel.stime) ? Utils.getDateStrFromJiekou(sunModel.stime) : '--'} 至 ${ObjectUtil.isNotEmpty(sunModel.etime) ? Utils.getDateStrFromJiekou(sunModel.etime) : '--'}',
|
|
|
|
style: TextStyle(
|
|
|
|
color: notSelect
|
|
|
|
? MyColours.color_EF7249
|
|
|
|
: MyColours.color_B7B7B7,
|
|
|
|
fontSize: ScreenUtil().setSp(22))),
|
|
|
|
)
|
|
|
|
: Container(),
|
|
|
|
),
|
|
|
|
child: Stack(
|
|
|
|
children: [
|
|
|
|
Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
width: ScreenUtil().setWidth(232 * 2),
|
|
|
|
child: Container(
|
|
|
|
height: ScreenUtil().setWidth(28 * 2),
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
maxWidth: ScreenUtil().setWidth(190)),
|
|
|
|
child: Text(
|
|
|
|
sunModel.aname,
|
|
|
|
maxLines: 2,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
color: notSelect
|
|
|
|
? MyColours.color_F05522
|
|
|
|
: MyColours.color_B0B0B0,
|
|
|
|
fontSize: ScreenUtil().setSp(40),
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(20 * 2),
|
|
|
|
width: ScreenUtil().setWidth(232 * 2),
|
|
|
|
child: Text('${sunModel.desc}',
|
|
|
|
maxLines: 1,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
color: notSelect
|
|
|
|
? MyColours.color_F05522
|
|
|
|
: MyColours.color_B0B0B0,
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
fontWeight: FontWeight.normal)),
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
(ObjectUtil.isNotEmpty(sunModel.stime) &&
|
|
|
|
sunModel.stime != '0') ||
|
|
|
|
(ObjectUtil.isNotEmpty(sunModel.etime) &&
|
|
|
|
sunModel.etime != '0')
|
|
|
|
? Container(
|
|
|
|
child: Text(
|
|
|
|
'有效期:${ObjectUtil.isNotEmpty(sunModel.stime) ? Utils.getDateStrFromJiekou(sunModel.stime) : '--'} 至 ${ObjectUtil.isNotEmpty(sunModel.etime) ? Utils.getDateStrFromJiekou(sunModel.etime) : '--'}',
|
|
|
|
style: TextStyle(
|
|
|
|
color: notSelect
|
|
|
|
? MyColours.color_EF7249
|
|
|
|
: MyColours.color_B8B8B8,
|
|
|
|
fontSize: ScreenUtil().setSp(22))),
|
|
|
|
)
|
|
|
|
: Container(),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
widget.from == 'select'
|
|
|
|
? widget.showCheck
|
|
|
|
? Positioned(
|
|
|
|
right: 0,
|
|
|
|
top: ScreenUtil().setWidth(20),
|
|
|
|
child: Image.asset(
|
|
|
|
Utils.getImgPath(
|
|
|
|
widget.couponSonModel.isCheck
|
|
|
|
? 'check_r'
|
|
|
|
: 'check_un'),
|
|
|
|
width: ScreenUtil().setWidth(40),
|
|
|
|
height: ScreenUtil().setWidth(40),
|
|
|
|
))
|
|
|
|
: Container()
|
|
|
|
: Positioned(
|
|
|
|
right: 0,
|
|
|
|
top: ScreenUtil().setWidth(20),
|
|
|
|
child: widget.showBtn
|
|
|
|
? RoundButton(
|
|
|
|
width: ScreenUtil().setWidth(58 * 2),
|
|
|
|
height: ScreenUtil().setWidth(26 * 2),
|
|
|
|
radius: ScreenUtil().setWidth(40),
|
|
|
|
text: notSelect ? '停用' : '启用',
|
|
|
|
fontSize: 28,
|
|
|
|
textColor: notSelect
|
|
|
|
? MyColours.color_F05522
|
|
|
|
: MyColours.color_999999,
|
|
|
|
gradientStart: notSelect
|
|
|
|
? MyColours.color_FFE2D3
|
|
|
|
: MyColours.color_E9E9E9,
|
|
|
|
gradientEnd: notSelect
|
|
|
|
? MyColours.color_FFE2D3
|
|
|
|
: MyColours.color_E9E9E9,
|
|
|
|
onPressed: widget.onPressedSwich,
|
|
|
|
)
|
|
|
|
: Container())
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
ObjectUtil.isNotEmpty(sunModel.explain)
|
|
|
|
? Container(
|
|
|
|
margin: EdgeInsets.only(top: ScreenUtil().setWidth(30)),
|
|
|
|
padding: EdgeInsets.all(ScreenUtil().setWidth(20)),
|
|
|
|
width: double.infinity,
|
|
|
|
child: Text('说明:${sunModel.explain}',
|
|
|
|
maxLines: 30,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
softWrap: false,
|
|
|
|
style: TextStyle(
|
|
|
|
? InkWell(
|
|
|
|
onTap: () {
|
|
|
|
if (explainH > 19) {
|
|
|
|
setState(() {
|
|
|
|
widget.couponSonModel.showText =
|
|
|
|
!widget.couponSonModel.showText;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: notSelect
|
|
|
|
? MyColours.color_EF7249
|
|
|
|
: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(24))),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
ScreenUtil().setWidth(30))),
|
|
|
|
? MyColours.color_ffffff
|
|
|
|
: MyColours.color_FAFAFA,
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
bottomLeft: Radius.circular(
|
|
|
|
ScreenUtil().setWidth(20)),
|
|
|
|
bottomRight: Radius.circular(
|
|
|
|
ScreenUtil().setWidth(20)))),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
widget.couponSonModel.showText
|
|
|
|
? Container(
|
|
|
|
padding: EdgeInsets.fromLTRB(
|
|
|
|
ScreenUtil().setWidth(30),
|
|
|
|
ScreenUtil().setWidth(14),
|
|
|
|
ScreenUtil().setWidth(0),
|
|
|
|
ScreenUtil().setWidth(14)),
|
|
|
|
width: ScreenUtil.screenWidthDp -
|
|
|
|
ScreenUtil().setWidth(92 * 2),
|
|
|
|
child: Text('说明:${sunModel.explain}',
|
|
|
|
maxLines: 5,
|
|
|
|
style: TextStyle(
|
|
|
|
color: notSelect
|
|
|
|
? MyColours.color_999999
|
|
|
|
: MyColours.color_cccccc,
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(24))),
|
|
|
|
)
|
|
|
|
: Container(
|
|
|
|
padding: EdgeInsets.fromLTRB(
|
|
|
|
ScreenUtil().setWidth(30),
|
|
|
|
ScreenUtil().setWidth(14),
|
|
|
|
ScreenUtil().setWidth(0),
|
|
|
|
ScreenUtil().setWidth(14)),
|
|
|
|
width: ScreenUtil.screenWidthDp -
|
|
|
|
ScreenUtil().setWidth(92 * 2) +
|
|
|
|
ScreenUtil().setWidth(20),
|
|
|
|
child: Text('说明:${sunModel.explain}',
|
|
|
|
maxLines: 1,
|
|
|
|
overflow: TextOverflow.fade,
|
|
|
|
softWrap: false,
|
|
|
|
style: TextStyle(
|
|
|
|
color: notSelect
|
|
|
|
? MyColours.color_999999
|
|
|
|
: MyColours.color_cccccc,
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(24))),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
explainH > 19
|
|
|
|
? Container(
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
top: ScreenUtil().setWidth(12)),
|
|
|
|
child: Image.asset(
|
|
|
|
!widget.couponSonModel.showText
|
|
|
|
? Utils.getImgPath('quan_down')
|
|
|
|
: Utils.getImgPath('quan_up'),
|
|
|
|
width: ScreenUtil().setWidth(68),
|
|
|
|
height: ScreenUtil().setWidth(44)),
|
|
|
|
)
|
|
|
|
: Container(),
|
|
|
|
HEmptyView(14)
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
)
|
|
|
|
: Container(),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
top: ScreenUtil().setWidth(30),
|
|
|
|
right: ScreenUtil().setWidth(60),
|
|
|
|
top: 0,
|
|
|
|
right: ScreenUtil().setWidth(40),
|
|
|
|
child: Container(
|
|
|
|
child: ObjectUtil.isNotEmpty(sunModel.explain)
|
|
|
|
? Image.asset(
|
|
|
|
Utils.getImgPath(
|
|
|
|
notSelect ? 'quan_zhi' : 'quan_un_zhi'),
|
|
|
|
width: ScreenUtil().setWidth(20),
|
|
|
|
height: ScreenUtil().setWidth(109 * 2))
|
|
|
|
: Image.asset(
|
|
|
|
Utils.getImgPath(
|
|
|
|
notSelect ? 'quan_wan' : 'quan_un_wan'),
|
|
|
|
width: ScreenUtil().setWidth(20),
|
|
|
|
height: ScreenUtil().setWidth(109 * 2)),
|
|
|
|
)),
|
|
|
|
Positioned(
|
|
|
|
top: 0,
|
|
|
|
right: ScreenUtil().setWidth(40),
|
|
|
|
child: InkWell(
|
|
|
|
onTap: widget.onPressedSwich,
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text('被领取:${sunModel.receiveNum}张',
|
|
|
|
style: TextStyle(
|
|
|
|
color: notSelect
|
|
|
|
? MyColours.color_EF7249
|
|
|
|
: MyColours.color_B7B7B7,
|
|
|
|
fontSize: ScreenUtil().setSp(22))),
|
|
|
|
VEmptyView(5),
|
|
|
|
Text('已使用:${sunModel.useNum}张',
|
|
|
|
style: TextStyle(
|
|
|
|
color: notSelect
|
|
|
|
? MyColours.color_EF7249
|
|
|
|
: MyColours.color_B7B7B7,
|
|
|
|
fontSize: ScreenUtil().setSp(22))),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
HEmptyView(20),
|
|
|
|
widget.showBtn
|
|
|
|
? RoundButton(
|
|
|
|
width: ScreenUtil().setWidth(100),
|
|
|
|
height: ScreenUtil().setWidth(50),
|
|
|
|
radius: ScreenUtil().setWidth(40),
|
|
|
|
text: notSelect ? '停用' : '启用',
|
|
|
|
textColor: notSelect
|
|
|
|
? MyColours.color_F05522
|
|
|
|
: MyColours.color_999999,
|
|
|
|
gradientStart: notSelect
|
|
|
|
? MyColours.color_FFE2D3
|
|
|
|
: MyColours.color_E9E9E9,
|
|
|
|
gradientEnd: notSelect
|
|
|
|
? MyColours.color_FFE2D3
|
|
|
|
: MyColours.color_E9E9E9,
|
|
|
|
onPressed: widget.onPressedSwich,
|
|
|
|
)
|
|
|
|
: Container()
|
|
|
|
],
|
|
|
|
child: Container(
|
|
|
|
constraints:
|
|
|
|
BoxConstraints(maxWidth: ScreenUtil().setWidth(335 * 2)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: notSelect
|
|
|
|
? MyColours.color_FFE1CB
|
|
|
|
: MyColours.color_EEF0F2,
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
bottomLeft: Radius.circular(ScreenUtil().setWidth(20)),
|
|
|
|
topRight: Radius.circular(ScreenUtil().setWidth(20)),
|
|
|
|
bottomRight:
|
|
|
|
Radius.circular(ScreenUtil().setWidth(20)))),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(20),
|
|
|
|
vertical: ScreenUtil().setWidth(2)),
|
|
|
|
child: Text(
|
|
|
|
'被领取:${sunModel.receiveNum}张 已使用:${sunModel.useNum}张',
|
|
|
|
maxLines: 1,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
color: notSelect
|
|
|
|
? MyColours.color_EF7249
|
|
|
|
: MyColours.color_B7B7B7,
|
|
|
|
fontSize: ScreenUtil().setSp(20))),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
...
|
...
|
|