地址接口的视线

This commit is contained in:
czz
2025-06-21 08:55:52 +08:00
parent d94a0c8a6c
commit 41adcedad7
38 changed files with 2399 additions and 2223 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,45 +1,45 @@
class ServiceConstant { class ServiceConstant {
static const String baseHost = "vsbs-test.he-info.cn";//服务地址 static const String baseHost = "vsbs-test.he-info.cn"; //服务地址
// static const String baseHost = "vsbst-api.he-info.cn";//服务地址 // static const String baseHost = "vsbst-api.he-info.cn";//服务地址
static const String service_address = "http://$baseHost"; static const String service_address = "http://$baseHost";
static String server_service = "/vsbs_app_server";//服务名称 static String server_service = "/vsbs_app_server"; //服务名称
static String send_code = "/api/verifycode/send";//发送验证码 static String send_code = "/api/verifycode/send"; //发送验证码
static String login = "/api/user/login";//登录 static String login = "/api/user/login"; //登录
static String get_bluetooth_device_status = "/api/device/status/info";//设备绑定状态 static String get_bluetooth_device_status =
static String device_bind = "/api/device/bind";//设备绑定 "/api/device/status/info"; //设备绑定状态
static String device_type = "/api/device/type/list";//设备类型 static String device_bind = "/api/device/bind"; //设备绑定
static String upload_file = "/api/file/info";//上传文件 static String device_type = "/api/device/type/list"; //设备类型
static String user_info = "/api/user/info";//更新用户资料,查询用户信息 static String upload_file = "/api/file/info"; //上传文件
static String device_list = "/api/device/list";//绑定设备列表 static String user_info = "/api/user/info"; //更新用户资料,查询用户信息
static String person_info = "/api/personnel/info";//用户资料 static String device_list = "/api/device/list"; //绑定设备列表
static String sleep_report = "/api/device/sleep/data";//睡眠报告 static String person_info = "/api/personnel/info"; //用户资料
static String device_share = "/api/device/share";//分享设备 static String sleep_report = "/api/device/sleep/data"; //睡眠报告
static String message_list = "/api/mesasge/list";//消息列表 static String device_share = "/api/device/share"; //分享设备
static String message_read = "/api/mesasge/read";//消息未读数量 static String message_list = "/api/mesasge/list"; //消息列表
static String device_show = "/api/device/bind";//更新设备绑定 static String message_read = "/api/mesasge/read"; //消息未读数量
static String disease_list = "/api/personnel/disease/list";//获取疾病类型 static String device_show = "/api/device/bind"; //更新设备绑定
static String share_deleted = "";//删除分享 static String disease_list = "/api/personnel/disease/list"; //获取疾病类型
static String start_calibration = "/api/caibration";//开始校准 static String share_deleted = ""; //删除分享
static String calibration_process = "/api/caibration";//校准进度 static String start_calibration = "/api/caibration"; //开始校准
static String submit_repair = "/api/device/repair";//提交报修 static String calibration_process = "/api/caibration"; //校准进度
static String user_setting = "/api/user/config";//查询和更新用户自定义配置 static String submit_repair = "/api/device/repair"; //提交报修
static String user_setting = "/api/user/config"; //查询和更新用户自定义配置
static String room_list = "/api/room/info"; //查询房间列表 static String room_list = "/api/room/info"; //查询房间列表
static String issue_list = "/api/help/list"; //问题与帮助列表 static String issue_list = "/api/help/list"; //问题与帮助列表
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 String logService = "$service_address/vsbs_log";
static const String webSocketService = "wss://$baseHost/vsbs_ws_gateway/ws"; static const String webSocketService = "wss://$baseHost/vsbs_ws_gateway/ws";
static const String sleep_token = "HdAMjzqiYQKsmHRyEFKhfRGQ"; static const String sleep_token = "HdAMjzqiYQKsmHRyEFKhfRGQ";
static const String sleep_report_url = "https://alltoone.he-info.cn/h5/#/mattress/sleep/sleep"; static const String sleep_report_url =
"https://alltoone.he-info.cn/h5/#/mattress/sleep/sleep";
static const String user_register = "/api/user/register";//用户注册
static const String user_forgot = "/api/user/forgot";//找回密码
static const String user_changePassword = "/api/user/changePassword";//修改密码
static const String personnel_info = "/api/personnel/info";//人员信息列表
static const String user_register = "/api/user/register"; //用户注册
static const String user_forgot = "/api/user/forgot"; //找回密码
static const String user_changePassword = "/api/user/changePassword"; //修改密码
static const String personnel_info = "/api/personnel/info"; //人员信息列表
} }

View File

@@ -1,10 +1,15 @@
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_city_picker/model/address.dart'; import 'package:flutter_city_picker/model/address.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/model/user_data.dart'; import 'package:vbvs_app/model/user_data.dart';
import 'package:lpinyin/lpinyin.dart';
part 'address_controller.g.dart'; part 'address_controller.g.dart';
@JsonSerializable() @JsonSerializable()
@@ -14,10 +19,11 @@ class AddressModel {
String? city; //市 String? city; //市
String? county; //区 String? county; //区
String? street; //街道 String? street; //街道
String? detail; //详细信息 String? address; //详细信息
String? name; //名字 String? name; //名字
String? phone; //手机号 String? tel; //手机号
bool? ischecked = false; //是否默认 @JsonKey(name: 'default')
int? default_ = 0; //是否默认
int currentType = 0; int currentType = 0;
String? all_address; String? all_address;
@@ -52,105 +58,161 @@ class AddressController extends GetControllerEx<AddressModel> {
address["street"] = model.addressList![3].name; // 第四个元素为街道 address["street"] = model.addressList![3].name; // 第四个元素为街道
} }
} }
address['detail'] = model.detail; address['address'] = model.address;
address['name'] = model.name; address['name'] = model.name;
address['phone'] = model.phone; address['tel'] = model.tel;
address['isChecked'] = model.ischecked; address['default'] = model.default_;
// try { String serviceAddress = ServiceConstant.service_address;
// final data = await ef.client.rpc("get_now_datetime"); String serviceName = ServiceConstant.server_service;
// final response = await ef.client.from("app_user_address").update({ String serviceApi = ServiceConstant.add_address;
// 'province': address["province"], String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
// 'city': address["city"], await requestWithLog(
// 'county': address["county"], logTitle: "更新地址",
// 'street': address["street"], method: MyHttpMethod.put,
// 'detail': address["detail"], queryUrl: queryUrl,
// 'name': address["name"], data: {
// 'phone': address["phone"], "id": address['_id'],
// 'ischecked': address['isChecked'] ? 1 : 0, "default": address['default'],
// 'update_time': "name": address['name'],
// DateFormat("yyyy-MM-dd HH:mm:ss").parse("$data").toString(), "tel": address['tel'],
// }).eq("id", address['id']); // "area": address['all_address'],
// } catch (e) { "address": address['address'],
// print('Error fetching repairs: $e'); "province": address['province'],
// return e.toString(); "city": address['city'],
// } "county": address['county'],
"street": address['street'],
},
onSuccess: (res) {
if (res.code == 1) {
print("更新地址成功");
}
},
);
return ''; return '';
} }
addAddress(AddressModel model) async { Future<void> addAddress(AddressModel model, BuildContext context) async {
// try { try {
// final UserInfoController userInfoController = final UserInfoController userInfoController =
// Get.find<UserInfoController>(); Get.find<UserInfoController>();
// UserModel user = userInfoController.model.user!; UserModel user = userInfoController.model.user!;
// // 设置省市区街道名称 // 设置省市区街道名称
// if (model.addressList != null && model.addressList!.isNotEmpty) { if (model.addressList != null && model.addressList!.isNotEmpty) {
// if (model.addressList!.length > 0) if (model.addressList!.length > 0)
// model.province = model.addressList![0].name; // 第一个元素为省 model.province = model.addressList![0].name;
// if (model.addressList!.length > 1) if (model.addressList!.length > 1)
// model.city = model.addressList![1].name; // 第二个元素为市 model.city = model.addressList![1].name;
// if (model.addressList!.length > 2) if (model.addressList!.length > 2)
// model.county = model.addressList![2].name; // 第三个元素为区 model.county = model.addressList![2].name;
// if (model.addressList!.length > 3) if (model.addressList!.length > 3)
// model.street = model.addressList![3].name; // 第四个元素为街道 model.street = model.addressList![3].name;
// } }
// // 查询数据库是否已有该用户的地址 // 查询现有地址判断是否设置为默认
// final existingAddresses = await ef.client String listUrl =
// .from('app_user_address') "${ServiceConstant.service_address}${ServiceConstant.server_service}${ServiceConstant.address_list}";
// .select() final listRes = await requestWithLog(
// .eq('user_id', user.uid!); logTitle: "查询地址列表",
method: MyHttpMethod.get,
// // 如果没有地址,将新增地址默认选中 queryUrl: listUrl,
// if (existingAddresses.isEmpty) { );
// model.ischecked = true; if (listRes.data.length <= 0) {
// } else if (model.ischecked == true) { model.default_ = 1;
// // 如果新地址被选中,将其他地址的 `ischecked` 字段设为 `0` }
// await ef.client // 添加地址
// .from('app_user_address') String addUrl =
// .update({'ischecked': 0}).eq('user_id', user.uid!); "${ServiceConstant.service_address}${ServiceConstant.server_service}${ServiceConstant.add_address}";
// } final addRes = await requestWithLog(
logTitle: '添加地址',
// // 添加新地址 method: MyHttpMethod.post,
// final response = await ef.client.from('app_user_address').insert({ queryUrl: addUrl,
// 'province': model.province, data: model.toJson(),
// 'city': model.city, );
// 'county': model.county,
// 'street': model.street, if (addRes.code == 1) {
// 'detail': model.detail, TopSlideNotification.show(context, text: "添加成功".tr);
// 'name': model.name, }
// 'phone': model.phone, } catch (e) {
// 'ischecked': model.ischecked! ? 1 : 0, print(e);
// 'user_id': user.uid, }
// }); }
// } catch (e) {
// print(e); List<dynamic>? _cityCache;
// }
Future<void> _loadCityDataOnce() async {
if (_cityCache != null) return;
String country = "CN";
String queryUrl =
"${ServiceConstant.service_address}${ServiceConstant.server_service}${ServiceConstant.city_data}?country=$country";
await requestWithLog(
logTitle: "查询城市数据",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
if (res.data != null && res.data is List) {
// 提取所有 data 并展开成一个统一列表
_cityCache = res.data
.where((e) => e["data"] != null && e["data"] is List)
.expand((e) => e["data"] as List)
.toList();
}
},
);
} }
Future<List<AddressNode>> getData({int? level, int? pid}) async {
// 构建查询 // 构建查询
return []; Future<List<AddressNode>> getData({int? level, String? parentCode}) async {
// var query = ef.from("app_area_city").select(); await _loadCityDataOnce(); // 确保只加载一次
if (_cityCache == null) return [];
// // 如果 pid 不为 null添加 pid 的条件 // 获取省级数据
// if (pid != null) { if (parentCode == null || parentCode.isEmpty) {
// query = query.eq("pid", pid); return _cityCache!.map<AddressNode>((item) {
// } return AddressNode.fromJson({
// if (level != null) { "name": item["name"],
// query = query.eq("deep", level); "code": item["code"],
// } "letter": _getLetter(item["name"]),
// List arr = await query; });
}).toList();
}
// List<AddressNode> addressNodes = arr.map((item) { // 递归查找下级
// return AddressNode.fromJson({ final parent = _findNodeByCode(_cityCache!, parentCode);
// "name": item["ext_name"], // ext_name 对应 name if (parent == null || parent["children"] == null) return [];
// "code": item["id"], // id 对应 code
// "letter": item["pinyin_prefix_upper"], // pinyin_prefix_upper 对应 letter
// });
// }).toList();
// return addressNodes; List children = parent["children"];
return children.map<AddressNode>((item) {
return AddressNode.fromJson({
"name": item["name"],
"code": item["code"],
"letter": _getLetter(item["name"]),
});
}).toList();
}
Map<String, dynamic>? _findNodeByCode(List<dynamic> list, String code) {
for (var item in list) {
if (item is Map<String, dynamic>) {
if (item["code"] == code) return item;
if (item["children"] != null && item["children"] is List) {
var result = _findNodeByCode(item["children"], code);
if (result != null) return result;
}
}
}
return null;
}
// 工具:中文首字母转大写英文(你也可以用更专业的拼音库)
String _getLetter(String name) {
if (name.isEmpty) return "#";
String pinyin = PinyinHelper.getPinyinE(name,
separator: '', defPinyin: '', format: PinyinFormat.WITHOUT_TONE);
if (pinyin.isEmpty) return "#";
return pinyin[0].toUpperCase();
} }
} }

