After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 694 B |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 146 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 838 B |
After Width: | Height: | Size: 348 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 3.4 KiB |
@ -0,0 +1,272 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:fluttertoast/fluttertoast.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/data/coupon.dart'; |
||||
import 'package:huixiang/retrofit/data/page.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/view_widget/coupon_widget.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
|
||||
class CouponsPage extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _CouponsPage(); |
||||
} |
||||
} |
||||
|
||||
class _CouponsPage extends State<CouponsPage> { |
||||
RefreshController _refreshController; |
||||
|
||||
ApiService apiService; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
|
||||
SharedPreferences.getInstance().then((value) => { |
||||
apiService = ApiService(Dio(), token: value.getString('token')), |
||||
queryCard(), |
||||
}); |
||||
|
||||
_refreshController = RefreshController(initialRefresh: false); |
||||
} |
||||
|
||||
int pageNum = 1; |
||||
List<Coupon> coupons = []; |
||||
|
||||
void _onRefresh() async { |
||||
pageNum = 1; |
||||
queryCard(); |
||||
} |
||||
|
||||
queryCard() async { |
||||
BaseData baseData = await apiService.queryCard({ |
||||
"centre": true, |
||||
"pageNum": pageNum, |
||||
"pageSize": 10, |
||||
"searchKey": "", |
||||
"state": 3 |
||||
}).catchError((error) { |
||||
_refreshController.loadFailed(); |
||||
_refreshController.refreshFailed(); |
||||
}); |
||||
if (baseData.isSuccess) { |
||||
PageInfo pageInfo = PageInfo.fromJson(baseData.data); |
||||
if (pageNum == 1) { |
||||
coupons.clear(); |
||||
} |
||||
coupons.addAll(pageInfo.list.map((e) => Coupon.fromJson(e))); |
||||
setState(() { |
||||
_refreshController.refreshCompleted(); |
||||
_refreshController.loadComplete(); |
||||
if (pageInfo.pageNum == pageInfo.pages) { |
||||
_refreshController.loadNoData(); |
||||
} else { |
||||
pageNum += 1; |
||||
} |
||||
}); |
||||
} else { |
||||
_refreshController.loadFailed(); |
||||
_refreshController.refreshFailed(); |
||||
Fluttertoast.showToast(msg: baseData.msg); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Scaffold( |
||||
body: Container( |
||||
child: 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: Colors.white, |
||||
), |
||||
child:GestureDetector( |
||||
onTap: (){ |
||||
|
||||
}, |
||||
child: Text( |
||||
S.of(context).keyongquan, |
||||
style:TextStyle( |
||||
fontSize: 14, |
||||
fontWeight:FontWeight.bold, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
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: Color(0xffE5E5E5), |
||||
), |
||||
child: |
||||
GestureDetector( |
||||
onTap: (){ |
||||
Navigator.of(context).pushNamed('/router/mine_card_invalid'); |
||||
}, |
||||
child: Text( |
||||
S.of(context).shixiaoquan, |
||||
style:TextStyle( |
||||
fontSize: 14, |
||||
color: Color(0xff727272), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget vipCardItem() { |
||||
return Container( |
||||
margin: EdgeInsets.fromLTRB(16, 8, 16, 8), |
||||
// margin: EdgeInsets.all(16), |
||||
child: Stack( |
||||
// alignment: Alignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/icon_vip_bj.png", |
||||
fit: BoxFit.contain, //填充剩余空间 |
||||
height: 185, |
||||
), |
||||
Container( |
||||
padding: EdgeInsets.only(left: 16,right: 16), |
||||
child:Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
SizedBox(height: 16), |
||||
Row( |
||||
children: [ |
||||
ClipOval( |
||||
child:Image.asset( |
||||
"assets/image/icon_vip_name.png", |
||||
), |
||||
clipBehavior: Clip.hardEdge, |
||||
), |
||||
SizedBox( |
||||
width: 12, |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
height: 54, |
||||
child: Column( |
||||
mainAxisAlignment: |
||||
MainAxisAlignment.spaceEvenly, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
"百年川椒火锅店", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 20, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
Image.asset( |
||||
"assets/image/icon_vip.png", |
||||
), |
||||
], |
||||
), |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "会员卡", |
||||
style: TextStyle( |
||||
fontSize: 12, |
||||
color: Colors.white), |
||||
), |
||||
]), |
||||
textDirection: TextDirection.ltr, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
flex: 1, |
||||
) |
||||
], |
||||
), |
||||
SizedBox(height: 50), |
||||
Row( |
||||
textDirection: TextDirection.rtl, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/icon_right.png", |
||||
), |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "查看详情", |
||||
style: TextStyle(fontSize: 12, color: Colors.white), |
||||
), |
||||
]), |
||||
), |
||||
], |
||||
), |
||||
SizedBox( |
||||
height: 10, |
||||
), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Expanded( |
||||
flex: 1, |
||||
child: Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "No.202107021324199", |
||||
style: TextStyle(fontSize: 14, color: Colors.white), |
||||
), |
||||
]), |
||||
), |
||||
), |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "有效期限:", |
||||
style: TextStyle(fontSize: 12, color: Colors.white), |
||||
), |
||||
]), |
||||
), |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "长期有效", |
||||
style: TextStyle(fontSize: 12, color: Colors.white), |
||||
), |
||||
]), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,202 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:fluttertoast/fluttertoast.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/data/coupon.dart'; |
||||
import 'package:huixiang/retrofit/data/page.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/view_widget/coupon_widget.dart'; |
||||
import 'package:huixiang/view_widget/separator.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
|
||||
class VipBalancePage extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _VipBalancePage(); |
||||
} |
||||
} |
||||
|
||||
class _VipBalancePage extends State<VipBalancePage> { |
||||
RefreshController _refreshController; |
||||
|
||||
ApiService apiService; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
|
||||
SharedPreferences.getInstance().then((value) => { |
||||
apiService = ApiService(Dio(), token: value.getString('token')), |
||||
queryCard(), |
||||
}); |
||||
|
||||
_refreshController = RefreshController(initialRefresh: false); |
||||
} |
||||
|
||||
int pageNum = 1; |
||||
List<Coupon> coupons = []; |
||||
|
||||
void _onRefresh() async { |
||||
pageNum = 1; |
||||
queryCard(); |
||||
} |
||||
|
||||
queryCard() async { |
||||
BaseData baseData = await apiService.queryCard({ |
||||
"centre": true, |
||||
"pageNum": pageNum, |
||||
"pageSize": 10, |
||||
"searchKey": "", |
||||
"state": 3 |
||||
}).catchError((error) { |
||||
_refreshController.loadFailed(); |
||||
_refreshController.refreshFailed(); |
||||
}); |
||||
if (baseData.isSuccess) { |
||||
PageInfo pageInfo = PageInfo.fromJson(baseData.data); |
||||
if (pageNum == 1) { |
||||
coupons.clear(); |
||||
} |
||||
coupons.addAll(pageInfo.list.map((e) => Coupon.fromJson(e))); |
||||
setState(() { |
||||
_refreshController.refreshCompleted(); |
||||
_refreshController.loadComplete(); |
||||
if (pageInfo.pageNum == pageInfo.pages) { |
||||
_refreshController.loadNoData(); |
||||
} else { |
||||
pageNum += 1; |
||||
} |
||||
}); |
||||
} else { |
||||
_refreshController.loadFailed(); |
||||
_refreshController.refreshFailed(); |
||||
Fluttertoast.showToast(msg: baseData.msg); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Scaffold( |
||||
appBar: AppBar( |
||||
title: Text( |
||||
S.of(context).yuemingxi, |
||||
style: TextStyle( |
||||
color: Colors.black, |
||||
fontWeight: FontWeight.bold, |
||||
), |
||||
), |
||||
centerTitle: false, |
||||
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: Container( |
||||
child: ListView.builder( |
||||
itemBuilder: (context, position) { |
||||
return balanceItem(); |
||||
}, |
||||
itemCount: coupons.length, |
||||
), |
||||
), |
||||
); |
||||
} |
||||
Widget balanceItem(){ |
||||
return Container( |
||||
margin: EdgeInsets.only(left: 16,right: 16), |
||||
child: Column( |
||||
// mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
// crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
|
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Container( |
||||
width: 19, |
||||
height: 19, |
||||
margin: EdgeInsets.only(left: 12, top: 12), |
||||
alignment: Alignment.center, |
||||
child: Image.asset( |
||||
"assets/image/icon_store_c.png", |
||||
), |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
width: double.infinity, |
||||
margin: EdgeInsets.only(left: 6, top: 12), |
||||
alignment: Alignment.centerLeft, |
||||
child: Text( |
||||
"门店消费", |
||||
style: TextStyle( |
||||
fontWeight: FontWeight.bold, |
||||
fontSize: 16, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
), |
||||
flex: 1, |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(top: 12), |
||||
child: Text("-200", |
||||
style: TextStyle( |
||||
fontSize: 16, |
||||
color: Color(0xffF68034))), |
||||
), |
||||
], |
||||
), |
||||
SizedBox(height: 8,), |
||||
Container( |
||||
margin: EdgeInsets.only(left: 35), |
||||
child:Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "2021-06-19 13:03", |
||||
style: TextStyle(fontSize: 14, color: Color(0xff727272)), |
||||
), |
||||
]), |
||||
), |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "余额:200.00", |
||||
style: TextStyle(fontSize: 14,fontWeight: FontWeight.bold, color: Color(0xff727272)), |
||||
), |
||||
]), |
||||
), |
||||
], |
||||
),), |
||||
Container( |
||||
margin: EdgeInsets.only(left: 35,top: 12,bottom: 12), |
||||
height: 1, |
||||
color: Color(0xFFF1F1F1), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,266 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:fluttertoast/fluttertoast.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/data/coupon.dart'; |
||||
import 'package:huixiang/retrofit/data/page.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/view_widget/coupon_widget.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
|
||||
class VipCardPage extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _VipCardPage(); |
||||
} |
||||
} |
||||
|
||||
class _VipCardPage extends State<VipCardPage> { |
||||
RefreshController _refreshController; |
||||
|
||||
ApiService apiService; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
|
||||
SharedPreferences.getInstance().then((value) => { |
||||
apiService = ApiService(Dio(), token: value.getString('token')), |
||||
queryCard(), |
||||
}); |
||||
|
||||
_refreshController = RefreshController(initialRefresh: false); |
||||
} |
||||
|
||||
int pageNum = 1; |
||||
List<Coupon> coupons = []; |
||||
|
||||
void _onRefresh() async { |
||||
pageNum = 1; |
||||
queryCard(); |
||||
} |
||||
|
||||
queryCard() async { |
||||
BaseData baseData = await apiService.queryCard({ |
||||
"centre": true, |
||||
"pageNum": pageNum, |
||||
"pageSize": 10, |
||||
"searchKey": "", |
||||
"state": 3 |
||||
}).catchError((error) { |
||||
_refreshController.loadFailed(); |
||||
_refreshController.refreshFailed(); |
||||
}); |
||||
if (baseData.isSuccess) { |
||||
PageInfo pageInfo = PageInfo.fromJson(baseData.data); |
||||
if (pageNum == 1) { |
||||
coupons.clear(); |
||||
} |
||||
coupons.addAll(pageInfo.list.map((e) => Coupon.fromJson(e))); |
||||
setState(() { |
||||
_refreshController.refreshCompleted(); |
||||
_refreshController.loadComplete(); |
||||
if (pageInfo.pageNum == pageInfo.pages) { |
||||
_refreshController.loadNoData(); |
||||
} else { |
||||
pageNum += 1; |
||||
} |
||||
}); |
||||
} else { |
||||
_refreshController.loadFailed(); |
||||
_refreshController.refreshFailed(); |
||||
Fluttertoast.showToast(msg: baseData.msg); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Scaffold( |
||||
body: Container( |
||||
child: SmartRefresher( |
||||
enablePullDown: true, |
||||
enablePullUp: true, |
||||
header: ClassicHeader(), |
||||
footer: CustomFooter( |
||||
builder: (context, mode) { |
||||
Widget body; |
||||
if (mode == LoadStatus.idle) { |
||||
body = Text("pull up load"); |
||||
} else if (mode == LoadStatus.loading) { |
||||
body = CupertinoActivityIndicator(); |
||||
} else if (mode == LoadStatus.failed) { |
||||
body = Text("Load Failed!Click retry!"); |
||||
} else if (mode == LoadStatus.canLoading) { |
||||
body = Text("release to load more"); |
||||
} else { |
||||
body = Text("-" + S.of(context).meiyougengduohuiyuanka + "-"); |
||||
} |
||||
return Container( |
||||
height: 55.0, |
||||
child: Center(child: body), |
||||
); |
||||
}, |
||||
), |
||||
controller: _refreshController, |
||||
onRefresh: _onRefresh, |
||||
onLoading: queryCard, |
||||
child: ListView.builder( |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pushNamed('/router/vip_details_page'); |
||||
}, |
||||
child: vipCardItem(), |
||||
); |
||||
return GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pushNamed('/router/vip_details_page'); |
||||
}, |
||||
child: vipCardItem(), |
||||
); |
||||
}, |
||||
itemCount: coupons.length, |
||||
), |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget vipCardItem() { |
||||
return Container( |
||||
margin: EdgeInsets.fromLTRB(16, 8, 16, 8), |
||||
// margin: EdgeInsets.all(16), |
||||
child: Stack( |
||||
// alignment: Alignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/icon_vip_bj.png", |
||||
fit: BoxFit.contain, //填充剩余空间 |
||||
height: 185, |
||||
), |
||||
Container( |
||||
padding: EdgeInsets.only(left: 16,right: 16), |
||||
child:Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
SizedBox(height: 16), |
||||
Row( |
||||
children: [ |
||||
ClipOval( |
||||
child:Image.asset( |
||||
"assets/image/icon_vip_name.png", |
||||
), |
||||
clipBehavior: Clip.hardEdge, |
||||
), |
||||
SizedBox( |
||||
width: 12, |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
height: 54, |
||||
child: Column( |
||||
mainAxisAlignment: |
||||
MainAxisAlignment.spaceEvenly, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
"百年川椒火锅店", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 20, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
Image.asset( |
||||
"assets/image/icon_vip.png", |
||||
), |
||||
], |
||||
), |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "会员卡", |
||||
style: TextStyle( |
||||
fontSize: 12, |
||||
color: Colors.white), |
||||
), |
||||
]), |
||||
textDirection: TextDirection.ltr, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
flex: 1, |
||||
) |
||||
], |
||||
), |
||||
SizedBox(height: 50), |
||||
Row( |
||||
textDirection: TextDirection.rtl, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/icon_right.png", |
||||
), |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "查看详情", |
||||
style: TextStyle(fontSize: 12, color: Colors.white), |
||||
), |
||||
]), |
||||
), |
||||
], |
||||
), |
||||
SizedBox( |
||||
height: 10, |
||||
), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Expanded( |
||||
flex: 1, |
||||
child: Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "No.202107021324199", |
||||
style: TextStyle(fontSize: 14, color: Colors.white), |
||||
), |
||||
]), |
||||
), |
||||
), |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "有效期限:", |
||||
style: TextStyle(fontSize: 12, color: Colors.white), |
||||
), |
||||
]), |
||||
), |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "长期有效", |
||||
style: TextStyle(fontSize: 12, color: Colors.white), |
||||
), |
||||
]), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,696 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/view_widget/border_text.dart'; |
||||
import 'package:huixiang/view_widget/pay_input_view.dart'; |
||||
import 'package:huixiang/view_widget/round_button.dart'; |
||||
import 'package:huixiang/view_widget/separator.dart'; |
||||
|
||||
class VipDetailPage extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _VipDetailPage(); |
||||
} |
||||
} |
||||
|
||||
class _VipDetailPage extends State<VipDetailPage> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Scaffold( |
||||
appBar: AppBar( |
||||
title: Text( |
||||
S.of(context).huiyuankaxiangqing, |
||||
style: TextStyle(color: Colors.white, |
||||
fontWeight: FontWeight.bold), |
||||
), |
||||
centerTitle: false, |
||||
backgroundColor: Color(0xFF3A405A), |
||||
brightness: Brightness.dark, |
||||
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.white, |
||||
size: 24, |
||||
), |
||||
), |
||||
), |
||||
titleSpacing: 2, |
||||
leadingWidth: 56, |
||||
// bottom: PreferredSize( |
||||
// preferredSize: Size(double.infinity, 88), |
||||
// child: Container( |
||||
// height: 88, |
||||
// padding: EdgeInsets.fromLTRB(16, 0, 16, 14), |
||||
// child: Row( |
||||
// mainAxisAlignment: MainAxisAlignment.end, |
||||
// crossAxisAlignment: CrossAxisAlignment.end, |
||||
// children: [ |
||||
// Expanded( |
||||
// child: Column( |
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
// crossAxisAlignment: CrossAxisAlignment.start, |
||||
// children: [ |
||||
// Container( |
||||
// height: 20, |
||||
// width: 82, |
||||
// decoration: BoxDecoration( |
||||
// borderRadius: BorderRadius.circular(15), |
||||
// border: Border.all( |
||||
// width: 1, |
||||
// color: Color(0xFF32A060), |
||||
// ), |
||||
// ), |
||||
// child: Stack( |
||||
// alignment: Alignment.lerp( |
||||
// Alignment.centerLeft, |
||||
// Alignment.centerRight, |
||||
// 0, |
||||
// ), |
||||
// children: [ |
||||
// Positioned( |
||||
// left: 0, |
||||
// child: GestureDetector( |
||||
// onTap: () { |
||||
// setState(() { |
||||
// type = 0; |
||||
// }); |
||||
// }, |
||||
// child: RoundButton( |
||||
// text: S.of(context).ziqu, |
||||
// width: 42, |
||||
// height: 20, |
||||
// textColor: Colors.white, |
||||
// padding: EdgeInsets.fromLTRB(8, 1, 8, 1), |
||||
// backgroup: type == 0 |
||||
// ? Color(0xFF32A060) |
||||
// : Colors.transparent, |
||||
// radius: 15, |
||||
// ), |
||||
// ), |
||||
// ), |
||||
// Positioned( |
||||
// right: 0, |
||||
// child: GestureDetector( |
||||
// onTap: () { |
||||
// setState(() { |
||||
// type = 1; |
||||
// }); |
||||
// }, |
||||
// child: RoundButton( |
||||
// text: S.of(context).waisong, |
||||
// width: 42, |
||||
// height: 20, |
||||
// textColor: Colors.white, |
||||
// padding: EdgeInsets.fromLTRB(8, 1, 8, 1), |
||||
// backgroup: type == 1 |
||||
// ? Color(0xFF32A060) |
||||
// : Colors.transparent, |
||||
// radius: 15, |
||||
// ), |
||||
// ), |
||||
// ), |
||||
// ], |
||||
// ), |
||||
// ), |
||||
// Text( |
||||
// S.of(context).qingzaiguidingshijianneizhifu, |
||||
// style: TextStyle( |
||||
// color: Colors.white, |
||||
// fontSize: 12, |
||||
// ), |
||||
// ), |
||||
// ], |
||||
// ), |
||||
// ), |
||||
// Container( |
||||
// height: 33, |
||||
// child: Row( |
||||
// mainAxisSize: MainAxisSize.min, |
||||
// children: [ |
||||
// AspectRatio( |
||||
// aspectRatio: 1, |
||||
// child: BorderText( |
||||
// text: "02", |
||||
// textColor: Colors.white, |
||||
// fontSize: 21, |
||||
// fontWeight: FontWeight.bold, |
||||
// borderColor: Colors.white, |
||||
// borderWidth: 1, |
||||
// padding: EdgeInsets.all(2), |
||||
// ), |
||||
// ), |
||||
// SizedBox( |
||||
// width: 8, |
||||
// ), |
||||
// Text( |
||||
// ":", |
||||
// style: TextStyle( |
||||
// color: Colors.white, |
||||
// fontSize: 21, |
||||
// ), |
||||
// ), |
||||
// SizedBox( |
||||
// width: 8, |
||||
// ), |
||||
// AspectRatio( |
||||
// aspectRatio: 1, |
||||
// child: BorderText( |
||||
// text: "02", |
||||
// textColor: Colors.white, |
||||
// fontSize: 21, |
||||
// fontWeight: FontWeight.bold, |
||||
// borderColor: Colors.white, |
||||
// borderWidth: 1, |
||||
// padding: EdgeInsets.all(2), |
||||
// ), |
||||
// ), |
||||
// ], |
||||
// ), |
||||
// ) |
||||
// ], |
||||
// ), |
||||
// ), |
||||
// ), |
||||
), |
||||
body: Container( |
||||
child: Stack( |
||||
children: [ |
||||
Container( |
||||
height: 150, |
||||
color: Color(0xFF3A405A), |
||||
), |
||||
SingleChildScrollView( |
||||
physics: BouncingScrollPhysics(), |
||||
child: Container( |
||||
child: Column( |
||||
children: [ |
||||
buildAddress(), |
||||
buildCommodity(), |
||||
Container( |
||||
height: 42, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
|
||||
], |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
var type = 0; |
||||
|
||||
Widget buildAddress() { |
||||
return Container( |
||||
margin: EdgeInsets.fromLTRB(16, 8, 16, 8), |
||||
// margin: EdgeInsets.all(16), |
||||
child: Stack( |
||||
// alignment: Alignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/icon_vip_bj.png", |
||||
fit: BoxFit.contain, //填充剩余空间 |
||||
height: 188, |
||||
), |
||||
Container( |
||||
padding: EdgeInsets.only(left: 16,right: 16), |
||||
child:Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
SizedBox(height: 16), |
||||
Row( |
||||
children: [ |
||||
ClipOval( |
||||
child:Image.asset( |
||||
"assets/image/icon_vip_name.png", |
||||
), |
||||
clipBehavior: Clip.hardEdge, |
||||
), |
||||
SizedBox( |
||||
width: 12, |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
height: 54, |
||||
child: Column( |
||||
mainAxisAlignment: |
||||
MainAxisAlignment.spaceEvenly, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
"百年川椒火锅店", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 20, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
Image.asset( |
||||
"assets/image/icon_vip.png", |
||||
), |
||||
], |
||||
), |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "会员卡", |
||||
style: TextStyle( |
||||
fontSize: 12, |
||||
color: Colors.white), |
||||
), |
||||
]), |
||||
textDirection: TextDirection.ltr, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
flex: 1, |
||||
) |
||||
], |
||||
), |
||||
SizedBox(height: 26), |
||||
Padding(padding: EdgeInsets.only(left: 32,right: 32), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Column( |
||||
children: [ |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "¥ 0.00", |
||||
style: TextStyle(fontSize: 24, color: Colors.white), |
||||
), |
||||
]), |
||||
), |
||||
GestureDetector( |
||||
onTap: (){ |
||||
Navigator.of(context).pushNamed('/router/vip_balance'); |
||||
}, |
||||
child:Row( |
||||
children: [ |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "余额", |
||||
style: TextStyle( |
||||
fontSize: 14, |
||||
color: Colors.white), |
||||
), |
||||
]), |
||||
textDirection: TextDirection.ltr, |
||||
), |
||||
Icon( |
||||
Icons.keyboard_arrow_right, |
||||
color: Colors.white, |
||||
size: 22.5, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Column( |
||||
children: [ |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "0", |
||||
style: TextStyle(fontSize: 24, color: Colors.white), |
||||
), |
||||
]), |
||||
), |
||||
SizedBox(height: 5,), |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "积分", |
||||
style: TextStyle(fontSize: 14, color: Colors.white), |
||||
), |
||||
]), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
),), |
||||
|
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget buildCommodity() { |
||||
return Stack( |
||||
alignment: Alignment.centerRight, |
||||
children: [ |
||||
Container( |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
children: historyList(), |
||||
), |
||||
), |
||||
], |
||||
); |
||||
} |
||||
|
||||
List<Widget> historyList() { |
||||
return [ |
||||
Padding(padding: EdgeInsets.only(left: 16,top: 35,bottom: 32),child: |
||||
Row( |
||||
children: [ |
||||
Text( |
||||
"历史订单", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 16, |
||||
fontWeight: FontWeight.bold, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
SizedBox(width: 8,), |
||||
Image.asset( |
||||
"assets/image/icon_history.png", |
||||
), |
||||
], |
||||
),), |
||||
historyItem(), |
||||
historyItem(), |
||||
historyItem(), |
||||
historyItem(), |
||||
historyItem(), |
||||
historyItem(), |
||||
historyItem(), |
||||
]; |
||||
} |
||||
|
||||
|
||||
Widget buildOrderInfo() { |
||||
return Container( |
||||
margin: EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 8), |
||||
padding: EdgeInsets.only(left: 20, right: 20, top: 12, bottom: 12), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 1), |
||||
blurRadius: 12, |
||||
spreadRadius: 0) |
||||
], |
||||
borderRadius: BorderRadius.all(Radius.circular(8))), |
||||
child: Column( |
||||
children: [ |
||||
orderInfoItem(S.of(context).shoujihao, "13800138000"), |
||||
orderInfoItem( |
||||
S.of(context).beizhu, S.of(context).qingshurubeizhuyaoqiu), |
||||
orderInfoItem(S.of(context).fapiao, S.of(context).buzhichikaipiao), |
||||
orderInfoItem(S.of(context).zhifufangshi, S.of(context).yue), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget orderInfoItem(leftText, rightText) { |
||||
return Container( |
||||
margin: EdgeInsets.only(top: 8, bottom: 8), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
leftText, |
||||
style: TextStyle( |
||||
fontWeight: FontWeight.bold, |
||||
fontSize: 12, |
||||
color: Color(0xFF727272)), |
||||
), |
||||
Expanded( |
||||
child: Text( |
||||
rightText, |
||||
textAlign: TextAlign.end, |
||||
style: TextStyle( |
||||
fontSize: 12, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
flex: 1, |
||||
), |
||||
SizedBox( |
||||
width: 16, |
||||
), |
||||
Icon( |
||||
Icons.keyboard_arrow_right, |
||||
size: 16, |
||||
color: Colors.black, |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget historyItem() { |
||||
return Container( |
||||
// margin: EdgeInsets.fromLTRB(16, 8, 16, 8), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Container( |
||||
width: 19, |
||||
height: 19, |
||||
margin: EdgeInsets.only(left: 12, top: 12), |
||||
alignment: Alignment.center, |
||||
decoration: new BoxDecoration( |
||||
color: Color(0xff32A060), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
child: Text("自", |
||||
style: TextStyle( |
||||
fontSize: 12, |
||||
fontWeight: FontWeight.bold, |
||||
color: Colors.white)), |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
width: double.infinity, |
||||
margin: EdgeInsets.only(left: 6, top: 12), |
||||
alignment: Alignment.centerLeft, |
||||
child: Text( |
||||
"前进麦味·天然烘焙(凯德1818店)", |
||||
style: TextStyle( |
||||
fontWeight: FontWeight.bold, |
||||
fontSize: 14, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
), |
||||
flex: 1, |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(top: 12, right: 12), |
||||
child: Text( S.of(context).yiwancheng, |
||||
style: TextStyle( |
||||
fontSize: 14, |
||||
fontWeight: FontWeight.bold, |
||||
color: Color(0xff32A060))), |
||||
), |
||||
], |
||||
), |
||||
Container( |
||||
margin: EdgeInsets.only(left: 37), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
S.of(context).xiadanshijian_("2020.01.20~2020.1.21"), |
||||
style: TextStyle( |
||||
fontSize: 10, |
||||
color: Color(0xFF727272), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 8, |
||||
), |
||||
Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Image.network( |
||||
"https://t7.baidu.com/it/u=1348120667,563487140&fm=193&f=GIF", |
||||
width: 75, |
||||
height: 75, |
||||
fit: BoxFit.contain, |
||||
), |
||||
SizedBox( |
||||
height: 4, |
||||
), |
||||
Text( |
||||
"桑葚椰汁水果茶", |
||||
style: TextStyle( |
||||
fontSize: 10, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(right: 22), |
||||
child: Image.asset( |
||||
"assets/image/icon_more.png", |
||||
fit: BoxFit.fill, |
||||
alignment: Alignment.centerRight, |
||||
width: 24, |
||||
height: 24, |
||||
), |
||||
) |
||||
], |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 12, |
||||
), |
||||
Container( |
||||
margin: EdgeInsets.only(right: 12, bottom: 12), |
||||
child: Directionality( |
||||
textDirection: TextDirection.rtl, |
||||
child: Column( |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text.rich(TextSpan(children: [ |
||||
TextSpan( |
||||
text: "合计:", |
||||
style: TextStyle( |
||||
fontSize: 12, |
||||
color: Color(0xFF868686), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: S.of(context).yuan("58.2"), |
||||
style: TextStyle( |
||||
fontSize: 12, |
||||
fontWeight: FontWeight.bold, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
])), |
||||
SizedBox( |
||||
width: 4, |
||||
), |
||||
Text.rich(TextSpan(children: [ |
||||
TextSpan( |
||||
text: "共", |
||||
style: TextStyle( |
||||
fontSize: 12, |
||||
color: Color(0xFF868686), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "5", |
||||
style: TextStyle( |
||||
fontSize: 12, |
||||
fontWeight: FontWeight.bold, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "件", |
||||
style: TextStyle( |
||||
fontSize: 12, |
||||
color: Color(0xFF868686), |
||||
), |
||||
), |
||||
])), |
||||
], |
||||
), |
||||
SizedBox( |
||||
height: 8, |
||||
), |
||||
Row( |
||||
children: [ |
||||
RoundButton( |
||||
text: "再来一单", |
||||
textColor: Colors.white, |
||||
fontSize: 12, |
||||
backgroup: Color(0xFF32A060), |
||||
radius: 2, |
||||
padding: EdgeInsets.fromLTRB(17, 4, 17, 4), |
||||
), |
||||
Container( |
||||
width: 72, |
||||
height: 24, |
||||
margin: EdgeInsets.only(right: 10), |
||||
child: TextButton( |
||||
onPressed: () {}, |
||||
style: ButtonStyle( |
||||
padding: |
||||
MaterialStateProperty.all(EdgeInsets.zero), |
||||
side: MaterialStateProperty.all( |
||||
BorderSide( |
||||
color: Color(0xff32A060), width: 0.5), |
||||
), |
||||
), |
||||
child: Text( |
||||
"删除一单", |
||||
style: TextStyle( |
||||
color: Color(0xff32A060), fontSize: 12), |
||||
), |
||||
), |
||||
), |
||||
Expanded( |
||||
flex: 1, |
||||
child: Container( |
||||
margin: EdgeInsets.only(left: 37), |
||||
alignment: Alignment.centerLeft, |
||||
child: Text( |
||||
"取单号 201", |
||||
style: TextStyle( |
||||
fontSize: 16, |
||||
fontWeight: FontWeight.bold, |
||||
color: Colors.black), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
)), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |