地址接口的视线

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 {
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 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 login = "/api/user/login";//登录
static String get_bluetooth_device_status = "/api/device/status/info";//设备绑定状态
static String device_bind = "/api/device/bind";//设备绑定
static String device_type = "/api/device/type/list";//设备类型
static String upload_file = "/api/file/info";//上传文件
static String user_info = "/api/user/info";//更新用户资料,查询用户信息
static String device_list = "/api/device/list";//绑定设备列表
static String person_info = "/api/personnel/info";//用户资料
static String sleep_report = "/api/device/sleep/data";//睡眠报告
static String device_share = "/api/device/share";//分享设备
static String message_list = "/api/mesasge/list";//消息列表
static String message_read = "/api/mesasge/read";//消息未读数量
static String device_show = "/api/device/bind";//更新设备绑定
static String disease_list = "/api/personnel/disease/list";//获取疾病类型
static String share_deleted = "";//删除分享
static String start_calibration = "/api/caibration";//开始校准
static String calibration_process = "/api/caibration";//校准进度
static String submit_repair = "/api/device/repair";//提交报修
static String user_setting = "/api/user/config";//查询和更新用户自定义配置
static String send_code = "/api/verifycode/send"; //发送验证码
static String login = "/api/user/login"; //登录
static String get_bluetooth_device_status =
"/api/device/status/info"; //设备绑定状态
static String device_bind = "/api/device/bind"; //设备绑定
static String device_type = "/api/device/type/list"; //设备类型
static String upload_file = "/api/file/info"; //上传文件
static String user_info = "/api/user/info"; //更新用户资料,查询用户信息
static String device_list = "/api/device/list"; //绑定设备列表
static String person_info = "/api/personnel/info"; //用户资料
static String sleep_report = "/api/device/sleep/data"; //睡眠报告
static String device_share = "/api/device/share"; //分享设备
static String message_list = "/api/mesasge/list"; //消息列表
static String message_read = "/api/mesasge/read"; //消息未读数量
static String device_show = "/api/device/bind"; //更新设备绑定
static String disease_list = "/api/personnel/disease/list"; //获取疾病类型
static String share_deleted = ""; //删除分享
static String start_calibration = "/api/caibration"; //开始校准
static String calibration_process = "/api/caibration"; //校准进度
static String submit_repair = "/api/device/repair"; //提交报修
static String user_setting = "/api/user/config"; //查询和更新用户自定义配置
static String room_list = "/api/room/info"; //查询房间列表
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 const String webSocketService = "wss://$baseHost/vsbs_ws_gateway/ws";
static const String sleep_token = "HdAMjzqiYQKsmHRyEFKhfRGQ";
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 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"; //人员信息列表
}

View File

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

View File

@@ -1,6 +1,7 @@
import 'package:ef/ef.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';
@@ -23,42 +24,48 @@ class AddressListController extends GetControllerEx<AddressListModel> {
attr = GetModel(AddressListModel()).obs;
}
// getAddressList() async {
// await ApiService.request.get("/api/address/info/list").then((d) {
// model.addressList = d.data["data"] ?? [];
// updateAll();
// }).catchError((e) {
// print("$e");
// });
// }
getAddressList() async {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.address_list;
String queryUrl = "$serviceAddress$serviceName$serviceApi";
// //更新默认
// Future<void> updateDefault(address) async {
// var id = address['id'];
// var uid = address['userId'];
// try {
// await ef.client
// .from("app_user_address")
// .update({
// 'ischecked': 0,
// })
// .eq("user_id", address['userId'])
// .eq("ischecked", 1);
// await ef.client.from("app_user_address").update({
// 'ischecked': 1,
// }).eq("id", address['id']);
// } catch (e) {
// print('Error fetching repairs: $e');
// }
// }
requestWithLog(
logTitle: '查询地址列表',
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
// 安全检查 res.data 是否为 List
if (res.data != null && res.data is List && res.data.isNotEmpty) {
model.addressList = res.data;
} else {
model.addressList = []; // 设为空数组,防止空指针问题
}
updateAll();
},
onFailure: (err) {
model.addressList = []; // 请求失败时也清空列表以防旧数据残留
updateAll();
},
);
}
// // 删除地址
// Future<void> deleteAddress(String id) async {
// try {
// await ef.client.from("app_user_address").delete().eq("id", id);
// print("Address with ID $id has been successfully deleted.");
// } catch (e) {
// print("Error deleting address with ID $id: $e");
// }
// }
Future<void> deleteAddress(String id) async {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.add_address;
String queryUrl = "$serviceAddress$serviceName$serviceApi?id=$id";
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/myDialog/my_dialog_controller.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/model/user_data.dart';
@@ -216,16 +217,14 @@ class ApplyRepairController extends GetControllerEx<ApplyRepairModel> {
return message;
}
// Future<void> getDeviceList() async {
// final UserInfoController userInfoController =
// Get.find<UserInfoController>();
// // UserModel loginUser = userInfoController.model.user!;
// DeviceListController deviceListController = Get.find();
// await deviceListController.getDeviceList();
// var aa = deviceListController.model.deviceListWyf;
// ApplyRepairController applyRepairController = Get.find();
// applyRepairController.model.device_list = aa;
// }
Future<void> getDeviceList() async {
// UserModel loginUser = userInfoController.model.user!;
DeviceListController deviceListController = Get.find();
await deviceListController.getDeviceList();
var aa = deviceListController.model.deviceList;
ApplyRepairController applyRepairController = Get.find();
applyRepairController.model.device_list = aa;
}
// String getPublicUrl(String path) {
// try {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -51,14 +51,10 @@ class ShareUserWidget extends GetView {
height: 42.rpx,
child: SvgPicture.asset('assets/img/icon/default_head.svg'),
),
Expanded(
child: Container(
margin:
EdgeInsetsDirectional.only(start: 30.rpx, end: 30.rpx),
// width: MediaQuery.sizeOf(context).width * 0.5,
// height: MediaQuery.sizeOf(context).height * 0.075,
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
@@ -72,6 +68,7 @@ class ShareUserWidget extends GetView {
color: Colors.white,
fontSize: 30.rpx,
letterSpacing: 0.0,
height: 1,
),
),
),
@@ -90,6 +87,7 @@ class ShareUserWidget extends GetView {
color: const Color(0xFFC8CBD2),
fontSize: 20.rpx,
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(
backgroundColor: Colors.transparent,
highlightColor: Colors.transparent,
@@ -147,25 +107,9 @@ class ShareUserWidget extends GetView {
child: SvgPicture.asset(
'assets/img/icon/expand.svg',
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>();
BoxConstraints? bodysize;
// AddressListPage() {
// controller.getAddressList();
// }
AddressListPage() {
controller.getAddressList();
}
@override
Widget build(BuildContext context) {
@@ -65,6 +65,7 @@ class AddressListPage extends GetView<AddressListController> {
centerTitle: false,
),
body: Container(
margin: EdgeInsets.only(top: 30.rpx),
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 1,
child: Column(
@@ -80,49 +81,24 @@ class AddressListPage extends GetView<AddressListController> {
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 1,
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(
shrinkWrap: true,
scrollDirection: Axis.vertical,
children: (controller.model.addressList!
.asMap()
.entries
.map((e) => AddressModuleWidget(
index: e.key,
addressListController:
controller,
))
.toList() as List<Widget>)
.divide(const SizedBox(height: 10))
.addToEnd(const SizedBox(
height: AppConstants
.list_end_height)),
)),
),
],
),
decoration: BoxDecoration(),
child: Obx(() => ListView(
shrinkWrap: true,
scrollDirection: Axis.vertical,
children: (controller.model.addressList!
.asMap()
.entries
.map((e) => AddressModuleWidget(
index: e.key,
addressListController:
controller,
))
.toList() as List<Widget>)
.divide(const SizedBox(height: 10))
.addToEnd(const SizedBox(
height:
AppConstants.list_end_height)),
)),
),
);
}
@@ -143,7 +119,7 @@ class AddressListPage extends GetView<AddressListController> {
),
child: TextButton(
onPressed: () {
controller.model.address = {'isChecked': false};
controller.model.address = {'default': 0};
controller.model.type = 1;
Get.toNamed("/editAddressPage");
},
@@ -167,20 +143,7 @@ class AddressListPage extends GetView<AddressListController> {
width: 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), // 加号和文字间距
Text(
'添加新地址',

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -84,7 +84,8 @@ class BluetoothPage extends GetView {
highlightColor: const Color(0xFF055466),
padding: EdgeInsets.only(left: 0),
onTap: () {
Get.toNamed("/editBedPage");
Get.toNamed("/editBedPage",
arguments: data);
},
child: Container(
width: 42.rpx,
@@ -135,7 +136,7 @@ class BluetoothPage extends GetView {
context, '人员资料', "/peopleInfoPage",
arguments: data),
_buildMenuButton(
context, '房间选择', "/roomPickerPage"),
context, '房间选择', "/roomPickerPage",arguments: data),
_buildMenuButton(context, '设备校准', ""),
_buildMenuButton(context, '体征传感器', ""),
_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/util/FitTool.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/mh_controller/device_list_controller.dart';
@@ -115,25 +116,25 @@ class DeviceInfoWidget extends GetView {
letterSpacing: 0,
height: 1),
),
TextSpan(
text:
' (${deviceListController.model.deviceList[index]['status'] ?? ''})',
style: TextStyle(
fontFamily: 'Readex Pro',
color: deviceListController
.model
.deviceList[
index]
['status'] ==
'在线'
? Color(
0xFF07C160) // 在线的颜色
: Color(
0xFFEA7CA7), // 离线的颜色
fontSize: 26.rpx,
letterSpacing: 0,
),
),
// TextSpan(
// text:
// ' (${deviceListController.model.deviceList[index]['status'] ?? ''})',
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: deviceListController
// .model
// .deviceList[
// index]
// ['status'] ==
// '在线'
// ? Color(
// 0xFF07C160) // 在线的颜色
// : Color(
// 0xFFEA7CA7), // 离线的颜色
// fontSize: 26.rpx,
// letterSpacing: 0,
// ),
// ),
],
),
maxLines: 1, // 限制显示一行
@@ -196,7 +197,7 @@ class DeviceInfoWidget extends GetView {
color: Color(0XFF85F5FF),
textStyle: TextStyle(
fontFamily: 'Readex Pro',
color: Colors.white,
color: Color(0xFF011D33),
fontSize: 28.rpx,
letterSpacing: 0,
),
@@ -238,11 +239,12 @@ class DeviceInfoWidget extends GetView {
children: [
InkWell(
onTap: () async {
if (device['type'] == 1) {
globalController.model.deviceMain = device;
await Get.toNamed("/deviceShare");
globalController.getDeviceList();
}
await Get.toNamed("/deviceSharePage");
// if (device['type'] == 1) {
// globalController.model.deviceMain = device;
// await Get.toNamed("/deviceSharePage");
// globalController.getDeviceList();
// }
},
child: Container(
height: MediaQuery.sizeOf(context).height * 0.1,
@@ -351,11 +353,15 @@ class DeviceInfoWidget extends GetView {
),
InkWell(
onTap: () {
var a = [device["bindMacA"]];
if ("${device["bindMacB"]}".length > 6) {
a.add(device["bindMacB"]);
}
Get.toNamed("/sleepWebview", arguments: a);
TopSlideNotification.show(
context,
text: "功能开发中...",
);
// var a = [device["bindMacA"]];
// if ("${device["bindMacB"]}".length > 6) {
// a.add(device["bindMacB"]);
// }
// Get.toNamed("/sleepWebview", arguments: a);
},
child: Container(
height: MediaQuery.sizeOf(context).height * 0.1,

View File

@@ -33,108 +33,107 @@ class _DeviceListPageState extends State<DeviceListPage> {
return LayoutBuilder(builder: (context, cc) {
bodysize = cc;
return GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: Colors.white),
titleSpacing: 0,
// leading: returnIconButtomAddCallback(() {
// controller.saveDataApi();
// updateParm(isShowToast: false);
// }),
// leading: returnIconButtomNew,
title: Container(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
// 中间居中的标题
Text(
'设备列表',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 30.rpx,
),
),
// 左侧图标
Positioned(
left: 20.rpx,
child: returnIconButtomNew,
),
],
),
onTap: () => FocusScope.of(context).unfocus(),
child: Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/new_background.png'), // 本地图片
fit: BoxFit.fill, // 填满整个 Container
),
actions: [],
centerTitle: false,
),
backgroundColor: Colors.transparent,
body: Stack(
children: [
Positioned.fill(
child: Image.asset(
'assets/images/new_background.png',
fit: BoxFit.fill,
),
),
Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 10, 0, 23),
child: SearchWidget(
keyword: controller.model.keyword,
color: controller.model.color,
hint: "检索设备",
onChange: (d) {
controller.model.keyword = d;
},
findCallback: () {
controller.getDeviceList();
},
),
),
Obx(() {
if (controller.model.deviceList == null ||
controller.model.deviceList.isEmpty) {
return Expanded(child: NullDataWidget());
}
// 如果 deviceList 不为空,渲染列表
return Expanded(
child: ListView(
shrinkWrap: true,
scrollDirection: Axis.vertical,
children: controller.model.deviceList
.asMap()
.entries
.map((e) => DeviceInfoWidget(
index: e.key,
deviceListController: controller,
))
.toList()
.divide(const SizedBox(height: 10))
.addToEnd(const SizedBox(height: 100)),
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: Colors.white),
titleSpacing: 0,
// leading: returnIconButtomAddCallback(() {
// controller.saveDataApi();
// updateParm(isShowToast: false);
// }),
// leading: returnIconButtomNew,
title: Container(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
// 中间居中的标题
Text(
'设备列表',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 30.rpx,
),
),
);
}),
],
// 左侧图标
Positioned(
left: 20.rpx,
child: returnIconButtomNew,
),
],
),
),
actions: [],
centerTitle: false,
),
],
)
backgroundColor: Colors.transparent,
body: Container(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 10, 0, 23),
child: SearchWidget(
keyword: controller.model.keyword,
color: controller.model.color,
hint: "检索设备",
onChange: (d) {
controller.model.keyword = d;
},
findCallback: () {
controller.getDeviceList();
},
),
),
Obx(() {
if (controller.model.deviceList == null ||
controller.model.deviceList.isEmpty) {
return Expanded(child: NullDataWidget());
}
// Container(
// width: bodysize!.maxWidth,
// height: bodysize!.maxHeight,
// 如果 deviceList 不为空,渲染列表
return Expanded(
child: ListView(
shrinkWrap: true,
scrollDirection: Axis.vertical,
children: controller.model.deviceList
.asMap()
.entries
.map((e) => DeviceInfoWidget(
index: e.key,
deviceListController: controller,
))
.toList()
.divide(const SizedBox(height: 10))
.addToEnd(const SizedBox(height: 100)),
),
);
}),
],
),
)
// ),
),
);
// Container(
// width: bodysize!.maxWidth,
// height: bodysize!.maxHeight,
// ),
),
));
});
}
}