View File

@@ -11,10 +11,10 @@ AddressModel _$AddressModelFromJson(Map<String, dynamic> json) => AddressModel()
..city = json['city'] as String? ..city = json['city'] as String?
..county = json['county'] as String? ..county = json['county'] as String?
..street = json['street'] as String? ..street = json['street'] as String?
..detail = json['detail'] as String? ..address = json['address'] as String?
..name = json['name'] as String? ..name = json['name'] as String?
..phone = json['phone'] as String? ..tel = json['tel'] as String?
..ischecked = json['ischecked'] as bool? ..default_ = (json['default'] as num?)?.toInt()
..currentType = (json['currentType'] as num).toInt() ..currentType = (json['currentType'] as num).toInt()
..all_address = json['all_address'] as String?; ..all_address = json['all_address'] as String?;
@@ -24,10 +24,10 @@ Map<String, dynamic> _$AddressModelToJson(AddressModel instance) =>
'city': instance.city, 'city': instance.city,
'county': instance.county, 'county': instance.county,
'street': instance.street, 'street': instance.street,
'detail': instance.detail, 'address': instance.address,
'name': instance.name, 'name': instance.name,
'phone': instance.phone, 'tel': instance.tel,
'ischecked': instance.ischecked, 'default': instance.default_,
'currentType': instance.currentType, 'currentType': instance.currentType,
'all_address': instance.all_address, 'all_address': instance.all_address,
}; };

View File

@@ -1,6 +1,7 @@
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
part 'address_list_controller.g.dart'; part 'address_list_controller.g.dart';
@@ -23,42 +24,48 @@ class AddressListController extends GetControllerEx<AddressListModel> {
attr = GetModel(AddressListModel()).obs; attr = GetModel(AddressListModel()).obs;
} }
// getAddressList() async { getAddressList() async {
// await ApiService.request.get("/api/address/info/list").then((d) { String serviceAddress = ServiceConstant.service_address;
// model.addressList = d.data["data"] ?? []; String serviceName = ServiceConstant.server_service;
// updateAll(); String serviceApi = ServiceConstant.address_list;
// }).catchError((e) { String queryUrl = "$serviceAddress$serviceName$serviceApi";
// print("$e");
// });
// }
// //更新默认 requestWithLog(
// Future<void> updateDefault(address) async { logTitle: '查询地址列表',
// var id = address['id']; method: MyHttpMethod.get,
// var uid = address['userId']; queryUrl: queryUrl,
// try { onSuccess: (res) {
// await ef.client // 安全检查 res.data 是否为 List
// .from("app_user_address") if (res.data != null && res.data is List && res.data.isNotEmpty) {
// .update({ model.addressList = res.data;
// 'ischecked': 0, } else {
// }) model.addressList = []; // 设为空数组,防止空指针问题
// .eq("user_id", address['userId']) }
// .eq("ischecked", 1); updateAll();
// await ef.client.from("app_user_address").update({ },
// 'ischecked': 1, onFailure: (err) {
// }).eq("id", address['id']); model.addressList = []; // 请求失败时也清空列表以防旧数据残留
// } catch (e) { updateAll();
// print('Error fetching repairs: $e'); },
// } );
// } }
// // 删除地址 // // 删除地址
// Future<void> deleteAddress(String id) async { Future<void> deleteAddress(String id) async {
// try { String serviceAddress = ServiceConstant.service_address;
// await ef.client.from("app_user_address").delete().eq("id", id); String serviceName = ServiceConstant.server_service;
// print("Address with ID $id has been successfully deleted."); String serviceApi = ServiceConstant.add_address;
// } catch (e) { String queryUrl = "$serviceAddress$serviceName$serviceApi?id=$id";
// print("Error deleting address with ID $id: $e"); requestWithLog(
// } logTitle: '删除地址',
// } method: MyHttpMethod.delete,
queryUrl: queryUrl,
onSuccess: (res) {
getAddressList();
},
onFailure: (err) {
getAddressList();
},
);
}
} }

View File

@@ -6,6 +6,7 @@ import 'package:vbvs_app/common/color/repair_status.dart';
import 'package:vbvs_app/common/util/MyUtils.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/myDialog/my_dialog_controller.dart';
import 'package:vbvs_app/common/util/requestWithLog.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/controller/user_info_controller.dart';
import 'package:vbvs_app/model/user_data.dart'; import 'package:vbvs_app/model/user_data.dart';
@@ -216,16 +217,14 @@ class ApplyRepairController extends GetControllerEx<ApplyRepairModel> {
return message; return message;
} }
// Future<void> getDeviceList() async { Future<void> getDeviceList() async {
// final UserInfoController userInfoController = // UserModel loginUser = userInfoController.model.user!;
// Get.find<UserInfoController>(); DeviceListController deviceListController = Get.find();
// // UserModel loginUser = userInfoController.model.user!; await deviceListController.getDeviceList();
// DeviceListController deviceListController = Get.find(); var aa = deviceListController.model.deviceList;
// await deviceListController.getDeviceList(); ApplyRepairController applyRepairController = Get.find();
// var aa = deviceListController.model.deviceListWyf; applyRepairController.model.device_list = aa;
// ApplyRepairController applyRepairController = Get.find(); }
// applyRepairController.model.device_list = aa;
// }
// String getPublicUrl(String path) { // String getPublicUrl(String path) {
// try { // try {

View File

@@ -18,7 +18,7 @@ part 'device_list_controller.g.dart';
class DeviceListModel { class DeviceListModel {
//设备列表 //设备列表
List<dynamic> deviceList = []; List<dynamic> deviceList = [];
List<dynamic> deviceListWyf = [];
@JsonKey(ignore: true) @JsonKey(ignore: true)
String? keyword; String? keyword;

View File

@@ -7,12 +7,9 @@ part of 'device_list_controller.dart';
// ************************************************************************** // **************************************************************************
DeviceListModel _$DeviceListModelFromJson(Map<String, dynamic> json) => DeviceListModel _$DeviceListModelFromJson(Map<String, dynamic> json) =>
DeviceListModel() DeviceListModel()..deviceList = json['deviceList'] as List<dynamic>;
..deviceList = json['deviceList'] as List<dynamic>
..deviceListWyf = json['deviceListWyf'] as List<dynamic>;
Map<String, dynamic> _$DeviceListModelToJson(DeviceListModel instance) => Map<String, dynamic> _$DeviceListModelToJson(DeviceListModel instance) =>
<String, dynamic>{ <String, dynamic>{
'deviceList': instance.deviceList, 'deviceList': instance.deviceList,
'deviceListWyf': instance.deviceListWyf,
}; };

View File

@@ -19,8 +19,8 @@ class RepairModel {
// String? issue; //问题描述 // String? issue; //问题描述
String? fileUrl; //文件地址 String? fileUrl; //文件地址
String? mac; //状态 String? mac; //状态
String? desc;//问题描述 String? desc; //问题描述
List? img;//上传图片 List? img; //上传图片
RepairModel(); RepairModel();
factory RepairModel.fromJson(Map<String, dynamic> json) { factory RepairModel.fromJson(Map<String, dynamic> json) {
try { try {

View File

@@ -18,7 +18,6 @@ UserInfoModel _$UserInfoModelFromJson(Map<String, dynamic> json) =>
..deviceId = json['deviceId'] as String? ..deviceId = json['deviceId'] as String?
..deviceModel = json['deviceModel'] as String? ..deviceModel = json['deviceModel'] as String?
..appVersion = json['appVersion'] as String? ..appVersion = json['appVersion'] as String?
..img_bucket = json['img_bucket'] as String?
..login = (json['login'] as num?)?.toInt() ..login = (json['login'] as num?)?.toInt()
..deviceBindNum = (json['deviceBindNum'] as num?)?.toInt() ..deviceBindNum = (json['deviceBindNum'] as num?)?.toInt()
..loginPhone = (json['loginPhone'] as num?)?.toInt(); ..loginPhone = (json['loginPhone'] as num?)?.toInt();
@@ -33,7 +32,6 @@ Map<String, dynamic> _$UserInfoModelToJson(UserInfoModel instance) =>
'deviceId': instance.deviceId, 'deviceId': instance.deviceId,
'deviceModel': instance.deviceModel, 'deviceModel': instance.deviceModel,
'appVersion': instance.appVersion, 'appVersion': instance.appVersion,
'img_bucket': instance.img_bucket,
'login': instance.login, 'login': instance.login,
'deviceBindNum': instance.deviceBindNum, 'deviceBindNum': instance.deviceBindNum,
'loginPhone': instance.loginPhone, 'loginPhone': instance.loginPhone,

View File

@@ -73,7 +73,7 @@ class BezierBottomNavigationBar extends StatelessWidget {
fontSize: 22.rpx, fontSize: 22.rpx,
color: selectedIndex == i color: selectedIndex == i
? Colors.white ? Colors.white
: Colors.grey.shade400, : const Color(0XFF929699),
), ),
), ),
], ],

View File

@@ -381,7 +381,7 @@ Future<void> showWeightPickerDialog(
context, context,
weights, weights,
tempIndex, // ✅ 传入 RxInt tempIndex, // ✅ 传入 RxInt
unit: "cm", unit: "kg",
), ),
), ),
], ],
@@ -408,7 +408,6 @@ Future<void> showHeightPickerDialog(
int selectedIndex = heights.indexOf(initialHeight); int selectedIndex = heights.indexOf(initialHeight);
// int tempIndex = selectedIndex; // int tempIndex = selectedIndex;
final RxInt tempIndex = RxInt(selectedIndex); // ✅ 改为 RxInt final RxInt tempIndex = RxInt(selectedIndex); // ✅ 改为 RxInt
ThemeController themeController = Get.find(); ThemeController themeController = Get.find();
await showDialog( await showDialog(

View File

@@ -17,20 +17,22 @@ class _MattressControlPageState extends State<MattressControlPage> {
final controller = Get.put(ControlCardController()); final controller = Get.put(ControlCardController());
final data = { final data = {
"_id": "684bf0845a81f423c0000000", "_id": "333330000000000000000000",
"uid": "68465947a0cff49592000000", "uid": "684b90df767e00004e0072e2",
"bind_type": 1, "bind_type": 1,
"device_type": 3, "device_type": 3,
"mac": "545024122617", "mac": "545024122666",
"bind_mac": null, "bind_mac": null,
"bind_mac_a": "48CA43B2E8C8", "bind_mac_a": "B43A45C3D411",
"bind_mac_b": "48CA43B2E8B0", "bind_mac_b": "B43A45C3D388",
"position": 0, "position": 0,
"share_uid": null, "share_uid": null,
"person": null, "person": null,
"op_type": null, "op_type": null,
"show": true, "show": true,
"create_time": 1749807236514, "create_time": 1750121686274,
"room_id": "684395bf9ef8601da20f6475",
"roomName": "主卧",
"shareNum": 0, "shareNum": 0,
"status": { "status": {
"signal": -1, "signal": -1,
@@ -40,7 +42,7 @@ class _MattressControlPageState extends State<MattressControlPage> {
"failure": 0, "failure": 0,
"updateTime": -1 "updateTime": -1
}, },
"code": "545024122617" "code": "545024122666"
}; };
int selectedIndex = 1; // 当前选中的tab索引 int selectedIndex = 1; // 当前选中的tab索引
@override @override
@@ -75,7 +77,7 @@ class _MattressControlPageState extends State<MattressControlPage> {
SizedBox(width: 26.rpx), SizedBox(width: 26.rpx),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFF003058), color: const Color(0xFF003058),
borderRadius: BorderRadius.circular(30.rpx), borderRadius: BorderRadius.circular(30.rpx),
), ),
constraints: BoxConstraints( constraints: BoxConstraints(
@@ -90,6 +92,11 @@ class _MattressControlPageState extends State<MattressControlPage> {
underline: const SizedBox(), underline: const SizedBox(),
dropdownColor: Colors.blueGrey, dropdownColor: Colors.blueGrey,
iconEnabledColor: Colors.white, iconEnabledColor: Colors.white,
icon: Icon(
Icons.keyboard_arrow_down, // 最常用的向下箭头
color: Colors.white,
size: 30.rpx,
),
style: const TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
isExpanded: true, isExpanded: true,
items: const [ items: const [
@@ -113,11 +120,16 @@ class _MattressControlPageState extends State<MattressControlPage> {
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
padding: EdgeInsets.only(right: 69.rpx), padding: EdgeInsets.only(right: 69.rpx),
onTap: () {}, onTap: () {},
child: Icon( child: Image.asset(
Icons.bluetooth, 'assets/images/active_bluetooth.png',
color: Colors.white, width: 42.rpx,
size: 42.rpx, height: 42.rpx,
), ),
// Icon(
// Icons.bluetooth,
// color: Colors.white,
// size: 42.rpx,
// ),
), ),
ClickableContainer( ClickableContainer(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
@@ -131,7 +143,7 @@ class _MattressControlPageState extends State<MattressControlPage> {
], ],
centerTitle: false, centerTitle: false,
), ),
body: SafeArea( body: const SafeArea(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [

View File

@@ -51,14 +51,10 @@ class ShareUserWidget extends GetView {
height: 42.rpx, height: 42.rpx,
child: SvgPicture.asset('assets/img/icon/default_head.svg'), child: SvgPicture.asset('assets/img/icon/default_head.svg'),
), ),
Expanded( Expanded(
child: Container( child: Container(
margin: margin:
EdgeInsetsDirectional.only(start: 30.rpx, end: 30.rpx), EdgeInsetsDirectional.only(start: 30.rpx, end: 30.rpx),
// width: MediaQuery.sizeOf(context).width * 0.5,
// height: MediaQuery.sizeOf(context).height * 0.075,
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
@@ -72,6 +68,7 @@ class ShareUserWidget extends GetView {
color: Colors.white, color: Colors.white,
fontSize: 30.rpx, fontSize: 30.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
height: 1,
), ),
), ),
), ),
@@ -90,6 +87,7 @@ class ShareUserWidget extends GetView {
color: const Color(0xFFC8CBD2), color: const Color(0xFFC8CBD2),
fontSize: 20.rpx, fontSize: 20.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
height: 1,
), ),
), ),
), ),
@@ -98,44 +96,6 @@ class ShareUserWidget extends GetView {
), ),
), ),
), ),
// Container(
// width: MediaQuery.sizeOf(context).width * 0.2,
// height: MediaQuery.sizeOf(context).height * 0.075,
// constraints: const BoxConstraints(
// maxWidth: 130,
// ),
// decoration: BoxDecoration(
//
// ),
// child: Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Align(
// alignment: const AlignmentDirectional(0, 0),
// child: Text(
// ' ',
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: const Color(0xFF333333),
// fontSize: 13,
// letterSpacing: 0.0,
// ),
// ),
// ),
// Flexible(
// child: Align(
// alignment: const AlignmentDirectional(0, 0.05),
// child: Icon(
// Icons.arrow_forward_ios,
// color: FlutterFlowTheme.of(context).secondaryText,
// size: 10,
// ),
// ),
// ),
// ].divide(const SizedBox(width: 27)),
// ),
// ),
ClickableContainer( ClickableContainer(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
@@ -147,25 +107,9 @@ class ShareUserWidget extends GetView {
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/img/icon/expand.svg', 'assets/img/icon/expand.svg',
color: Colors.white, color: Colors.white,
) ))),
// Icon(
// Icons.arrow_forward_ios,
// color: Colors.white,
// // size: 14.rpx,
// ),
)),
], ],
), ),
// Container(
// width: MediaQuery.sizeOf(context).width,
// height: MediaQuery.sizeOf(context).height * 0.09,
// child: Container(
// width: MediaQuery.sizeOf(context).width,
// height: MediaQuery.sizeOf(context).height * 0.09,
// decoration: BoxDecoration(),
// ),
// ),
), ),
), ),
); );

