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.
164 lines
5.9 KiB
164 lines
5.9 KiB
import 'package:flutter/material.dart'; |
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
import 'package:huixiang/generated/l10n.dart'; |
|
import 'package:huixiang/data/store_info.dart'; |
|
import 'package:huixiang/utils/font_weight.dart'; |
|
import 'package:huixiang/view_widget/round_button.dart'; |
|
|
|
class Vip extends StatefulWidget { |
|
final StoreInfo? storeInfo; |
|
final Function receiveVip; |
|
final bool isReceive; |
|
|
|
Vip(this.storeInfo, this.receiveVip, this.isReceive); |
|
|
|
@override |
|
State<StatefulWidget> createState() { |
|
return _Vip(); |
|
} |
|
} |
|
|
|
class _Vip extends State<Vip> { |
|
@override |
|
Widget build(BuildContext context) { |
|
return Container( |
|
margin: EdgeInsets.symmetric(vertical: 2.h, horizontal: 16.w), |
|
padding: EdgeInsets.all(16), |
|
decoration: BoxDecoration( |
|
image: DecorationImage( |
|
fit: BoxFit.fill, |
|
image: AssetImage("assets/image/icon_vip_bg.webp"), |
|
), |
|
), |
|
child: (widget.storeInfo?.isVip ?? false) |
|
? Column( |
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
mainAxisSize: MainAxisSize.max, |
|
children: [ |
|
Row( |
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
children: [ |
|
Row( |
|
mainAxisAlignment: MainAxisAlignment.center, |
|
crossAxisAlignment: CrossAxisAlignment.baseline, |
|
textBaseline: TextBaseline.alphabetic, |
|
children: [ |
|
Text( |
|
S.of(context).huiyuanyue, |
|
style: TextStyle( |
|
fontSize: 16.sp, |
|
fontWeight: MyFontWeight.medium, |
|
color: Colors.white, |
|
), |
|
), |
|
SizedBox( |
|
width: 8.w, |
|
), |
|
Text( |
|
"¥${(widget.storeInfo?.memberSource != null) ? widget.storeInfo?.memberSource?.balance : ""}", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
fontWeight: MyFontWeight.medium, |
|
color: Colors.white, |
|
), |
|
), |
|
], |
|
), |
|
Container( |
|
color: Colors.white, |
|
width: 1.w, |
|
height: 20.h, |
|
), |
|
Row( |
|
mainAxisAlignment: MainAxisAlignment.center, |
|
crossAxisAlignment: CrossAxisAlignment.baseline, |
|
textBaseline: TextBaseline.alphabetic, |
|
children: [ |
|
Text( |
|
S.of(context).huiyuanjifen, |
|
style: TextStyle( |
|
fontSize: 16.sp, |
|
fontWeight: MyFontWeight.medium, |
|
color: Colors.white, |
|
), |
|
), |
|
SizedBox( |
|
width: 8.w, |
|
), |
|
Text( |
|
(widget.storeInfo?.memberSource != null) |
|
? "${widget.storeInfo!.memberSource!.integral}" |
|
: "", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
fontWeight: MyFontWeight.medium, |
|
color: Colors.white, |
|
), |
|
), |
|
], |
|
), |
|
], |
|
), |
|
SizedBox( |
|
height: 10.h, |
|
), |
|
Text( |
|
S.of(context).gongxinichengweibendianhuiyuan, |
|
style: TextStyle( |
|
fontSize: 10.sp, |
|
fontWeight: MyFontWeight.medium, |
|
color: Color(0xFFEDC98E), |
|
), |
|
) |
|
], |
|
) |
|
: Row( |
|
children: [ |
|
Expanded( |
|
child: Column( |
|
mainAxisAlignment: MainAxisAlignment.start, |
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
children: [ |
|
Image.asset( |
|
"assets/image/icon_vip.webp", |
|
width: 36.w, |
|
height: 20.h, |
|
), |
|
SizedBox( |
|
height: 2.h, |
|
), |
|
Text( |
|
S.of(context).chengweidianpuzhuanshuhuiyuan, |
|
style: TextStyle( |
|
fontSize: 10.sp, |
|
color: Color(0xCFFFFFFF), |
|
fontWeight: MyFontWeight.semi_bold, |
|
), |
|
), |
|
], |
|
), |
|
flex: 1, |
|
), |
|
InkWell( |
|
onTap: () { |
|
widget.receiveVip(); |
|
}, |
|
child: RoundButton( |
|
text: widget.isReceive |
|
? S.of(context).dianwolingqu |
|
: S.of(context).yilingqu, |
|
textColor: |
|
widget.isReceive ? Colors.white : Color(0xFF484D66), |
|
backgroup: |
|
widget.isReceive ? Color(0xFF242B45) : Colors.white, |
|
padding: |
|
EdgeInsets.symmetric(vertical: 5.h, horizontal: 16.w), |
|
radius: 14, |
|
), |
|
), |
|
], |
|
), |
|
); |
|
} |
|
}
|
|
|