提交 36cf481a authored 作者: maodou's avatar maodou

1:完善订单页面功能

2:版本升级提示弹窗 3:取消订单弹窗及功能 4:头像修改弹窗及功能
上级 9855a239
......@@ -174,6 +174,7 @@ class CartListModel {
this.price,
this.num_,
this.bookId,
this.isRating,
this.name,
this.img,
this.introduction,
......@@ -188,6 +189,7 @@ class CartListModel {
price = json['price'];
num_ = json['num'];
bookId = json['book_id'];
isRating = json['is_rating'];
name = json['name'];
img = json['img'];
introduction = json['introduction'];
......@@ -201,6 +203,7 @@ class CartListModel {
String? price; // 书籍价格
num? num_; // 书籍价格
num? bookId; //书籍id,为0则是充值的没有书籍
num? isRating; //书籍id,为0则是充值的没有书籍
String? name; // 书籍名
String? img; // 图片
String? introduction; // 简介
......@@ -214,6 +217,7 @@ class CartListModel {
String? price, // 书籍价格
num? num_, // 书籍价格
num? bookId, //书籍id,为0则是充值的没有书籍
num? isRating, //书籍id,为0则是充值的没有书籍
String? name, // 书籍名
String? img, // 图片
String? introduction, // 简介
......@@ -227,6 +231,7 @@ class CartListModel {
price: price ?? this.price,
num_: num_ ?? this.num_,
bookId: bookId ?? this.bookId,
isRating: isRating ?? this.isRating,
name: name ?? this.name,
img: img ?? this.img,
introduction: introduction ?? this.introduction,
......@@ -242,6 +247,7 @@ class CartListModel {
map['num'] = num_;
map['price'] = price;
map['book_id'] = bookId;
map['is_rating'] = isRating;
map['name'] = name;
map['img'] = img;
map['introduction'] = introduction;
......
......@@ -3,7 +3,8 @@ part of user_info;
class UserInfoController extends GetxController {
final UserInfoModel userInfo;
UserInfoController(this.userInfo);
// 时候展示底部视图
bool showDetail = false;
/// 上传头像
void upload({
required String path
......@@ -12,6 +13,11 @@ class UserInfoController extends GetxController {
_changeInfo(result);
}
void show(){
showDetail = !showDetail;
update();
}
/// 修改用用户信息
void _changeInfo(String img) async {
final result = await MineAPI.changeInfo(headImg: img);
......
......@@ -14,7 +14,8 @@ class _UserInfoPageState extends State<UserInfoPage> {
Widget build(BuildContext context) {
return GetBuilder<UserInfoController>(
init: UserInfoController(widget.userInfo),
builder: (controller) =>
builder: (controller) => Stack(
children: [
Scaffold(
appBar: AppBar(
title: const Text('个人信息'),
......@@ -22,7 +23,8 @@ class _UserInfoPageState extends State<UserInfoPage> {
),
body: Container(
margin: EdgeInsets.symmetric(
horizontal: AppTheme.margin, vertical: AppTheme.margin),
horizontal: AppTheme.margin,
vertical: AppTheme.margin),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.white,
......@@ -40,22 +42,21 @@ class _UserInfoPageState extends State<UserInfoPage> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
/// 头像
Container(
height: 52.w,
padding: EdgeInsets.only(left: 18.w, right: 15.w),
child: GestureDetector(
onTap: () async {
final assets = await AssetsPicker.image(
context: context,
);
controller.upload(path: assets!.path);
onTap: () {
controller.show();
Console.log('点击头像');
},
child: Container(
color: Colors.transparent,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'头像',
......@@ -74,7 +75,9 @@ class _UserInfoPageState extends State<UserInfoPage> {
color: Colors.cyan,
),
child: CustomImage.network(
url: controller.userInfo.headImg ?? '',
url:
controller.userInfo.headImg ??
'',
radius: 16.5,
),
),
......@@ -99,7 +102,8 @@ class _UserInfoPageState extends State<UserInfoPage> {
),
GestureDetector(
onTap: () {
context.pushNamed(Routes.nike, extra: controller.userInfo);
context.pushNamed(Routes.nike,
extra: controller.userInfo);
},
child: _buildItem(
'昵称',
......@@ -112,18 +116,107 @@ class _UserInfoPageState extends State<UserInfoPage> {
),
GestureDetector(
onTap: () {
context.pushNamed(
Routes.gender, extra: controller.userInfo);
context.pushNamed(Routes.gender,
extra: controller.userInfo);
},
child: _buildItem(
'性别',
getGender(widget.userInfo.sex)
'性别', getGender(widget.userInfo.sex)
// widget.userInfo.sex == 1 ? '男' : '女',
)),
],
),
),
)),);
)),
controller.showDetail?Positioned(
left: 0.w,
bottom: 0.w,
right: 0.w,
top: 0.w,
child: GestureDetector(
onTap: (){
controller.show();
},
child: Container(
color:const Color(0xFF000000).withOpacity(0.5),
child: Align(
alignment: Alignment.bottomCenter,
child: ClipRRect(
borderRadius: BorderRadius.only(topRight: Radius.circular(8.w),topLeft: Radius.circular(8.w)),
child: Container(
height: 140.5.w,
color: Colors.white,
child: _buildPic(controller),
),
),
),
),
),
):const SizedBox()
],
));
}
Widget _buildPic(UserInfoController controller ){
return Column(
children: [
GestureDetector(
onTap: () async {
Console.log("点击拍照");
final assets = await AssetsPicker.camera(
context: context,
);
controller.upload(path: assets!.path);
},
child: Container(
height: 45.w,
padding: EdgeInsets.all(12.w),
child: const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('拍照',textAlign:TextAlign.center,style: TextStyle(fontSize: 15,height: 1.1,color: Colours.c3,fontWeight: Fonts.medium),),
],
),
),
),
Container(height: 0.5.w,color: Colours.cLine,width: double.infinity,),
GestureDetector(
onTap: () async {
Console.log("点击选择现有图片");
final assets = await AssetsPicker.image(
context: context,
);
controller.upload(path: assets!.path);
},
child: Container(
height: 45.w,
padding: EdgeInsets.all(12.w),
child: const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('选择现有图片',textAlign:TextAlign.center,style: TextStyle(fontSize: 15,height: 1.1,color: Colours.c3,fontWeight: Fonts.medium),),
],
),
),
),
Container(height: 5.w,color: Colours.cF9,width: double.infinity,),
GestureDetector(
onTap: () {
Console.log("点击取消");
controller.show();
},
child: Container(
height: 45.w,
padding: EdgeInsets.all(12.w),
child: const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('取消',textAlign:TextAlign.center,style: TextStyle(fontSize: 15,height: 1.1,color: Colours.c3,fontWeight: Fonts.medium),),
],
),
),
),
],
);
}
getGender(num? sex) {
......
part of user_order;
/// 等待付款订单
/// 订单详情
class UserOrderController extends GetxController
with GetTickerProviderStateMixin {
int tag;
......
......@@ -14,6 +14,7 @@ import 'package:go_router/go_router.dart';
import '../../apis/index.dart';
import '../../models/index.dart';
import '../../routes/index.dart';
import '../library/index.dart';
part 'view.dart';
part 'controller.dart';
......@@ -23,3 +24,5 @@ part 'widgets/completed.dart';
part 'widgets/canceled.dart';
part 'widgets/refunded.dart';
part 'widgets/coin.dart';
part 'widgets/search.dart';
part 'widgets/search_controller.dart';
\ No newline at end of file
......@@ -84,18 +84,10 @@ class _UserOrderState extends State<UserOrderPage> with SingleTickerProviderStat
padding: EdgeInsets.symmetric(horizontal: AppTheme.margin),
child: CustomInputSearch(
controller: searchController,
readOnly: false,
readOnly: true,
hintText: '搜索我的订单',
onTap: () {
// context.pushNamed(Routes.msgs);
},
onEditingComplete: () {
// _getOrders(
// isRefresh: true,
// keys: searchController.text,
// tabIndex: _tabController.index);
FocusNode blankNode = FocusNode();
FocusScope.of(context).requestFocus(blankNode); //指定为空白焦点
context.pushNamed(Routes.orderSearch);
},
),
),
......
part of user_order;
class OrderSearchPage extends StatefulWidget {
const OrderSearchPage({Key? key}) : super(key: key);
@override
State<OrderSearchPage> createState() => _SearchPageState();
}
class _SearchPageState extends State<OrderSearchPage> {
@override
Widget build(BuildContext context) {
return GetBuilder<UserSearchController>(
init: UserSearchController(),
builder: (controller) => Scaffold(
appBar: CustomAppBar(
automaticallyImplyLeading: false,
titleSpacing: 0,
title: Padding(
padding: EdgeInsets.symmetric(horizontal: AppTheme.margin),
child: CustomInputSearch(
controller: controller.searchController,
readOnly: false,
hintText: '搜索图书名称/订单编号',
onTap: () {
// context.pushNamed(Routes.msgs);
},
onEditingComplete: () {
controller._getOrders(
isRefresh: true,
keys: controller.searchController.text,);
// 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: ListView.builder(
itemBuilder: (BuildContext context, int index) {
OrderListModel model = 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: controller.orderList.length,
// itemCount: widget.models.length,
),
),
);
}
}
part of user_order;
/// 订单详情
class UserSearchController extends GetxController
with GetTickerProviderStateMixin {
List<OrderListModel> orderList = [];
late TextEditingController searchController = TextEditingController();
final int _limit = 10;
int _page = 1;
bool _noMore = false;
@override
void onReady() {
// onRefresh();
super.onReady();
}
@override
void onClose() {
searchController.dispose();
super.onClose();
}
/// 获取订单列表
Future<void> _getOrders({bool isRefresh = false, String keys ='',}) async {
// 网路请求
final result = await MineAPI.orderList(
page: _page, limit: _limit, status: 0, keys: keys);
orderList.clear();
orderList.addAll(result);
_page++;
_noMore = result.length < _limit;
update();
}
}
......@@ -30,7 +30,7 @@ class UserOrderAwaitingController extends GetxController {
/// 获取订单信息
void getOrderInfo() async {
Future<void> getOrderInfo() async {
model = await MineAPI.getOrderInfo(orderNum: orderNum);
String payWay ='';
if(model.payType==1){
......
library user_order_awaiting;
import 'dart:ffi';
import 'package:flutter/material.dart';
import 'package:flutter_book/theme.dart';
import 'package:flutter_book/utils/index.dart';
......
......@@ -9,14 +9,25 @@ class UserOrderAwaitingPage extends StatefulWidget {
}
class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
late UserOrderAwaitingController myController;
@override
void initState() {
Get.put(UserOrderAwaitingController(widget.orderNum));
myController = Get.put(UserOrderAwaitingController(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(
onWillPop: () async {
context.pop(true);
......@@ -167,7 +178,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
child: GestureDetector(
onTap: () {
// print("保存昵称");
context.pushNamed(Routes.orderEvaluate);
// context.pushNamed(Routes.orderEvaluate);
},
child: Text(
'立即支付 ¥${controller.model.finalTotalPrice}',
......@@ -183,31 +194,98 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
),
GestureDetector(
onTap: () {
CustomDialog.show(context: context, builder:(context) =>
Text('确定取消订单吗',style: TextStyle(fontSize: 15.w,fontWeight: Fonts.medium,color: Colours.c3),),
cancel: Text('取消',style: TextStyle(fontSize: 12.w,fontWeight: Fonts.medium,color: Colours.c6),),
confirm: Text('确定',style: TextStyle(fontSize: 12.w,fontWeight: Fonts.medium,color: Colours.cFF),),
onCancel: () {
Navigator.of(context).pop();
},
onConfirm: () {
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,
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: const Text(
'取消',
style: TextStyle(
fontSize: 12,
fontWeight: Fonts.medium,
color: Colours.c6,
),
),
),
Container(
height: 39.5.w, // 设置分割线的高度
width: 1, // 设置分割线的宽度
color: Colours.cLine, // 设置分割线的颜色
),
GestureDetector(
onTap: () {
controller.cancelPay();
Navigator.of(context).pop();
Navigator.pop(context);
},);
// Navigator.pop(context);
},
child: const Text(
'确定',
style: TextStyle(
fontSize: 12,
fontWeight: Fonts.medium,
color: Colours.cAB1941,
),
),
),
],
),
],
);
},
);
},
child: Text(
'取消订单',
style: TextStyle(
fontWeight: Fonts.medium,
fontSize: 15.w,
color: Colours.c9),
color: Colours.c9,
),
),
),
],
),
)),
);
); ;
}
},);
}
}
......@@ -7,7 +7,9 @@ class UserOrderEvaluateController extends GetxController {
String orderNum;
UserOrderEvaluateController(this.orderNum,this.orderInfoModel); // 已完成订单
// 按钮是否可用
bool _enable = false;
bool get enable => _enable;
@override
......@@ -31,5 +33,13 @@ class UserOrderEvaluateController extends GetxController {
}
}
void setCanClick(num double){
if (double > 0){
_enable = true;
}
else{
_enable = false;
}
update();
}
}
library user_order_evaluate;
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_star/custom_rating.dart';
......
......@@ -37,7 +37,57 @@ class _UserOrderEvaluatePageState extends State<UserOrderEvaluatePage> {
title: const Text('订单评价'),
),);
}else{
return GetBuilder<UserOrderEvaluateController>(
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: const Text('订单评价'),
),
body: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
ListView.builder(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (BuildContext context, int index) {
return listItem(
myController.orderInfoModel.bookList![index],
orderEvaluates,controllers);
},
itemCount:
myController.orderInfoModel.bookList?.length,
),
],
),
),
),
SizedBox(
height: 26.w,
),
Container(
margin: EdgeInsets.symmetric(horizontal: 10.w),
child: CustomGradientButton(
text: '提交评价',
isEnabled: myController.enable,
onPressed: () {
for(int i=0;i<orderEvaluates.length;i++){
orderEvaluates[i].comments=controllers[i].text.toString();
}
print(jsonEncode(orderEvaluates));
myController.UpOrderEvaluate(jsonEncode(orderEvaluates));
},
),
),
SizedBox(
height: 41.w,
)
],
),
);
/*GetBuilder<UserOrderEvaluateController>(
init:
UserOrderEvaluateController(widget.orderNum, widget.orderInfoModel),
builder: (controller) => Scaffold(
......@@ -57,7 +107,7 @@ class _UserOrderEvaluatePageState extends State<UserOrderEvaluatePage> {
itemBuilder: (BuildContext context, int index) {
return listItem(
controller.orderInfoModel.bookList![index],
orderEvaluates);
orderEvaluates,controllers,myController);
},
itemCount:
controller.orderInfoModel.bookList?.length,
......@@ -73,9 +123,13 @@ class _UserOrderEvaluatePageState extends State<UserOrderEvaluatePage> {
margin: EdgeInsets.symmetric(horizontal: 10.w),
child: CustomGradientButton(
text: '提交评价',
isEnabled: false,
isEnabled: controller.enable,
onPressed: () {
print('11111111111111111');
for(int i=0;i<orderEvaluates.length;i++){
orderEvaluates[i].comments=controllers[i].text.toString();
}
print(jsonEncode(orderEvaluates));
controller.UpOrderEvaluate(jsonEncode(orderEvaluates));
},
),
),
......@@ -84,17 +138,28 @@ class _UserOrderEvaluatePageState extends State<UserOrderEvaluatePage> {
)
],
),
));
));*/
}
},);
}
Widget listItem(BookListModel bookListModel, List<OrderEvaluate> orderEvaluates) {
Widget listItem(BookListModel bookListModel,
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];
}
int index = orderEvaluates.length-1;
return Container(
margin:
EdgeInsets.only(left: 10.w, top: 10.w, right: 10.w),
......@@ -194,6 +259,7 @@ class _UserOrderEvaluatePageState extends State<UserOrderEvaluatePage> {
),
onRating: (double) {
orderEvaluates[index].rating=double;
myController.setCanClick(double);
print(double);
},
),
......@@ -212,6 +278,7 @@ class _UserOrderEvaluatePageState extends State<UserOrderEvaluatePage> {
hintStyle: TextStyle(
fontSize: 14.w, height: 1.5, color: Colours.c6)),
maxLines: 5,
controller: textFieldController,
hintText: '请简要描述',
),
),
......
......@@ -11,6 +11,7 @@ class _UserSetPageState extends State<UserSetPage> {
late UModel _getModel;
String url =
"https://imtt.dd.qq.com/16891/apk/FA48766BA12A41A1D619CB4B152889C6.apk?fsname=com.estrongs.android.pop_4.2.3.3_10089.apk&csr=1bbd";
@override
Widget build(BuildContext context) {
return Scaffold(
......@@ -21,7 +22,7 @@ class _UserSetPageState extends State<UserSetPage> {
body: Column(
children: [
Container(
margin: EdgeInsets.symmetric(vertical: 10.w,horizontal: 10.w),
margin: EdgeInsets.symmetric(vertical: 10.w, horizontal: 10.w),
padding: EdgeInsets.only(right: 10.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
......@@ -39,63 +40,66 @@ class _UserSetPageState extends State<UserSetPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () async{
onTap: () async {
clearCache();
},
child: Container(
color: Colors.white,
margin: EdgeInsets.only(left: 15.w),
height:45.w,
height: 45.w,
alignment: Alignment.centerLeft,
child: Text('清除缓存',style: TextStyle(fontSize: 14.w,color: Colours.c3)),
child: Text('清除缓存',
style: TextStyle(fontSize: 14.w, color: Colours.c3)),
),
),
Container(
margin: EdgeInsets.only(left: 10.w),
height: 0.5.w,
color:Colours.cF0,
color: Colours.cF0,
),
GestureDetector(
onTap: () async{
onTap: () async {
_checkUpdates();
},
child: Container(
color: Colors.white,
margin: EdgeInsets.only(left: 15.w),
height:45.w,
height: 45.w,
alignment: Alignment.centerLeft,
child: Text('查看更新 >',style: TextStyle(fontSize: 14.w,color: Colours.c3)),
child: Text('查看更新 >',
style: TextStyle(fontSize: 14.w, color: Colours.c3)),
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 10.w),
height: 0.5.w,
color:Colours.cF0,
color: Colours.cF0,
),
GestureDetector(
onTap: (){
onTap: () {
context.pushNamed(Routes.version);
},
child: Container(
color: Colors.white,
margin: EdgeInsets.only(left: 15.w),
height:45.w,
height: 45.w,
alignment: Alignment.centerLeft,
child: Text('版本介绍 >',style: TextStyle(fontSize: 14.w,color: Colours.c3)),
child: Text('版本介绍 >',
style: TextStyle(fontSize: 14.w, color: Colours.c3)),
),
)
],
),
),
GestureDetector(
onTap: () async{
onTap: () async {
final result = await AccountAPI.logout();
if (result){
if (result) {
// Toast.show('退出成功');
CustomToast.loading();
await UserStore.to.logout();
CustomToast.dismiss();
if(context.mounted){
if (context.mounted) {
context.goNamed(Routes.splash);
}
}
......@@ -117,7 +121,10 @@ class _UserSetPageState extends State<UserSetPage> {
],
),
margin: EdgeInsets.symmetric(horizontal: AppTheme.margin),
child: Text('退出登录',style: TextStyle(fontSize: 14.w,color: Colours.c3),),
child: Text(
'退出登录',
style: TextStyle(fontSize: 14.w, color: Colours.c3),
),
),
)
],
......@@ -129,21 +136,21 @@ class _UserSetPageState extends State<UserSetPage> {
ClearCache().clearApplicationCache();
Toast.show('清除完成');
}
void _checkUpdates() async {
UModel model = await MineAPI.update();
_getModel = model;
final packageInfo = await PackageInfo.fromPlatform();
int getVersion = int.parse(model.version!.replaceAll('.', ''));
int localVersion = int.parse(packageInfo.version.replaceAll('.', ''));
if (localVersion < getVersion){
if (localVersion < getVersion) {
_showUpdateDialog(false);
}
}
///Flutter侧处理升级对话框
///[forcedUpgrade] 是否强制升级
_showUpdateDialog(bool forcedUpgrade) {
/*_showUpdateDialog(bool forcedUpgrade) {
showDialog(
context: context,
barrierDismissible: !forcedUpgrade,
......@@ -154,16 +161,70 @@ class _UserSetPageState extends State<UserSetPage> {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0.w),
),
title: Text('发现新版本',style: TextStyle(fontSize: 16.w,fontWeight: Fonts.medium,color: Colours.c3),),
content: Text(_getModel.remarks??'',style: TextStyle(fontSize: 13.w,fontWeight: Fonts.medium,color: Colours.c3),),
// title: Text('发现新版本',style: TextStyle(fontSize: 16.w,fontWeight: Fonts.medium,color: Colours.c3),),
// content: Text(_getModel.remarks??'',style: TextStyle(fontSize: 13.w,fontWeight: Fonts.medium,color: Colours.c3),),
actions: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
height: 25.5.w,
),
SizedBox(
height: 92.w,
width: 92.w,
child: Image.asset('assets/images/app_update.png'),
),
SizedBox(
height: 13.w,
),
Text(
"版本更新",
style: TextStyle(
fontSize: 14.w,
color: Colours.c3,
fontWeight: Fonts.medium),
),
Padding(
padding: EdgeInsets.only(top: 5.5.w),
child: Text(
'发现新版本V${_getModel.version}',
style: TextStyle(
fontSize: 10.w,
color: Colours.c9,
fontWeight: Fonts.medium),
),
),
SizedBox(
height: 22.w,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (!forcedUpgrade)
TextButton(
child: const Text('取消',style: TextStyle(color: Colours.c3),),
child: const Text(
'稍后再说',
style: TextStyle(
color: Colours.c6,
fontSize: 12,
fontWeight: Fonts.medium),
),
onPressed: () => Navigator.of(context).pop(),
),
TextButton(
child: const Text('升级'),
child: const Text(
'立即更新',
style: TextStyle(
color: Colours.cAB1941,
fontSize: 12,
fontWeight: Fonts.medium),
),
onPressed: () {
_appUpdate();
if (!forcedUpgrade) {
......@@ -173,10 +234,132 @@ class _UserSetPageState extends State<UserSetPage> {
),
],
),
],
),
],
),
],
),
);
},
);
}*/
_showUpdateDialog(bool forcedUpgrade) {
showDialog(
context: context,
barrierDismissible: !forcedUpgrade,
builder: (BuildContext context) {
return WillPopScope(
onWillPop: () => Future.value(!forcedUpgrade),
child: AlertDialog(
insetPadding: EdgeInsets.zero, // 设置水平边距
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0.w),
),
// 去除操作按钮区域的内边距
actionsPadding: EdgeInsets.zero,
actions: <Widget>[
Wrap(
children: [
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
height: 25.5.w,
),
SizedBox(
height: 92.w,
width: 92.w,
child: Image.asset('assets/images/app_update.png'),
),
SizedBox(
height: 13.w,
),
Text(
"版本更新",
style: TextStyle(
fontSize: 14.w,
color: Colours.c3,
fontWeight: Fonts.medium),
),
Padding(
padding: EdgeInsets.only(top: 5.5.w),
child: Text(
'发现新版本V${_getModel.version}',
style: TextStyle(
fontSize: 10.w,
color: Colours.c9,
fontWeight: Fonts.medium),
),
),
SizedBox(
height: 22.w,
),
Container(
height: 1, // 设置分割线的高度
width: 216.5.w, // 设置分割线的宽度
color: Colours.cLine, // 设置分割线的颜色
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (!forcedUpgrade)
Padding(padding: EdgeInsets.only(right: 28.w),
child: GestureDetector(
child: const Text(
'稍后再说',
style: TextStyle(
color: Colours.c6,
fontSize: 12,
fontWeight: Fonts.medium),
),
onTap: () => Navigator.of(context).pop(),
),),
Container(
height: 39.5.w, // 设置分割线的高度
width: 1, // 设置分割线的宽度
color: Colours.cLine, // 设置分割线的颜色
),
Padding(padding: EdgeInsets.only(left: 28.w),
child: GestureDetector(
child: const Text(
'立即更新',
style: TextStyle(
color: Colours.cAB1941,
fontSize: 12,
fontWeight: Fonts.medium),
),
onTap: () {
_appUpdate();
if (!forcedUpgrade) {
Navigator.of(context).pop();
}
},
),
),
],
),
],
),
],
),
],
),
);
},
);
}
/// TODO: 苹果市场app地址
_appUpdate() {
UpdateModel model = UpdateModel(
......
......@@ -109,6 +109,8 @@ abstract class Routes {
static const orderAwaiting= 'order_awaiting';
// 已退款订单
static const orderRefunded= 'order_refunded';
// 已退款订单
static const orderSearch= 'order_search';
......@@ -551,6 +553,15 @@ abstract class Routes {
)
)
),
GoRoute( // 订单搜索
path: '/$orderSearch',
name: orderSearch,
pageBuilder: (context, state) =>CupertinoPage(
name: state.uri.toString(),
key: state.pageKey,
child: const OrderSearchPage(),
)
),
]
);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论