View File

@@ -15,9 +15,9 @@ class AddressListPage extends GetView<AddressListController> {
final scaffoldKey = GlobalKey<ScaffoldState>(); final scaffoldKey = GlobalKey<ScaffoldState>();
BoxConstraints? bodysize; BoxConstraints? bodysize;
// AddressListPage() { AddressListPage() {
// controller.getAddressList(); controller.getAddressList();
// } }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -65,6 +65,7 @@ class AddressListPage extends GetView<AddressListController> {
centerTitle: false, centerTitle: false,
), ),
body: Container( body: Container(
margin: EdgeInsets.only(top: 30.rpx),
width: bodysize!.maxWidth, width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 1, height: bodysize!.maxHeight * 1,
child: Column( child: Column(
@@ -80,29 +81,7 @@ class AddressListPage extends GetView<AddressListController> {
child: Container( child: Container(
width: bodysize!.maxWidth, width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 1, height: bodysize!.maxHeight * 1,
decoration: BoxDecoration( decoration: BoxDecoration(),
color: Color(0xFFF6F6F6),
),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Align(
alignment: AlignmentDirectional(-1, 0),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
31, 27, 0, 26),
child: Text(
'我的地址',
style: TextStyle(
fontFamily: 'Readex Pro',
fontSize: AppFontsize.title_size,
letterSpacing: 0,
fontWeight: FontWeight.w600,
),
),
),
),
Expanded(
child: Obx(() => ListView( child: Obx(() => ListView(
shrinkWrap: true, shrinkWrap: true,
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
@@ -117,13 +96,10 @@ class AddressListPage extends GetView<AddressListController> {
.toList() as List<Widget>) .toList() as List<Widget>)
.divide(const SizedBox(height: 10)) .divide(const SizedBox(height: 10))
.addToEnd(const SizedBox( .addToEnd(const SizedBox(
height: AppConstants height:
.list_end_height)), AppConstants.list_end_height)),
)), )),
), ),
],
),
),
); );
} }
}), }),
@@ -143,7 +119,7 @@ class AddressListPage extends GetView<AddressListController> {
), ),
child: TextButton( child: TextButton(
onPressed: () { onPressed: () {
controller.model.address = {'isChecked': false}; controller.model.address = {'default': 0};
controller.model.type = 1; controller.model.type = 1;
Get.toNamed("/editAddressPage"); Get.toNamed("/editAddressPage");
}, },
@@ -167,20 +143,7 @@ class AddressListPage extends GetView<AddressListController> {
width: 42.rpx, width: 42.rpx,
height: 42.rpx, height: 42.rpx,
), ),
// Text(
// '+',
// style: FlutterFlowTheme.of(context)
// .titleSmall
// .override(
// fontFamily: 'Readex Pro',
// color: Color(0xFF85F5FF),
// fontSize:
// AppFontsize.normal_text_size +
// 12, // 让加号比文字稍大
// letterSpacing: 0,
// ),
// ),
//),
SizedBox(width: 10), // 加号和文字间距 SizedBox(width: 10), // 加号和文字间距
Text( Text(
'添加新地址', '添加新地址',

View File

@@ -2,8 +2,8 @@ import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/controller/mh_controller/address_list_controller.dart'; import 'package:vbvs_app/controller/mh_controller/address_list_controller.dart';
import '../../common/color/appFontsize.dart'; import '../../common/color/appFontsize.dart';
class AddressModuleWidget extends GetView { class AddressModuleWidget extends GetView {
@@ -20,14 +20,14 @@ class AddressModuleWidget extends GetView {
return SingleChildScrollView( return SingleChildScrollView(
child: SlidableAutoCloseBehavior( child: SlidableAutoCloseBehavior(
child: Padding( child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(15, 0, 15, 0), padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
child: Container( child: Container(
width: MediaQuery.sizeOf(context).width, width: MediaQuery.sizeOf(context).width,
constraints: BoxConstraints( constraints: BoxConstraints(
minHeight: 100, minHeight: 220.rpx,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Color(0xFF003058),
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
), ),
child: Slidable( child: Slidable(
@@ -38,12 +38,12 @@ class AddressModuleWidget extends GetView {
Expanded( Expanded(
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
// await addressListController.deleteAddress( await addressListController.deleteAddress(
// addressListController.model.addressList[index] addressListController.model.addressList[index]
// ['id']); ['_id']);
// addressListController.model.addressList.removeAt(index); addressListController.model.addressList.removeAt(index);
// addressListController.updateAll(); addressListController.updateAll();
}, },
child: Container( child: Container(
margin: EdgeInsets.only(left: 30), margin: EdgeInsets.only(left: 30),
@@ -62,178 +62,120 @@ class AddressModuleWidget extends GetView {
], ],
), ),
child: Padding( child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(15, 13, 15, 10), padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 20.rpx, 30.rpx, 20.rpx),
child: Container( child: Container(
width: MediaQuery.sizeOf(context).width, width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.123, height: MediaQuery.sizeOf(context).height * 0.123,
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
Expanded( Container(
child: Container( height: 60.rpx,
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.08,
constraints: BoxConstraints(
minHeight: 112,
),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Container( Expanded(
width: MediaQuery.sizeOf(context).width * 0.7,
height:
MediaQuery.sizeOf(context).height * 0.08,
constraints: BoxConstraints(
minHeight: 112,
),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Flexible(
child: Align(
alignment: AlignmentDirectional(-1, 0),
child: Text( child: Text(
[ [
addressListController.model addressListController
.addressList[index]['province'], .model.addressList[index]['province'],
addressListController.model addressListController
.addressList[index]['city'], .model.addressList[index]['city'],
addressListController.model addressListController
.addressList[index]['county'], .model.addressList[index]['county'],
addressListController.model addressListController
.addressList[index]['street'] .model.addressList[index]['street']
] ]
.where((element) => .where((element) =>
element != null && element != null && element.isNotEmpty)
element.isNotEmpty)
.join(' '), .join(' '),
style: TextStyle( style: TextStyle(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Color(0xFF333333), color: Colors.white,
fontSize: fontSize: AppFontsize.normal_text_size,
AppFontsize.normal_text_size,
letterSpacing: 0, letterSpacing: 0,
), ),
), ),
), ),
), Obx(() => Visibility(
Flexible( visible: addressListController.model
child: Align( .addressList[index]["default"] ==
alignment: AlignmentDirectional(-1, 0), 1,
child: Container(
width: 71.rpx,
height: 36.rpx,
child: ElevatedButton(
onPressed: () {},
child: Text( child: Text(
addressListController '默认',
.model style: TextStyle(
.addressList[index] color: Color(0XFF6BFDAC),
['detail'] fontSize: 20.rpx,
?.isEmpty ?? ),
),
style: ElevatedButton.styleFrom(
backgroundColor:
const Color(0x4D6BFDAC),
padding: EdgeInsets.zero,
),
),
),
))
],
)),
Container(
height: 60.rpx,
alignment: Alignment.centerLeft,
child: Text(
addressListController.model
.addressList[index]['address']?.isEmpty ??
true true
? '无详细地址' ? '无详细地址'
: addressListController.model : addressListController.model.addressList[index]
.addressList[index]['detail'], ['address'],
style: TextStyle( style: TextStyle(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Color(0xFF333333),
fontSize:
AppFontsize.normal_text_size,
letterSpacing: 0,
),
),
),
),
Flexible(
child: Align(
alignment: AlignmentDirectional(-1, 0),
child: Text(
'${addressListController.model.addressList[index]['name']} ' +
'${addressListController.model.addressList[index]['phone']} ',
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFF333333),
fontSize:
AppFontsize.normal_text_size,
letterSpacing: 0,
),
),
),
),
].divide(SizedBox(height: 5)),
),
),
Align(
alignment: AlignmentDirectional(1, -1),
child: Theme(
data: ThemeData(
checkboxTheme: CheckboxThemeData(
visualDensity: VisualDensity.compact,
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(64),
),
),
unselectedWidgetColor: Color(0xFFD3D3D3),
),
child: Obx(() {
return Checkbox(
value: addressListController
.model.addressList[index]
['isChecked'] ??
false,
onChanged: (newValue) async {
// if (newValue == true) {
// for (var i = 0;
// i <
// addressListController
// .model.addressList.length;
// i++) {
// addressListController
// .model.addressList[i]
// ['isChecked'] = false;
// }
// addressListController
// .model.addressList[index]
// ['isChecked'] = newValue;
// addressListController.updateDefault(
// addressListController
// .model.addressList[index]);
// }
// addressListController.updateAll();
},
side: BorderSide(
width: 1.5,
color: Colors.white, color: Colors.white,
), fontSize: AppFontsize.normal_text_size,
activeColor: const Color(0xFFd3b684), letterSpacing: 0,
// checkColor:
// FlutterFlowTheme.of(context).info,
);
}),
),
)
],
), ),
), ),
), ),
Align( Container(
alignment: AlignmentDirectional(1, 0), height: 60.rpx,
child: InkWell( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${addressListController.model.addressList[index]['name']} ' +
'${addressListController.model.addressList[index]['tel']} ',
style: TextStyle(
fontFamily: 'Readex Pro',
color: Colors.white,
fontSize: AppFontsize.normal_text_size,
letterSpacing: 0,
),
),
InkWell(
onTap: () { onTap: () {
addressListController.model.address = addressListController.model.address =
addressListController.model.addressList[index]; addressListController
.model.addressList[index];
addressListController.model.type = 2; addressListController.model.type = 2;
Get.toNamed("/editAddressPage"); Get.toNamed("/editAddressPage");
}, },
child: Container( child: Container(
width: 100, width: 100,
height: MediaQuery.sizeOf(context).height * 0.03, height:
MediaQuery.sizeOf(context).height * 0.03,
child: Align( child: Align(
alignment: AlignmentDirectional(1, 0), alignment: AlignmentDirectional(1, 0),
child: Text( child: Text(
'编辑', '编辑',
style: TextStyle( style: TextStyle(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Color(0xFF9EA4B7), color: Color(0xFF84F5FF),
fontSize: AppFontsize.small_text_size, fontSize: AppFontsize.small_text_size,
letterSpacing: 0, letterSpacing: 0,
), ),
@@ -241,6 +183,8 @@ class AddressModuleWidget extends GetView {
), ),
), ),
), ),
],
),
), ),
], ],
), ),

File diff suppressed because it is too large Load Diff

View File

@@ -84,7 +84,8 @@ class BluetoothPage extends GetView {
highlightColor: const Color(0xFF055466), highlightColor: const Color(0xFF055466),
padding: EdgeInsets.only(left: 0), padding: EdgeInsets.only(left: 0),
onTap: () { onTap: () {
Get.toNamed("/editBedPage"); Get.toNamed("/editBedPage",
arguments: data);
}, },
child: Container( child: Container(
width: 42.rpx, width: 42.rpx,
@@ -135,7 +136,7 @@ class BluetoothPage extends GetView {
context, '人员资料', "/peopleInfoPage", context, '人员资料', "/peopleInfoPage",
arguments: data), arguments: data),
_buildMenuButton( _buildMenuButton(
context, '房间选择', "/roomPickerPage"), context, '房间选择', "/roomPickerPage",arguments: data),
_buildMenuButton(context, '设备校准', ""), _buildMenuButton(context, '设备校准', ""),
_buildMenuButton(context, '体征传感器', ""), _buildMenuButton(context, '体征传感器', ""),
_buildMenuButton(context, 'WIFI配置', ""), _buildMenuButton(context, 'WIFI配置', ""),

View File

@@ -6,6 +6,7 @@ import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appFontsize.dart'; import 'package:vbvs_app/common/color/appFontsize.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart'; import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart';
@@ -115,25 +116,25 @@ class DeviceInfoWidget extends GetView {
letterSpacing: 0, letterSpacing: 0,
height: 1), height: 1),
), ),
TextSpan( // TextSpan(
text: // text:
' (${deviceListController.model.deviceList[index]['status'] ?? ''})', // ' (${deviceListController.model.deviceList[index]['status'] ?? ''})',
style: TextStyle( // style: TextStyle(
fontFamily: 'Readex Pro', // fontFamily: 'Readex Pro',
color: deviceListController // color: deviceListController
.model // .model
.deviceList[ // .deviceList[
index] // index]
['status'] == // ['status'] ==
'在线' // '在线'
? Color( // ? Color(
0xFF07C160) // 在线的颜色 // 0xFF07C160) // 在线的颜色
: Color( // : Color(
0xFFEA7CA7), // 离线的颜色 // 0xFFEA7CA7), // 离线的颜色
fontSize: 26.rpx, // fontSize: 26.rpx,
letterSpacing: 0, // letterSpacing: 0,
), // ),
), // ),
], ],
), ),
maxLines: 1, // 限制显示一行 maxLines: 1, // 限制显示一行
@@ -196,7 +197,7 @@ class DeviceInfoWidget extends GetView {
color: Color(0XFF85F5FF), color: Color(0XFF85F5FF),
textStyle: TextStyle( textStyle: TextStyle(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: Color(0xFF011D33),
fontSize: 28.rpx, fontSize: 28.rpx,
letterSpacing: 0, letterSpacing: 0,
), ),
@@ -238,11 +239,12 @@ class DeviceInfoWidget extends GetView {
children: [ children: [
InkWell( InkWell(
onTap: () async { onTap: () async {
if (device['type'] == 1) { await Get.toNamed("/deviceSharePage");
globalController.model.deviceMain = device; // if (device['type'] == 1) {
await Get.toNamed("/deviceShare"); // globalController.model.deviceMain = device;
globalController.getDeviceList(); // await Get.toNamed("/deviceSharePage");
} // globalController.getDeviceList();
// }
}, },
child: Container( child: Container(
height: MediaQuery.sizeOf(context).height * 0.1, height: MediaQuery.sizeOf(context).height * 0.1,
@@ -351,11 +353,15 @@ class DeviceInfoWidget extends GetView {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
var a = [device["bindMacA"]]; TopSlideNotification.show(
if ("${device["bindMacB"]}".length > 6) { context,
a.add(device["bindMacB"]); text: "功能开发中...",
} );
Get.toNamed("/sleepWebview", arguments: a); // var a = [device["bindMacA"]];
// if ("${device["bindMacB"]}".length > 6) {
// a.add(device["bindMacB"]);
// }
// Get.toNamed("/sleepWebview", arguments: a);
}, },
child: Container( child: Container(
height: MediaQuery.sizeOf(context).height * 0.1, height: MediaQuery.sizeOf(context).height * 0.1,

View File

@@ -34,6 +34,13 @@ class _DeviceListPageState extends State<DeviceListPage> {
bodysize = cc; bodysize = cc;
return GestureDetector( return GestureDetector(
onTap: () => FocusScope.of(context).unfocus(), onTap: () => FocusScope.of(context).unfocus(),
child: Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/new_background.png'), // 本地图片
fit: BoxFit.fill, // 填满整个 Container
),
),
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
appBar: AppBar( appBar: AppBar(
@@ -74,15 +81,8 @@ class _DeviceListPageState extends State<DeviceListPage> {
centerTitle: false, centerTitle: false,
), ),
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
body: Stack( body: Container(
children: [ child: Column(
Positioned.fill(
child: Image.asset(
'assets/images/new_background.png',
fit: BoxFit.fill,
),
),
Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
Padding( Padding(
@@ -125,7 +125,6 @@ class _DeviceListPageState extends State<DeviceListPage> {
}), }),
], ],
), ),
],
) )
// Container( // Container(
@@ -134,7 +133,7 @@ class _DeviceListPageState extends State<DeviceListPage> {
// ), // ),
), ),
); ));
}); });
} }
} }