View File

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

View File

@@ -434,22 +434,30 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
letterSpacing: 0.0,
),
),
Radio<int>(
value: 1,
groupValue: controller.model.type,
onChanged: (value) {
controller.model.type = value!;
controller.updateAll();
},
activeColor:
const Color(0xFF6BFDAC),
materialTapTargetSize:
MaterialTapTargetSize
.shrinkWrap, // 减少内边距
visualDensity: VisualDensity(
horizontal: -4,
vertical: -4), // 缩小视觉密度
)
Theme(
data:
Theme.of(context).copyWith(
unselectedWidgetColor: Color(
0xFFC8CBD2), // 改变未选中状态边框颜色
),
child: Radio<int>(
value: 1,
groupValue:
controller.model.type,
onChanged: (value) {
controller.model.type =
value!;
controller.updateAll();
},
activeColor:
const Color(0xFF6BFDAC),
materialTapTargetSize:
MaterialTapTargetSize
.shrinkWrap, // 减少内边距
visualDensity: VisualDensity(
horizontal: -4,
vertical: -4), // 缩小视觉密度
))
],
),
),
@@ -485,22 +493,30 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
letterSpacing: 0.0,
),
),
Radio<int>(
value: 2,
groupValue: controller.model.type,
onChanged: (value) {
controller.model.type = value!;
controller.updateAll();
},
activeColor:
const Color(0xFF6BFDAC),
materialTapTargetSize:
MaterialTapTargetSize
.shrinkWrap, // 减少内边距
visualDensity: VisualDensity(
horizontal: -4,
vertical: -4), // 缩小视觉密度
)
Theme(
data:
Theme.of(context).copyWith(
unselectedWidgetColor: Color(
0xFFC8CBD2), // 改变未选中状态边框颜色
),
child: Radio<int>(
value: 2,
groupValue:
controller.model.type,
onChanged: (value) {
controller.model.type =
value!;
controller.updateAll();
},
activeColor:
const Color(0xFF6BFDAC),
materialTapTargetSize:
MaterialTapTargetSize
.shrinkWrap, // 减少内边距
visualDensity: VisualDensity(
horizontal: -4,
vertical: -4), // 缩小视觉密度
))
],
),
),

