提交 206717a2 authored 作者: yueweilu's avatar yueweilu

Merge remote-tracking branch 'origin/test' into test

......@@ -50,7 +50,7 @@ class _CoursePageState extends State<CoursePage> {
badgeStyle: const badges.BadgeStyle(
badgeColor: AppTheme.primary,
shape: badges.BadgeShape.circle,
padding: EdgeInsets.all(3),
padding: EdgeInsets.all(2),
),
child: CustomButton.icon(
padding: EdgeInsets.zero,
......
......@@ -126,7 +126,7 @@ class _FilterPageState extends State<FilterPage> {
},
child: Container(
height: 27,
padding: const EdgeInsets.only(left: 15,right: 15,top: 4),
padding: const EdgeInsets.only(left: 15,right: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(13.5),
color: model.selected?const Color(0xFFC02D55).withOpacity(0.08): Colours.cF4,
......@@ -139,7 +139,8 @@ class _FilterPageState extends State<FilterPage> {
Text(model.name??'',style: TextStyle(fontSize: 13,height: 1.4,color: model.selected?AppTheme.primary: Colours.c3),textAlign: TextAlign.center,),
Image.asset(model.selected?'assets/images/filter_select.png':'assets/images/filter_unselect.png'),
],
):Text(model.name??'',style: TextStyle(fontSize: 13,height: 1.4,color: model.selected?AppTheme.primary: Colours.c3),textAlign: TextAlign.end,),
):Padding(padding: EdgeInsets.only(top: 4.w),child: Text(model.name??'',style: TextStyle(fontSize: 13,height: 1.4,color: model.selected?AppTheme.primary: Colours.c3),textAlign: TextAlign.end,),),
),
);
......
......@@ -199,7 +199,7 @@ class _LoginPageState extends State<LoginPage> {
height: 14.w,
// color: AppTheme.primary,
child: Image.asset(
controller.agree?'assets/images/check_box_select.png':'assets/images/uncheck.png',
controller.agree?'assets/images/check_box_select.png':'assets/images/uncheck.png',fit: BoxFit.contain,
),
),
Gaps.hGaps5,
......
......@@ -56,7 +56,7 @@ class _MinePageState extends State<MinePage> {
badgeStyle: const badges.BadgeStyle(
badgeColor: AppTheme.primary,
shape: badges.BadgeShape.circle,
padding: EdgeInsets.all(3),
padding: EdgeInsets.all(2),
),
child: CustomButton.icon(
padding: EdgeInsets.zero,
......
......@@ -33,13 +33,13 @@ class BuildCard extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(model.bookName??'',style: TextStyle(fontSize: 20.w,height: 1.4,color: Colors.white,fontWeight: Fonts.medium),),
Text(model.bookName??'',style: TextStyle(fontSize: 18.w,height: 1.4,color: Colors.white,fontWeight: Fonts.boldSemi),),
Gaps.vGaps15,
Row(
children: [
Text('学习总进度',style: TextStyle(fontSize: 15.w,height: 1.4,color: Colors.white),),
Gaps.hGaps15,
Text(model.progress??'',style: TextStyle(fontSize: 16.w,height: 1.4,color: Colors.white,fontWeight: Fonts.medium),),
Text(model.progress??'',style: TextStyle(fontSize: 16.w,height: 1.4,color: Colors.white,fontWeight: Fonts.boldSemi),),
]
),
Gaps.vGaps10,
......@@ -47,13 +47,13 @@ class BuildCard extends StatelessWidget {
children: [
Text('学习总时长',style: TextStyle(fontSize: 15.w,height: 1.4,color: Colors.white),),
Gaps.hGaps15,
Text('${model.readSecond??''}分钟',style: TextStyle(fontSize: 16.w,height: 1.4,color: Colors.white,fontWeight: Fonts.medium),),
Text('${model.readSecond??''}分钟',style: TextStyle(fontSize: 16.w,height: 1.4,color: Colors.white,fontWeight: Fonts.boldSemi),),
]
),
Gaps.vGaps10,
Text('上次读到',style: TextStyle(fontSize: 15.w,height: 1.4,color: Colors.white),),
Gaps.vGaps5,
Text(model.lastChapter??'',style: TextStyle(fontSize: 16.w,height: 1.4,color: Colors.white,fontWeight: Fonts.medium),maxLines: 1,overflow: TextOverflow.ellipsis,),
Text(model.lastChapter??'',style: TextStyle(fontSize: 16.w,height: 1.4,color: Colors.white,fontWeight: Fonts.boldSemi),maxLines: 1,overflow: TextOverflow.ellipsis,),
]
),
),
......
......@@ -3,18 +3,8 @@ part of user_order;
/// 订单详情
class UserOrderController extends GetxController
with GetTickerProviderStateMixin {
int tag;
// final List<OrderListModel> models;
UserOrderController(this.tag);/*{
onRefresh();
}*/
/* List<Tab> tabs = [
const Tab(text: '全部',),
const Tab(text: '待支付',),
const Tab(text: '已取消',),
const Tab(text: '已完成',),
const Tab(text: '已退款',),
];*/
final int tag;
UserOrderController(this.tag);
List<OrderListModel> orderList = [];
......@@ -44,7 +34,6 @@ class UserOrderController extends GetxController
/// 获取订单列表
Future<void> _getOrders({bool isRefresh = false, String keys ='',int ?tabIndex}) async {
if(tabIndex != null)tag=tabIndex;
if (isRefresh) _page = 1;
// 网路请求
final result = await MineAPI.orderList(
......
......@@ -23,7 +23,7 @@ class _UserOrderState extends State<UserOrderPage> with SingleTickerProviderStat
@override
void initState() {
_tabController = TabController(length: 5, vsync: this);
_tabController = TabController(length: tabs.length, vsync: this);
super.initState();
// 在这里可以使用 localVariable 进行操作
......@@ -31,52 +31,7 @@ class _UserOrderState extends State<UserOrderPage> with SingleTickerProviderStat
@override
Widget build(BuildContext context) {
return /*GetBuilder<UserOrderController>(
init: UserOrderController(tab),
builder: (controller) => Scaffold(
appBar: CustomAppBar(
automaticallyImplyLeading: false,
titleSpacing: 0,
title: Padding(
padding: EdgeInsets.symmetric(horizontal: AppTheme.margin),
child: CustomInputSearch(
controller: searchController,
readOnly: false,
hintText: '搜索我的订单',
onTap: () {
// context.pushNamed(Routes.msgs);
},
onEditingComplete: () {
controller._getOrders(
isRefresh: true,
keys: searchController.text,
tabIndex: _tabController.index);
// FocusScope.of(context).unfocus();
FocusNode blankNode = FocusNode();
FocusScope.of(context).requestFocus(blankNode); //指定为空白焦点
},
),
),
actions: [
GestureDetector(
onTap: () {
context.pop();
},
child: Container(
padding: EdgeInsets.only(left: 10.w, top: 10.w, bottom: 10.w),
child: Text(
'取消',
style:
TextStyle(fontSize: 14.w, height: 1.5, color: Colours.c3),
),
),
)
],
),
body: _buildBody(controller),
),
);*/
WillPopScope(
return WillPopScope(
onWillPop: () async {
context.pop(true);
return false;
......@@ -132,13 +87,6 @@ class _UserOrderState extends State<UserOrderPage> with SingleTickerProviderStat
color: Colors.white,
height: 35.w,
child: TabBar(
indicator: UnderlineTabIndicator(
borderRadius: BorderRadius.circular(0.75),
borderSide:
BorderSide(width: 1.5.w, color: AppTheme.primary),
insets: EdgeInsets.symmetric(
horizontal:24.w), // 设置标签下面指示器的水平内边距
),
labelPadding: EdgeInsets.symmetric(horizontal: 15.w),
indicatorSize: TabBarIndicatorSize.label,
indicatorColor: AppTheme.primary,
......@@ -147,7 +95,7 @@ class _UserOrderState extends State<UserOrderPage> with SingleTickerProviderStat
color: AppTheme.primary,
fontSize: 15.w,
height: 1.5,
fontWeight: Fonts.medium),
fontWeight: Fonts.boldSemi),
unselectedLabelColor: Colours.c9,
unselectedLabelStyle: TextStyle(
color: Colours.c9, fontSize: 15.w, height: 1.5),
......@@ -163,7 +111,7 @@ class _UserOrderState extends State<UserOrderPage> with SingleTickerProviderStat
tab = index;
return BuildListPage(
tag:
tab,/* models:controller.orderList,*//*controller: controller,*//*,context: context,*/
tab,/* models:controller.orderList,*//*controller: controller,*//*,context: context,*/
);
})),
)
......
part of user_order;
/// 待付款item
class BuiltAwaiting extends StatelessWidget {
final OrderListModel model;
final UserOrderController controller;
const BuiltAwaiting({Key? key, required this.model}) : super(key: key);
const BuiltAwaiting({Key? key, required this.model, required this.controller})
: super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
context.pushNamed(Routes.orderAwaiting,
onTap: () async {
final result = await context.pushNamed(Routes.orderAwaiting,
queryParameters: {'orderNum': model.ordersnum});
if (result == true) {
controller.onRefresh(); }
},
child: Container(
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 10.w),
......@@ -123,8 +128,7 @@ class BuiltAwaiting extends StatelessWidget {
child: Align(
alignment: Alignment.center,
child: Text(
'${30 - (DateTime.now().difference(
DateTime.parse(model.createTime.toString()))).inMinutes}分钟',
'${30 - (DateTime.now().difference(DateTime.parse(model.createTime.toString()))).inMinutes}分钟',
style: TextStyle(
color: Colours.cC31F4C,
fontSize: 10.w,
......
......@@ -2,8 +2,8 @@ part of user_order;
/// 紫荆币item
class BuiltCoin extends StatelessWidget {
final OrderListModel model;
const BuiltCoin({Key? key, required this.model}) : super(key: key);
final UserOrderController controller;
const BuiltCoin({Key? key, required this.model,required this.controller}) : super(key: key);
@override
Widget build(BuildContext context) {
......@@ -16,10 +16,13 @@ class BuiltCoin extends StatelessWidget {
status ='已完成';
}
return GestureDetector(
onTap: () {
onTap: () async {
if(model.status == 1){
context.pushNamed(Routes.orderCoinAwaiting,
final result = await context.pushNamed(Routes.orderCoinAwaiting,
queryParameters: {'orderNum': model.ordersnum});
if(result==true){
controller.onRefresh();
}
}
},
child: Container(
......
......@@ -32,7 +32,7 @@ class _BuildListPageState extends State<BuildListPage>
Widget build(BuildContext context) {
return GetBuilder<UserOrderController>(
tag: widget.tag.toString(),
init: Get.put(UserOrderController(widget.tag)),
init: UserOrderController(widget.tag),
builder: (controller) => CustomPullScrollView(
controller: controller.refreshController,
onRefresh: controller.onRefresh,
......@@ -42,10 +42,10 @@ class _BuildListPageState extends State<BuildListPage>
OrderListModel model = controller.orderList[index];
// OrderListModel model = widget.models[index];
if (model.types == 2) {
return BuiltCoin(model: model,);
return BuiltCoin(model: model,controller: controller,);
} else {
if (model.status == 1) {
return BuiltAwaiting(model: model,);
return BuiltAwaiting(model: model,controller: controller,);
} else if (model.status == 2) {
return BuiltCanceled(model: model,);
} else if (model.status == 3) {
......@@ -60,33 +60,6 @@ class _BuildListPageState extends State<BuildListPage>
),
),
);
/*return CustomPullScrollView(
controller: widget.controller.refreshController,
onRefresh: widget.controller.onRefresh,
onLoading: widget.controller.onLoading,
child: ListView.builder(
itemBuilder: (BuildContext context, int index) {
OrderListModel model = widget.controller.orderList[index];
// OrderListModel model = widget.models[index];
if (model.types == 2) {
return BuiltCoin(model: model,);
} else {
if (model.status == 1) {
return BuiltAwaiting(model: model,);
} else if (model.status == 2) {
return BuiltCanceled(model: model,);
} else if (model.status == 3) {
return BuiltCompleted(model: model,);
} else if (model.status == 4) {
return BuiltRefunded(model: model,);
}
}
},
itemCount: widget.controller.orderList.length,
// itemCount: widget.models.length,
),
);*/
}
@override
......
......@@ -56,10 +56,10 @@ class _SearchPageState extends State<OrderSearchPage> {
OrderListModel model = controller.orderList[index];
// OrderListModel model = widget.models[index];
if (model.types == 2) {
return BuiltCoin(model: model,);
return BuiltCoin(model: model,controller: UserOrderController(0),);
} else {
if (model.status == 1) {
return BuiltAwaiting(model: model,);
return BuiltAwaiting(model: model,controller: UserOrderController(0),);
} else if (model.status == 2) {
return BuiltCanceled(model: model,);
} else if (model.status == 3) {
......
......@@ -32,13 +32,12 @@ class UserOrderAwaitingController extends GetxController {
}
/// 取消订单
void cancelPay() async {
Future<bool> cancelPay() async {
final result = await MineAPI.cancelPay(ordersnum: orderNum);
if (result) {
Get.find<UserOrderController>().onRefresh();
Toast.show('取消成功');
context.pop(true);
}
return result;
}
......@@ -100,7 +99,6 @@ class UserOrderAwaitingController extends GetxController {
// 支付宝支付
void requestAliPay(){
print('================================================================${payOrderModel.encryptionOrder!}');
tobias.pay(payOrderModel.encryptionOrder!).then((payResult){
if (payResult['resultStatus'] == '9000') {
......
......@@ -2,7 +2,8 @@ part of user_order_awaiting;
class UserOrderAwaitingPage extends StatefulWidget {
final String orderNum; // 订单编号
const UserOrderAwaitingPage({Key? key , required this.orderNum}) : super(key: key);
const UserOrderAwaitingPage({Key? key, required this.orderNum})
: super(key: key);
@override
State<UserOrderAwaitingPage> createState() => _UserOrderAwaitingState();
......@@ -13,293 +14,306 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
@override
void initState() {
myController = Get.put(UserOrderAwaitingController(context));
myController = Get.put(UserOrderAwaitingController(context));
myController.updateOrderNum(widget.orderNum);
super.initState();
}
@override
Widget build(BuildContext context) {
return FutureBuilder(future: myController.getOrderInfo(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: const Text('等待付款'),
),);
}else{
return WillPopScope(
return WillPopScope(
onWillPop: () async {
context.pop(true);
return false;
},
child: Scaffold(
appBar: CustomAppBar(
title: const Text('等待付款'),
actions: [],
),
body: Column(
children: [
Container(
margin: EdgeInsets.symmetric(
horizontal: AppTheme.margin,
vertical: AppTheme.margin),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colours.cC7.withOpacity(0.5),
offset: Offset(3.w, 0),
blurRadius: 10.w,
spreadRadius: 0.w,
),
],
child: FutureBuilder(
future: myController.getOrderInfo(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: const Text('等待付款'),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
);
} else {
return WillPopScope(
onWillPop: () async {
context.pop(true);
return false;
},
child: Scaffold(
appBar: CustomAppBar(
title: const Text('等待付款'),
actions: [],
),
body: Column(
children: [
Padding(
padding: EdgeInsets.only(
left: 12.0.w, top: 12.0.w, bottom: 12.0.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.network(
myController.model?.bookList?[0].img??'',
fit: BoxFit.cover, // 设置适应方式为充满
width: 72.0.w,
height: 86.0.w,
Container(
margin: EdgeInsets.symmetric(
horizontal: AppTheme.margin,
vertical: AppTheme.margin),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colours.cC7.withOpacity(0.5),
offset: Offset(3.w, 0),
blurRadius: 10.w,
spreadRadius: 0.w,
),
Expanded(
child: Padding(
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: EdgeInsets.only(
left: 12.0.w,
top: 5.5.w,
right: 23.5.w),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.end, // 下面的Text靠左
left: 12.0.w, top: 12.0.w, bottom: 12.0.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
myController.model.bookList?[0].name??'',
style: TextStyle(
color: Colours.c3,
fontWeight: Fonts.bold,
fontSize: 13.w,
),
maxLines: 2,
overflow: TextOverflow
.ellipsis, // 超过部分显示省略号
Image.network(
myController.model?.bookList?[0].img ?? '',
fit: BoxFit.cover, // 设置适应方式为充满
width: 72.0.w,
height: 86.0.w,
),
SizedBox(height: 25.5.w),
Text(
"需付款 ¥${myController.model.finalTotalPrice}",
style: TextStyle(
color: Colours.cAB1941,
fontWeight: Fonts.bold,
fontSize: 14.w,
Expanded(
child: Padding(
padding: EdgeInsets.only(
left: 12.0.w,
top: 5.5.w,
right: 23.5.w),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.end, // 下面的Text靠左
children: [
Text(
myController
.model.bookList?[0].name ??
'',
style: TextStyle(
color: Colours.c3,
fontWeight: Fonts.bold,
fontSize: 13.w,
),
maxLines: 2,
overflow: TextOverflow
.ellipsis, // 超过部分显示省略号
),
SizedBox(height: 25.5.w),
Text(
"需付款 ¥${myController.model.finalTotalPrice}",
style: TextStyle(
color: Colours.cAB1941,
fontWeight: Fonts.bold,
fontSize: 14.w,
),
),
],
),
),
),
],
),
),
),
],
),
),
Container(
color: Colours.cLine,
margin: EdgeInsets.only(
left: 10.w, right: 10.w, bottom: 12.w),
height: 1.w,
),
Container(
padding: EdgeInsets.only(
left: 11.5.w, bottom: 8.w, right: 23.5.w),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children:
myController.orderAwaitings.map((model) {
return Padding(
padding: EdgeInsets.only(top: 12.w),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
model.name,
style: TextStyle(
fontSize: 13.w,
height: 1.6.w,
color: Colours.c9),
),
Text(
model.value.toString(),
style: TextStyle(
fontSize: 13.w,
height: 1.6.w,
color: Colours.c3),
),
],
Container(
color: Colours.cLine,
margin: EdgeInsets.only(
left: 10.w, right: 10.w, bottom: 12.w),
height: 1.w,
),
Container(
padding: EdgeInsets.only(
left: 11.5.w, bottom: 8.w, right: 23.5.w),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children:
myController.orderAwaitings.map((model) {
return Padding(
padding: EdgeInsets.only(top: 12.w),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
model.name,
style: TextStyle(
fontSize: 13.w,
height: 1.6.w,
color: Colours.c9),
),
Text(
model.value.toString(),
style: TextStyle(
fontSize: 13.w,
height: 1.6.w,
color: Colours.c3),
),
],
),
);
}).toList(),
),
),
SizedBox(
height: 13.5.w,
),
);
}).toList(),
],
),
),
),
SizedBox(
height: 13.5.w,
height: 39.w,
),
],
),
),
),
SizedBox(
height: 39.w,
),
GestureDetector(
onTap: (){
myController.payOrder();
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: 15.w),
height: 40.w,
decoration: BoxDecoration(
color: AppTheme.primary,
borderRadius: BorderRadius.circular(180.w),
border:
Border.all(color: Colours.cC31F4C, width: 0.5.w)),
child: Center(
child: Text(
'立即支付 ¥${myController.model.finalTotalPrice}',
style: TextStyle(
fontWeight: Fonts.medium,
fontSize: 14.w,
color: Colours.cFF),
),
),
),
),
SizedBox(
height: 11.5.w,
),
GestureDetector(
onTap: () {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0.w),
),
contentPadding: EdgeInsets.zero, // 移除内容部分的内边距
content: Wrap(children: [
Container(
margin: EdgeInsets.only(top: 44.w, bottom: 29.w), // 调整上下间距
child: Center(
child: Text(
'确定取消订单吗',
style: TextStyle(
fontSize: 15.w,
GestureDetector(
onTap: () {
myController.payOrder();
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: 15.w),
height: 40.w,
decoration: BoxDecoration(
color: AppTheme.primary,
borderRadius: BorderRadius.circular(180.w),
border: Border.all(
color: Colours.cC31F4C, width: 0.5.w)),
child: Center(
child: Text(
'立即支付 ¥${myController.model.finalTotalPrice}',
style: TextStyle(
fontWeight: Fonts.medium,
color: Colours.c3,
),
),
fontSize: 14.w,
color: Colours.cFF),
),
),
Container(
height: 1.w, // 设置分割线的高度
width: double.infinity, // 设置分割线的宽度
color: Colours.cLine, // 设置分割线的颜色
),
],),
// 去除操作按钮区域的内边距
actionsPadding: EdgeInsets.zero,
actions: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, // 或者使用MainAxisAlignment.spaceEvenly
children: [
GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: Container(
width: 105.w,
color: Colours.cFF,
alignment: Alignment.center,
child: const Text(
'取消',
style: TextStyle(
fontSize: 14,
fontWeight: Fonts.medium,
color: Colours.c6,
),
),
),
),
SizedBox(
height: 11.5.w,
),
GestureDetector(
onTap: () {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0.w),
),
),
Container(
height: 39.5.w, // 设置分割线的高度
width: 1, // 设置分割线的宽度
color: Colours.cLine, // 设置分割线的颜色
),
GestureDetector(
onTap: () {
myController.cancelPay();
Navigator.of(context).pop();
// Navigator.pop(context);
},
child: Container(
width: 105.w,
color: Colours.cFF,
alignment: Alignment.center,
child: const Text(
'确定',
style: TextStyle(
fontSize: 14,
fontWeight: Fonts.boldSemi,
color: Colours.cAB1941,
contentPadding: EdgeInsets.zero,
// 移除内容部分的内边距
content: Wrap(
children: [
Container(
margin: EdgeInsets.only(
top: 44.w, bottom: 29.w), // 调整上下间距
child: Center(
child: Text(
'确定取消订单吗',
style: TextStyle(
fontSize: 15.w,
fontWeight: Fonts.medium,
color: Colours.c3,
),
),
),
),
),
Container(
height: 1.w, // 设置分割线的高度
width: double.infinity, // 设置分割线的宽度
color: Colours.cLine, // 设置分割线的颜色
),
],
),
),
],
// 去除操作按钮区域的内边距
actionsPadding: EdgeInsets.zero,
actions: <Widget>[
Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
// 或者使用MainAxisAlignment.spaceEvenly
children: [
GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: Container(
width: 105.w,
color: Colours.cFF,
alignment: Alignment.center,
child: const Text(
'取消',
style: TextStyle(
fontSize: 14,
fontWeight: Fonts.medium,
color: Colours.c6,
),
),
),
),
Container(
height: 39.5.w, // 设置分割线的高度
width: 1, // 设置分割线的宽度
color: Colours.cLine, // 设置分割线的颜色
),
GestureDetector(
onTap: () async {
Future<bool> result = myController.cancelPay();
if(await result){
Navigator.of(context).pop();
context.pop(true);
}
},
child: Container(
width: 105.w,
color: Colours.cFF,
alignment: Alignment.center,
child: const Text(
'确定',
style: TextStyle(
fontSize: 14,
fontWeight: Fonts.boldSemi,
color: Colours.cAB1941,
),
),
),
),
],
),
],
);
},
);
},
child: Container(
width: 105.w,
color: Colours.cFF,
alignment: Alignment.center,
child: const Text(
'取消订单',
style: TextStyle(
fontWeight: Fonts.medium,
fontSize: 15,
color: Colours.c9,
),
),
],
);
},
);
},
child: Container(
width: 105.w,
color: Colours.cFF,
alignment: Alignment.center,
child: const Text(
'取消订单',
style: TextStyle(
fontWeight: Fonts.medium,
fontSize: 15,
color: Colours.c9,
),
),
),
],
),
),
),
],
),
);
}
},
),
);
}
},);
}
}
......@@ -53,6 +53,7 @@ class UserOrderCoinAwaitingController extends GetxController {
@override
void onClose() {
// controller.onRefresh();
if (_connectionSubscription != null) {
_connectionSubscription.cancel();
_connectionSubscription = null;
......@@ -94,14 +95,12 @@ class UserOrderCoinAwaitingController extends GetxController {
/// 取消订单
void cancelPay() async {
Future<bool> cancelPay() async {
final result = await MineAPI.cancelPay(ordersnum: orderNum);
if (result) {
Get.find<UserOrderController>().onRefresh();
Toast.show('取消成功');
context.pop(true);
// update();
}
return result;
}
/// 获取订单信息
......@@ -231,9 +230,8 @@ class UserOrderCoinAwaitingController extends GetxController {
final result = await ShopAPI.orderStatus(orderNumber: model.ordersnum??'',receipt:_resultItem != null?_resultItem!.transactionReceipt.toString():'');
if (result.paySuccess == 1){
Toast.show('订单支付完成');
Get.find<UserOrderController>().onRefresh();
if(context.mounted){
context.pop(true);
context.pop(true);
}
if (model.payType == 3){
// 清除
......
......@@ -23,7 +23,12 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> {
@override
Widget build(BuildContext context) {
return FutureBuilder(
return WillPopScope(
onWillPop: () async {
context.pop(true);
return false;
},
child: FutureBuilder(
future: myController.getOrderInfo(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
......@@ -269,10 +274,12 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> {
color: Colours.cLine, // 设置分割线的颜色
),
GestureDetector(
onTap: () {
myController.cancelPay();
Navigator.of(context).pop();
onTap: () async {
Future<bool> result = myController.cancelPay();
if(await result){
Navigator.of(context).pop();
context.pop(true);
}
},
child:Container(
width: 105.w,
......@@ -315,6 +322,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> {
);
}
},
),
);
}
}
......@@ -96,14 +96,14 @@ class _UserOrderEvaluatePageState extends State<UserOrderEvaluatePage> with Auto
List<OrderEvaluate> orderEvaluates,
List<TextEditingController> controllers) {
int indexToUpdate = orderEvaluates.indexWhere((obj) => obj.recordId == bookListModel.recordId);
TextEditingController textFieldController= TextEditingController();
if(indexToUpdate==-1){
OrderEvaluate evaluate = OrderEvaluate(recordId: bookListModel.recordId);
orderEvaluates.add(evaluate);
controllers.add(textFieldController);
}else{
textFieldController = controllers[indexToUpdate];
}
// TextEditingController textFieldController= TextEditingController();
// if(indexToUpdate==-1){
// OrderEvaluate evaluate = OrderEvaluate(recordId: bookListModel.recordId);
// orderEvaluates.add(evaluate);
// controllers.add(textFieldController);
// }else{
// textFieldController = controllers[indexToUpdate];
// }
int index = orderEvaluates.length-1;
return Container(
......@@ -225,7 +225,7 @@ class _UserOrderEvaluatePageState extends State<UserOrderEvaluatePage> with Auto
hintStyle: TextStyle(
fontSize: 14.w, height: 1.5, color: Colours.c6)),
maxLines: 5,
controller: textFieldController,
// controller: textFieldController,
hintText: '请简要描述',
),
),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论