fmk
3 years ago
29 changed files with 1668 additions and 1397 deletions
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<paths xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<!--自定义配置分享文件目录访问权限--> |
||||
<external-path name="sample-external-path" path="/"/> |
||||
<files-path name="sample-files-path" path="/"/> |
||||
</paths> |
@ -0,0 +1,195 @@
|
||||
|
||||
|
||||
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_swiper/flutter_swiper.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/activity.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:huixiang/view_widget/item_title.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class StoreActivity extends StatefulWidget { |
||||
|
||||
final Map arguments; |
||||
final List<Activity> activitys; |
||||
|
||||
StoreActivity(this.arguments, this.activitys); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _StoreActivity(); |
||||
} |
||||
|
||||
} |
||||
|
||||
class _StoreActivity extends State<StoreActivity> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Column( |
||||
children: [ |
||||
Container( |
||||
margin: EdgeInsets.only(top: 20.h, bottom: 20.h), |
||||
child: ItemTitle( |
||||
text: S.of(context).xindianhuodong, |
||||
imgPath: "assets/image/icon_union_start_store.png", |
||||
), |
||||
), |
||||
(widget.activitys != null && widget.activitys.length > 0) |
||||
? Container( |
||||
margin: EdgeInsets.only(bottom: 30.h), |
||||
child: AspectRatio( |
||||
aspectRatio: 1.55, |
||||
child: buildSwiper2Bottom(), |
||||
), |
||||
) |
||||
: Container( |
||||
width: double.infinity, |
||||
height: 30.h, |
||||
margin: EdgeInsets.only(bottom: 30.h), |
||||
alignment: Alignment.center, |
||||
child: Text( |
||||
S.of(context).muqianzanwuxingdianhuodong, |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFFA0A0A0), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
); |
||||
} |
||||
|
||||
|
||||
Widget buildSwiper2Bottom() { |
||||
return Container( |
||||
child: Swiper( |
||||
viewportFraction: 0.95, |
||||
loop: false, |
||||
itemBuilder: (context, position) { |
||||
return InkWell( |
||||
onTap: () { |
||||
if (widget.arguments["source"] != null && |
||||
widget.arguments["source"] == widget.activitys[position].id) { |
||||
Navigator.of(context).pop(); |
||||
} else { |
||||
Navigator.of(context).pushNamed('/router/web_page', |
||||
arguments: { |
||||
"activityId": widget.activitys[position].id, |
||||
"source": widget.arguments["id"] |
||||
}); |
||||
} |
||||
}, |
||||
child: Container( |
||||
margin: EdgeInsets.symmetric(horizontal: 5.w), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(8), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Color(0x0D000000), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
), |
||||
child: Stack( |
||||
children: [ |
||||
Container( |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
mainAxisSize: MainAxisSize.max, |
||||
children: [ |
||||
MImage( |
||||
(widget.activitys != null && widget.activitys.length > position) |
||||
? widget.activitys[position].coverImg |
||||
: "", |
||||
aspectRatio: 2.2, |
||||
radius: BorderRadius.vertical( |
||||
top: Radius.circular(8), |
||||
), |
||||
fit: BoxFit.cover, |
||||
errorSrc: "assets/image/default_2_1.png", |
||||
fadeSrc: "assets/image/default_2_1.png", |
||||
), |
||||
Container( |
||||
padding: EdgeInsets.all(8), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
(widget.activitys != null && |
||||
widget.activitys.length > position) |
||||
? widget.activitys[position].storeName |
||||
: "", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF000000), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 4.h, |
||||
), |
||||
Text( |
||||
(widget.activitys != null && |
||||
widget.activitys.length > position) |
||||
? widget.activitys[position].mainTitle |
||||
: "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF727272), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Positioned( |
||||
top: 0, |
||||
right: 0, |
||||
child: Container( |
||||
padding: EdgeInsets.symmetric( |
||||
vertical: 4.h, |
||||
horizontal: 8.w, |
||||
), |
||||
decoration: BoxDecoration( |
||||
color: Colors.black.withAlpha(76), |
||||
borderRadius: BorderRadius.only( |
||||
bottomLeft: Radius.circular(8), |
||||
topRight: Radius.circular(8), |
||||
), |
||||
), |
||||
child: Text( |
||||
(widget.activitys != null && widget.activitys.length > position) |
||||
? widget.activitys[position].startTime.split(" ")[0] |
||||
: "", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
fontSize: 12.sp, |
||||
color: Color(0xD9FFFFFF), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
); |
||||
}, |
||||
itemCount: |
||||
(widget.activitys != null && widget.activitys.length > 0) ? widget.activitys.length : 0, |
||||
), |
||||
); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,299 @@
|
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_swiper/flutter_swiper.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/store_info.dart'; |
||||
import 'package:huixiang/utils/flutter_utils.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:huixiang/view_widget/round_button.dart'; |
||||
import 'package:url_launcher/url_launcher.dart'; |
||||
|
||||
class StoreInfos extends StatefulWidget { |
||||
|
||||
final StoreInfo storeInfo; |
||||
|
||||
StoreInfos(this.storeInfo); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _StoreInfos(); |
||||
} |
||||
|
||||
} |
||||
|
||||
class _StoreInfos extends State<StoreInfos> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return AspectRatio( |
||||
aspectRatio: 1, |
||||
child: Container( |
||||
margin: EdgeInsets.fromLTRB(16, 20, 16, 8), |
||||
padding: EdgeInsets.fromLTRB(10, 20, 10, 14), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(8), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(25), |
||||
offset: Offset(0, 1), |
||||
blurRadius: 12, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
AspectRatio( |
||||
aspectRatio: 1.8, |
||||
child: buildSwiper(), |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
margin: EdgeInsets.only( |
||||
left: 10.w, |
||||
right: 10.w, |
||||
top: 16.h, |
||||
), |
||||
child: Column( |
||||
mainAxisAlignment: |
||||
MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: |
||||
CrossAxisAlignment.start, |
||||
children: [ |
||||
Row( |
||||
children: [ |
||||
Text( |
||||
widget.storeInfo != null |
||||
? widget.storeInfo.storeName |
||||
: "", |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
color: Colors.black, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
alignment: |
||||
Alignment.centerRight, |
||||
child: Text( |
||||
S.of(context).ren( |
||||
widget.storeInfo != null |
||||
? widget.storeInfo |
||||
.perCapitaConsumption |
||||
: "", |
||||
), |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Text( |
||||
widget.storeInfo != null |
||||
? widget.storeInfo.address |
||||
: "", |
||||
maxLines: 2, |
||||
textAlign: TextAlign.justify, |
||||
style: TextStyle( |
||||
color: Color(0xFF353535), |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 12.sp, |
||||
), |
||||
), |
||||
Row( |
||||
children: itemServer( |
||||
widget.storeInfo != null |
||||
? widget.storeInfo.businessService |
||||
: "", |
||||
), |
||||
), |
||||
Row( |
||||
mainAxisAlignment: |
||||
MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: |
||||
CrossAxisAlignment.end, |
||||
children: [ |
||||
Expanded( |
||||
child: Text( |
||||
S.of(context).yingyeshijian(widget.storeInfo == |
||||
null |
||||
? "" |
||||
: (widget.storeInfo.openStartTime == |
||||
null && |
||||
widget.storeInfo |
||||
.openEndTime == |
||||
null) |
||||
? S.of(context).quantian |
||||
: "${widget.storeInfo.openStartTime.substring(0, widget.storeInfo.openStartTime.lastIndexOf(":"))} " |
||||
"- ${widget.storeInfo.openEndTime.substring(0, widget.storeInfo.openEndTime.lastIndexOf(":"))}"), |
||||
style: TextStyle( |
||||
color: Color(0xFF353535), |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 12.sp, |
||||
), |
||||
), |
||||
), |
||||
SizedBox( |
||||
width: 16.w, |
||||
), |
||||
InkWell( |
||||
onTap: () { |
||||
if (widget.storeInfo == null || |
||||
widget.storeInfo.latitude == |
||||
null || |
||||
widget.storeInfo.longitude == |
||||
null || |
||||
widget.storeInfo.latitude == "" || |
||||
widget.storeInfo.longitude == "") |
||||
return; |
||||
Navigator.of(context).pushNamed( |
||||
'/router/location_map', |
||||
arguments: { |
||||
"lat": widget.storeInfo.latitude, |
||||
"lng": |
||||
widget.storeInfo.longitude, |
||||
"storeName": |
||||
widget.storeInfo.storeName, |
||||
}); |
||||
}, |
||||
child: Image.asset( |
||||
"assets/image/icon_union_location.png", |
||||
width: 24.w, |
||||
height: 24.h, |
||||
), |
||||
), |
||||
SizedBox( |
||||
width: 16.w, |
||||
), |
||||
InkWell( |
||||
onTap: () { |
||||
showCallMobile(); |
||||
}, |
||||
child: Image.asset( |
||||
"assets/image/icon_union_call.png", |
||||
width: 24, |
||||
height: 24, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
), |
||||
flex: 1, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget buildSwiper() { |
||||
return Container( |
||||
child: Swiper( |
||||
pagination: SwiperPagination( |
||||
alignment: Alignment.bottomCenter, |
||||
builder: DotSwiperPaginationBuilder( |
||||
size: 8.w, |
||||
activeSize: 8.w, |
||||
space: 5.w, |
||||
activeColor: Colors.white, |
||||
color: Colors.white.withAlpha(76), |
||||
), |
||||
), |
||||
itemBuilder: (context, position) { |
||||
return Container( |
||||
margin: EdgeInsets.only(left: 10.w, right: 10.w), |
||||
child: MImage( |
||||
(widget.storeInfo != null && |
||||
widget.storeInfo.bannerList != null && |
||||
position < widget.storeInfo.bannerList.length) |
||||
? widget.storeInfo.bannerList[position].imgUrl |
||||
: "", |
||||
fit: BoxFit.cover, |
||||
radius: BorderRadius.circular(4), |
||||
errorSrc: "assets/image/default_2_1.png", |
||||
fadeSrc: "assets/image/default_2_1.png", |
||||
), |
||||
); |
||||
}, |
||||
itemCount: (widget.storeInfo != null && widget.storeInfo.bannerList != null) |
||||
? widget.storeInfo.bannerList.length |
||||
: 1), |
||||
); |
||||
} |
||||
|
||||
|
||||
List<Widget> itemServer(String businessService) { |
||||
if (businessService == null || businessService == "") return []; |
||||
var list = businessService.split(","); |
||||
return list |
||||
.map((e) => Container( |
||||
margin: EdgeInsets.only(right: 8.w), |
||||
child: RoundButton( |
||||
height: 14.h * AppUtils.textScale(context), |
||||
text: "$e", |
||||
backgroup: Color(0xFFFF7A1A), |
||||
padding: EdgeInsets.only( |
||||
left: 2.w, |
||||
right: 2.w, |
||||
), |
||||
fontSize: 10.sp, |
||||
textColor: Colors.white, |
||||
), |
||||
)) |
||||
.toList(); |
||||
} |
||||
|
||||
showCallMobile() { |
||||
showCupertinoModalPopup( |
||||
context: context, |
||||
builder: (context) { |
||||
return CupertinoActionSheet( |
||||
title: Text(S.of(context).bodadianhua), |
||||
actions: [ |
||||
if (widget.storeInfo != null && |
||||
widget.storeInfo.headMobile != null && |
||||
widget.storeInfo.headMobile != "") |
||||
CupertinoActionSheetAction( |
||||
child: Text(widget.storeInfo.headMobile), |
||||
onPressed: () { |
||||
callMobile(widget.storeInfo.headMobile); |
||||
Navigator.of(context).pop(); |
||||
}, |
||||
isDefaultAction: true, |
||||
isDestructiveAction: false, |
||||
), |
||||
], |
||||
cancelButton: CupertinoActionSheetAction( |
||||
onPressed: () { |
||||
Navigator.of(context).pop(); |
||||
}, |
||||
child: Text(S.of(context).quxiao), |
||||
isDestructiveAction: true, |
||||
), |
||||
); |
||||
}); |
||||
} |
||||
|
||||
callMobile(mobile) async { |
||||
String url = "tel:$mobile"; |
||||
if (await canLaunch(url)) { |
||||
await launch(url); |
||||
} else { |
||||
throw 'Could not launch $url'; |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
|
@ -0,0 +1,264 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/store_info.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/item_title.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:huixiang/view_widget/round_button.dart'; |
||||
import 'package:huixiang/view_widget/separator.dart'; |
||||
|
||||
class UnionCoupon extends StatefulWidget { |
||||
|
||||
final StoreInfo storeInfo; |
||||
final Function(String id) receiveCoupon; |
||||
UnionCoupon(this.storeInfo, this.receiveCoupon); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _UnionCoupon(); |
||||
} |
||||
|
||||
} |
||||
|
||||
class _UnionCoupon extends State<UnionCoupon> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Column( |
||||
children: [ |
||||
Container( |
||||
margin: EdgeInsets.only(top: 10.h, bottom: 10.h), |
||||
child: ItemTitle( |
||||
text: S.of(context).youhuiquan, |
||||
imgPath: "assets/image/icon_union_coupons.png", |
||||
), |
||||
), |
||||
(widget.storeInfo != null && widget.storeInfo.couponVOList != null) |
||||
? buildCoupon() |
||||
: Container( |
||||
width: double.infinity, |
||||
height: 50.h, |
||||
alignment: Alignment.center, |
||||
child: Text( |
||||
S.of(context).zanwuyouhuiquankelingqu, |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFFA0A0A0), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
); |
||||
} |
||||
|
||||
|
||||
Widget buildCoupon() { |
||||
return Container( |
||||
height: 109.h, |
||||
child: ListView.builder( |
||||
itemCount: (widget.storeInfo != null && widget.storeInfo.couponVOList != null) |
||||
? widget.storeInfo.couponVOList.length |
||||
: 0, |
||||
physics: BouncingScrollPhysics(parent: PageScrollPhysics()), |
||||
scrollDirection: Axis.horizontal, |
||||
itemBuilder: (context, position) { |
||||
return Container( |
||||
width: MediaQuery.of(context).size.width * 0.784, |
||||
margin: EdgeInsets.only(left: 6.w), |
||||
child: AspectRatio( |
||||
aspectRatio: 2.86, |
||||
child: Stack( |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/icon_union_coupons_bg.png", |
||||
fit: BoxFit.fill, |
||||
width: double.infinity, |
||||
height: double.infinity, |
||||
), |
||||
Container( |
||||
padding: EdgeInsets.only( |
||||
left: 24.w, |
||||
right: 24.w, |
||||
bottom: 17.h, |
||||
top: 11.h, |
||||
), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Container( |
||||
margin: EdgeInsets.only(left: 5), |
||||
child: Text.rich(TextSpan(children: [ |
||||
TextSpan( |
||||
text: (widget.storeInfo != null && |
||||
widget.storeInfo.couponVOList != null && |
||||
widget.storeInfo |
||||
.couponVOList[position].bizType == |
||||
1) |
||||
? "¥" |
||||
: "", |
||||
style: TextStyle( |
||||
fontSize: 22.sp, |
||||
color: Color(0xFFFF7A1A), |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: (widget.storeInfo != null && |
||||
widget.storeInfo.couponVOList != null && |
||||
widget.storeInfo |
||||
.couponVOList[position].bizType == |
||||
1) |
||||
? "${double.tryParse(widget.storeInfo.couponVOList[position].discountAmount).toInt()}" |
||||
: (widget.storeInfo != null && |
||||
widget.storeInfo.couponVOList != null && |
||||
widget.storeInfo.couponVOList[position] |
||||
.bizType == |
||||
5) |
||||
? S.of(context).duihuanquan |
||||
: "${widget.storeInfo.couponVOList[position].discountPercent ~/ 10}折", |
||||
style: TextStyle( |
||||
fontSize: 36.sp, |
||||
color: Color(0xFFFF7A1A), |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
), |
||||
), |
||||
])), |
||||
alignment: Alignment.center, |
||||
), |
||||
Container( |
||||
margin: EdgeInsets.only( |
||||
top: 12.h, |
||||
bottom: 12.h, |
||||
left: 15.w, |
||||
right: 24.w, |
||||
), |
||||
child: MySeparator( |
||||
width: 1.w, |
||||
height: 5.h, |
||||
color: Color(0xFF979797), |
||||
), |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
margin: EdgeInsets.only( |
||||
bottom: 12.h, |
||||
top: 12.h, |
||||
), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
(widget.storeInfo != null && |
||||
widget.storeInfo.couponVOList != null) |
||||
? widget.storeInfo |
||||
.couponVOList[position].couponName |
||||
: "", |
||||
maxLines: 1, |
||||
overflow: TextOverflow.ellipsis, |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF727272), |
||||
), |
||||
), |
||||
Text( |
||||
(widget.storeInfo != null && |
||||
widget.storeInfo.couponVOList != null) |
||||
? (widget.storeInfo.couponVOList[position] |
||||
.bizType == |
||||
1 |
||||
? S.of(context).manlijiandaijinquan( |
||||
double.tryParse(widget.storeInfo |
||||
.couponVOList[position] |
||||
.fullAmount) |
||||
.toInt(), |
||||
double.tryParse(widget.storeInfo |
||||
.couponVOList[position] |
||||
.discountAmount) |
||||
.toInt()) |
||||
: S.of(context).quanchangzhe(widget.storeInfo |
||||
.couponVOList[position] |
||||
.discountPercent)) |
||||
: "", |
||||
overflow: TextOverflow.ellipsis, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFFFF7A1A), |
||||
), |
||||
), |
||||
Text( |
||||
S.of(context).youxiaoqizhi( |
||||
(widget.storeInfo != null && |
||||
widget.storeInfo.couponVOList != |
||||
null && |
||||
// widget.storeInfo.couponVOList[position].useStartTime != null && |
||||
widget.storeInfo.couponVOList[position] |
||||
.useEndTime != |
||||
null) |
||||
// ? "${widget.storeInfo.couponVOList[position].useStartTime.replaceAll("-", ".").split(" ")[0]}-${widget.storeInfo.couponVOList[position].useEndTime.replaceAll("-", ".").split(" ")[0]}" |
||||
? "${widget.storeInfo.couponVOList[position].useEndTime.replaceAll("-", ".").split(" ")[0]}" |
||||
: "", |
||||
), |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 1, |
||||
style: TextStyle( |
||||
fontSize: 8.sp, |
||||
color: Color(0xFFA29E9E), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
InkWell( |
||||
onTap: () { |
||||
if (widget.storeInfo != null && |
||||
widget.storeInfo.couponVOList != null && |
||||
widget.storeInfo.couponVOList[position].status == 0) { |
||||
widget.receiveCoupon( |
||||
widget.storeInfo.couponVOList[position].id); |
||||
} |
||||
}, |
||||
child: Container( |
||||
height: 25.h, |
||||
child: RoundButton( |
||||
text: (widget.storeInfo != null && |
||||
widget.storeInfo.couponVOList != null && |
||||
widget.storeInfo.couponVOList[position].status > |
||||
0) |
||||
? S.of(context).yilingqu |
||||
: S.of(context).lingqu, |
||||
textColor: Colors.white, |
||||
backgroup: (widget.storeInfo != null && |
||||
widget.storeInfo.couponVOList != null && |
||||
widget.storeInfo.couponVOList[position].status > |
||||
0) |
||||
? Colors.grey |
||||
: Color(0xFF32A060), |
||||
padding: EdgeInsets.symmetric( |
||||
horizontal: 8.w, vertical: 4.h), |
||||
fontSize: 12.sp, |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
); |
||||
}, |
||||
), |
||||
); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,170 @@
|
||||
|
||||
|
||||
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/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: (widget.storeInfo != null && widget.storeInfo.isVip) ? 12.h : 20.h, |
||||
horizontal: 16.w), |
||||
padding: EdgeInsets.all(16), |
||||
decoration: BoxDecoration( |
||||
image: DecorationImage( |
||||
fit: BoxFit.fill, |
||||
image: AssetImage("assets/image/icon_vip_bg.png"), |
||||
), |
||||
), |
||||
child: (widget.storeInfo != null && widget.storeInfo.isVip) |
||||
? 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 != null && 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 != null && 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.png", |
||||
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, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue