diff --git a/assets/mhlangs/zh_CN.json b/assets/mhlangs/zh_CN.json index 9f59b40..a2bee32 100644 --- a/assets/mhlangs/zh_CN.json +++ b/assets/mhlangs/zh_CN.json @@ -165,5 +165,11 @@ "注销账号":"注销账号", "退出成功":"退出成功", "退出失败":"退出失败" - } + }, + "操作成功": "操作成功", + "关于我们": "关于我们", + "用户协议": "用户协议", + "隐私协议": "隐私协议", + "退出登录": "退出登录", + "注销账号": "注销账号" } \ No newline at end of file diff --git a/lib/common/color/ServiceConstant.dart b/lib/common/color/ServiceConstant.dart index b97a506..82d7f18 100644 --- a/lib/common/color/ServiceConstant.dart +++ b/lib/common/color/ServiceConstant.dart @@ -31,6 +31,7 @@ class ServiceConstant { static String city_data = "/api/city/data/info"; //城市数据 static String address_list = "/api/addresss/list"; //查询地址列表 static String add_address = "/api/addresss/info"; //添加地址 + static String logService = "$service_address/vsbs_log"; static const String webSocketService = "wss://$baseHost/vsbs_ws_gateway/ws"; diff --git a/lib/controller/mh_controller/apply_repair_controller.dart b/lib/controller/mh_controller/apply_repair_controller.dart index f900fb6..45ae88d 100644 --- a/lib/controller/mh_controller/apply_repair_controller.dart +++ b/lib/controller/mh_controller/apply_repair_controller.dart @@ -1,13 +1,20 @@ +import 'dart:convert'; + +import 'package:EasyDartModule/EasyDartModule.dart'; import 'package:ef/ef.dart'; +import 'package:dio/dio.dart' as dio; import 'package:flutter/material.dart'; +import 'package:img_picker/img_picker.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:vbvs_app/common/color/ServiceConstant.dart'; import 'package:vbvs_app/common/color/repair_status.dart'; +import 'package:vbvs_app/common/util/DailyLogUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/myDialog/my_dialog_controller.dart'; import 'package:vbvs_app/common/util/requestWithLog.dart'; import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart'; import 'package:vbvs_app/controller/user_info_controller.dart'; +import 'package:vbvs_app/model/api_response.dart'; import 'package:vbvs_app/model/user_data.dart'; part 'apply_repair_controller.g.dart'; @@ -17,11 +24,11 @@ class ApplyRepairModel { int? id; //报修id String? apply_name; //申请人名称 String? tel; //手机号 - String? address; //地址 + String? desc; //问题描述 DateTime? create_time; //创建时间 - String? device_type; //类型 床,床垫 不能为空 + int? device_type; //类型 床,床垫 不能为空 String? device_category; //型号 不能为空 String? device_id; //序列号 设备id 不能为空 @@ -55,168 +62,179 @@ class ApplyRepairController extends GetControllerEx { attr = GetModel(ApplyRepairModel()).obs; } - // //上传图片 - // Future uploadImg() async { - // final ImagePicker picker = ImagePicker(); - // final XFile? image = await picker.pickImage(source: ImageSource.gallery); - // final user = Supabase.instance.client.auth.currentUser; - // try { - // if (image != null) { - // int fileSize = await image.length(); // 获取图片大小,单位为字节 - // if (fileSize > 1024 * 1024 * 5) { - // // 1 MB = 1024 * 1024 bytes - // showToast("上传图片不能超过5MB"); - // return; - // } - // final filePath = image.path; // 获取文件路径 - // final fileExtension = p.extension(filePath); // 获取文件扩展名,包括点(.) - // // 获取当前日期并格式化为 yyyy-MM-dd - // final String folderName = - // DateFormat('yyyy-MM-dd').format(DateTime.now()); - // final file = File(image.path); - // // 构造文件路径,文件会被上传到 record_img 文件夹下的当天日期文件夹 - // var response = await ef.client.storage - // .from(model.img_bucket!) - // .upload('$folderName/${Uuid().v4()}$fileExtension', file); - // if (response != null) { - // String publicUrl = - // ef.client.storage.from(model.img_bucket!).getPublicUrl(response); - - // print('文件上传成功: $response'); - // print('文件上传成功: $publicUrl'); - // String prefixToRemove = 'mianhuatang_repair/'; - // model.issue_img!.add(response.startsWith(prefixToRemove) - // ? response.substring(prefixToRemove.length) - // : response); - // updateAll(); - // } - // print('/$model.img_bucket'); - // } else { - // print('未选择图片'); - // return; - // } - // } catch (e) { - // print('上传失败: $e'); - // } - // } - - //提交 - Future submitRepair(BuildContext context) async { - //tmp - // return ''; - String message = ''; - final MyDialogController myDialogController = - Get.find(); - if (model.device_type == null || model.device_type!.isEmpty) { - message = '请选择设备类型!'; - showToast(message); - return message; - } - if (model.device_category == null || model.device_category!.isEmpty) { - message = '请输入设备型号!'; - showToast(message); - return message; - } - if (model.device_id == null || model.device_id!.isEmpty) { - message = '请输入设备序列号id!'; - showToast(message); - return message; - } - if (model.apply_name == null || model.apply_name!.isEmpty) { - message = '请输入姓名!'; - showToast(message); - return message; - } - RegExp nameRegExp = RegExp(r'^[\u4e00-\u9fa5]{2,4}$'); - - if (!nameRegExp.hasMatch(model.apply_name!)) { - message = '姓名必须为2到4个汉字!'; - showToast(message); - return message; - } - if (model.tel == null || model.tel!.isEmpty) { - message = '请输入手机号!'; - showToast(message); - return message; - } - if (!MyUtils.isValidPhoneNumber(model.tel!)) { - message = '无效的手机号!'; - showToast(message); - return message; - } - if (model.address == null || model.address!.isEmpty) { - message = '请输入地址!'; - showToast(message); - return message; - } - if (model.desc == null || model.desc!.isEmpty) { - message = '请输入问题描述!'; - showToast(message); - return message; - } - if (model.issue_img == null || model.issue_img!.isEmpty) { - message = '请至少上传一张问题图片!'; - showToast(message); - return message; - } - model.status = RepairStatus.pending; - // await repairRepository.saveRepair(model); - String type = "repair_submit_${model.device_id}"; - String serviceAddress = ServiceConstant.service_address; - String serviceName = ServiceConstant.server_service; - String serviceApi = ServiceConstant.submit_repair; - String queryUrl = "$serviceAddress$serviceName$serviceApi?type=$type"; - - // 组织请求数据 - final UserInfoController userInfoController = - Get.find(); - UserModel user = userInfoController.model.user!; - - Map data = { - 'apply_name': model.apply_name, - 'address': model.address, - 'desc': model.desc, - 'device_type': model.device_type, - 'issue_img': model.issue_img, - 'tel': model.tel, - 'uid': user.uid, - 'device_category': model.device_category, - 'device_id': model.device_id, - 'device_name': model.device_name, - 'status': model.status, - }; - - // 发起插入请求(这里相当于之前的 saveRepair) - requestWithLog( - logTitle: "提交报修", - method: MyHttpMethod.post, - queryUrl: queryUrl, - data: data, - onSuccess: (res) { - if (res.data is List && res.data.isNotEmpty) { - final inserted = res.data[0]; - model.id = inserted['id']; - model.create_time = DateTime.tryParse(inserted['create_time']); - // TextSelectionOverlay - // // saveRepairHistor - // saveRepairHistory( - // RepairProcessModel() - // ..status = model.status - // ..record_id = inserted['id'], - // ); - showToast("提交成功!"); - } else { - showToast("提交失败:未返回数据!"); + Future uploadImg() async { + EasyDartModule.logger.info("请求上传图片"); + DailyLogUtils.writeLog("请求上传图片"); + final ImagePicker picker = ImagePicker(); + final XFile? image = await picker.pickImage(source: ImageSource.gallery); + try { + ApiResponse apiResponse = ApiResponse(code: -1, msg: "我的.头像上传失败".tr); + if (image != null) { + int fileSize = await image.length(); // 获取图片大小,单位为字节 + if (fileSize > 1048576 * 5) { + apiResponse.msg = "上传限制".tr; + return apiResponse; } - }, - onFailure: (res) { - showToast("提交失败!"); - }, - ); - - return message; + String serviceAddress = ServiceConstant.service_address; + String serviceName = ServiceConstant.server_service; + String serviceApi = ServiceConstant.upload_file; + String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; + String? language = ""; + if (languageController.selectLanguage != null) { + language = languageController.selectLanguage.value!.language_code; + } + if (language != null && language.isNotEmpty) { + if (queryUrl.contains("?")) { + queryUrl += "&lang=$language"; + } else { + queryUrl += "?lang=$language"; + } + } + var formData = dio.FormData.fromMap({ + "type": 2, + "file": await dio.MultipartFile.fromFile( + image.path, // 确保 image 是 File 类型 + filename: image.path.split('/').last, + ), + }); + var response = await EasyDartModule.dio.post(queryUrl, data: formData); + if (response != null) { + var responseData = response.data is String + ? jsonDecode(response.data) + : response.data; + ApiResponse res = + ApiResponse.fromJson(responseData, (object) => object); + model.issue_img!.add(res.data['path']); + updateAll(); + MyUtils.formatResponse(res, "我的.上传成功".tr, "我的.头像上传失败".tr); + updateAll(); + return res; + } else { + return ApiResponse(code: -1, msg: "服务器.失败".tr); + } + } else { + apiResponse.msg = "我的.未选择图片".tr; + return apiResponse; + } + } catch (e) { + EasyDartModule.logger.error("上传图片失败->$e"); + DailyLogUtils.writeError("上传图片失败->$e"); + return ApiResponse(code: -1, msg: "服务器.失败".tr); + } } + // //提交 + // Future submitRepair(BuildContext context) async { + // //tmp + // // return ''; + // String message = ''; + // final MyDialogController myDialogController = + // Get.find(); + // if (model.device_type == null || model.device_type!.isEmpty) { + // message = '请选择设备类型!'; + // showToast(message); + // return message; + // } + // if (model.device_category == null || model.device_category!.isEmpty) { + // message = '请输入设备型号!'; + // showToast(message); + // return message; + // } + // if (model.device_id == null || model.device_id!.isEmpty) { + // message = '请输入设备序列号id!'; + // showToast(message); + // return message; + // } + // if (model.apply_name == null || model.apply_name!.isEmpty) { + // message = '请输入姓名!'; + // showToast(message); + // return message; + // } + // RegExp nameRegExp = RegExp(r'^[\u4e00-\u9fa5]{2,4}$'); + + // if (!nameRegExp.hasMatch(model.apply_name!)) { + // message = '姓名必须为2到4个汉字!'; + // showToast(message); + // return message; + // } + // if (model.tel == null || model.tel!.isEmpty) { + // message = '请输入手机号!'; + // showToast(message); + // return message; + // } + // if (!MyUtils.isValidPhoneNumber(model.tel!)) { + // message = '无效的手机号!'; + // showToast(message); + // return message; + // } + + // if (model.desc == null || model.desc!.isEmpty) { + // message = '请输入问题描述!'; + // showToast(message); + // return message; + // } + // if (model.issue_img == null || model.issue_img!.isEmpty) { + // message = '请至少上传一张问题图片!'; + // showToast(message); + // return message; + // } + // model.status = RepairStatus.pending; + // // await repairRepository.saveRepair(model); + // String type = "repair_submit_${model.device_id}"; + // String serviceAddress = ServiceConstant.service_address; + // String serviceName = ServiceConstant.server_service; + // String serviceApi = ServiceConstant.submit_repair; + // String queryUrl = "$serviceAddress$serviceName$serviceApi?type=$type"; + + // // 组织请求数据 + // final UserInfoController userInfoController = + // Get.find(); + // UserModel user = userInfoController.model.user!; + + // Map data = { + // 'apply_name': model.apply_name, + // 'desc': model.desc, + // 'device_type': model.device_type, + // 'issue_img': model.issue_img, + // 'tel': model.tel, + // 'uid': user.uid, + // 'device_category': model.device_category, + // 'device_id': model.device_id, + // 'device_name': model.device_name, + // 'status': model.status, + // }; + + // // 发起插入请求(这里相当于之前的 saveRepair) + // requestWithLog( + // logTitle: "提交报修", + // method: MyHttpMethod.post, + // queryUrl: queryUrl, + // data: data, + // onSuccess: (res) { + // if (res.data is List && res.data.isNotEmpty) { + // final inserted = res.data[0]; + // model.id = inserted['id']; + // model.create_time = DateTime.tryParse(inserted['create_time']); + // // TextSelectionOverlay + // // // saveRepairHistor + // // saveRepairHistory( + // // RepairProcessModel() + // // ..status = model.status + // // ..record_id = inserted['id'], + // // ); + // showToast("提交成功!"); + // } else { + // showToast("提交失败:未返回数据!"); + // } + // }, + // onFailure: (res) { + // showToast("提交失败!"); + // }, + // ); + + // return message; + // } + Future getDeviceList() async { // UserModel loginUser = userInfoController.model.user!; DeviceListController deviceListController = Get.find(); @@ -226,22 +244,4 @@ class ApplyRepairController extends GetControllerEx { applyRepairController.model.device_list = aa; } - // String getPublicUrl(String path) { - // try { - // String bucketPath = '${model.img_bucket}/'; - // if (path.contains(bucketPath)) { - // int firstIndex = path.indexOf(bucketPath); - // // int secondIndex = - // // response.indexOf(bucketPath, firstIndex + bucketPath.length); - // if (firstIndex != -1) { - // // 去掉第一个存储桶路径 - // path = path.replaceFirst(bucketPath, '', firstIndex); - // } - // } - // String publicUrl = - // ef.client.storage.from(model.img_bucket!).getPublicUrl(path); - // return publicUrl; - // } catch (e) {} - // return ''; - // } } diff --git a/lib/controller/mh_controller/apply_repair_controller.g.dart b/lib/controller/mh_controller/apply_repair_controller.g.dart index 8a5b4d0..46a2712 100644 --- a/lib/controller/mh_controller/apply_repair_controller.g.dart +++ b/lib/controller/mh_controller/apply_repair_controller.g.dart @@ -11,12 +11,11 @@ ApplyRepairModel _$ApplyRepairModelFromJson(Map json) => ..id = (json['id'] as num?)?.toInt() ..apply_name = json['apply_name'] as String? ..tel = json['tel'] as String? - ..address = json['address'] as String? ..desc = json['desc'] as String? ..create_time = json['create_time'] == null ? null : DateTime.parse(json['create_time'] as String) - ..device_type = json['device_type'] as String? + ..device_type = (json['device_type'] as num?)?.toInt() ..device_category = json['device_category'] as String? ..device_id = json['device_id'] as String? ..device_name = json['device_name'] as String? @@ -40,7 +39,6 @@ Map _$ApplyRepairModelToJson(ApplyRepairModel instance) => 'id': instance.id, 'apply_name': instance.apply_name, 'tel': instance.tel, - 'address': instance.address, 'desc': instance.desc, 'create_time': instance.create_time?.toIso8601String(), 'device_type': instance.device_type, diff --git a/lib/pages/mh_page/repair_history_page.dart b/lib/pages/mh_page/repair_history_page.dart index f741981..edada1c 100644 --- a/lib/pages/mh_page/repair_history_page.dart +++ b/lib/pages/mh_page/repair_history_page.dart @@ -15,35 +15,37 @@ import '../../controller/mh_controller/apply_repair_controller.dart'; import '../../controller/mh_controller/repair_info_controller.dart'; class RepairHistoryListPage extends GetView { + Map data; + RepairHistoryListPage({Key? key, required this.data}); final scaffoldKey = GlobalKey(); + BoxConstraints? bodysize; @override Widget build(BuildContext context) { - controller.model.applyRepairModel = ApplyRepairModel() - ..id = 1001 - ..apply_name = '张三' - ..tel = '13812345678' - ..address = '北京市海淀区清华东路66号' - ..desc = '床垫传感器失灵,无法监测心率和呼吸' - ..create_time = DateTime.parse('2025-05-01 10:00:00') - ..device_type = '床垫' - ..device_category = 'BY-H' - ..device_id = 'BD202505011001' - ..device_name = '智能床垫 BY-H 型号' - ..issue_img = [ - 'https://example.com/img1.jpg', - 'https://example.com/img2.jpg' - ] - ..imagesLImit = 3 - ..img_bucket = 'mianhuatang_repair' - ..status = '待处理' - ..select_device = '床垫/BY-H/智能床垫' - ..device_list = ['床垫/BY-H/智能床垫', '床垫/BY-A/智能床垫', '床垫/BY-C/智能床垫'] - ..score = null - ..score_time = null - ..messageType = 1 - ..repairId = 1001; + // controller.model.applyRepairModel = ApplyRepairModel() + // ..id = 1001 + // ..apply_name = '张三' + // ..tel = '13812345678' + // ..desc = '床垫传感器失灵,无法监测心率和呼吸' + // ..create_time = DateTime.parse('2025-05-01 10:00:00') + // ..device_type = 1 + // ..device_category = 'BY-H' + // ..device_id = 'BD202505011001' + // ..device_name = '智能床垫 BY-H 型号' + // ..issue_img = [ + // 'https://example.com/img1.jpg', + // 'https://example.com/img2.jpg' + // ] + // ..imagesLImit = 3 + // ..img_bucket = 'mianhuatang_repair' + // ..status = '待处理' + // ..select_device = '床垫/BY-H/智能床垫' + // ..device_list = ['床垫/BY-H/智能床垫', '床垫/BY-A/智能床垫', '床垫/BY-C/智能床垫'] + // ..score = null + // ..score_time = null + // ..messageType = 1 + // ..repairId = 1001; controller.model.repairProcessList = [ RepairProcessModel() @@ -154,10 +156,7 @@ class RepairHistoryListPage extends GetView { -1, 0), child: Text( // 'SWES01号智能一键入眠床', - controller - .model - .applyRepairModel! - .device_name ?? + data['device'][0]['name'] ?? '未命名', style: TextStyle( fontFamily: 'Readex Pro', @@ -173,10 +172,8 @@ class RepairHistoryListPage extends GetView { -1, 0), child: Text( '系列:' + - (controller - .model - .applyRepairModel! - .device_category ?? + (data['device'][0][ + 'device_category'] ?? '未命名'), style: TextStyle( fontFamily: 'Readex Pro', @@ -193,11 +190,12 @@ class RepairHistoryListPage extends GetView { -1, 0), child: Text( '类型:' + - (controller - .model - .applyRepairModel! - .device_type ?? - '未命名'), + getDeviceTypeName( + controller + .model + .applyRepairModel + ?.device_type, + ), style: TextStyle( fontFamily: 'Readex Pro', color: const Color( @@ -254,11 +252,9 @@ class RepairHistoryListPage extends GetView { -1, 0), child: Text( '提交时间:' + - (MyUtils.formatDateTime( - controller - .model - .applyRepairModel! - .create_time!)), + (MyUtils.formatDateTimeDay( + data['device'][0][ + 'create_time']!)), style: TextStyle( fontFamily: 'Readex Pro', color: const Color( @@ -274,10 +270,8 @@ class RepairHistoryListPage extends GetView { -1, 0), child: Text( '问题描述:' + - (controller - .model - .applyRepairModel! - .desc ?? + (data['device'][0] + ['desc'] ?? '未命名'), style: TextStyle( fontFamily: 'Readex Pro', @@ -755,4 +749,17 @@ class RepairHistoryListPage extends GetView { return images; } + + String getDeviceTypeName(int? type) { + switch (type) { + case 1: + return '体征检测设备'; + case 2: + return '智能床'; + case 3: + return '智能床垫'; + default: + return '未知设备'; + } + } } diff --git a/lib/pages/mh_page/repair_list.dart b/lib/pages/mh_page/repair_list.dart index 18effa6..57b7580 100644 --- a/lib/pages/mh_page/repair_list.dart +++ b/lib/pages/mh_page/repair_list.dart @@ -41,12 +41,6 @@ class DeviceRepairPage extends GetView { Widget build(BuildContext context) { return LayoutBuilder(builder: (context, cc) { bodysize = cc; - controller.model.repairList = List.generate(4, (index) { - return ApplyRepairModel() - ..device_category = "SWESO1号智能一键入眠床" - ..status = index == 0 ? "已提交" : "已完成" - ..create_time = DateTime(2024, 5, 12, 12, 5, 12); - }); return GestureDetector( onTap: () => FocusScope.of(context).unfocus(), child: Container( @@ -175,54 +169,7 @@ class DeviceRepairPage extends GetView { ))), SizedBox(height: 24.rpx), InkWell( - onTap: () { - // bool isOk = true; - // for (var i = 0; i < 2; i++) { - // var d = controller.model.peopleList[i]; - // print("${d.toJson()}"); - // String before = "人员信息${i == 0 ? "A" : "B"}:"; - // if (isOk && - // d.height != null && - // d.height != "" && - // int.tryParse("${d.height}") == null) { - // showToast("$before身高请输入数字"); - // isOk = false; - // } - // if (isOk && - // d.weight != null && - // d.weight != "" && - // int.tryParse("${d.weight}") == null) { - // showToast("$before体重请输入数字"); - // isOk = false; - // } - // if (isOk && - // d.tel != null && - // d.tel != "" && - // MyUtils.isValidPhoneNumber("${d.tel}") == - // false) { - // showToast("$before请输入正确的电话"); - // isOk = false; - // } - // if (isOk && - // d.emergencyContact != null && - // d.emergencyContact != "" && - // MyUtils.isValidPhoneNumber( - // "${d.emergencyContact}") == - // false) { - // showToast("$before请输入正确的紧急联系人电话"); - // isOk = false; - // } - // if (isOk) { - // controller.savePeoples().then((d) { - // showToast("保存成功", color: color_success); - // }).catchError((d) { - // print("$d"); - // showToast("保存失败"); - // }); - // } - // } - // controller.model.peopleList.forEach((d) {}); - }, + onTap: () {}, child: CustomCard( borderRadius: 16.rpx, gradientDirection: GradientDirection.vertical, @@ -268,119 +215,51 @@ class DeviceRepairPage extends GetView { ), SizedBox(height: 32.rpx), - - // 报修历史列表 - // Expanded( - // child: ListView.builder( - // itemCount: mockData.length, - // itemBuilder: (context, index) { - // final item = mockData[index]; - // return ClickableContainer( - // backgroundColor: Colors.transparent, - // highlightColor: Color(0XFF055466), - // padding: EdgeInsets.only(top: 0), - // onTap: () { - // Get.toNamed("/repairHistoryListPage"); - // }, - // child: Container( - // height: 119.rpx, - // // margin: const EdgeInsets.only(bottom: 10), - // // padding: const EdgeInsets.symmetric( - // // vertical: 12, horizontal: 16), - // decoration: BoxDecoration( - // // color: const Color(0xFF06486F), - // border: Border( - // top: index == 0 - // ? BorderSide( - // color: - // const Color(0xFF929699), - // width: 1.rpx) - // : BorderSide.none, - // bottom: BorderSide( - // color: const Color(0xFF929699), - // width: 1.rpx), - // ), - // ), - // child: Padding( - // padding: EdgeInsets.fromLTRB( - // 17.rpx, 0, 30.rpx, 0), - // child: Row( - // mainAxisAlignment: - // MainAxisAlignment.spaceBetween, - // crossAxisAlignment: - // CrossAxisAlignment.center, - // children: [ - // // 左侧设备信息 - // Column( - // mainAxisAlignment: - // MainAxisAlignment.center, - // crossAxisAlignment: - // CrossAxisAlignment.start, - // children: [ - // Text( - // item.device_name ?? '', - // style: TextStyle( - // color: Colors.white, - // fontSize: 30.rpx), - // ), - // const SizedBox(height: 4), - // Text( - // "提交时间:${item.create_time?.toString().substring(0, 19) ?? ''}", - // style: TextStyle( - // color: Colors.white60, - // fontSize: 20.rpx), - // ), - // ], - // ), - // // 右侧状态 - // Row( - // children: [ - // Text( - // item.status ?? '', - // style: TextStyle( - // color: Colors.white, - // fontSize: 26.rpx), - // ), - // Icon(Icons.arrow_forward_ios, - // color: Colors.white, - // size: 30.rpx), - // ], - // ) - // ], - // ), - // ))); - // }, - // ), - // ), - - Obx(() { - return Visibility( - visible: controller.model.repairList != null && - controller.model.repairList!.isNotEmpty, - replacement: EmptyMessageWidget(), - child: Expanded( - child: Obx(() => ListView( - controller: - scrollController, // 绑定 ScrollController - shrinkWrap: true, - scrollDirection: Axis.vertical, - children: (controller.model.repairList - .asMap() - .entries - .map((e) => RepairHistoryWidget( - index: e.key, - repairListController: controller)) - .toList() as List) - // .divide(const SizedBox( - // height: 13, - // )) - // .addToEnd(SizedBox( - // height: AppConstants.list_end_height, - // )) - )), - ), - ); - }), + // Obx(() { + // return Visibility( + // visible: controller.model.repairList != null && + // controller.model.repairList!.isNotEmpty, + // replacement: EmptyMessageWidget(), + // child: Expanded( + // child: Obx(() => ListView( + // controller: + // scrollController, // 绑定 ScrollController + // shrinkWrap: true, + // scrollDirection: Axis.vertical, + // children: (controller.model.repairList + // .asMap() + // .entries + // .map((e) => RepairHistoryWidget( + // index: e.key, + // repairListController: controller)) + // .toList() as List))), + // ), + // ); + // }), + // 替换原来的 Obx(() => Visibility(...)) + Expanded( + child: Obx(() { + final hasData = + controller.model.repairList != null && + controller.model.repairList!.isNotEmpty; + return hasData + ? ListView( + controller: scrollController, + padding: EdgeInsets.zero, + shrinkWrap: true, + children: controller.model.repairList + .asMap() + .entries + .map((e) => RepairHistoryWidget( + index: e.key, + repairListController: + controller, + )) + .toList(), + ) + : EmptyMessageWidget(); + }), + ), ], ), ))), diff --git a/lib/pages/mh_page/user/page/edit_userinfo_page.dart b/lib/pages/mh_page/user/page/edit_userinfo_page.dart index fe2c56f..7a1cc12 100644 --- a/lib/pages/mh_page/user/page/edit_userinfo_page.dart +++ b/lib/pages/mh_page/user/page/edit_userinfo_page.dart @@ -82,7 +82,7 @@ class _UpdateUserPageState extends State { ), ), Positioned( - left: 0, + left: 20.rpx, child: returnIconButtomNew, ), Positioned( diff --git a/lib/pages/repair/apply_repair_page.dart b/lib/pages/repair/apply_repair_page.dart index 78fa88a..26d5318 100644 --- a/lib/pages/repair/apply_repair_page.dart +++ b/lib/pages/repair/apply_repair_page.dart @@ -491,7 +491,6 @@ class _ApplyRepairPageState extends State { cursorColor: themeController.currentColor.sc3, onChanged: onChanged, ), - ), ), ].divide(SizedBox(width: 24.rpx)), diff --git a/pubspec.yaml b/pubspec.yaml index 0c0a774..52b019d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -48,6 +48,7 @@ dependencies: fluwx: ^5.5.2 connectivity_plus: ^6.1.4 google_sign_in: ^6.2.1 + azlistview: ^2.0.0 path: ^1.8.0 flutter_pdfview: ^1.4.0+1 flutter_switch: ^0.3.2 @@ -55,6 +56,7 @@ dependencies: flutter_slidable: ^3.1.1 flutter_city_picker: ^2.1.1 weather: ^3.1.1 + lpinyin: ^2.0.3 geocoding: ^2.1.0 # fl_chart: ^1.0.0 video_player: ^2.9.5 @@ -65,7 +67,7 @@ dependencies: git: url: https://gitea.wslpc.real.he-info.cn:94/flutter/easyweb.git ref: main - archive: ^4.0.0 + archive: ^4.0.0 dev_dependencies: