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.
458 lines
20 KiB
458 lines
20 KiB
import 'dart:convert'; |
|
|
|
import 'package:flutter/material.dart'; |
|
import 'package:flutter/rendering.dart'; |
|
import 'package:huixiang/generated/l10n.dart'; |
|
import 'package:huixiang/retrofit/data/store.dart'; |
|
import 'package:huixiang/retrofit/data/user_info.dart'; |
|
import 'package:huixiang/utils/min.dart'; |
|
import 'package:huixiang/view_widget/item_title.dart'; |
|
import 'package:huixiang/view_widget/round_button.dart'; |
|
import 'package:huixiang/view_widget/separator.dart'; |
|
import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart'; |
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
class UnionDetailsPage extends StatefulWidget { |
|
final Map<String, dynamic> arguments; |
|
|
|
UnionDetailsPage({this.arguments}); |
|
|
|
@override |
|
State<StatefulWidget> createState() { |
|
return _UnionDetailsPage(); |
|
} |
|
} |
|
|
|
class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
@override |
|
Widget build(BuildContext context) { |
|
return Scaffold( |
|
appBar: AppBar( |
|
backgroundColor: Color(0xFFF7F7F7), |
|
elevation: 0, |
|
leading: GestureDetector( |
|
onTap: () { |
|
Navigator.of(context).pop(); |
|
}, |
|
child: Container( |
|
alignment: Alignment.centerRight, |
|
margin: EdgeInsets.only(left: 10), |
|
padding: EdgeInsets.all(6), |
|
child: Icon( |
|
Icons.arrow_back_ios, |
|
color: Colors.black, |
|
size: 24, |
|
), |
|
), |
|
), |
|
titleSpacing: 2, |
|
leadingWidth: 56, |
|
), |
|
body: Column( |
|
children: [ |
|
Expanded( |
|
child: SingleChildScrollView( |
|
physics: BouncingScrollPhysics(), |
|
child: Column( |
|
children: [ |
|
AspectRatio( |
|
aspectRatio: 1, |
|
child: GestureDetector( |
|
onTap: () { |
|
Navigator.of(context) |
|
.pushNamed('/router/store_detail_page'); |
|
}, |
|
child: Container( |
|
margin: EdgeInsets.fromLTRB(16, 20, 16, 8), |
|
padding: EdgeInsets.fromLTRB(10, 20, 10, 14), |
|
decoration: BoxDecoration( |
|
color: Colors.white, |
|
borderRadius: BorderRadius.all(Radius.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, right: 10, top: 16), |
|
child: Column( |
|
mainAxisAlignment: |
|
MainAxisAlignment.spaceBetween, |
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
children: [ |
|
Row( |
|
children: [ |
|
Text( |
|
"百年川椒汉街店", |
|
style: TextStyle( |
|
fontSize: 16, |
|
color: Colors.black, |
|
fontWeight: FontWeight.bold), |
|
), |
|
Icon( |
|
Icons.keyboard_arrow_right, |
|
size: 20, |
|
color: Colors.black, |
|
), |
|
Expanded( |
|
child: Container( |
|
alignment: Alignment.centerRight, |
|
child: Text( |
|
"116/人", |
|
style: TextStyle( |
|
fontSize: 14, |
|
color: Color(0xFF353535), |
|
), |
|
), |
|
)) |
|
], |
|
), |
|
Text( |
|
"武昌区楚河汉界第一街区万达总部\n国际C座对面", |
|
maxLines: 2, |
|
style: TextStyle( |
|
color: Color(0xFF353535), |
|
fontSize: 12), |
|
), |
|
Row( |
|
children: [ |
|
RoundButton( |
|
text: S.of(context).kongtiao, |
|
backgroup: Color(0xFFFF7A1A), |
|
padding: EdgeInsets.only( |
|
left: 2, right: 2), |
|
fontSize: 10, |
|
), |
|
SizedBox( |
|
width: 8, |
|
), |
|
RoundButton( |
|
text: "WiFi", |
|
backgroup: Color(0xFFFF7A1A), |
|
padding: EdgeInsets.only( |
|
left: 2, right: 2), |
|
fontSize: 10, |
|
), |
|
SizedBox( |
|
width: 8, |
|
), |
|
RoundButton( |
|
text: S.of(context).tingchewei, |
|
backgroup: Color(0xFFFF7A1A), |
|
padding: EdgeInsets.only( |
|
left: 2, right: 2), |
|
fontSize: 10, |
|
), |
|
], |
|
), |
|
Row( |
|
mainAxisAlignment: |
|
MainAxisAlignment.spaceBetween, |
|
crossAxisAlignment: |
|
CrossAxisAlignment.end, |
|
children: [ |
|
Expanded( |
|
child: Text( |
|
S |
|
.of(context) |
|
.yingyeshijian("2015.09.06"), |
|
style: TextStyle( |
|
color: Color(0xFF353535), |
|
fontSize: 12, |
|
), |
|
)), |
|
SizedBox( |
|
width: 16, |
|
), |
|
Image.asset( |
|
"assets/image/icon_union_location.png", |
|
width: 24, |
|
height: 24, |
|
), |
|
SizedBox( |
|
width: 16, |
|
), |
|
Image.asset( |
|
"assets/image/icon_union_call.png", |
|
width: 24, |
|
height: 24, |
|
) |
|
], |
|
), |
|
], |
|
), |
|
), |
|
flex: 1, |
|
) |
|
], |
|
), |
|
), |
|
), |
|
), |
|
Container( |
|
margin: EdgeInsets.only(top: 20, bottom: 20), |
|
child: ItemTitle( |
|
text: S.of(context).youhuiquan, |
|
imgPath: "assets/image/icon_union_coupons.png", |
|
), |
|
), |
|
Container( |
|
height: 109, |
|
child: ListView.builder( |
|
itemCount: 5, |
|
physics: BouncingScrollPhysics(), |
|
scrollDirection: Axis.horizontal, |
|
itemBuilder: (context, position) { |
|
return Container( |
|
width: MediaQuery.of(context).size.width * 0.784, |
|
margin: EdgeInsets.only(left: 6), |
|
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, |
|
right: 24, |
|
bottom: 17, |
|
top: 11), |
|
child: Row( |
|
mainAxisAlignment: |
|
MainAxisAlignment.spaceBetween, |
|
crossAxisAlignment: |
|
CrossAxisAlignment.end, |
|
children: [ |
|
Container( |
|
child: Image.network( |
|
"https://t7.baidu.com/it/u=136439029,1848397702&fm=193&f=GIF", |
|
width: 40, |
|
height: 40, |
|
fit: BoxFit.contain, |
|
), |
|
alignment: Alignment.center, |
|
), |
|
Container( |
|
margin: EdgeInsets.only( |
|
top: 12, |
|
bottom: 12, |
|
left: 24, |
|
right: 24), |
|
child: MySeparator( |
|
width: 1, |
|
height: 5, |
|
color: Color(0xFF979797), |
|
), |
|
), |
|
Expanded( |
|
child: Container( |
|
margin: EdgeInsets.only( |
|
bottom: 12, top: 12), |
|
child: Column( |
|
mainAxisAlignment: |
|
MainAxisAlignment.spaceBetween, |
|
crossAxisAlignment: |
|
CrossAxisAlignment.start, |
|
children: [ |
|
Text( |
|
"百年川椒", |
|
style: TextStyle( |
|
fontSize: 10, |
|
fontWeight: FontWeight.bold, |
|
color: Color(0xFF727272), |
|
), |
|
), |
|
Text( |
|
S |
|
.of(context) |
|
.manlijiandaijinquan(30, 5), |
|
overflow: TextOverflow.ellipsis, |
|
style: TextStyle( |
|
fontSize: 14, |
|
fontWeight: FontWeight.bold, |
|
color: Color(0xFFFF7A1A), |
|
), |
|
), |
|
Text( |
|
S |
|
.of(context) |
|
.youxiaoqizhi("2021.01.03"), |
|
style: TextStyle( |
|
fontSize: 8, |
|
color: Color(0xFFA29E9E), |
|
), |
|
), |
|
], |
|
), |
|
)), |
|
Container( |
|
margin: EdgeInsets.only(bottom: 12), |
|
height: 25, |
|
child: RoundButton( |
|
text: S.of(context).lingqu, |
|
textColor: Colors.white, |
|
backgroup: Color(0xFF32A060), |
|
padding: |
|
EdgeInsets.fromLTRB(8, 4, 8, 4), |
|
fontSize: 12, |
|
), |
|
), |
|
], |
|
), |
|
) |
|
], |
|
), |
|
), |
|
); |
|
}), |
|
), |
|
Container( |
|
margin: EdgeInsets.only(top: 20, bottom: 20), |
|
child: ItemTitle( |
|
text: S.of(context).xindianhuodong, |
|
imgPath: "assets/image/icon_union_start_store.png", |
|
), |
|
), |
|
Container( |
|
padding: EdgeInsets.only(left: 10, right: 10), |
|
margin: EdgeInsets.only(bottom: 30), |
|
child: AspectRatio( |
|
aspectRatio: 2.0, |
|
child: buildSwiper2Bottom(), |
|
), |
|
) |
|
], |
|
), |
|
), |
|
flex: 1, |
|
), |
|
InkWell( |
|
onTap: _startMin, |
|
child: Container( |
|
padding: EdgeInsets.only(top: 16, bottom: 16), |
|
decoration: BoxDecoration( |
|
color: Color(0xFFD8D8D8), |
|
borderRadius: BorderRadius.only( |
|
topLeft: Radius.circular(4), |
|
topRight: Radius.circular(4))), |
|
alignment: Alignment.center, |
|
child: Text( |
|
S.of(context).diancan, |
|
style: TextStyle( |
|
fontSize: 16, |
|
color: Color(0xFFA0A0A0), |
|
fontWeight: FontWeight.bold), |
|
), |
|
), |
|
), |
|
], |
|
), |
|
); |
|
} |
|
|
|
_startMin() async { |
|
if (!(await Min.isInitialize())) { |
|
await Min.initialize(); |
|
} |
|
Min.clickListener(); |
|
if (!(await Min.isExistsApp("__UNI__ACD00DA"))) { |
|
await Min.reloadWgt("__UNI__ACD00DA", |
|
"/storage/emulated/0/Android/data/com.zsw.huixiang/files/__UNI__ACD00DA.wgt"); |
|
} |
|
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); |
|
String token = sharedPreferences.getString("token"); |
|
String userId = sharedPreferences.getString("userId"); |
|
String nickname = sharedPreferences.getString("nick"); |
|
String mobile = sharedPreferences.getString("mobile"); |
|
String user = sharedPreferences.getString('user'); |
|
UserInfo userInfo = UserInfo.fromJson(jsonDecode(user)); |
|
Min.startMin("__UNI__ACD00DA", { |
|
"token": "Bearer $token", |
|
"shopId": widget.arguments["id"], |
|
"tenantCode": widget.arguments["tenantCode"], |
|
"uid": userId, |
|
"userInfo": { |
|
"nickname": nickname, |
|
"headimg": userInfo.headimg, |
|
"balance": userInfo.balance, |
|
"money": userInfo.money, |
|
"phone": mobile, |
|
"isBind": userInfo.isBind, |
|
}, |
|
}); |
|
} |
|
|
|
Widget buildSwiper2Bottom() { |
|
return Container( |
|
child: Swiper( |
|
pagination: SwiperPagination( |
|
alignment: Alignment.bottomCenter, |
|
builder: DotSwiperPaginationBuilder( |
|
size: 8, |
|
activeSize: 8, |
|
space: 5, |
|
activeColor: Colors.white, |
|
color: Colors.white.withAlpha(76), |
|
), |
|
), |
|
itemBuilder: (context, position) { |
|
return Container( |
|
margin: EdgeInsets.only(left: 10, right: 10), |
|
child: ClipRRect( |
|
borderRadius: BorderRadius.circular(8), |
|
child: Image.network( |
|
"https://t7.baidu.com/it/u=1492471725,655950677&fm=193&f=GIF", |
|
fit: BoxFit.cover, |
|
), |
|
), |
|
); |
|
}, |
|
itemCount: 3, |
|
), |
|
); |
|
} |
|
|
|
Widget buildSwiper() { |
|
return Container( |
|
child: Swiper( |
|
pagination: SwiperPagination( |
|
alignment: Alignment.bottomCenter, |
|
builder: DotSwiperPaginationBuilder( |
|
size: 8, |
|
activeSize: 8, |
|
space: 5, |
|
activeColor: Colors.white, |
|
color: Colors.white.withAlpha(76))), |
|
itemBuilder: (context, position) { |
|
return Container( |
|
margin: EdgeInsets.only(left: 10, right: 10), |
|
child: ClipRRect( |
|
borderRadius: BorderRadius.circular(4), |
|
child: Image.network( |
|
"https://t7.baidu.com/it/u=1492471725,655950677&fm=193&f=GIF", |
|
fit: BoxFit.cover, |
|
), |
|
), |
|
); |
|
}, |
|
itemCount: 3), |
|
); |
|
} |
|
}
|
|
|