View File

@@ -35,9 +35,6 @@ class DevicePeopleInfo extends GetView<PeopleInfoController> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
WidgetsBinding.instance.addPostFrameCallback((_) {
controller.initData(data['mac']);
});
return LayoutBuilder( return LayoutBuilder(
builder: (context, boxConstraints) => GestureDetector( builder: (context, boxConstraints) => GestureDetector(
onTap: () => FocusScope.of(context).unfocus(), onTap: () => FocusScope.of(context).unfocus(),

View File

@@ -434,11 +434,19 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
letterSpacing: 0.0, letterSpacing: 0.0,
), ),
), ),
Radio<int>( Theme(
data:
Theme.of(context).copyWith(
unselectedWidgetColor: Color(
0xFFC8CBD2), // 改变未选中状态边框颜色
),
child: Radio<int>(
value: 1, value: 1,
groupValue: controller.model.type, groupValue:
controller.model.type,
onChanged: (value) { onChanged: (value) {
controller.model.type = value!; controller.model.type =
value!;
controller.updateAll(); controller.updateAll();
}, },
activeColor: activeColor:
@@ -449,7 +457,7 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
visualDensity: VisualDensity( visualDensity: VisualDensity(
horizontal: -4, horizontal: -4,
vertical: -4), // 缩小视觉密度 vertical: -4), // 缩小视觉密度
) ))
], ],
), ),
), ),
@@ -485,11 +493,19 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
letterSpacing: 0.0, letterSpacing: 0.0,
), ),
), ),
Radio<int>( Theme(
data:
Theme.of(context).copyWith(
unselectedWidgetColor: Color(
0xFFC8CBD2), // 改变未选中状态边框颜色
),
child: Radio<int>(
value: 2, value: 2,
groupValue: controller.model.type, groupValue:
controller.model.type,
onChanged: (value) { onChanged: (value) {
controller.model.type = value!; controller.model.type =
value!;
controller.updateAll(); controller.updateAll();
}, },
activeColor: activeColor:
@@ -500,7 +516,7 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
visualDensity: VisualDensity( visualDensity: VisualDensity(
horizontal: -4, horizontal: -4,
vertical: -4), // 缩小视觉密度 vertical: -4), // 缩小视觉密度
) ))
], ],
), ),
), ),

View File

@@ -1,6 +1,6 @@
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_city_picker/city_picker.dart'; import 'package:flutter_city_picker/listener/picker_listener.dart';
import 'package:flutter_city_picker/model/address.dart'; import 'package:flutter_city_picker/model/address.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart';
@@ -11,6 +11,7 @@ import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/controller/mh_controller/address_controller.dart'; import 'package:vbvs_app/controller/mh_controller/address_controller.dart';
import 'package:vbvs_app/controller/mh_controller/address_list_controller.dart'; import 'package:vbvs_app/controller/mh_controller/address_list_controller.dart';
import 'package:vbvs_app/pages/mh_page/homepage/component/citypicker.dart';
class EditAddressPage extends GetView<AddressController> class EditAddressPage extends GetView<AddressController>
implements CityPickerListener { implements CityPickerListener {
@@ -36,12 +37,12 @@ class EditAddressPage extends GetView<AddressController>
AddressListController addressListController = Get.find(); AddressListController addressListController = Get.find();
var address = var address =
Map<String, dynamic>.from(addressListController.model.address); Map<String, dynamic>.from(addressListController.model.address);
controller.model.ischecked = address['isChecked']; controller.model.default_ = address['default'];
controller.model.all_address = getAddressDesc(address); controller.model.all_address = getAddressDesc(address);
controller.model.detail = address['detail']; controller.model.address = address['address'];
controller.model.name = address['name']; controller.model.name = address['name'];
controller.model.phone = address['phone']; controller.model.tel = address['tel'];
controller.model.ischecked = address['isChecked'];
return LayoutBuilder(builder: (context, cc) { return LayoutBuilder(builder: (context, cc) {
bodysize = cc; bodysize = cc;
return GestureDetector( return GestureDetector(
@@ -61,11 +62,6 @@ class EditAddressPage extends GetView<AddressController>
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: Colors.white), iconTheme: IconThemeData(color: Colors.white),
titleSpacing: 0, titleSpacing: 0,
// leading: returnIconButtomAddCallback(() {
// controller.saveDataApi();
// updateParm(isShowToast: false);
// }),
// leading: returnIconButtomNew,
title: Container( title: Container(
width: double.infinity, width: double.infinity,
height: 180.rpx, height: 180.rpx,
@@ -89,7 +85,6 @@ class EditAddressPage extends GetView<AddressController>
], ],
), ),
), ),
actions: [], actions: [],
centerTitle: false, centerTitle: false,
), ),
@@ -181,7 +176,8 @@ class EditAddressPage extends GetView<AddressController>
-1, 0), -1, 0),
child: Text( child: Text(
'地址信息', '地址信息',
style: TextStyle( style:
TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
color: Colors color: Colors
@@ -200,19 +196,14 @@ class EditAddressPage extends GetView<AddressController>
), ),
), ),
Container( Container(
width:
MediaQuery.sizeOf(
context)
.width *
0.17,
height: height:
MediaQuery.sizeOf( MediaQuery.sizeOf(
context) context)
.height * .height *
0.038, 0.038,
constraints: constraints:
const BoxConstraints( BoxConstraints(
maxWidth: 55, minWidth: 104.rpx,
), ),
decoration: decoration:
BoxDecoration(), BoxDecoration(),
@@ -238,8 +229,10 @@ class EditAddressPage extends GetView<AddressController>
0), 0),
child: child:
Container( Container(
width: 18, width:
height: 18, 60.rpx,
height:
60.rpx,
decoration: decoration:
const BoxDecoration(), const BoxDecoration(),
child: child:
@@ -248,51 +241,73 @@ class EditAddressPage extends GetView<AddressController>
const AlignmentDirectional( const AlignmentDirectional(
0, 0,
0), 0),
child: Theme( child:
data: ThemeData( Theme(
data:
ThemeData(
checkboxTheme: checkboxTheme:
CheckboxThemeData( CheckboxThemeData(
visualDensity: VisualDensity.compact, visualDensity:
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, VisualDensity.compact,
shape: RoundedRectangleBorder( materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
shape:
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(64), borderRadius: BorderRadius.circular(64),
), ),
), ),
unselectedWidgetColor: unselectedWidgetColor:
const Color(0xFFD3D3D3), const Color(0xFFD3D3D3),
), ),
child: Obx(() { child: Obx(
() {
return Checkbox( return Checkbox(
value: controller.model.ischecked, value:
onChanged: (newValue) async { controller.model.default_ == 1,
controller.model.ischecked = newValue; onChanged:
(newValue) {
controller.model.default_ = (newValue ?? false) ? 1 : 0;
controller.updateAll(); controller.updateAll();
}, },
side: BorderSide( side:
const BorderSide(
width: 1.5, width: 1.5,
color:Colors.white, color: Colors.white,
), ),
activeColor: const Color(0xFF84F5FF), activeColor:
checkColor: Color(0xFF011D33), const Color(0xFF84F5FF),
checkColor:
const Color(0xFF011D33),
// Add this to prevent double triggers
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
); );
})), }),
), ),
), ),
), ),
), ),
Text( ),
Obx(
() => Text(
'默认', '默认',
style: TextStyle( style:
TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
fontSize: fontSize:
AppFontsize 26.rpx,
.normal_text_size,
letterSpacing: letterSpacing:
0, 0,
color: Color( color: controller.model.default_ ==
0XFF84F5FF)), 1
? const Color(
0XFF84F5FF)
: Colors
.white,
), ),
),
)
], ],
), ),
), ),
@@ -379,25 +394,29 @@ class EditAddressPage extends GetView<AddressController>
controller.model controller.model
.name = val; .name = val;
}, },
initialValue: initialValue:
address[ address[
'name'], 'name'],
decoration: decoration:
InputDecoration( InputDecoration(
contentPadding: contentPadding:
const EdgeInsetsDirectional EdgeInsets
.fromSTEB( .symmetric(
10, vertical:
0, 25.rpx,
10, horizontal:
18), 26.rpx,
labelStyle: TextStyle( ),
labelStyle:
TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
letterSpacing: letterSpacing:
0, 0,
), ),
hintStyle: TextStyle( hintStyle:
TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
letterSpacing: letterSpacing:
@@ -456,11 +475,15 @@ class EditAddressPage extends GetView<AddressController>
8), 8),
), ),
), ),
style:TextStyle( style: TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
letterSpacing: letterSpacing:
0, 0,
color: Colors
.black,
fontSize:
26.rpx,
), ),
), ),
), ),
@@ -511,7 +534,8 @@ class EditAddressPage extends GetView<AddressController>
children: [ children: [
Text( Text(
'手机号', '手机号',
style: TextStyle( style:
TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
fontSize: fontSize:
@@ -544,30 +568,35 @@ class EditAddressPage extends GetView<AddressController>
// autofocus: true, // autofocus: true,
onChanged: (val) { onChanged: (val) {
controller.model controller.model
.phone = .tel = val;
val;
}, },
textAlignVertical:
TextAlignVertical
.center, // 垂直居中
obscureText: obscureText:
false, false,
initialValue: initialValue:
address[ address[
'phone'], 'tel'],
decoration: decoration:
InputDecoration( InputDecoration(
contentPadding: contentPadding:
const EdgeInsetsDirectional EdgeInsets
.fromSTEB( .symmetric(
10, vertical:
0, 25.rpx,
10, horizontal:
18), 26.rpx,
labelStyle: TextStyle( ),
labelStyle:
TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
letterSpacing: letterSpacing:
0, 0,
), ),
hintStyle: TextStyle( hintStyle:
TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
letterSpacing: letterSpacing:
@@ -631,6 +660,10 @@ class EditAddressPage extends GetView<AddressController>
'Readex Pro', 'Readex Pro',
letterSpacing: letterSpacing:
0, 0,
color: Colors
.black,
fontSize:
26.rpx,
), ),
), ),
), ),
@@ -678,7 +711,7 @@ class EditAddressPage extends GetView<AddressController>
.max, .max,
children: [ children: [
InkWell( InkWell(
// onTap: () { onTap: () {
// CityPicker // CityPicker
// .show( // .show(
// context: // context:
@@ -686,14 +719,16 @@ class EditAddressPage extends GetView<AddressController>
// cityPickerListener: // cityPickerListener:
// this, // this,
// ); // );
// }, },
child: Text( child: Text(
'所在地区', '所在地区',
style: TextStyle( style:
TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
fontSize: fontSize:
AppFontsize.normal_text_size, AppFontsize
.normal_text_size,
letterSpacing: letterSpacing:
0, 0,
color: Colors color: Colors
@@ -712,6 +747,8 @@ class EditAddressPage extends GetView<AddressController>
context, context,
cityPickerListener: cityPickerListener:
this, this,
// 在大屏/Web 上最大宽度为 600px
// 移除内边距
); );
}, },
child: Container( child: Container(
@@ -726,6 +763,9 @@ class EditAddressPage extends GetView<AddressController>
.circular( .circular(
8), 8),
), ),
alignment:
Alignment
.center,
child: Obx(() { child: Obx(() {
return TextFormField( return TextFormField(
enabled: enabled:
@@ -735,22 +775,34 @@ class EditAddressPage extends GetView<AddressController>
text: text:
controller.model.all_address), controller.model.all_address),
(val) { (val) {
val.text = controller val.text =
.model controller.model.all_address ??
.all_address; "";
}), }),
// autofocus: true, // autofocus: true,
obscureText: obscureText:
false, false,
textAlignVertical:
TextAlignVertical
.center, // 垂直居中
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: const EdgeInsetsDirectional.fromSTEB(10, 0, 10, 18), contentPadding: EdgeInsets.symmetric(
vertical:
25.rpx,
horizontal:
26.rpx,
),
labelStyle: TextStyle( labelStyle: TextStyle(
fontFamily: 'Readex Pro', fontFamily:
letterSpacing: 0, 'Readex Pro',
letterSpacing:
0,
), ),
hintStyle: TextStyle( hintStyle: TextStyle(
fontFamily: 'Readex Pro', fontFamily:
letterSpacing: 0, 'Readex Pro',
letterSpacing:
0,
), ),
enabledBorder: UnderlineInputBorder( enabledBorder: UnderlineInputBorder(
borderSide: borderSide:
@@ -814,16 +866,24 @@ class EditAddressPage extends GetView<AddressController>
Icon( Icon(
Icons.arrow_forward_ios, Icons.arrow_forward_ios,
color: color:
Colors.white, Colors.black,
size: size:
12, 26.rpx,
), ),
)), )),
style: TextStyle( style:
TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
letterSpacing: letterSpacing:
0, 0,
color: Color(
0xFF333333),
fontSize:
26.rpx,
overflow:
TextOverflow
.ellipsis,
), ),
); );
})), })),
@@ -882,7 +942,7 @@ class EditAddressPage extends GetView<AddressController>
children: [ children: [
Text( Text(
'详细地址', '详细地址',
style:TextStyle( style: TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
fontSize: fontSize:
@@ -934,31 +994,34 @@ class EditAddressPage extends GetView<AddressController>
(val) { (val) {
controller controller
.model .model
.detail = .address =
val; val;
}, },
initialValue: initialValue:
address[ address[
'detail'], 'address'],
maxLines: 2, maxLines: 2,
obscureText: obscureText:
false, false,
decoration: decoration:
InputDecoration( InputDecoration(
contentPadding: contentPadding:
const EdgeInsetsDirectional EdgeInsets
.fromSTEB( .symmetric(
10, vertical:
10, 10.rpx,
10, horizontal:
10), 26.rpx,
labelStyle: TextStyle( ),
labelStyle:
TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
letterSpacing: letterSpacing:
0, 0,
), ),
hintStyle: TextStyle( hintStyle:
TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
letterSpacing: letterSpacing:
@@ -1013,11 +1076,16 @@ class EditAddressPage extends GetView<AddressController>
.circular(8), .circular(8),
), ),
), ),
style: TextStyle( style:
TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
letterSpacing: letterSpacing:
0, 0,
color: Colors
.black,
fontSize:
26.rpx,
), ),
), ),
), ),
@@ -1049,42 +1117,43 @@ class EditAddressPage extends GetView<AddressController>
child: CustomCard( child: CustomCard(
borderRadius: 16.rpx, borderRadius: 16.rpx,
gradientDirection: GradientDirection.vertical, gradientDirection: GradientDirection.vertical,
onTap: () { onTap: () async {
// if (controller.model.all_address == null || if (controller.model.all_address == null ||
// controller.model.all_address!.isEmpty) { controller.model.all_address!.isEmpty) {
// showToast("地址不能为空"); showToast("地址不能为空");
// return; return;
// } }
// if (controller.model.name == null || if (controller.model.name == null ||
// controller.model.name!.isEmpty) { controller.model.name!.isEmpty) {
// showToast("名字不能为空"); showToast("名字不能为空");
// return; return;
// } }
// if (controller.model.detail == null || if (controller.model.address == null ||
// controller.model.detail!.isEmpty) { controller.model.address!.isEmpty) {
// showToast("详细地址不能为空"); showToast("详细地址不能为空");
// return; return;
// } }
// if (controller.model.phone == null || if (controller.model.tel == null ||
// controller.model.phone!.isEmpty) { controller.model.tel!.isEmpty) {
// showToast("手机号不能为空"); showToast("手机号不能为空");
// return; return;
// } }
// if (!MyUtils.isValidPhoneNumber( if (!MyUtils.isValidPhoneNumber(
// controller.model.phone!)) { controller.model.tel!)) {
// showToast("无效的手机号码"); showToast("无效的手机号码");
// return; return;
// } }
// if (addressListController.model.type == 1) { if (addressListController.model.type == 1) {
// await controller.addAddress(controller.model); await controller.addAddress(
// } else { controller.model, context);
// await controller.updateAddress( } else {
// address, controller.model); await controller.updateAddress(
// } address, controller.model);
// await addressListController.getAddressList(); }
// Get.back(); await addressListController.getAddressList();
// controller.model = AddressModel(); Get.back();
// controller.updateAll(); controller.model = AddressModel();
controller.updateAll();
}, },
colors: const [ colors: const [
Color(0xFFFCFCFC), Color(0xFFFCFCFC),
@@ -1110,91 +1179,7 @@ class EditAddressPage extends GetView<AddressController>
), ),
), ),
), ),
) )),
// Container(
// width: bodysize!.maxWidth,
// height: bodysize!.maxHeight * 0.056,
// decoration: BoxDecoration(
// color: FlutterFlowTheme.of(context)
// .secondaryBackground,
// ),
// child:
// Container(
// width: bodysize!.maxWidth,
// height: bodysize!.maxHeight * 0.056,
// decoration: BoxDecoration(
// color: FlutterFlowTheme.of(context)
// .secondaryBackground,
// borderRadius: BorderRadius.circular(12),
// ),
// child: FFButtonWidget(
// onPressed: () async {
// // if (controller.model.all_address == null ||
// // controller.model.all_address!.isEmpty) {
// // showToast("地址不能为空");
// // return;
// // }
// // if (controller.model.name == null ||
// // controller.model.name!.isEmpty) {
// // showToast("名字不能为空");
// // return;
// // }
// // if (controller.model.detail == null ||
// // controller.model.detail!.isEmpty) {
// // showToast("详细地址不能为空");
// // return;
// // }
// // if (controller.model.phone == null ||
// // controller.model.phone!.isEmpty) {
// // showToast("手机号不能为空");
// // return;
// // }
// // if (!MyUtils.isValidPhoneNumber(
// // controller.model.phone!)) {
// // showToast("无效的手机号码");
// // return;
// // }
// // if (addressListController.model.type == 1) {
// // await controller.addAddress(controller.model);
// // } else {
// // await controller.updateAddress(
// // address, controller.model);
// // }
// // await addressListController.getAddressList();
// // Get.back();
// // controller.model = AddressModel();
// // controller.updateAll();
// },
// text: '确定',
// options: FFButtonOptions(
// height: 40,
// padding: const EdgeInsetsDirectional.fromSTEB(
// 24, 0, 24, 0),
// iconPadding:
// const EdgeInsetsDirectional.fromSTEB(
// 0, 0, 0, 0),
// color: const Color(0xFFD3B684),
// textStyle: FlutterFlowTheme.of(context)
// .titleSmall
// .override(
// fontFamily: 'Readex Pro',
// color: Colors.white,
// fontSize: AppFontsize.normal_text_size,
// letterSpacing: 0,
// ),
// elevation: 0,
// borderSide: const BorderSide(
// color: Colors.transparent,
// width: 1,
// ),
// borderRadius: BorderRadius.circular(6),
// ),
// ),
// ),
// ),
),
], ],
), ),
), ),
@@ -1205,28 +1190,9 @@ class EditAddressPage extends GetView<AddressController>
@override @override
Future<List<AddressNode>> onDataLoad( Future<List<AddressNode>> onDataLoad(
int index, String code, String name) async { int index, String code, String name) async {
debugPrint("onDataLoad ---> $index $name"); debugPrint("onDataLoad ---> index=$index, code=$code, name=$name");
if (index == 0) {
await Future.delayed(const Duration(milliseconds: 200));
return HttpUtils.getCityData("", index);
} else {
if (controller.model.currentType == 0) {
return Future.value([]);
} else if (controller.model.currentType == 1) {
if (index == 2) {
return Future.value([]);
}
return HttpUtils.getCityData(code, index); return HttpUtils.getCityData(code, index);
} else if (controller.model.currentType == 2) {
if (index == 3) {
return Future.value([]);
}
return HttpUtils.getCityData(code, index);
} else {
return HttpUtils.getCityData(code, index);
}
}
} }
@override @override
@@ -1268,20 +1234,28 @@ class EditAddressPage extends GetView<AddressController>
} }
} }
// class HttpUtils {
// static Future<List<AddressNode>> getCityData(String code, int index) async {
// final AddressController addressController = Get.find<AddressController>();
// addressController.model.currentType = 1;
// if (code.isEmpty) {
// addressController.updateAll();
// return addressController.getData();
// }
// addressController.model.currentType = index + 1;
// //控制选择区域层级 1.省 2.市 3.区 4.街道
// if (addressController.model.currentType > 3) {
// return [];
// }
// return addressController.getData();
// }
// }
class HttpUtils { class HttpUtils {
static Future<List<AddressNode>> getCityData(String code, int index) async { static Future<List<AddressNode>> getCityData(String code, int index) async {
final AddressController addressController = Get.find<AddressController>(); final AddressController controller = Get.find<AddressController>();
addressController.model.currentType = 1; controller.model.currentType = index;
if (code.isEmpty) { return controller.getData(parentCode: code, level: index);
addressController.updateAll();
return addressController.getData(level: 0);
}
addressController.model.currentType = index + 1;
//控制选择区域层级 1.省 2.市 3.区 4.街道
if (addressController.model.currentType > 3) {
return [];
}
return addressController.getData(pid: int.parse(code));
} }
} }

View File

@@ -188,7 +188,7 @@ class _EditBedPageState extends State<EditBedPage> {
ServiceConstant.service_address; ServiceConstant.service_address;
String serviceName = String serviceName =
ServiceConstant.server_service; ServiceConstant.server_service;
String serviceApi = ServiceConstant.person_info; String serviceApi = ServiceConstant.device_show;
String queryUrl = String queryUrl =
"$serviceAddress$serviceName$serviceApi"; "$serviceAddress$serviceName$serviceApi";
await requestWithLog( await requestWithLog(
@@ -196,10 +196,12 @@ class _EditBedPageState extends State<EditBedPage> {
method: MyHttpMethod.put, method: MyHttpMethod.put,
queryUrl: queryUrl, queryUrl: queryUrl,
data: { data: {
"id": editedData["id"], "id": editedData["_id"],
"name": editedData["name"], "name": editedData["name"],
}, },
onSuccess: (res) {}, onSuccess: (res) {
'更新人员信息成功: $res';
},
); );
}, },
colors: const [ colors: const [

View File

@@ -0,0 +1,105 @@
import 'package:flutter/material.dart';
import 'package:flutter_city_picker/listener/picker_listener.dart';
import 'package:flutter_city_picker/model/address.dart';
import 'package:flutter_city_picker/view/city_picker.dart';
class CityPicker {
/// 展示
static void show({
required BuildContext context,
AnimationController? animController,
double opacity = 0.5,
bool dismissible = true,
double height = 500.0,
double titleHeight = 50.0,
double corner = 20.0,
Color? backgroundColor,
double paddingLeft = 15.0,
Widget? titleWidget,
String? selectText,
Widget? closeWidget,
double tabHeight = 40.0,
bool showTabIndicator = true,
double tabPadding = 10.0,
Color? tabIndicatorColor,
double tabIndicatorHeight = 3.0,
double labelTextSize = 15.0,
Color? selectedLabelColor,
Color? unselectedLabelColor,
double itemHeadHeight = 30.0,
Color? itemHeadBackgroundColor,
Color? itemHeadLineColor,
double itemHeadLineHeight = 0.1,
TextStyle? itemHeadTextStyle,
double itemHeight = 40.0,
double indexBarWidth = 28,
double indexBarItemHeight = 20,
Color indexBarBackgroundColor = Colors.black12,
TextStyle? indexBarTextStyle,
Widget? itemSelectedIconWidget,
TextStyle? itemSelectedTextStyle,
TextStyle? itemUnSelectedTextStyle,
List<AddressNode>? initialAddress,
required CityPickerListener cityPickerListener,
}) {
showGeneralDialog(
context: context,
barrierColor: Colors.black.withOpacity(opacity),
barrierDismissible: dismissible,
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (context, animation, secondaryAnimation) {
return Align(
alignment: Alignment.bottomCenter,
child: Material(
color: Colors.transparent,
child: Container(
width: MediaQuery.of(context).size.width,
height: height,
decoration: BoxDecoration(
color: backgroundColor ?? Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(corner),
topRight: Radius.circular(corner),
),
),
child: CityPickerWidget(
height: height,
titleHeight: titleHeight,
corner: corner,
backgroundColor: backgroundColor,
paddingLeft: paddingLeft,
titleWidget: titleWidget,
selectText: selectText,
closeWidget: closeWidget,
tabHeight: tabHeight,
showTabIndicator: showTabIndicator,
tabPadding: tabPadding,
tabIndicatorColor: tabIndicatorColor,
tabIndicatorHeight: tabIndicatorHeight,
labelTextSize: labelTextSize,
selectedLabelColor: selectedLabelColor,
unselectedLabelColor: unselectedLabelColor,
itemHeadHeight: itemHeadHeight,
itemHeadBackgroundColor: itemHeadBackgroundColor,
itemHeadLineColor: itemHeadLineColor,
itemHeadLineHeight: itemHeadLineHeight,
itemHeadTextStyle: itemHeadTextStyle,
itemHeight: itemHeight,
indexBarWidth: indexBarWidth,
indexBarItemHeight: indexBarItemHeight,
indexBarBackgroundColor: indexBarBackgroundColor,
indexBarTextStyle: indexBarTextStyle,
itemSelectedIconWidget: itemSelectedIconWidget,
itemSelectedTextStyle: itemSelectedTextStyle,
itemUnSelectedTextStyle: itemUnSelectedTextStyle,
initialAddress: initialAddress,
cityPickerListener: cityPickerListener,
),
),
),
);
},
);
}
}

View File

@@ -142,7 +142,7 @@ class _NewHomePageState extends State<NewHomePage> {
}), }),
const Spacer(), // 左右分隔 const Spacer(), // 左右分隔
FloatingSvgIcon( FloatingSvgIcon(
assetPath: 'assets/img/icon/xiaoe.svg', assetPath: 'assets/img/icon/xiaoyi.svg',
width: 60.rpx, width: 60.rpx,
height: 60.rpx, height: 60.rpx,
onTap: () { onTap: () {
@@ -463,7 +463,7 @@ class _NewHomePageState extends State<NewHomePage> {
), ),
fillColor: fillColor:
stringToColor( stringToColor(
"#184468"), "##011D33"),
elevation: 2, elevation: 2,
borderColor: borderColor:
Colors.transparent, Colors.transparent,
@@ -482,6 +482,7 @@ class _NewHomePageState extends State<NewHomePage> {
isMultiSelect: false, isMultiSelect: false,
), ),
), ),
), ),
InkWell( InkWell(
onTap: () { onTap: () {
@@ -559,7 +560,8 @@ class _NewHomePageState extends State<NewHomePage> {
.value .value
.length, (index) { .length, (index) {
var day = homeController var day = homeController
.homeSleepDays[index]; .homeSleepDays[
index];
bool isSelected = bool isSelected =
homeController homeController
.selectedDayIndex .selectedDayIndex
@@ -607,7 +609,7 @@ class _NewHomePageState extends State<NewHomePage> {
BoxDecoration( BoxDecoration(
color: isSelected color: isSelected
? stringToColor( ? stringToColor(
"#184468") "#011D33")
: Colors : Colors
.transparent, .transparent,
borderRadius: borderRadius:

View File

@@ -28,10 +28,6 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
PeopleInfoController controller = Get.put(PeopleInfoController()); PeopleInfoController controller = Get.put(PeopleInfoController());
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// 初始化只做一次
WidgetsBinding.instance.addPostFrameCallback((_) {
controller.initData(data['mac']);
});
return LayoutBuilder( return LayoutBuilder(
builder: (context, boxConstraints) => GestureDetector( builder: (context, boxConstraints) => GestureDetector(
onTap: () { onTap: () {
@@ -186,12 +182,14 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
// ), // ),
// ), // ),
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Obx(() => Column(
children: [ children: [
if (controller.model.peopleList.isNotEmpty) if (controller.model.peopleList.isNotEmpty)
...List.generate(controller.model.peopleList.length, ...List.generate(
controller.model.peopleList.length,
(index) { (index) {
final person = controller.model.peopleList[index]; final person =
controller.model.peopleList[index];
String location_ = ''; String location_ = '';
// if ("${data["bindMacB"]}".length > 6 && // if ("${data["bindMacB"]}".length > 6 &&
// (person["direction"] == 1 || // (person["direction"] == 1 ||
@@ -200,7 +198,8 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
// } // }
return Column( return Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Container( Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
@@ -210,7 +209,8 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
child: Text( child: Text(
"人员资料${index == 0 ? "A" : "B"}", "人员资料${index == 0 ? "A" : "B"}",
style: TextStyle( style: TextStyle(
color: Colors.white, fontSize: 30.rpx), color: Colors.white,
fontSize: 30.rpx),
), ),
), ),
Container( Container(
@@ -222,18 +222,23 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
width: double.infinity, width: double.infinity,
height: 90.rpx, height: 90.rpx,
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 40.rpx, right: 35.rpx), left: 40.rpx,
right: 35.rpx),
decoration: BoxDecoration(), decoration: BoxDecoration(),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize:
MainAxisSize.max,
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment
.spaceBetween,
children: [ children: [
Text( Text(
'姓名', '姓名',
style: TextStyle( style: TextStyle(
fontFamily: 'Readex Pro', fontFamily:
color: Color(0xFF9EA4B7), 'Readex Pro',
color:
Color(0xFF9EA4B7),
fontSize: 30.rpx, fontSize: 30.rpx,
letterSpacing: 0, letterSpacing: 0,
), ),
@@ -242,40 +247,49 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
width: 300.rpx, width: 300.rpx,
child: TextField( child: TextField(
obscureText: false, obscureText: false,
textAlign: TextAlign.right, textAlign:
TextAlign.right,
style: TextStyle( style: TextStyle(
fontSize: 30.rpx, fontSize: 30.rpx,
color: Colors.white),
decoration:
const InputDecoration(
fillColor:
Colors.transparent,
filled: true,
hintText: "请输入姓名",
hintStyle: TextStyle(
color: color:
Colors.white), Colors.white),
decoration:
const InputDecoration(
fillColor: Colors
.transparent,
filled: true,
hintText:
"请输入姓名",
hintStyle: TextStyle(
color: Colors
.white),
border: border:
InputBorder.none, InputBorder
.none,
contentPadding: contentPadding:
EdgeInsets.all(0)), EdgeInsets
.all(
0)),
onChanged: (value) { onChanged: (value) {
controller.model controller.model
.peopleList[index] .peopleList[
index]
["name"] = value; ["name"] = value;
}, },
controller: controller.onReDraw( controller: controller.onReDraw(
TextEditingController( TextEditingController(
text: controller.model text: controller
.peopleList[ .model
index] .peopleList[index]
["name"] ?? [
"name"] ??
""), ""),
(textEditingController) { (textEditingController) {
textEditingController textEditingController
.text = controller.model .text = controller
.peopleList[index] .model
["name"] ?? .peopleList[
index]["name"] ??
""; "";
}, "people_name_$index"), }, "people_name_$index"),
), ),
@@ -288,50 +302,43 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
Obx( Obx(
() => Container( () => Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 40.rpx, right: 35.rpx), left: 40.rpx,
right: 35.rpx),
width: double.infinity, width: double.infinity,
height: 90.rpx, height: 90.rpx,
decoration: BoxDecoration(), decoration: BoxDecoration(),
child: Row( child: InkWell(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'性别',
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFF9EA4B7),
fontSize: 30.rpx,
letterSpacing: 0,
),
),
InkWell(
onTap: () { onTap: () {
// 触摸收起键盘 // 触摸收起键盘
FocusScope.of(context) FocusScope.of(context)
.requestFocus(FocusNode()); .requestFocus(
FocusNode());
Future.delayed( Future.delayed(
const Duration( const Duration(
milliseconds: 250), () { milliseconds:
250), () {
// 延迟执行的代码 // 延迟执行的代码
showOneSelectionDialog( showOneSelectionDialog(
context, context,
arr: ["", ""], arr: ["", ""],
checkIndex: controller checkIndex: controller
.model .model
.peopleList[ .peopleList[index]
index] [
['gender'] == 'gender'] ==
"" ""
? 0 ? 0
: 1, : 1,
checkChange: (sindex) { checkChange:
(sindex) {
controller.model.peopleList[ controller.model.peopleList[
index]['gender'] = index]
['gender'] =
sindex; // 👈 保存为 0 / 1 sindex; // 👈 保存为 0 / 1
controller.updateAll(); controller
print("gender $sindex"); .updateAll();
print(
"gender $sindex");
}).then((d) { }).then((d) {
// Timer(Duration.zero, () { // Timer(Duration.zero, () {
// FocusScope.of(context).unfocus(); // FocusScope.of(context).unfocus();
@@ -340,20 +347,44 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
}); });
}, },
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize:
MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'性别',
style: TextStyle(
fontFamily:
'Readex Pro',
color: Color(
0xFF9EA4B7),
fontSize: 30.rpx,
letterSpacing: 0,
),
),
Row(
mainAxisSize:
MainAxisSize.max,
children: [ children: [
Container( Container(
width: 200.rpx, width: 200.rpx,
child: Text( child: Text(
'${controller.model.peopleList[index]['gender'] == 1 ? '' : ''}', '${controller.model.peopleList[index]['gender'] == 1 ? '' : ''}',
textAlign: textAlign:
TextAlign.right, TextAlign
style: TextStyle( .right,
style:
TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
color: Colors.white, color: Colors
fontSize: 30.rpx, .white,
letterSpacing: 0, fontSize:
30.rpx,
letterSpacing:
0,
), ),
), ),
), ),
@@ -362,57 +393,129 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
), ),
Icon( Icon(
Icons.expand_more, Icons.expand_more,
color: Colors.white, color:
Colors.white,
size: 48.rpx, size: 48.rpx,
), ),
], ],
), ),
),
], ],
), ),
), )),
), ),
getLine(), getLine(),
// Container(
// width: double.infinity,
// height: 90.rpx,
// margin: EdgeInsets.only(
// left: 40.rpx, right: 35.rpx),
// decoration: BoxDecoration(),
// child: Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// children: [
// Text(
// '身高(cm)',
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: Color(0xFF9EA4B7),
// fontSize: 30.rpx,
// letterSpacing: 0,
// ),
// ),
// InkWell(
// onTap: () {
// FocusScope.of(context).unfocus();
// Future.delayed(
// const Duration(
// milliseconds: 250), () {
// showHeightPickerDialog(
// context,
// initialHeight: controller
// .model
// .peopleList[index]
// ['height'] ??
// 170,
// onConfirm:
// (int selectedHeight) {
// controller.model.peopleList[
// index]['height'] =
// selectedHeight
// .toString();
// controller.updateAll();
// print(
// "身高: $selectedHeight cm");
// },
// );
// });
// },
// child: Row(
// children: [
// Text(
// controller.model.peopleList[
// index]
// ['height'] !=
// null
// ? "${controller.model.peopleList[index]['height']} cm"
// : '',
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: Colors.white,
// fontSize: 30.rpx,
// ),
// ),
// SizedBox(width: 16.rpx),
// Icon(Icons.expand_more,
// color: Colors.white,
// size: 48.rpx),
// ],
// ),
// ),
// ],
// ),
// ),
Container( Container(
width: double.infinity, width: double.infinity,
height: 90.rpx, height: 90.rpx,
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 40.rpx, right: 35.rpx), left: 40.rpx,
right: 35.rpx),
decoration: BoxDecoration(), decoration: BoxDecoration(),
child: Row( child: InkWell(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'身高(cm)',
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFF9EA4B7),
fontSize: 30.rpx,
letterSpacing: 0,
),
),
InkWell(
onTap: () { onTap: () {
FocusScope.of(context).unfocus(); FocusScope.of(context)
.unfocus();
Future.delayed( Future.delayed(
const Duration( const Duration(
milliseconds: 250), () { milliseconds: 250),
() {
// Convert string height to int for initial value
final currentHeight =
controller.model
.peopleList[
index]['height'];
final initialHeight =
currentHeight != null
? int.tryParse(
currentHeight
.toString()) ??
170
: 170;
showHeightPickerDialog( showHeightPickerDialog(
context, context,
initialHeight: controller initialHeight:
.model initialHeight,
.peopleList[index] onConfirm: (int
['height'] ?? selectedHeight) {
170,
onConfirm:
(int selectedHeight) {
controller.model.peopleList[ controller.model.peopleList[
index]['height'] = index]
['height'] =
selectedHeight selectedHeight
.toString(); .toString();
controller.updateAll(); controller
.updateAll();
print( print(
"身高: $selectedHeight cm"); "身高: $selectedHeight cm");
}, },
@@ -420,71 +523,87 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
}); });
}, },
child: Row( child: Row(
children: [ mainAxisSize:
Text( MainAxisSize.max,
controller.model.peopleList[
index]
['height'] !=
null
? "${controller.model.peopleList[index]['height']} cm"
: '',
style: TextStyle(
fontFamily: 'Readex Pro',
color: Colors.white,
fontSize: 30.rpx,
),
),
SizedBox(width: 16.rpx),
Icon(Icons.expand_more,
color: Colors.white,
size: 48.rpx),
],
),
),
],
),
),
getLine(),
Container(
width: double.infinity,
height: 90.rpx,
margin: EdgeInsets.only(
left: 40.rpx, right: 35.rpx),
decoration: BoxDecoration(),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment
.spaceBetween,
children: [ children: [
Text( Text(
'体重(kg)', '身高(cm)',
style: TextStyle( style: TextStyle(
fontFamily: 'Readex Pro', fontFamily:
color: Color(0xFF9EA4B7), 'Readex Pro',
color:
Color(0xFF9EA4B7),
fontSize: 30.rpx, fontSize: 30.rpx,
letterSpacing: 0, letterSpacing: 0,
), ),
), ),
InkWell( Row(
children: [
Text(
controller.model.peopleList[
index]
[
'height'] !=
null
? "${controller.model.peopleList[index]['height']} cm"
: '',
style: TextStyle(
fontFamily:
'Readex Pro',
color:
Colors.white,
fontSize: 30.rpx,
),
),
SizedBox(
width: 16.rpx),
Icon(
Icons.expand_more,
color:
Colors.white,
size: 48.rpx),
],
),
],
),
)),
getLine(),
Obx(
() => Container(
width: double.infinity,
height: 90.rpx,
margin: EdgeInsets.only(
left: 40.rpx,
right: 35.rpx),
decoration: BoxDecoration(),
child: InkWell(
onTap: () { onTap: () {
FocusScope.of(context).unfocus(); FocusScope.of(context)
.unfocus();
Future.delayed( Future.delayed(
const Duration( const Duration(
milliseconds: 250), () { milliseconds:
250), () {
showWeightPickerDialog( showWeightPickerDialog(
context, context,
initialWeight: controller initialWeight: controller
.model .model
.peopleList[index] .peopleList[
index]
['weight'] ?? ['weight'] ??
"", "",
onConfirm: onConfirm: (int
(int selectedWeight) { selectedWeight) {
controller.model.peopleList[ controller.model.peopleList[
index]['weight'] = index]
['weight'] =
selectedWeight selectedWeight
.toString(); // ✅ 转成字符串 .toString(); // ✅ 转成字符串
controller.updateAll(); controller
.updateAll();
print( print(
"体重: $selectedWeight kg"); "体重: $selectedWeight kg");
}, },
@@ -492,80 +611,99 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
}); });
}, },
child: Row( child: Row(
mainAxisSize:
MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'体重(kg)',
style: TextStyle(
fontFamily:
'Readex Pro',
color: Color(
0xFF9EA4B7),
fontSize: 30.rpx,
letterSpacing: 0,
),
),
Row(
children: [ children: [
Text( Text(
controller.model.peopleList[ controller.model.peopleList[
index] index]
['weight'] != [
'weight'] !=
null null
? "${controller.model.peopleList[index]['weight']} kg" ? "${controller.model.peopleList[index]['weight']} kg"
: '', : '',
style: TextStyle( style: TextStyle(
fontFamily: 'Readex Pro', fontFamily:
color: Colors.white, 'Readex Pro',
fontSize: 30.rpx, color: Colors
.white,
fontSize:
30.rpx,
), ),
), ),
SizedBox(width: 16.rpx), SizedBox(
Icon(Icons.expand_more, width: 16.rpx),
color: Colors.white, Icon(
Icons
.expand_more,
color: Colors
.white,
size: 48.rpx), size: 48.rpx),
], ],
), ),
),
], ],
), ),
)),
), ),
getLine(), getLine(),
Obx( Obx(
() => Container( () => Container(
width: double.infinity, width: double.infinity,
height: 90.rpx, height: 90.rpx,
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 40.rpx, right: 35.rpx), left: 40.rpx,
right: 35.rpx),
decoration: BoxDecoration(), decoration: BoxDecoration(),
child: Row( child: InkWell(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'生日',
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFF9EA4B7),
fontSize: 30.rpx,
letterSpacing: 0,
),
),
InkWell(
onTap: () { onTap: () {
// 触摸收起键盘 // 触摸收起键盘
FocusScope.of(context) FocusScope.of(context)
.requestFocus(FocusNode()); .requestFocus(
FocusNode());
Future.delayed( Future.delayed(
const Duration( const Duration(
milliseconds: 250), () { milliseconds:
250), () {
// 延迟执行的代码 // 延迟执行的代码
showDateSelectionDialog( showDateSelectionDialog(
context, context,
checkDate: controller checkDate: controller
.model .model
.peopleList[index] .peopleList[index]['birthday']
['birthday']
is DateTime is DateTime
? controller.model ? controller
.model
.peopleList[index] .peopleList[index]
['birthday'] ['birthday']
: DateTime.tryParse( : DateTime.tryParse(
controller.model.peopleList[index]['birthday'] ?? controller.model.peopleList[index]['birthday'] ??
'') ?? '') ??
DateTime.now(), DateTime.now(),
checkChange: (DateTime d) { checkChange:
(DateTime d) {
controller.model controller.model
.peopleList[index] .peopleList[
index]
['birthday'] = d; ['birthday'] = d;
controller.updateAll(); controller
.updateAll();
print("$d"); print("$d");
}).then((d) { }).then((d) {
// Timer(Duration.zero, () { // Timer(Duration.zero, () {
@@ -575,48 +713,73 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
}); });
}, },
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize:
MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [ children: [
Container( Text(
constraints: BoxConstraints( '生日',
minWidth: 200.rpx),
child: Text(
controller.model.peopleList[
index][
'birthday'] !=
null
? time_08_Formatter_pattern(
controller.model
.peopleList[
index]
['birthday'],
"yyyy年MM月dd日")
: '',
textAlign:
TextAlign.right,
style: TextStyle( style: TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
color: Colors.white, color: Color(
0xFF9EA4B7),
fontSize: 30.rpx, fontSize: 30.rpx,
letterSpacing: 0, letterSpacing: 0,
), ),
), ),
Row(
mainAxisSize:
MainAxisSize.max,
children: [
Container(
constraints:
BoxConstraints(
minWidth:
200.rpx),
child: Text(
controller.model.peopleList[index]
[
'birthday'] !=
null
? time_08_Formatter_pattern(
controller
.model
.peopleList[index]['birthday'],
"yyyy年MM月dd日")
: '',
textAlign:
TextAlign
.right,
style:
TextStyle(
fontFamily:
'Readex Pro',
color: Colors
.white,
fontSize:
30.rpx,
letterSpacing:
0,
),
),
), ),
SizedBox( SizedBox(
width: 16.rpx, width: 16.rpx,
), ),
Icon( Icon(
Icons.expand_more, Icons.expand_more,
color: Colors.white, color:
Colors.white,
size: 48.rpx, size: 48.rpx,
), ),
], ],
), ),
),
], ],
), ),
), )),
), ),
getLine(), getLine(),
Container( Container(
@@ -628,7 +791,8 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment
.spaceBetween,
children: [ children: [
Text( Text(
'联系人', '联系人',
@@ -647,37 +811,45 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
TextInputType.number, TextInputType.number,
textInputAction: textInputAction:
TextInputAction.done, TextInputAction.done,
textAlign: TextAlign.right, textAlign:
TextAlign.right,
style: TextStyle( style: TextStyle(
fontSize: 30.rpx, fontSize: 30.rpx,
color: Colors.white), color: Colors.white),
decoration: InputDecoration( decoration: InputDecoration(
fillColor: Colors.transparent, fillColor: Colors
.transparent,
filled: true, filled: true,
hintText: "请输入联系人", hintText: "请输入联系人",
hintStyle: TextStyle( hintStyle: TextStyle(
color: Colors.white), color:
border: InputBorder.none, Colors.white),
border:
InputBorder.none,
contentPadding: contentPadding:
EdgeInsets.all(0)), EdgeInsets.all(
0)),
onChanged: (value) { onChanged: (value) {
controller controller.model
.model.peopleList[index] .peopleList[
index]
['contact'] = value; ['contact'] = value;
controller.updateAll(); controller.updateAll();
}, },
controller: controller.onReDraw( controller: controller.onReDraw(
TextEditingController( TextEditingController(
text: controller.model text: controller
.peopleList[ .model
index] .peopleList[index]
['contact'] ?? [
'contact'] ??
""), ""),
(textEditingController) { (textEditingController) {
textEditingController textEditingController
.text = controller.model .text = controller
.peopleList[index] .model
['contact'] ?? .peopleList[
index]['contact'] ??
""; "";
}, "contact_$index"), }, "contact_$index"),
), ),
@@ -697,7 +869,7 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
), ),
], ],
)), )),
), )),
), ),
), ),
)), )),