File diff suppressed because it is too large Load Diff

View File

@@ -188,7 +188,7 @@ class _EditBedPageState extends State<EditBedPage> {
ServiceConstant.service_address;
String serviceName =
ServiceConstant.server_service;
String serviceApi = ServiceConstant.person_info;
String serviceApi = ServiceConstant.device_show;
String queryUrl =
"$serviceAddress$serviceName$serviceApi";
await requestWithLog(
@@ -196,10 +196,12 @@ class _EditBedPageState extends State<EditBedPage> {
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: {
"id": editedData["id"],
"id": editedData["_id"],
"name": editedData["name"],
},
onSuccess: (res) {},
onSuccess: (res) {
'更新人员信息成功: $res';
},
);
},
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(), // 左右分隔
FloatingSvgIcon(
assetPath: 'assets/img/icon/xiaoe.svg',
assetPath: 'assets/img/icon/xiaoyi.svg',
width: 60.rpx,
height: 60.rpx,
onTap: () {
@@ -463,7 +463,7 @@ class _NewHomePageState extends State<NewHomePage> {
),
fillColor:
stringToColor(
"#184468"),
"##011D33"),
elevation: 2,
borderColor:
Colors.transparent,
@@ -482,6 +482,7 @@ class _NewHomePageState extends State<NewHomePage> {
isMultiSelect: false,
),
),
),
InkWell(
onTap: () {
@@ -559,7 +560,8 @@ class _NewHomePageState extends State<NewHomePage> {
.value
.length, (index) {
var day = homeController
.homeSleepDays[index];
.homeSleepDays[
index];
bool isSelected =
homeController
.selectedDayIndex
@@ -607,7 +609,7 @@ class _NewHomePageState extends State<NewHomePage> {
BoxDecoration(
color: isSelected
? stringToColor(
"#184468")
"#011D33")
: Colors
.transparent,
borderRadius:

File diff suppressed because it is too large Load Diff

View File

@@ -173,9 +173,7 @@ class DeviceRepairPage extends GetView<RepairListController> {
),
],
))),
SizedBox(height: 24.rpx),
InkWell(
onTap: () {
// 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';
class RoomPickerPage extends StatefulWidget {
final Map data;
RoomPickerPage({Key? key, required this.data});
@override
_RoomPickerPageState createState() => _RoomPickerPageState();
}
class _RoomPickerPageState extends State<RoomPickerPage> {
late Map<String, dynamic> editedData;
RxList rooms = [].obs;
@override
void initState() {
super.initState();
editedData = Map.from(widget.data); // 创建副本
getRoomList();
}
@@ -31,6 +35,7 @@ class _RoomPickerPageState extends State<RoomPickerPage> {
queryUrl: queryUrl,
onSuccess: (res) {
rooms.assignAll(res.data);
setState(() => selectedIndex = 0);
},
);
}
@@ -161,8 +166,32 @@ class _RoomPickerPageState extends State<RoomPickerPage> {
child: CustomCard(
borderRadius: 16.rpx,
gradientDirection: GradientDirection.vertical,
onTap: () {
onTap: () async {
// 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 [
Color(0xFFFCFCFC),

View File

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

View File

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

View File

@@ -591,8 +591,13 @@ class _RxhxMhtState extends State<RxhxMht> {
child: Center(
child: Text(
weeks[index],
style: const TextStyle(
color: Colors.white),
style: TextStyle(
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,
onChanged: onChanged,
),
),
),
].divide(SizedBox(width: 24.rpx)),

View File

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