View File

@@ -173,9 +173,7 @@ class DeviceRepairPage extends GetView<RepairListController> {
), ),
], ],
))), ))),
SizedBox(height: 24.rpx), SizedBox(height: 24.rpx),
InkWell( InkWell(
onTap: () { onTap: () {
// bool isOk = true; // bool isOk = true;

View File

@@ -7,16 +7,20 @@ import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart';
class RoomPickerPage extends StatefulWidget { class RoomPickerPage extends StatefulWidget {
final Map data;
RoomPickerPage({Key? key, required this.data});
@override @override
_RoomPickerPageState createState() => _RoomPickerPageState(); _RoomPickerPageState createState() => _RoomPickerPageState();
} }
class _RoomPickerPageState extends State<RoomPickerPage> { class _RoomPickerPageState extends State<RoomPickerPage> {
late Map<String, dynamic> editedData;
RxList rooms = [].obs; RxList rooms = [].obs;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
editedData = Map.from(widget.data); // 创建副本
getRoomList(); getRoomList();
} }
@@ -31,6 +35,7 @@ class _RoomPickerPageState extends State<RoomPickerPage> {
queryUrl: queryUrl, queryUrl: queryUrl,
onSuccess: (res) { onSuccess: (res) {
rooms.assignAll(res.data); rooms.assignAll(res.data);
setState(() => selectedIndex = 0);
}, },
); );
} }
@@ -161,8 +166,32 @@ class _RoomPickerPageState extends State<RoomPickerPage> {
child: CustomCard( child: CustomCard(
borderRadius: 16.rpx, borderRadius: 16.rpx,
gradientDirection: GradientDirection.vertical, gradientDirection: GradientDirection.vertical,
onTap: () { onTap: () async {
// Get.toNamed("/applyRepairPage"); // Get.toNamed("/applyRepairPage");
try {
String serviceAddress =
ServiceConstant.service_address;
String serviceName =
ServiceConstant.server_service;
String serviceApi =
ServiceConstant.device_show;
String queryUrl =
"$serviceAddress$serviceName$serviceApi";
await requestWithLog(
logTitle: "更新设备信息",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: {
"id": editedData["_id"],
"roomId": rooms[selectedIndex]['_id'],
},
onSuccess: (res) {
'更新人员信息成功: $res';
},
);
} catch (e) {
print(e);
}
}, },
colors: const [ colors: const [
Color(0xFFFCFCFC), Color(0xFFFCFCFC),

View File

@@ -130,7 +130,7 @@ class SearchWidget extends GetView {
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
SizedBox( SizedBox(
height: 50.rpx, height: 30.rpx,
child: VerticalDivider( child: VerticalDivider(
thickness: 2.rpx, thickness: 2.rpx,
color: stringToColor("#333333"), //固定 color: stringToColor("#333333"), //固定

View File

@@ -83,7 +83,7 @@ class _UpdateUserPageState extends State<EditUserPage> {
), ),
Positioned( Positioned(
left: 0, left: 0,
child: returnIconButtom, child: returnIconButtomNew,
), ),
Positioned( Positioned(
right: 20.rpx, right: 20.rpx,

View File

@@ -591,8 +591,13 @@ class _RxhxMhtState extends State<RxhxMht> {
child: Center( child: Center(
child: Text( child: Text(
weeks[index], weeks[index],
style: const TextStyle( style: TextStyle(
color: Colors.white), color: controller.model
.rxhxWeeks[
index] ==
1
? Color(0XFF003058)
: Colors.white),
), ),
), ),
), ),

View File

@@ -491,6 +491,7 @@ class _ApplyRepairPageState extends State<ApplyRepairPage> {
cursorColor: themeController.currentColor.sc3, cursorColor: themeController.currentColor.sc3,
onChanged: onChanged, onChanged: onChanged,
), ),
), ),
), ),
].divide(SizedBox(width: 24.rpx)), ].divide(SizedBox(width: 24.rpx)),

View File

@@ -68,7 +68,7 @@ var mhroutes = {
"/sleepHabitPage": (context) => SleepHabitPage(), "/sleepHabitPage": (context) => SleepHabitPage(),
'/syms': (context) => Smys(), '/syms': (context) => Smys(),
"/applyRepairPage": (context) => ApplyRepairPage(), "/applyRepairPage": (context) => ApplyRepairPage(),
"/roomPickerPage": (context) => RoomPickerPage(), "/roomPickerPage": (context, {arguments}) => RoomPickerPage(data: arguments),
"/editBedPage": (context, {arguments}) => EditBedPage(data: arguments), "/editBedPage": (context, {arguments}) => EditBedPage(data: arguments),
"/experienceStorePage": (context) => ExperienceStorePage(), "/experienceStorePage": (context) => ExperienceStorePage(),
"/bookInfoPage": (context, {arguments}) => "/bookInfoPage": (context, {arguments}) =>