diff --git a/assets/langs/zh_CN.json b/assets/langs/zh_CN.json index 257469f..a8cd4f8 100644 --- a/assets/langs/zh_CN.json +++ b/assets/langs/zh_CN.json @@ -71,7 +71,11 @@ "无法绑定1":"检测到该设备", "无法绑定2":"已被绑定", "无法绑定3":",绑定前请先进行解绑,有疑问请联系客服", - "知道了":"知道了" + "知道了":"知道了", + "是":"是", + "否":"否", + "确定绑定提示":"确定绑定该设备吗?", + "连接成功":"连接成功" }, "登录页":{ "欢迎使用太和e护":"欢迎使用太和e护", @@ -84,7 +88,8 @@ "协议4":"《隐私政策》", "协议5":"以及", "协议6":"《用户使用条款》", - "其他登录方式":"欢迎使用太和e护" + "其他登录方式":"欢迎使用太和e护", + "未同意协议":"请确认同意协议" }, "人员资料":{ "标题":"人员资料", @@ -123,8 +128,38 @@ "输入内容":"输入手机号码/邮箱", "输入验证码":"输入验证码", "获取验证码":"获取验证码", - "登录":"登录" - + "登录":"登录", + "请输入手机号":"请输入手机号/邮箱", + "不正确手机号":"请输入正确的手机号或者邮箱", + "请输入验证码":"请输入验证码", + "登录成功":"登录成功", + "秒":"秒", + "发送成功":"验证码发送成功", + "发送失败":"验证码发送失败", + "登录失败":"登录失败" + }, + "修改资料页":{ + "个人信息":"个人信息", + "保存":"保存", + "点击更换头像":"点击更换头像", + "保存成功":"保存成功!", + "保存失败":"保存失败!" + }, + "设置页":{ + "标题":"设置", + "主题模式":"主题模式", + "选择语言":"选择语言", + "关于我们":"关于我们", + "用户协议":"用户协议", + "隐私协议":"隐私协议", + "退出登录":"退出登录", + "注销账号":"注销账号" + }, + "关于我们":{ + "标题":"关于我们" + }, + "服务器":{ + "失败":"服务器内部错误,请联系管理员" } } \ No newline at end of file diff --git a/lib/common/color/appConstants.dart b/lib/common/color/appConstants.dart index 5cd8c8c..783859f 100644 --- a/lib/common/color/appConstants.dart +++ b/lib/common/color/appConstants.dart @@ -19,6 +19,7 @@ class AppConstants { double text_padding_up_dowm_p = 5.rpx; //段落文字上下间距 + double smaller_text_fontSize = 18.rpx; //普通文字字号 double small_text_fontSize = 20.rpx; //普通文字字号 double normal_text_fontSize = 26.rpx; //普通文字字号 double title_text_fontSize = 30.rpx; //标题文字字号 diff --git a/lib/common/util/Ble.dart b/lib/common/util/Ble.dart index a1c02c4..ccb8e20 100644 --- a/lib/common/util/Ble.dart +++ b/lib/common/util/Ble.dart @@ -694,7 +694,10 @@ void setOther(device, connectedDeviceProp, fun) async { // 连接设备 void connectToDevice(fun) async { - BluetoothDevice device = fun['device']; + if (fun != null) { + return; + } + BluetoothDevice device = fun.device; ConnectedDeviceProp? connectedDeviceProp = getOneConnectedDeviceProp(device.remoteId.str); if (connectedDeviceProp != null) { @@ -709,12 +712,7 @@ void connectToDevice(fun) async { await device.connect(timeout: const Duration(seconds: 8)); print("device.connect success"); ConnectedDevicePropType connectedDevicePropType = - ConnectedDevicePropType.JunHe; - if (isQuanShiDevice(device.advName)) { - connectedDevicePropType = ConnectedDevicePropType.QuanShi; - } else if (isMHTSWES(device.advName)) { - connectedDevicePropType = ConnectedDevicePropType.MHT; - } + ConnectedDevicePropType.JunHe; connectedDeviceProp = ConnectedDeviceProp( connectDevice: device, fun: fun, @@ -735,6 +733,11 @@ void connectToDevice(fun) async { } } +bool jsJunHe(String name) { + return "$name".contains("AITH-V2") || "$name".contains("AITH-V2") || "$name".contains("AITH-V2"); +} + + void disconnect(ConnectedDeviceProp connectedDeviceProp) { connectedDeviceProp.closeHeartBeat(); connectList.remove(connectedDeviceProp.id); diff --git a/lib/common/util/CommonVariables.dart b/lib/common/util/CommonVariables.dart index b0c6dff..730e68a 100644 --- a/lib/common/util/CommonVariables.dart +++ b/lib/common/util/CommonVariables.dart @@ -32,4 +32,6 @@ class CommonVariables { static String shareText = "您的朋友邀请您使用《智慧眠花糖》APP,请复制后面链接在浏览器中打开! " + shoph5Url + "/#/pages/download/download"; + + static Map callMap = {}; } diff --git a/lib/common/util/MyUtils.dart b/lib/common/util/MyUtils.dart index 5016e52..6ea7faf 100644 --- a/lib/common/util/MyUtils.dart +++ b/lib/common/util/MyUtils.dart @@ -3,9 +3,14 @@ import 'dart:async'; import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; +import 'package:vbvs_app/common/color/app_uri_status.dart'; import 'package:vbvs_app/common/util/CommonVariables.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; +import 'package:vbvs_app/model/api_response.dart'; + +ThemeController themeController = Get.find(); Future initDataEf({String key = ""}) async { await ef.init( @@ -16,6 +21,25 @@ Future initDataEf({String key = ""}) async { } class MyUtils { + static ApiResponse formatResponse( + ApiResponse res, + String successMsg, + String errorMsg, + ) { + if (res.code == HttpStatusCodes.ok) { + // 成功但 msg 为空时填默认成功提示 + if (res.msg == null || res.msg!.isEmpty) { + res.msg = successMsg; + } + } else { + // 失败且 msg 为空时填默认失败提示 + if (res.msg == null || res.msg!.isEmpty) { + res.msg = errorMsg; + } + } + return res; + } + static String timestampToDateString(int timestamp) { DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(timestamp); @@ -43,6 +67,13 @@ class MyUtils { return phoneRegExp.hasMatch(phoneNumber); } + static bool isValidEmail(String email) { + final RegExp emailRegExp = RegExp( + r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$', + ); + return emailRegExp.hasMatch(email); + } + static Future makePhoneCall(String phoneNumber) async { final Uri launchUri = Uri( scheme: 'tel', @@ -114,7 +145,6 @@ showToast(String msg, // gravity: ToastGravity.CENTER, // timeInSecForIosWeb: 1, // backgroundColor: color == null ? color_error : color, - // textColor: Colors.white, // fontSize: 14.0, // ); final context = Get.overlayContext; // 获取 Overlay 的上下文 @@ -211,7 +241,7 @@ var closeIconWhite = GestureDetector( alignment: Alignment.center, child: Icon( Icons.close, - color: Colors.white, + color: themeController.currentColor.sc3, ), ), ), @@ -263,6 +293,7 @@ enum LoadingDialogIcon { ble, wifi, none } class LoadingDialog { static show(String name, {LoadingDialogIcon icon = LoadingDialogIcon.none}) { + ThemeController themeController = Get.find(); String iconUrl = ""; if (icon == LoadingDialogIcon.wifi) { iconUrl = "wifi"; @@ -296,18 +327,18 @@ class LoadingDialog { Text( textAlign: TextAlign.center, name, - style: const TextStyle( + style: TextStyle( fontSize: 16, - color: Colors.white, + color: themeController.currentColor.sc3, decoration: TextDecoration.none), ), SizedBox( height: 30.rpx, ), - const CircularProgressIndicator( + CircularProgressIndicator( strokeWidth: 2, valueColor: AlwaysStoppedAnimation( - Colors.white, + themeController.currentColor.sc3, ), ), ], diff --git a/lib/common/util/myDialog/confirm_dialog.dart b/lib/common/util/myDialog/confirm_dialog.dart index 58ace86..6c0ad0d 100644 --- a/lib/common/util/myDialog/confirm_dialog.dart +++ b/lib/common/util/myDialog/confirm_dialog.dart @@ -2,6 +2,7 @@ import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; class ConfirmDialog extends GetView { ConfirmDialog(); @@ -9,6 +10,7 @@ class ConfirmDialog extends GetView { Future showConfirmCustomDialog(BuildContext context, {String name = "是否确认取消?"}) async { // Completer completer = Completer(); + ThemeController themeController = Get.find(); TextEditingController textEditingController = TextEditingController(); return showDialog( context: context, @@ -49,7 +51,7 @@ class ConfirmDialog extends GetView { color: stringToColor("#D3B684")), child: Text( '确定', - style: TextStyle(color: Colors.white, fontSize: 30.rpx), + style: TextStyle( color: themeController.currentColor.sc3, fontSize: 30.rpx), ), ), ), diff --git a/lib/component/home_page/SleepDataModuleWidget.dart b/lib/component/home_page/SleepDataModuleWidget.dart index abaee63..96bcbad 100644 --- a/lib/component/home_page/SleepDataModuleWidget.dart +++ b/lib/component/home_page/SleepDataModuleWidget.dart @@ -39,7 +39,7 @@ class _SleepDataModuleWidgetState extends State { minWidth: 200.rpx, ), decoration: BoxDecoration( - color: stringToColor("#313541"), + color: themeController.currentColor.sc5, borderRadius: BorderRadius.circular(20.rpx), ), child: Padding( @@ -113,7 +113,7 @@ class _SleepDataModuleWidgetState extends State { height: 40.rpx, padding: EdgeInsetsDirectional.fromSTEB(0.rpx, 0, 0.rpx, 0), - color: stringToColor("#FF7159"), + color: themeController.currentColor.sc14, textStyle: FlutterFlowTheme.of(context).titleSmall.override( fontFamily: 'Inter Tight', @@ -134,7 +134,7 @@ class _SleepDataModuleWidgetState extends State { fontFamily: 'Inter', fontSize: AppConstants().small_text_fontSize, letterSpacing: 0.0, - color: Colors.grey), + color: themeController.currentColor.sc4), ), ], ), diff --git a/lib/component/home_page/SleepDateWidget.dart b/lib/component/home_page/SleepDateWidget.dart index 38e2e14..82838bf 100644 --- a/lib/component/home_page/SleepDateWidget.dart +++ b/lib/component/home_page/SleepDateWidget.dart @@ -118,7 +118,7 @@ class _SleepDateWidgetState extends State { textStyle: FlutterFlowTheme.of(context).titleSmall.override( fontFamily: 'Inter Tight', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0.0, ), elevation: 0, diff --git a/lib/component/tool/ClickableContainer.dart b/lib/component/tool/ClickableContainer.dart index ac5f1f4..b45a426 100644 --- a/lib/component/tool/ClickableContainer.dart +++ b/lib/component/tool/ClickableContainer.dart @@ -1,12 +1,12 @@ import 'package:flutter/material.dart'; class ClickableContainer extends StatelessWidget { - final Color backgroundColor; // 容器背景色 - final Color highlightColor; // 点击时背景色 - final EdgeInsetsGeometry padding; // 内部间距 - final VoidCallback onTap; // 点击回调 - final Widget child; // 子组件 - final double borderRadius; // 容器圆角(可选,默认为0) + final Color backgroundColor; + final Color highlightColor; + final EdgeInsetsGeometry padding; + final VoidCallback onTap; + final Widget child; + final double borderRadius; const ClickableContainer({ Key? key, @@ -15,13 +15,13 @@ class ClickableContainer extends StatelessWidget { required this.padding, required this.onTap, required this.child, - this.borderRadius = 0, // 默认无圆角 + this.borderRadius = 0, }) : super(key: key); @override Widget build(BuildContext context) { - return GestureDetector( - onTap: onTap, + return Theme( + data: Theme.of(context).copyWith(splashFactory: InkRipple.splashFactory), child: Material( color: Colors.transparent, child: Ink( @@ -32,10 +32,10 @@ class ClickableContainer extends StatelessWidget { child: InkWell( borderRadius: BorderRadius.circular(borderRadius), onTap: onTap, - splashColor: highlightColor.withOpacity(0.3), // 点击时的波纹效果 + splashColor: highlightColor.withOpacity(0.2), child: Padding( padding: padding, - child: child, // 内容自适应 + child: child, ), ), ), diff --git a/lib/controller/device/blueteeth_bind_controller.dart b/lib/controller/device/blueteeth_bind_controller.dart index 573fdce..903ed2c 100644 --- a/lib/controller/device/blueteeth_bind_controller.dart +++ b/lib/controller/device/blueteeth_bind_controller.dart @@ -1,5 +1,16 @@ +import 'dart:async'; +import 'dart:convert'; + +import 'package:EasyDartModule/EasyDartModule.dart'; +import 'package:easydevice/src/ble_device.dart'; 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/color/app_uri_status.dart'; +import 'package:vbvs_app/common/util/DailyLogUtils.dart'; +import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/model/BleDeviceData.dart'; +import 'package:vbvs_app/model/api_response.dart'; part 'blueteeth_bind_controller.g.dart'; // 由json_serializable自动生成的部分 @@ -8,7 +19,8 @@ class BlueteethBindModel { int? read = 1; //是否不再提示教程 0 不再提示 1 需要提示 double? singal = -70; //扫描信号强度 - List? devicelist = []; //蓝牙扫描到的设备数据列表 + List? devicelist = []; //蓝牙扫描到的设备数据列表 + List? betDevicelist = []; //请求的 List? blelist = []; //蓝牙扫描到的设备数据列表 List? wifiList = []; @@ -46,21 +58,122 @@ class BlueteethBindController extends GetControllerEx { attr = GetModel(BlueteethBindModel()).obs; } - void updateDeviceStatus() { - // try { + Timer? _statusTimer; - // } catch (e) { - // print(e); - // EasyDartModule.logger.info("向后端请求设备绑定状态报错了:$e"); - // } finally { - // EasyDartModule.logger.info("向后端请求设备绑定状态"); - // } + BLEDevice? currentDevice; + + // 启动每10秒获取设备状态 + void startStatusPolling() { + if (_statusTimer == null) { + _statusTimer = Timer.periodic(Duration(seconds: 10), (timer) { + updateDeviceStatus(); + }); + } } - Future bindDevice(d) async { - print("绑定参数:$d"); - await Future.delayed(Duration(seconds: 1)); - // return ApiService.request - // .post("/api/device/info/bind", data: formdata.FormData.fromMap(d)); + // 停止轮询 + void stopStatusPolling() { + _statusTimer?.cancel(); + _statusTimer = null; } + + // 你的已有方法 + Future updateDeviceStatus() async { + try { + String serviceAddress = ServiceConstant.service_address; + String serviceName = ServiceConstant.server_service; + String serviceApi = ServiceConstant.get_bluetooth_device_status; + String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; + + if (model.devicelist != null && model.devicelist!.isNotEmpty) { + final macParams = model.devicelist! + .map((device) => "mac=${Uri.encodeQueryComponent(device.mac!)}") + .join("&"); + + if (queryUrl.contains('?')) { + queryUrl += '&$macParams'; + } else { + queryUrl += '?$macParams'; + } + + var response = await EasyDartModule.dio.get(queryUrl); + + if (response.data['data'] != null && response.data['data'] is List) { + List responseList = response.data['data']; + + Map deviceMap = { + for (var d in model.devicelist!) + if (d.mac != null) d.mac!: d + }; + + List slaveMacsToRemove = []; + + for (var item in responseList) { + String mac = item['mac']; + String? bindMac = item['bindMac']; + bool? bind = item['bind']; + + if (deviceMap.containsKey(mac)) { + BleDeviceData currentDevice = deviceMap[mac]!; + currentDevice.bind = bind; + if (bindMac != null && deviceMap.containsKey(bindMac)) { + BleDeviceData masterDevice = deviceMap[bindMac]!; + masterDevice.slave = currentDevice; + slaveMacsToRemove.add(mac); + } + } + } + model.devicelist! + .removeWhere((device) => slaveMacsToRemove.contains(device.mac)); + } + print("获取设备状态成功"); + updateAll(); + } + } catch (e) { + print("获取设备状态异常: $e"); + EasyDartModule.logger.info("获取设备状态异常: $e"); + DailyLogUtils.writeLog("获取设备状态异常: $e"); + } + } + + Future bindDeviceAndMAC(BleDeviceData d) async { + try { + ApiResponse apiResponse = ApiResponse(code: -1, msg: "蓝牙绑定.绑定失败".tr); + String serviceAddress = ServiceConstant.service_address; + String serviceName = ServiceConstant.server_service; + String serviceApi = ServiceConstant.device_bind; + String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; + var data = { + "deviceType": 1, + "mac": d.mac, + }; + var response = + await EasyDartModule.dio.post(queryUrl, data: jsonEncode(data)); + if (response != null) { + var responseData = + response.data is String ? jsonDecode(response.data) : response.data; + ApiResponse res = + ApiResponse.fromJson(responseData, (object) => object); + MyUtils.formatResponse(apiResponse, "蓝牙绑定.绑定成功".tr, "蓝牙绑定.绑定成功".tr); + if (res.code == HttpStatusCodes.ok) { + return res; + } + } else { + return ApiResponse(code: -1, msg: "服务器.失败".tr); + } + return apiResponse; + } catch (e) { + EasyDartModule.logger.info("蓝牙绑定.绑定异常: $e"); + DailyLogUtils.writeLog("蓝牙绑定.绑定异常: $e"); + } + return ApiResponse(code: -1, msg: "未知错误".tr); // Default return statement + } + + @override + void onClose() { + stopStatusPolling(); // 控制器销毁时停止轮询 + super.onClose(); + } + + bindDevice(Map map) {} } diff --git a/lib/controller/login/login_controller.dart b/lib/controller/login/login_controller.dart index 410168d..c5fccfe 100644 --- a/lib/controller/login/login_controller.dart +++ b/lib/controller/login/login_controller.dart @@ -1,9 +1,17 @@ +import 'dart:convert'; + +import 'package:EasyDartModule/EasyDartModule.dart'; import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart'; +import 'package:get_storage/get_storage.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:vbvs_app/common/color/ServiceConstant.dart'; +import 'package:vbvs_app/common/color/app_uri_status.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/controller/user_info_controller.dart'; +import 'package:vbvs_app/model/api_response.dart'; part 'login_controller.g.dart'; @JsonSerializable() @@ -13,7 +21,7 @@ class LoginModel { String? account = '17649984946'; //账户 String? password = 'wyf123,.'; //密码 - String? phone; //手机号 + String? phone; //手机号/邮箱 String? code; //验证码 String? register_code; @@ -47,88 +55,87 @@ class LoginController extends GetControllerEx { } //登录 - Future login(BuildContext context) async { - // return ''; - String message = ''; - String account = ''; - String password = ''; - // if (model.loginStyle == 1) { - // //账号登录 - // if (model.account == null || model.account!.isEmpty) { - // message = '账户不能为空'; - // showToast(message); - // return message; - // } - // if (model.password == null || model.password!.isEmpty) { - // message = '密码不能为空'; - // showToast(message); - // return message; - // } - // account = model.account!; - // password = model.password!; - // } - // if (model.loginStyle == 2) { - // //账号登录 - // if (model.phone == null || model.phone!.isEmpty) { - // message = '手机号不能为空'; - - // showToast(message); - // return message; - // } - // if (!MyUtils.isValidPhoneNumber(model.phone!)) { - // message = '请输入正确的手机号'; - - // showToast(message); - // return message; - // } - // if (model.code == null || model.code!.isEmpty) { - // message = '验证码不能为空'; - - // showToast(message); - // return message; - // } - // account = model.phone!; - // password = model.code!; - // } - // RegisterController registerController = Get.find(); - // if (registerController.model.register_agree == null || - // registerController.model.register_agree != true) { - // message = "需要同意协议"; - // showToast(message); - // return message; - // } - // message = await repository.login( - // model.loginStyle!, account, password, model.forceLogin); - // model.forceLogin = 0; - - return message; + Future login(BuildContext context) async { + ApiResponse apiResponse = ApiResponse(code: -1, msg: "其他手机登录页.登录失败".tr); + if (model.phone == null || model.phone!.isEmpty) { + apiResponse.msg = "其他手机登录页.请输入手机号".tr; + return apiResponse; + } + if (model.code == null || model.code!.isEmpty) { + apiResponse.msg = "其他手机登录页.请输入验证码".tr; + return apiResponse; + } + String serviceAddress = ServiceConstant.service_address; + String serviceName = ServiceConstant.server_service; + String serviceApi = ServiceConstant.login; + String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; + var data = { + "type": 1, + "userName": model.phone, + "password": model.code, + }; + var response = + await EasyDartModule.dio.post(queryUrl, data: jsonEncode(data)); + if (response != null) { + var responseData = + response.data is String ? jsonDecode(response.data) : response.data; + ApiResponse res = ApiResponse.fromJson(responseData, (object) => object); + MyUtils.formatResponse(apiResponse, "其他手机登录页.登陆成功".tr, "其他手机登录页.登陆失败".tr); + if (res.code == HttpStatusCodes.ok) { + UserInfoController userInfoController = Get.find(); + userInfoController.model.login = 1; + String token = response.headers['token']!.first; + EasyDartModule.dio.token = token; + final box = GetStorage(); + box.write('token', userInfoController.model.token); // 存储 token + } + return res; + } else { + return ApiResponse(code: -1, msg: "服务器.失败".tr); + } } - Future getCode(BuildContext context) async { - String message = ""; + Future getCode(BuildContext context) async { + ApiResponse apiResponse = ApiResponse(code: -1, msg: "其他手机登录页.发送失败".tr); if (model.register_agree == null || model.register_agree != true) { - // message = "需要同意协议"; - // showToast(message); - return message; + apiResponse.msg = "登录页.未同意协议".tr; + return apiResponse; } if (model.phone == null || model.phone!.isEmpty) { - message = "请输入手机号"; - // showToast(message); - return message; + apiResponse.msg = "其他手机登录页.请输入手机号".tr; + return apiResponse; } - if (!MyUtils.isValidPhoneNumber(model.phone!)) { - message = '请输入正确的手机号'; - showToast(message); - return message; + if (!MyUtils.isValidPhoneNumber(model.phone!) && + !MyUtils.isValidEmail(model.phone!)) { + apiResponse.msg = '其他手机登录页.不正确手机号'.tr; + return apiResponse; } - // message = await repository.sendRegisterCode(model.phone!); - if (message.isNotEmpty) { - showToast(message ?? "发送失败,请稍后再试!"); - return "发送失败,请稍后再试!"; + String serviceAddress = ServiceConstant.service_address; + String serviceName = ServiceConstant.server_service; + String serviceApi = ServiceConstant.send_code; + String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; + var data = { + "userName": model.phone, + }; + var response = + await EasyDartModule.dio.post(queryUrl, data: jsonEncode(data)); + if (response != null) { + var responseData = + response.data is String ? jsonDecode(response.data) : response.data; + ApiResponse res = ApiResponse.fromJson(responseData, (object) => object); + if (res.code != HttpStatusCodes.ok) { + if (res.msg == null || res.msg!.isEmpty) { + res.msg = apiResponse.msg; + } + } else { + if (res.msg == null || res.msg!.isEmpty) { + res.msg = "其他手机登录页.发送成功".tr; + } + } + return res; } else { - showToast("发送验证码成功!", color: color_success); + return ApiResponse(code: -1, msg: "服务器.失败".tr); } - return ''; } //微信登录 diff --git a/lib/controller/person/person_controller.dart b/lib/controller/person/person_controller.dart index e7c93e7..8e6c2f0 100644 --- a/lib/controller/person/person_controller.dart +++ b/lib/controller/person/person_controller.dart @@ -7,7 +7,8 @@ part 'person_controller.g.dart'; // 由json_serializable自动生成的部分 class PersonModel { int read = 1; - DateTime? birthday;//是否不再提示教程 0 不再提示 1 需要提示 + DateTime? birthday; + double? weight; PersonModel(); diff --git a/lib/controller/user_info_controller.dart b/lib/controller/user_info_controller.dart index 6c4e7e5..091cea0 100644 --- a/lib/controller/user_info_controller.dart +++ b/lib/controller/user_info_controller.dart @@ -22,7 +22,7 @@ class UserInfoModel { User? superbase_user; String? img_bucket = 'user'; - int? login = 1; //0未登录 1 登录 + int? login = 0; //0未登录 1 登录 diff --git a/lib/main.dart b/lib/main.dart index 5e83c29..be07cf9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,15 @@ +import 'dart:convert'; + +import 'package:EasyDartModule/EasyDartModule.dart'; +import 'package:EasyDartModule/base/logger/Logger.dart'; +import 'package:EasyDartModule/base/websocket/WebSocket.dart'; import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:get_storage/get_storage.dart'; +import 'package:localstorage/localstorage.dart'; +import 'package:vbvs_app/common/color/ServiceConstant.dart'; +import 'package:vbvs_app/common/util/CommonVariables.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart'; import 'package:vbvs_app/controller/login/login_controller.dart'; @@ -27,6 +35,8 @@ Future main() async { // ApiService.init(); // await GetStorage.init(); // 初始化登录 + await initLocalStorage(); + initEasyDartModule(); await initLogin(); await initLog(); // 检查网络 @@ -41,14 +51,44 @@ Future main() async { .then((_) { runApp(MyApp()); }); - - // runApp(const MyApp()); } -initLog() { - +void initEasyDartModule() { + //初始化 + EasyDartModule.init( + loggerConfig: + LoggerConfig(host: ServiceConstant.logService, serviceName: "web"), + webSocketConfig: + WebSocketConfig(ServiceConstant.webSocketService, (data) { + // 接收到服务消息 + var json = jsonDecode(data); + if (json["path"] != null) { + var call = CommonVariables.callMap[json["path"]]; + if (call != null) { + try { + call(json["data"]); + } catch (e) { + print(e); + } + } else { + print("未找到当前路径: ${json["path"]} 回调函数"); + } + } + // print(data); + }, onOpen: () { + //连接建立完毕 + // EasyDartModule.websocket + // .sendData(jsonEncode({"path": "/aa/bb", "type": 1})); + })); + EasyDartModule.dio.token = localStorage.getItem('token'); + // document.onContextMenu.listen((event) { + // event.preventDefault(); + // }); + EasyDartModule.dio.token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiI2ODAxY2JmMzY5YjJhODQ5MWQwMDAwMDAiLCJ0aWQiOiI2N2Y1ZDk2ZTI2ZWYzMTA0NjMwMDAwMDAiLCJsZXZlbCI6NSwiaWF0IjoxNzQ0OTQ4MjExfQ._XXG3WzEHuOzWdj01NXJxLJpxe3SU20XQqShBZUHCUU"; } +initLog() {} + Future initLogin() async { // 初始化控制器 Get.put(UserInfoController()); @@ -70,9 +110,10 @@ Future initLogin() async { userInfoController.model.user = user; } if (token != null) { - // userInfoController.model.login = 1; - //根据token去请求 + userInfoController.model.login = 1; + // 根据token去请求 // await userInfoController.autoLogin(token); + EasyDartModule.dio.token = token; } else { // 如果没有 token,则将用户标记为未登录 userInfoController.model.login = 0; @@ -150,7 +191,6 @@ class MyApp extends StatelessWidget { ], supportedLocales: [ const Locale('zh', 'CN'), // 中文 - // 其他支持的语言 ], debugShowCheckedModeBanner: false, title: '', diff --git a/lib/model/BleDeviceData.dart b/lib/model/BleDeviceData.dart index b4ad163..94b292d 100644 --- a/lib/model/BleDeviceData.dart +++ b/lib/model/BleDeviceData.dart @@ -8,10 +8,12 @@ class BleDeviceData { final int flag; // 设备属性 final int version; // 软件版本 final int qsn; // 广播帧序列号高16位 - int? status; // 设备状态 - String? name;//设备名称 + bool? bind = true; // 设备状态 + String? name; //设备名称 int? rssi; - String? mac;//mac地址 + String? mac; //mac地址 + + BleDeviceData? slave;//从设备 BleDeviceData({ required this.type, diff --git a/lib/model/CustomThemeColor.dart b/lib/model/CustomThemeColor.dart index e77a380..05b0a34 100644 --- a/lib/model/CustomThemeColor.dart +++ b/lib/model/CustomThemeColor.dart @@ -24,6 +24,7 @@ class CustomThemeColor { final String color19; final String color20; final String color21; + final String color22; final String color25; final String color26; final String color27; @@ -61,6 +62,7 @@ class CustomThemeColor { required this.color19, required this.color20, required this.color21, + required this.color22, required this.color25, required this.color26, required this.color27, @@ -98,7 +100,8 @@ class CustomThemeColor { color18: "#FFFFFF", color19: "#FFFFFF", color20: "#f7f8fa", - color21: "#5EE00A", + color21: "#eaeaea", + color22: "#eaeaea", color25: "#FF7159", color26: "#4AD8FA", color27: "#f7f8fa", @@ -134,7 +137,8 @@ class CustomThemeColor { color18: "#EAEAEA", color19: "#FFFFFF", color20: "#f7f8fa", - color21: "#5EE00A", + color21: "#333844", + color22: "#333844", color25: "#FF7159", color26: "#4AD8FA", color27: "#f7f8fa", @@ -180,6 +184,7 @@ class CustomThemeColor { Color get sc19 => getColor(color19); Color get sc20 => getColor(color20); Color get sc21 => getColor(color21); + Color get sc22 => getColor(color22); Color get sc25 => getColor(color25); Color get sc26 => getColor(color26); Color get sc27 => getColor(color27); @@ -238,6 +243,7 @@ class CustomThemeColor { color19: json['color19'], color20: json['color20'], color21: json['color21'], + color22: json['color22'], color25: json['color25'], color26: json['color26'], color27: json['color27'], @@ -274,6 +280,7 @@ class CustomThemeColor { 'color19': color19, 'color20': color20, 'color21': color21, + 'color22': color22, 'color25': color25, 'color26': color26, 'color27': color27, diff --git a/lib/pages/common/selectDialog.dart b/lib/pages/common/selectDialog.dart index c5e0411..f554041 100644 --- a/lib/pages/common/selectDialog.dart +++ b/lib/pages/common/selectDialog.dart @@ -3,10 +3,11 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; - +import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged, {bool looping = false}) { + ThemeController themeController = Get.find(); return CupertinoPicker( key: UniqueKey(), useMagnifier: false, @@ -38,7 +39,7 @@ getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged, child: Text("${arr[index]}", style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx)), ); @@ -51,6 +52,7 @@ Future showDateSelectionDialog(BuildContext context, {required DateTime checkDate, Function? checkChange, String title = "选择生日"}) { + ThemeController themeController = Get.find(); Color checkColor = stringToColor("#D3B684"); List years = [], months = [], days = []; var days_select = [].obs; @@ -113,7 +115,7 @@ Future showDateSelectionDialog(BuildContext context, .bodyMedium .override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx), ), @@ -152,7 +154,7 @@ Future showDateSelectionDialog(BuildContext context, .bodyMedium .override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx), ), @@ -182,7 +184,7 @@ Future showDateSelectionDialog(BuildContext context, .bodyMedium .override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx), ), @@ -213,7 +215,7 @@ Future showDateSelectionDialog(BuildContext context, .bodyMedium .override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx), ), @@ -240,7 +242,7 @@ Future showDateSelectionDialog(BuildContext context, .bodyMedium .override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx), ), @@ -260,6 +262,7 @@ Future showDateSelectionDialog(BuildContext context, Future showDayTimeSelectionDialog(BuildContext context, {required List dayTimeArr, Function? checkChange, String title = ""}) { + ThemeController themeController = Get.find(); Color checkColor = stringToColor("#D3B684"); List hours = [], minutes = []; for (var i = 0; i < 24; i++) { @@ -309,7 +312,7 @@ Future showDayTimeSelectionDialog(BuildContext context, .bodyMedium .override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx), ), @@ -340,7 +343,7 @@ Future showDayTimeSelectionDialog(BuildContext context, .bodyMedium .override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx), ), @@ -362,7 +365,7 @@ Future showDayTimeSelectionDialog(BuildContext context, .bodyMedium .override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx), ), @@ -389,7 +392,7 @@ Future showDayTimeSelectionDialog(BuildContext context, .bodyMedium .override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx), ), @@ -412,6 +415,7 @@ Future showOneSelectionDialog(BuildContext context, int checkIndex = 0, Function? checkChange, String title = "选择性别"}) { + ThemeController themeController = Get.find(); Color checkColor = stringToColor("#D3B684"); return showDialog( // barrierColor: stringToColor("#000320"), @@ -452,7 +456,7 @@ Future showOneSelectionDialog(BuildContext context, .bodyMedium .override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx), ), @@ -490,7 +494,7 @@ Future showOneSelectionDialog(BuildContext context, .bodyMedium .override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx), ), @@ -537,6 +541,7 @@ enum ConfirmDialogIcon { Future showCustomConfirmDialog(BuildContext context, String name, {String btnName = "确定", ConfirmDialogIcon icon = ConfirmDialogIcon.warn}) async { + ThemeController themeController = Get.find(); return showDialog( context: context, barrierDismissible: true, @@ -589,7 +594,9 @@ Future showCustomConfirmDialog(BuildContext context, String name, color: stringToColor("#D3B684")), child: Text( '$btnName', - style: TextStyle(color: Colors.white, fontSize: 30.rpx), + style: TextStyle( + color: themeController.currentColor.sc3, + fontSize: 30.rpx), ), ), ), @@ -602,11 +609,11 @@ Future showCustomConfirmDialog(BuildContext context, String name, ); } - Future showCustomConfirmAndCancelDialog(BuildContext context, String name, {String confirmName = "确定", String cancelName = "取消", ConfirmDialogIcon icon = ConfirmDialogIcon.warn}) async { + ThemeController themeController = Get.find(); return showDialog( context: context, barrierDismissible: true, @@ -684,8 +691,9 @@ Future showCustomConfirmAndCancelDialog(BuildContext context, String name, color: stringToColor("#D3B684")), child: Text( '$confirmName', - style: - TextStyle(color: Colors.white, fontSize: 30.rpx), + style: TextStyle( + color: themeController.currentColor.sc3, + fontSize: 30.rpx), ), ), ) @@ -702,6 +710,7 @@ Future showCustomConfirmAndCancelDialog(BuildContext context, String name, //权限说明弹窗 void showPermissionInfoDialog(BuildContext context, List data) { + ThemeController themeController = Get.find(); showDialog( context: context, barrierDismissible: false, // 点击对话框外部可关闭 @@ -715,7 +724,7 @@ void showPermissionInfoDialog(BuildContext context, List data) { child: Material( color: Colors.transparent, child: Dialog( - backgroundColor: Colors.white, + backgroundColor: themeController.currentColor.sc3, insetPadding: EdgeInsets.fromLTRB(0, 0, 0, 0), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), diff --git a/lib/pages/device_bind/bind_device_success.dart b/lib/pages/device_bind/bind_device_success.dart index 626e40d..779e492 100644 --- a/lib/pages/device_bind/bind_device_success.dart +++ b/lib/pages/device_bind/bind_device_success.dart @@ -8,6 +8,7 @@ import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart'; import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; +import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/controller/user_info_controller.dart'; class BindDeviceSuccess extends StatefulWidget { @@ -21,6 +22,7 @@ class _EPageState extends State { GlobalController globalController = Get.find(); UserInfoController userInfoController = Get.find(); BlueteethBindController blueteethBindController = Get.find(); + ThemeController themeController = Get.find(); @override void initState() { @@ -42,14 +44,14 @@ class _EPageState extends State { child: Scaffold( backgroundColor: Colors.transparent, // 加上这一行 appBar: AppBar( - backgroundColor: stringToColor("#242835"), - // backgroundColor: Colors.transparent, + backgroundColor: themeController.currentColor.sc17, automaticallyImplyLeading: false, - iconTheme: IconThemeData(color: Colors.white), + iconTheme: IconThemeData( + color: themeController.currentColor.sc3, + ), titleSpacing: 0, // leading: returnIconButtom, title: Container( - // color: Colors.grey, width: double.infinity, height: 180.rpx, child: Stack( @@ -60,7 +62,7 @@ class _EPageState extends State { '绑定成功.标题'.tr, style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx, ), @@ -98,7 +100,7 @@ class _EPageState extends State { child: SvgPicture.asset( 'assets/img/icon/tick.svg', fit: BoxFit.cover, - color: Colors.white, + color: themeController.currentColor.sc3, ), ), ), @@ -118,7 +120,7 @@ class _EPageState extends State { fontFamily: 'Inter', fontSize: 48.rpx, letterSpacing: 0.0, - color: Colors.white, + color: themeController.currentColor.sc3, ), ), ), @@ -140,7 +142,7 @@ class _EPageState extends State { fontFamily: 'Inter', fontSize: 30.rpx, letterSpacing: 0.0, - color: Colors.white, + color: themeController.currentColor.sc3, ), ), ), @@ -162,7 +164,7 @@ class _EPageState extends State { fontFamily: 'Inter', fontSize: 30.rpx, letterSpacing: 0.0, - color: Colors.white, + color: themeController.currentColor.sc3, ), ), ), @@ -180,9 +182,9 @@ class _EPageState extends State { }, colors: [ // 渐变色 - stringToColor("45D989"), // 左侧渐变色 - stringToColor("00C1AA"), // 右侧渐变色 - ], + themeController.currentColor.sc1, + themeController.currentColor.sc2, + ], child: Container( width: MediaQuery.sizeOf(context).width * 0.66, height: MediaQuery.sizeOf(context).height * 0.055, @@ -198,14 +200,14 @@ class _EPageState extends State { 'assets/img/icon/share.svg', width: 25.rpx, height: 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - color: Colors.white, // 设置图标颜色为白色 + color: themeController.currentColor.sc3, ), Text( '绑定成功.立即分享'.tr, style: FlutterFlowTheme.of(context) .bodyMedium .override( - color: Colors.white, // 文字颜色 + color: themeController.currentColor.sc3, fontFamily: 'Inter', fontSize: AppConstants() .normal_text_fontSize, // 自定义字体大小 @@ -223,13 +225,13 @@ class _EPageState extends State { child: CustomCard( borderRadius: AppConstants().button_container_radius, // 圆角半径 - onTap: () { + onTap: () { Get.offAllNamed("/mianPageBottomChange"); }, colors: [ // 渐变色 - stringToColor("45D989"), // 左侧渐变色 - stringToColor("00C1AA"), // 右侧渐变色 + themeController.currentColor.sc1, + themeController.currentColor.sc2, ], child: Container( @@ -248,7 +250,7 @@ class _EPageState extends State { style: FlutterFlowTheme.of(context) .bodyMedium .override( - color: Colors.white, // 文字颜色 + color: themeController.currentColor.sc3, fontFamily: 'Inter', fontSize: AppConstants() .normal_text_fontSize, // 自定义字体大小 @@ -282,8 +284,8 @@ class _EPageState extends State { } } }, - // colors: [Colors.white.withOpacity(0.06)], // 背景色 - colors: [stringToColor("#242835")], // 背景色 + + colors: [themeController.currentColor.sc17], // 背景色 child: Container( width: double.infinity, height: MediaQuery.sizeOf(context).height * 0.135, diff --git a/lib/pages/device_bind/blueteeth_device_page.dart b/lib/pages/device_bind/blueteeth_device_page.dart index d653d24..1de07b6 100644 --- a/lib/pages/device_bind/blueteeth_device_page.dart +++ b/lib/pages/device_bind/blueteeth_device_page.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:ef/ef.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_svg/svg.dart'; @@ -10,6 +11,7 @@ import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart'; import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; +import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/model/BleDeviceData.dart'; import 'package:vbvs_app/pages/common/selectDialog.dart'; @@ -28,6 +30,7 @@ class _EPageState extends State { GlobalController globalController = Get.find(); UserInfoController userInfoController = Get.find(); BlueteethBindController blueteethBindController = Get.find(); + ThemeController themeController = Get.find(); late FlutterBluePlus flutterBlue; // 声明 flutterBlue 实例 List scanResults = []; // 存储扫描到的设备 bool isScanning = false; // 扫描状态控制 @@ -48,6 +51,7 @@ class _EPageState extends State { super.initState(); flutterBlue = FlutterBluePlus(); // 初始化flutterBlue实例 _checkBluetoothPermission(); // 检查蓝牙权限 + Get.find().startStatusPolling(); } // 检查蓝牙权限 @@ -125,29 +129,6 @@ class _EPageState extends State { await FlutterBluePlus.startScan(timeout: Duration(seconds: 10)); - // FlutterBluePlus.scanResults.listen((results) { - // // 使用 controller 中设定的最小信号强度过滤 - // final signalThreshold = blueteethBindController.model.singal!; - // final filteredResults = results - // .where((r) => - // r.rssi > signalThreshold && - // r.advertisementData.localName == "AITH-V2") - // .toList(); - // setState(() { - // scanResults = filteredResults; - // print("过滤后设备数量:${filteredResults.length}"); - // blueteethBindController.model.devicelist = filteredResults; - // blueteethBindController.updateAll(); - // if (filteredResults.isNotEmpty) { - // for (var r in filteredResults) { - // print("设备名: ${r.device.name}, RSSI: ${r.rssi}"); - // } - // } else { - // print("没有找到符合条件的设备"); - // } - // }); - // }); - FlutterBluePlus.scanResults.listen((results) { final signalThreshold = blueteethBindController.model.singal!; final filteredResults = results @@ -173,24 +154,35 @@ class _EPageState extends State { } } + // 使用一个临时变量 lastDeviceList 来比较是否有变化 setState(() { - scanResults = filteredResults; + bool hasChanges = false; - // 存入 controller 中 - blueteethBindController.model.blelist = filteredResults; - blueteethBindController.model.devicelist = parsedDeviceList; - blueteethBindController.updateDeviceStatus(); - blueteethBindController.updateAll(); + // 如果 devicelist 长度不同或内容有差异,认为有变化 + if (blueteethBindController.model.devicelist?.length != + parsedDeviceList.length) { + hasChanges = true; + } else { + // 深度比较每个设备的属性(比如 mac, rssi) + for (int i = 0; + i < blueteethBindController.model.devicelist!.length; + i++) { + if (blueteethBindController.model.devicelist![i].mac != + parsedDeviceList[i].mac || + blueteethBindController.model.devicelist![i].rssi != + parsedDeviceList[i].rssi) { + hasChanges = true; + break; + } + } + } - // print("过滤并解析后设备数量:${parsedDeviceList.length}"); - // for (var device in parsedDeviceList) { - // print( - // "设备: ${device.deviceId}, HR: ${device.ht}, BRE: ${device.bre}, Seq: ${device.fullSeq}"); - // } - - // if (parsedDeviceList.isEmpty) { - // print("没有符合条件的 BLE 广播数据"); - // } + // 如果有变化,更新 devicelist 和 blelist + if (hasChanges) { + blueteethBindController.model.devicelist = parsedDeviceList; + blueteethBindController.model.blelist = filteredResults; + // blueteethBindController.updateDeviceStatus(); + } }); }); @@ -206,7 +198,7 @@ class _EPageState extends State { } } - // 定时每10秒进行一次扫描 +// 定时每10秒进行一次扫描 void _startPeriodicScan() { _timer = Timer.periodic(Duration(seconds: 10), (timer) { if (!isScanning) { @@ -637,8 +629,8 @@ class _EPageState extends State { child: Scaffold( backgroundColor: Colors.transparent, // 加上这一行 appBar: AppBar( - iconTheme: IconThemeData(color: Colors.white), - backgroundColor: stringToColor("#242835"), + iconTheme: IconThemeData(color: themeController.currentColor.sc3), + backgroundColor: themeController.currentColor.sc17, automaticallyImplyLeading: false, titleSpacing: 0, title: Container( @@ -651,7 +643,7 @@ class _EPageState extends State { '蓝牙绑定.标题'.tr, style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx, ), @@ -763,7 +755,7 @@ class _EPageState extends State { Container( width: double.infinity, decoration: BoxDecoration( - color: Colors.white, + color: themeController.currentColor.sc3, borderRadius: BorderRadius.circular(20.rpx), ), child: Padding( @@ -776,7 +768,7 @@ class _EPageState extends State { Expanded( child: Row( mainAxisSize: MainAxisSize.max, - children: [ + children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB( 0, 0.rpx, 0, 0), @@ -788,7 +780,7 @@ class _EPageState extends State { child: SvgPicture.asset( 'assets/img/icon/query.svg', fit: BoxFit.cover, - color: Colors.black, + color: stringToColor("#333333"), //固定 ), ), ), @@ -861,10 +853,9 @@ class _EPageState extends State { borderRadius: BorderRadius.circular(8.rpx), ), - filled: true, - fillColor: - FlutterFlowTheme.of(context) - .secondaryBackground, + filled: false, + fillColor: themeController + .currentColor.sc22, ), style: FlutterFlowTheme.of(context) .bodyMedium @@ -896,8 +887,7 @@ class _EPageState extends State { height: 50.rpx, child: VerticalDivider( thickness: 2.rpx, - color: FlutterFlowTheme.of(context) - .alternate, + color: stringToColor("#333333"), //固定 ), ), Text( @@ -908,6 +898,7 @@ class _EPageState extends State { fontFamily: 'Inter', fontSize: 30.rpx, letterSpacing: 0.0, + color: stringToColor("#333333"), //固定 ), ), ].divide(SizedBox(width: 26.rpx)), @@ -931,35 +922,38 @@ class _EPageState extends State { style: FlutterFlowTheme.of(context) .bodyMedium .override( - fontFamily: 'Inter', - fontSize: 30.rpx, - letterSpacing: 0.0, - color: Colors.white), + fontFamily: 'Inter', + fontSize: 30.rpx, + letterSpacing: 0.0, + color: themeController.currentColor.sc3, + ), ), ), ), ), - Expanded( - child: Container( - width: double.infinity, - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - ...blueteethBindController.model.blelist! - .map((device) => - SingleBlueteethDeviceCompoentWidget( - // device: device, - bleDevice: device, - )) - .toList() - .divide(SizedBox(height: 30.rpx)) - .addToEnd(SizedBox(height: 30.rpx)), - ], + Obx(() { + return Expanded( + child: Container( + width: double.infinity, + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + ...blueteethBindController.model.blelist! + .map((device) => + SingleBlueteethDeviceCompoentWidget( + // device: device, + bleDevice: device, + )) + .toList() + .divide(SizedBox(height: 30.rpx)) + .addToEnd(SizedBox(height: 30.rpx)), + ], + ), ), ), - ), - ), + ); + }), ].divide(SizedBox(height: 30.rpx)), ), ), diff --git a/lib/pages/device_bind/componnet/DoubleBlueteethDeviceCompoentWidget.dart b/lib/pages/device_bind/componnet/DoubleBlueteethDeviceCompoentWidget.dart index 4664d0c..50c97cf 100644 --- a/lib/pages/device_bind/componnet/DoubleBlueteethDeviceCompoentWidget.dart +++ b/lib/pages/device_bind/componnet/DoubleBlueteethDeviceCompoentWidget.dart @@ -2,15 +2,25 @@ import 'package:ef/base/widget/flutterflow/FlutterFlowTheme.dart'; import 'package:flutter/material.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; +import 'package:vbvs_app/model/BleDeviceData.dart'; class DoubleBlueteethDeviceCompoentWidget extends StatefulWidget { - const DoubleBlueteethDeviceCompoentWidget({super.key}); + final BleDeviceData masterDevice; // 主设备 + final BleDeviceData? slaveDevice; // 从设备(可为空) + + // 构造函数,接受参数 + const DoubleBlueteethDeviceCompoentWidget({ + super.key, + required this.masterDevice, + this.slaveDevice, + }); @override State createState() => _DoubleBlueteethDeviceCompoentWidgetState(); } + class _DoubleBlueteethDeviceCompoentWidgetState extends State { @override diff --git a/lib/pages/device_bind/componnet/FancyCircleCheckbox.dart b/lib/pages/device_bind/componnet/FancyCircleCheckbox.dart index fec9480..94e1310 100644 --- a/lib/pages/device_bind/componnet/FancyCircleCheckbox.dart +++ b/lib/pages/device_bind/componnet/FancyCircleCheckbox.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:vbvs_app/common/color/appConstants.dart'; +import 'package:vbvs_app/common/util/FitTool.dart'; class FancyCircleCheckbox extends StatefulWidget { final bool value; @@ -59,8 +61,8 @@ class _FancyCircleCheckboxState extends State return GestureDetector( onTap: () => widget.onChanged(!widget.value), child: Container( - width: 24, - height: 24, + width: 32.rpx, + height: 32.rpx, decoration: BoxDecoration( shape: BoxShape.circle, border: Border.all( @@ -73,7 +75,7 @@ class _FancyCircleCheckboxState extends State child: ScaleTransition( scale: _scaleAnimation, child: Container( - margin: EdgeInsets.all(5), + margin: EdgeInsets.all(8.rpx), decoration: BoxDecoration( shape: BoxShape.circle, color: widget.fillColor, diff --git a/lib/pages/device_bind/componnet/SingleBlueteethDeviceCompoentWidget.dart b/lib/pages/device_bind/componnet/SingleBlueteethDeviceCompoentWidget.dart index 84dab75..61915e3 100644 --- a/lib/pages/device_bind/componnet/SingleBlueteethDeviceCompoentWidget.dart +++ b/lib/pages/device_bind/componnet/SingleBlueteethDeviceCompoentWidget.dart @@ -1,22 +1,25 @@ -import 'package:ef/base/widget/flutterflow/FlutterFlowTheme.dart'; +import 'package:EasyDartModule/EasyDartModule.dart' as edm; +import 'package:easydevice/easydevice.dart'; import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart'; +import 'package:vbvs_app/common/color/app_uri_status.dart'; +import 'package:vbvs_app/common/util/DailyLogUtils.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart'; +import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; +import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart'; import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/model/BleDeviceData.dart'; +import 'package:vbvs_app/model/api_response.dart'; import 'package:vbvs_app/pages/device_bind/blueteeth_device_page.dart'; import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart'; class SingleBlueteethDeviceCompoentWidget extends StatefulWidget { - // final BleDeviceData device; final bleDevice; const SingleBlueteethDeviceCompoentWidget({ super.key, - // required this.device, required this.bleDevice, }); @@ -27,9 +30,10 @@ class SingleBlueteethDeviceCompoentWidget extends StatefulWidget { class _SingleBlueteethDeviceCompoentWidgetState extends State { + ThemeController themeController = Get.find(); + BlueteethBindController blueteethBindController = Get.find(); @override Widget build(BuildContext context) { - var bleDevice = widget.bleDevice; List rawData = widget.bleDevice.advertisementData.manufacturerData[0xFFED]!; BleDeviceData deviceData = parseBleData(rawData); @@ -37,45 +41,80 @@ class _SingleBlueteethDeviceCompoentWidgetState deviceData.rssi = widget.bleDevice.rssi; deviceData.mac = deviceData.deviceId.replaceAll(':', ''); BleDeviceData device = deviceData; + device = blueteethBindController.model.devicelist!.firstWhere( + (d) => d.mac == device.mac, + orElse: () => device, + ); - ThemeController themeController = Get.find(); return ClickableContainer( backgroundColor: themeController.currentColor.sc5, - highlightColor: Colors.white, + highlightColor: themeController.currentColor.sc21, borderRadius: 20.rpx, padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 36.rpx, 0, 52.rpx), onTap: () async { - //todo 请求绑定 - print(device.mac); - // try { - // await bleDevice.device.connect(autoConnect: false); - // List services = - // await bleDevice.device.discoverServices(); - // BluetoothCharacteristic? wifiListChar; - // BluetoothCharacteristic? wifiSsidChar; - // BluetoothCharacteristic? wifiPasswordChar; - // BluetoothCharacteristic? startProvisionChar; - - // for (BluetoothService service in services) { - // for (BluetoothCharacteristic c in service.characteristics) { - // if (c.uuid.toString() == 'YOUR_WIFI_LIST_UUID') { - // wifiListChar = c; - // } else if (c.uuid.toString() == 'YOUR_WIFI_SSID_UUID') { - // wifiSsidChar = c; - // } else if (c.uuid.toString() == 'YOUR_WIFI_PWD_UUID') { - // wifiPasswordChar = c; - // } else if (c.uuid.toString() == 'YOUR_WIFI_START_UUID') { - // startProvisionChar = c; - // } - // } - // } - // } catch (e) { - // print("蓝牙连接失败"); - // } - // - // Get.toNamed('/wifiPage', arguments: bleDevice.device); - showBindDoubleDialog(context,[]); - // showHaveBindDialog(context); + try { + if (device.bind == true) { + showHaveBindDialog(context); + // showBindDoubleDialog(context, []); + } else { + showConfirmDialog( + context, + Container(), + '蓝牙绑定.确定绑定提示'.tr, + onConfirm: () async { + ApiResponse response = + await blueteethBindController.bindDeviceAndMAC(device); + if (response.code == HttpStatusCodes.ok) { + showLoadingDialog(context); // 显示 loading + BLEDevice bledevice = + BLEDevice(device: widget.bleDevice.device); + var res1 = bledevice.isConnected; + print("res1: $res1"); + await bledevice.device.connect(); + var res2 = bledevice.isConnected; + print("res2: $res2"); + if (res2) { + Navigator.pop(context); + TopSlideNotification.show( + context, + text: "蓝牙绑定.连接成功".tr, + textColor: themeController.currentColor.sc2, + ); + blueteethBindController.currentDevice = bledevice; + // Get.toNamed("/wifiPage", arguments: {bledevice}); + Get.toNamed("/wifiPage"); + } else { + Navigator.pop(context); + TopSlideNotification.show( + context, + text: "蓝牙绑定.连接失败".tr, + textColor: themeController.currentColor.sc9, + ); + } + } else { + TopSlideNotification.show( + context, + text: "蓝牙绑定.连接异常".tr, + textColor: themeController.currentColor.sc9, + ); + } + }, + onCancel: () { + print('用户点击了取消'); + // 执行取消后的处理逻辑 + }, + ); + } + } catch (e) { + Navigator.pop(context); + TopSlideNotification.show( + context, + text: "蓝牙绑定.连接异常".tr, + textColor: themeController.currentColor.sc9, + ); + edm.EasyDartModule.logger.info("蓝牙绑定.连接异常: $e"); + DailyLogUtils.writeLog("蓝牙绑定.连接异常: $e"); + } }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -156,10 +195,12 @@ class _SingleBlueteethDeviceCompoentWidgetState ), ), Text( - device.status == 1 ? '蓝牙绑定.可绑定'.tr : '蓝牙绑定.已被绑定'.tr, + device.bind == false ? '蓝牙绑定.可绑定'.tr : '蓝牙绑定.已被绑定'.tr, style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'Inter', - color: const Color(0xFF1AD2B5), + color: device.bind == false + ? const Color(0xFF1AD2B5) + : themeController.currentColor.sc9, fontSize: 26.rpx, letterSpacing: 0.0, ), diff --git a/lib/pages/device_bind/componnet/bind_dialog.dart b/lib/pages/device_bind/componnet/bind_dialog.dart index 3db176f..9082fd0 100644 --- a/lib/pages/device_bind/componnet/bind_dialog.dart +++ b/lib/pages/device_bind/componnet/bind_dialog.dart @@ -1,8 +1,7 @@ -import 'dart:ui'; - import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart'; +import 'package:loading_indicator/loading_indicator.dart'; import 'package:vbvs_app/common/color/appConstants.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart'; @@ -45,7 +44,8 @@ void showBindDoubleDialog(BuildContext context, List devices) { Align( alignment: AlignmentDirectional(0, 0), child: Padding( - padding: EdgeInsetsDirectional.fromSTEB(0.rpx, 93.rpx, 0, 0), + padding: + EdgeInsetsDirectional.fromSTEB(0.rpx, 93.rpx, 0, 0), child: Text( '蓝牙绑定.双人版绑定标题'.tr, style: FlutterFlowTheme.of(context).bodyMedium.override( @@ -74,7 +74,7 @@ void showBindDoubleDialog(BuildContext context, List devices) { // 主设备 _buildCheckboxRow( context, - title: '蓝牙绑定.主设备'.tr, + title: '蓝牙绑定.主设备'.tr + "asasasasasas(已被绑定)", value: () => blueteethBindController.model.deviceIndex1!, onChanged: (v) { if (!blueteethBindController.model.deviceIndex1!) { @@ -130,8 +130,6 @@ void showBindDoubleDialog(BuildContext context, List devices) { ); } - - void showHaveBindDialog(BuildContext context) { ThemeController themeController = Get.find(); @@ -187,7 +185,7 @@ void showHaveBindDialog(BuildContext context) { TextSpan( text: "蓝牙绑定.无法绑定2".tr, style: TextStyle( - color: themeController.currentColor.sc10, + color: themeController.currentColor.sc8, fontSize: AppConstants().normal_text_fontSize, ), ), @@ -228,10 +226,9 @@ void showHaveBindDialog(BuildContext context) { style: FlutterFlowTheme.of(context) .bodyMedium .override( - color: Colors.white, + color: themeController.currentColor.sc3, fontFamily: 'Inter', - fontSize: - AppConstants().normal_text_fontSize, + fontSize: AppConstants().normal_text_fontSize, letterSpacing: 0.0, ), ), @@ -251,6 +248,85 @@ void showHaveBindDialog(BuildContext context) { ); } +void showLoadingDialog(BuildContext context) { + ThemeController themeController = Get.find(); + showDialog( + context: context, + barrierDismissible: true, + barrierColor: Colors.black.withOpacity(0.5), + builder: (BuildContext context) { + return FrostedDialog( + blurSigma: 3.0, + child: Container( + decoration: BoxDecoration( + color: Colors.transparent, + borderRadius: BorderRadius.circular(20.0), + ), + padding: EdgeInsetsDirectional.fromSTEB(60.rpx, 0, 60.rpx, 0), + child: Container( + width: double.infinity, + constraints: BoxConstraints( + maxHeight: MediaQuery.sizeOf(context).height * 0.656, + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // Align( + // alignment: AlignmentDirectional(0, 0), + // child: Padding( + // padding: EdgeInsetsDirectional.fromSTEB( + // 0.rpx, 93.rpx, 0.rpx, 0.rpx), + // child: Text( + // '蓝牙绑定.无法绑定'.tr, + // style: FlutterFlowTheme.of(context).bodyMedium.override( + // fontFamily: 'Inter', + // fontSize: 30.rpx, + // letterSpacing: 0.0, + // color: themeController.currentColor.sc3, + // ), + // ), + // ), + // ), + Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 0.rpx, 93.rpx, 0.rpx, 0.rpx), + child: SizedBox( + width: 120.rpx, + height: 120.rpx, + child: LoadingIndicator( + indicatorType: Indicator.ballSpinFadeLoader, + colors: [ + themeController.currentColor.sc3, + ], + strokeWidth: 1, + backgroundColor: Colors.transparent, + pathBackgroundColor: themeController.currentColor.sc3), + ), + ), + + Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 0.rpx, 27.rpx, 0.rpx, 56.rpx), + child: RichText( + text: TextSpan(children: [ + TextSpan( + text: "连接中...".tr, + style: TextStyle( + color: themeController.currentColor.sc3, + fontSize: AppConstants().normal_text_fontSize, + ), + ), + ]), + ), + ), + ], + ), + ), + ), + ); + }, + ); +} Widget _buildCheckboxRow( BuildContext context, { @@ -260,7 +336,7 @@ Widget _buildCheckboxRow( }) { ThemeController themeController = Get.find(); return Padding( - padding: EdgeInsetsDirectional.fromSTEB(60.rpx, 64.rpx, 0.rpx, 0.rpx), + padding: EdgeInsetsDirectional.fromSTEB(20.rpx, 64.rpx, 0.rpx, 0.rpx), child: Row( mainAxisSize: MainAxisSize.max, children: [ @@ -270,14 +346,16 @@ Widget _buildCheckboxRow( value: value(), onChanged: onChanged, )), - Text( - title, - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: 'Inter', - letterSpacing: 0.0, - fontSize: AppConstants().normal_text_fontSize, - color: themeController.currentColor.sc3, - ), + Expanded( + child: Text( + title, + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: 'Inter', + letterSpacing: 0.0, + fontSize: AppConstants().normal_text_fontSize, + color: themeController.currentColor.sc3, + ), + ), ), ].divide(SizedBox(width: 21.rpx)), ), @@ -311,7 +389,7 @@ Widget _buildActionButton( Text( text, style: FlutterFlowTheme.of(context).bodyMedium.override( - color: Colors.white, + color: themeController.currentColor.sc3, fontFamily: 'Inter', fontSize: AppConstants().normal_text_fontSize, letterSpacing: 0.0, @@ -322,3 +400,145 @@ Widget _buildActionButton( ), ); } + +void showConfirmDialog( + BuildContext context, + Widget widget, + String title, { + required VoidCallback onConfirm, + required VoidCallback onCancel, +}) { + ThemeController themeController = Get.find(); + BlueteethBindController blueteethBindController = Get.find(); + + showDialog( + context: context, + barrierDismissible: true, + barrierColor: Colors.black.withOpacity(0.5), // 背景模糊色 + builder: (BuildContext context) { + return FrostedDialog( + blurSigma: 3.0, + child: Container( + decoration: BoxDecoration( + color: themeController.currentColor.sc17, + borderRadius: BorderRadius.circular(20.0), + ), + padding: EdgeInsetsDirectional.fromSTEB(64.rpx, 0, 64.rpx, 0), + child: Container( + width: double.infinity, + constraints: BoxConstraints( + maxHeight: MediaQuery.sizeOf(context).height * 0.656, + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // 标题 + Align( + alignment: AlignmentDirectional(0, 0), + child: Padding( + padding: + EdgeInsetsDirectional.fromSTEB(0.rpx, 93.rpx, 0, 0), + child: Text( + title, + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: 'Inter', + fontSize: 30.rpx, + letterSpacing: 0.0, + color: themeController.currentColor.sc3, + ), + ), + ), + ), + widget, + Padding( + padding: EdgeInsetsDirectional.fromSTEB(0, 58.rpx, 0, 60.rpx), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CustomCard( + borderRadius: AppConstants().button_container_radius, + onTap: () { + Get.back(); + onConfirm(); + }, + colors: [ + themeController.currentColor.sc1, + themeController.currentColor.sc2, + ], + child: Container( + width: MediaQuery.sizeOf(context).width * 0.115, + height: MediaQuery.sizeOf(context).height * 0.055, + constraints: BoxConstraints( + minWidth: 160.rpx, + minHeight: 90.rpx, + ), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "蓝牙绑定.是".tr, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + color: themeController.currentColor.sc3, + fontFamily: 'Inter', + fontSize: + AppConstants().normal_text_fontSize, + letterSpacing: 0.0, + ), + ), + ].divide(SizedBox(width: 17.rpx)), + ), + ), + ), + CustomCard( + borderRadius: AppConstants().button_container_radius, + onTap: () { + Get.back(); + onCancel(); + }, + colors: [ + themeController.currentColor.sc1, + themeController.currentColor.sc2, + ], + child: Container( + width: MediaQuery.sizeOf(context).width * 0.215, + height: MediaQuery.sizeOf(context).height * 0.055, + constraints: BoxConstraints( + minWidth: 160.rpx, + minHeight: 90.rpx, + ), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "蓝牙绑定.否".tr, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + color: themeController.currentColor.sc3, + fontFamily: 'Inter', + fontSize: + AppConstants().normal_text_fontSize, + letterSpacing: 0.0, + ), + ), + ].divide(SizedBox(width: 17.rpx)), + ), + ), + ), + ].divide(SizedBox( + width: 70.rpx, + )), + ), + ), + ], + ), + ), + ), + ); + }, + ); +} diff --git a/lib/pages/device_bind/device_type.dart b/lib/pages/device_bind/device_type.dart index b13fd5f..19ae67c 100644 --- a/lib/pages/device_bind/device_type.dart +++ b/lib/pages/device_bind/device_type.dart @@ -13,7 +13,8 @@ import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/controller/user_info_controller.dart'; class DeviceTypePage extends StatefulWidget { - const DeviceTypePage({super.key}); + int type = 0;//0绑定设备 1.查询我的设备 + DeviceTypePage({super.key,this.type = 0}); @override State createState() => _EPageState(); @@ -30,7 +31,7 @@ class _EPageState extends State { super.initState(); // 延迟到 build 完成后执行弹窗逻辑 WidgetsBinding.instance.addPostFrameCallback((_) { - if (blueteethBindController.model.read == 1) { + if (blueteethBindController.model.read == 1 && widget.type == 0) { showDialog( context: context, barrierDismissible: false, @@ -71,7 +72,7 @@ class _EPageState extends State { mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB( @@ -84,8 +85,7 @@ class _EPageState extends State { child: SvgPicture.asset( 'assets/img/icon/sound.svg', fit: BoxFit.fill, - color: themeController - .currentColor.sc8, + color: stringToColor("#ff9f66"), ), ), ), @@ -97,17 +97,19 @@ class _EPageState extends State { children: [ Text( '绑定引导.说明标题'.tr, - style: FlutterFlowTheme.of( - context) - .bodyMedium - .override( - fontFamily: 'Inter', - fontSize: AppConstants() - .normal_text_fontSize, - letterSpacing: 0.0, - fontWeight: - FontWeight.w500, - color: Colors.orange), + style: + FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Inter', + fontSize: AppConstants() + .normal_text_fontSize, + letterSpacing: 0.0, + fontWeight: + FontWeight.w500, + color: stringToColor( + "#916d46"), + ), ), Text( '绑定引导.说明正文'.tr, @@ -119,6 +121,8 @@ class _EPageState extends State { fontSize: AppConstants() .normal_text_fontSize, letterSpacing: 0.0, + color: stringToColor( + "#916d46"), ), ), ].divide(SizedBox( @@ -223,10 +227,12 @@ class _EPageState extends State { style: FlutterFlowTheme.of(context) .bodyMedium .override( - fontFamily: 'Inter', - fontSize: 26.rpx, - letterSpacing: 0.0, - color: Colors.white), + fontFamily: 'Inter', + fontSize: 26.rpx, + letterSpacing: 0.0, + color: themeController + .currentColor.sc3, + ), ), ].divide(SizedBox(width: 22.rpx)), ), @@ -239,9 +245,8 @@ class _EPageState extends State { Get.back(); // 关闭当前弹窗或页面 }, colors: [ - //todo 颜色 - stringToColor("45D989"), - stringToColor("00C1AA") + themeController.currentColor.sc1, + themeController.currentColor.sc2, ], // 单色背景也用渐变写法 child: Container( @@ -300,14 +305,13 @@ class _EPageState extends State { child: Scaffold( backgroundColor: Colors.transparent, // 加上这一行 appBar: AppBar( - backgroundColor: stringToColor("#242835"), + backgroundColor: themeController.currentColor.sc17, // backgroundColor: Colors.transparent, automaticallyImplyLeading: false, - iconTheme: IconThemeData(color: Colors.white), + iconTheme: IconThemeData(color: themeController.currentColor.sc3), titleSpacing: 0, // leading: returnIconButtom, title: Container( - // color: Colors.grey, width: double.infinity, height: 180.rpx, child: Stack( @@ -318,7 +322,7 @@ class _EPageState extends State { '设备列表', style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx, ), @@ -391,7 +395,7 @@ class _EPageState extends State { } } }, - colors: [stringToColor("#242835")], // 背景色 + colors: [themeController.currentColor.sc17], // 背景色 child: Container( width: double.infinity, height: MediaQuery.sizeOf(context).height * 0.135, diff --git a/lib/pages/device_bind/wifi_page.dart b/lib/pages/device_bind/wifi_page.dart index fe7801b..0fa20df 100644 --- a/lib/pages/device_bind/wifi_page.dart +++ b/lib/pages/device_bind/wifi_page.dart @@ -1,11 +1,10 @@ import 'dart:async'; +import 'package:easydevice/easydevice.dart'; import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:vbvs_app/common/color/appConstants.dart'; -import 'package:vbvs_app/common/util/Ble.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart'; @@ -14,14 +13,12 @@ import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; import 'package:vbvs_app/controller/person/person_controller.dart'; import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/controller/user_info_controller.dart'; -import 'package:vbvs_app/common/util/Ble.dart' as ble; import 'package:vbvs_app/pages/common/selectDialog.dart'; class WifiPage extends StatefulWidget { - // ble.ConnectedDeviceProp connectedDeviceProp; - BluetoothDevice bluetoothDevice; - // WifiPage({super.key, required this.connectedDeviceProp}); - WifiPage({super.key, required this.bluetoothDevice}); + BLEDevice bleDevice; + WifiPage({super.key, required this.bleDevice}); + // WifiPage({super.key}); @override State createState() => _WifiPageState(); @@ -33,12 +30,10 @@ class _WifiPageState extends State { BlueteethBindController blueteethBindController = Get.find(); PersonController personController = Get.find(); ThemeController themeController = Get.find(); - late ble.ConnectedDeviceProp connectedDeviceProp; @override void initState() { super.initState(); - connectToDevice(widget.bluetoothDevice); // connectedDeviceProp = widget.connectedDeviceProp; Timer(const Duration(microseconds: 100), () { getWifiList(); @@ -60,14 +55,12 @@ class _WifiPageState extends State { child: Scaffold( backgroundColor: Colors.transparent, // 加上这一行 appBar: AppBar( - backgroundColor: stringToColor("#242835"), - // backgroundColor: Colors.transparent, + backgroundColor: themeController.currentColor.sc17, automaticallyImplyLeading: false, - iconTheme: IconThemeData(color: Colors.white), + iconTheme: IconThemeData(color: themeController.currentColor.sc3), titleSpacing: 0, // leading: returnIconButtom, title: Container( - // color: Colors.grey, width: double.infinity, height: 180.rpx, child: Stack( @@ -78,7 +71,7 @@ class _WifiPageState extends State { 'wifi页.标题'.tr, style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx, ), @@ -97,8 +90,8 @@ class _WifiPageState extends State { Get.offAllNamed("/bindDeviceSuccess"); }, colors: [ - stringToColor("#45D989"), - stringToColor("#00C1AA"), + themeController.currentColor.sc1, + themeController.currentColor.sc2, ], child: Container( width: 100.rpx, @@ -112,7 +105,7 @@ class _WifiPageState extends State { .titleSmall .override( fontFamily: 'Inter Tight', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0.0, ), ), @@ -390,8 +383,7 @@ class _WifiPageState extends State { } } }, - // colors: [Colors.white.withOpacity(0.06)], // 背景色 - colors: [stringToColor("#242835")], // 背景色 + colors: [themeController.currentColor.sc17], // 背景色 child: Container( width: double.infinity, @@ -430,46 +422,12 @@ class _WifiPageState extends State { getWifiList({int time = 3}) { // LoadingDialog.show("扫描WIFI列表中...", icon: LoadingDialogIcon.wifi); try { - var device = widget.bluetoothDevice; - String log = ""; - Function logAdd = (l) { - log += l; - }; - connectedDeviceProp.receiveLogArr.add(logAdd); - connectedDeviceProp.write3OfString("wscan scan", success: () { - Timer.periodic(const Duration(milliseconds: 1000), (timer) async { - if (timer.tick > 8) { - timer.cancel(); - connectedDeviceProp.receiveLogArr.remove(logAdd); - LoadingDialog.hide(); - if (time > 0) { - getWifiList(time: time - 1); - } - } - Iterable a = RegExp( - r'ITEM:SSID=([^\t]*)\s*RSSI=(\S*)\s*(,\s*auth\s*=\s*(\S*))?') - .allMatches(log); - if (a.isEmpty == false) { - await Future.delayed(const Duration(milliseconds: 500)); - a = RegExp( - r'ITEM:SSID=([^\t]*)\s*RSSI=(\S*)\s*(,\s*auth\s*=\s*(\S*))?') - .allMatches(log); - List arr = []; - for (RegExpMatch one in a) { - arr.add({"name": one[1], "num": one[2], "auth": one[4]}); - } - LoadingDialog.hide(); - blueteethBindController.model.wifiList = arr; - blueteethBindController.updateAll(); - connectedDeviceProp.receiveLogArr.remove(logAdd); - timer.cancel(); - checkIsCalibration(); - } - }); - }, fail: () { - connectedDeviceProp.receiveLogArr.remove(logAdd); - LoadingDialog.hide(); - }); + // var device = widget.bluetoothDevice; + // String log = ""; + // Function logAdd = (l) { + // log += l; + // }; + } catch (e) { print(e); } diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 923d8e1..8799a49 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -9,6 +9,7 @@ import 'package:vbvs_app/component/tool/ClickableContainer.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/controller/login/login_controller.dart'; import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; +import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/controller/user_info_controller.dart'; class LoginPage extends StatefulWidget { @@ -22,6 +23,7 @@ class _EPageState extends State { GlobalController globalController = Get.find(); UserInfoController userInfoController = Get.find(); LoginController loginController = Get.find(); + ThemeController themeController = Get.find(); @override Widget build(BuildContext context) { @@ -53,7 +55,8 @@ class _EPageState extends State { ), ClickableContainer( backgroundColor: Colors.transparent, // 容器背景色 - highlightColor: Colors.green, // 点击时的背景色 + highlightColor: + themeController.currentColor.sc21, // 点击时的背景色 padding: EdgeInsets.zero, // 这里去掉外部的 padding,避免影响点击范围 onTap: () { @@ -66,7 +69,7 @@ class _EPageState extends State { 'assets/img/icon/close.svg', width: 25.rpx, height: 25.rpx, // 如果 SVG 中没有固定颜色,使用 color 设置 - color: Colors.white, // 这里设置了颜色 + color: themeController.currentColor.sc3, ), ), ), @@ -96,7 +99,8 @@ class _EPageState extends State { fontSize: 48.rpx, letterSpacing: 0.0, //todo 颜色 - color: stringToColor("#FFFFFF"), + color: themeController + .currentColor.sc3, ), ), ), @@ -122,7 +126,8 @@ class _EPageState extends State { fontSize: 30.rpx, letterSpacing: 0.0, //todo 颜色 - color: stringToColor("#FFFFFF"), + color: themeController + .currentColor.sc3, ), ), ), @@ -148,7 +153,8 @@ class _EPageState extends State { fontSize: 48.rpx, letterSpacing: 0.0, //todo 颜色 - color: stringToColor("#FFFFFF"), + color: themeController + .currentColor.sc3, ), ), ), @@ -162,8 +168,8 @@ class _EPageState extends State { borderRadius: AppConstants() .button_container_radius, // 圆角半径 onTap: () { - bool agree = loginController - .model.register_agree!; + bool agree = + loginController.model.register_agree!; if (!agree) { print('未授权 ...'); } else { @@ -172,8 +178,8 @@ class _EPageState extends State { }, colors: [ //todo 颜色 - stringToColor("45D989"), - stringToColor("00C1AA") + themeController.currentColor.sc1, + themeController.currentColor.sc2, ], // 渐变色是同一个色,也可以根据需要调整 child: Container( @@ -197,7 +203,8 @@ class _EPageState extends State { .bodyMedium .override( //todo 颜色 - color: Colors.white, + color: themeController + .currentColor.sc3, fontFamily: 'Inter', fontSize: AppConstants() .normal_text_fontSize, @@ -216,7 +223,8 @@ class _EPageState extends State { ), ClickableContainer( backgroundColor: Colors.transparent, // 容器背景色 - highlightColor: Colors.orange, // 点击时的背景色 + highlightColor: themeController + .currentColor.sc21, // 点击时的背景色 padding: EdgeInsetsDirectional.fromSTEB( 16.rpx, 10.rpx, 16.rpx, 10.rpx), onTap: () { @@ -228,7 +236,7 @@ class _EPageState extends State { style: TextStyle( fontFamily: 'Inter', fontSize: 26.rpx, - color: Colors.white, + color: themeController.currentColor.sc3, ), ), ), @@ -414,8 +422,7 @@ class _EPageState extends State { fontFamily: 'Inter', fontSize: 26.rpx, letterSpacing: 0.0, - //todo 颜色 - color: stringToColor("#FFFFFF"), + color: themeController.currentColor.sc3, ), ), ), diff --git a/lib/pages/login/other_login.dart b/lib/pages/login/other_login.dart index 0a98278..a9a25a3 100644 --- a/lib/pages/login/other_login.dart +++ b/lib/pages/login/other_login.dart @@ -1,17 +1,24 @@ +import 'dart:io'; + +import 'package:EasyDartModule/EasyDartModule.dart' as edm; import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:vbvs_app/common/color/appConstants.dart'; +import 'package:vbvs_app/common/color/app_uri_status.dart'; +import 'package:vbvs_app/common/util/DailyLogUtils.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart'; +import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; import 'package:vbvs_app/controller/login/login_controller.dart'; import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/controller/time/countdown_controller.dart'; import 'package:vbvs_app/controller/user_info_controller.dart'; +import 'package:vbvs_app/model/api_response.dart'; class OtherLoginPage extends StatefulWidget { const OtherLoginPage({super.key}); @@ -57,7 +64,8 @@ class _OtherLoginPageState extends State { ), ClickableContainer( backgroundColor: Colors.transparent, // 容器背景色 - highlightColor: Colors.green, // 点击时的背景色 + highlightColor: + themeController.currentColor.sc21, // 点击时的背景色 padding: EdgeInsets.zero, // 这里去掉外部的 padding,避免影响点击范围 onTap: () { @@ -70,7 +78,7 @@ class _OtherLoginPageState extends State { 'assets/img/icon/arrow_left.svg', width: 25.rpx, height: 25.rpx, // 如果 SVG 中没有固定颜色,使用 color 设置 - color: Colors.white, // 这里设置了颜色 + color: themeController.currentColor.sc3, ), ), ), @@ -99,8 +107,8 @@ class _OtherLoginPageState extends State { fontFamily: 'Inter', fontSize: 48.rpx, letterSpacing: 0.0, - //todo 颜色 - color: stringToColor("#FFFFFF"), + color: themeController + .currentColor.sc3, ), ), ), @@ -125,8 +133,8 @@ class _OtherLoginPageState extends State { fontFamily: 'Inter', fontSize: 30.rpx, letterSpacing: 0.0, - //todo 颜色 - color: stringToColor("#FFFFFF"), + color: themeController + .currentColor.sc3, ), ), ), @@ -147,7 +155,7 @@ class _OtherLoginPageState extends State { AppConstants() .button_container_radius), border: Border.all( - color: Colors.white, + color: themeController.currentColor.sc3, width: 1.rpx, ), ), @@ -168,6 +176,10 @@ class _OtherLoginPageState extends State { alignment: AlignmentDirectional(-1, 0), child: TextFormField( + onChanged: (value) { + loginController + .model.phone = value; + }, autofocus: false, obscureText: false, decoration: InputDecoration( @@ -285,7 +297,7 @@ class _OtherLoginPageState extends State { AppConstants() .button_container_radius), border: Border.all( - color: Colors.white, + color: themeController.currentColor.sc3, width: 1.rpx, ), ), @@ -306,6 +318,10 @@ class _OtherLoginPageState extends State { alignment: AlignmentDirectional(-1, 0), child: TextFormField( + onChanged: (value) { + loginController.model.code = + value; + }, autofocus: false, obscureText: false, decoration: InputDecoration( @@ -418,21 +434,6 @@ class _OtherLoginPageState extends State { .currentColor.sc7, ), ), - // Text( - // countdownController.countdown - // .value == - // 0 - // ? '其他手机登录页.获取验证码'.tr - // : '${countdownController.countdown.value}秒', - // style: TextStyle( - // fontFamily: 'Readex Pro', - // color: themeController - // .currentColor.sc7, - // fontSize: AppConstants() - // .title_text_fontSize, - // letterSpacing: 0, - // ), - // ), Obx(() { final CountdownController countdownController = @@ -440,28 +441,70 @@ class _OtherLoginPageState extends State { CountdownController>(); return InkWell( onTap: () async { - if (countdownController - .countdown - .value != - 0) { - return; + try { + await DailyLogUtils + .writeLog( + "点击获取验证码"); + if (countdownController + .countdown + .value != + 0) { + return; + } + ApiResponse + apiResponse = + await loginController + .getCode( + context); + if (apiResponse.code != + HttpStatusCodes.ok) { + TopSlideNotification + .show( + context, + text: apiResponse + .msg!, + textColor: + themeController + .currentColor + .sc9, + ); + await DailyLogUtils + .writeLog( + "获取验证码成功,${apiResponse}"); + return; + } else { + TopSlideNotification + .show( + context, + text: apiResponse + .msg!, + textColor: + themeController + .currentColor + .sc2, + ); + await DailyLogUtils + .writeLog( + "获取验证码失败,${apiResponse}"); + } + countdownController + .countdown + .value == + 0 + ? countdownController + .startCountdown( + AppConstants + .code_time) + : null; + } catch (e) { + await DailyLogUtils + .writeLog( + "获取验证码异常,${e}"); + edm.EasyDartModule + .logger + .info( + "获取验证码异常:${e}"); } - - String msg = - await loginController - .getCode(context); - if (msg.isNotEmpty) { - return; - } - countdownController - .countdown - .value == - 0 - ? countdownController - .startCountdown( - AppConstants - .code_time) - : null; }, child: Container( alignment: @@ -475,13 +518,14 @@ class _OtherLoginPageState extends State { .countdown .value == 0 - ? '获取验证码' - : '${countdownController.countdown.value}秒', + ? '其他手机登录页.获取验证码'.tr + : '${countdownController.countdown.value}' + + "其他手机登录页.秒".tr, style: TextStyle( fontFamily: 'Readex Pro', - color: - Color(0xFF333333), + color: themeController + .currentColor.sc2, fontSize: AppConstants() .title_text_fontSize, letterSpacing: 0, @@ -505,25 +549,53 @@ class _OtherLoginPageState extends State { child: CustomCard( borderRadius: AppConstants() .button_container_radius, // 圆角半径 - onTap: () { - bool agree = - loginController.model.register_agree!; - if (!agree) { - print('未授权 ...'); - } else { - print('已授权 ...'); + onTap: () async { + try { + await DailyLogUtils.writeLog("点击登录"); + bool agree = + loginController.model.register_agree!; + if (!agree) { + TopSlideNotification.show( + context, + text: "登录页.未同意协议".tr, + textColor: + themeController.currentColor.sc9, + ); + } else { + ApiResponse apiResponse = + await loginController + .login(context); + if (apiResponse.code != HttpStatusCodes.ok) { + TopSlideNotification.show( + context, + text: apiResponse.msg!, + textColor: themeController + .currentColor.sc9, + ); + } else { + // 登录成功,跳转到主页面 + TopSlideNotification.show( + context, + text: "其他手机登录页.登录成功".tr, + textColor: themeController + .currentColor.sc2, + ); + Get.offAllNamed('/homePage'); + } + } + } catch (e) { + await DailyLogUtils.writeLog("登录失败,${e}"); + edm.EasyDartModule.logger + .info("登录失败:${e}"); } }, colors: [ - //todo 颜色 - stringToColor("45D989"), - stringToColor("00C1AA") - ], // 渐变色是同一个色,也可以根据需要调整 + themeController.currentColor.sc1, + themeController.currentColor.sc2, + ], child: Container( - width: - // MediaQuery.sizeOf(context).width * 0.66, - bodysize.maxWidth, + width: bodysize.maxWidth, height: MediaQuery.sizeOf(context).height * 0.055, constraints: BoxConstraints( @@ -540,8 +612,8 @@ class _OtherLoginPageState extends State { style: FlutterFlowTheme.of(context) .bodyMedium .override( - //todo 颜色 - color: Colors.white, + color: themeController + .currentColor.sc3, fontFamily: 'Inter', fontSize: AppConstants() .normal_text_fontSize, @@ -604,7 +676,7 @@ class _OtherLoginPageState extends State { .secondaryText, ), activeColor: - stringToColor("#FF9F66"), + stringToColor("#FF9F66"), //固定 checkColor: FlutterFlowTheme.of(context) .info, @@ -633,8 +705,8 @@ class _OtherLoginPageState extends State { fontFamily: 'Inter', letterSpacing: 0.0, fontSize: 26.rpx, - color: Colors - .white, // 可以调整为你想要的颜色 + color: themeController + .currentColor.sc3, ), ), TextSpan( @@ -659,8 +731,8 @@ class _OtherLoginPageState extends State { fontFamily: 'Inter', letterSpacing: 0.0, fontSize: 26.rpx, - color: Colors - .white, // 可以调整为你想要的颜色 + color: themeController + .currentColor.sc3, ), ), TextSpan( @@ -685,8 +757,8 @@ class _OtherLoginPageState extends State { fontFamily: 'Inter', letterSpacing: 0.0, fontSize: 26.rpx, - color: Colors - .white, // 可以调整为你想要的颜色 + color: themeController + .currentColor.sc3, ), ), TextSpan( @@ -737,8 +809,7 @@ class _OtherLoginPageState extends State { fontFamily: 'Inter', fontSize: 26.rpx, letterSpacing: 0.0, - //todo 颜色 - color: stringToColor("#FFFFFF"), + color: themeController.currentColor.sc3, ), ), ), diff --git a/lib/pages/main_bottom/e_page.dart b/lib/pages/main_bottom/e_page.dart index 73da0b6..bfe9287 100644 --- a/lib/pages/main_bottom/e_page.dart +++ b/lib/pages/main_bottom/e_page.dart @@ -19,61 +19,7 @@ class _EPageState extends State { builder: (context, boxConstraints) => GestureDetector( onTap: () => FocusScope.of(context).unfocus(), child: Scaffold( - // appBar: AppBar( - // backgroundColor: AppColors.bg_color, - // automaticallyImplyLeading: false, - // title: Container( - // width: double.infinity, - // height: 70.rpx, - // child: Obx( - // () => InkWell( - // onTap: () { - // Get.toNamed("/editUserInfoPage"); - // }, - // child: Row( - // mainAxisSize: MainAxisSize.max, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Row( - // mainAxisSize: MainAxisSize.max, - // children: [ - // Container( - // width: 56.rpx, - // height: 56.rpx, - // clipBehavior: Clip.antiAlias, - // decoration: BoxDecoration( - // shape: BoxShape.circle, - // ), - // ), - // Container( - // width: 20.rpx, - // height: 0, - // decoration: BoxDecoration( - // color: Colors.white, - // shape: BoxShape.rectangle, - // ), - // ), - // Text( - // userInfoController.model.user!.nickName ?? '匿名', - // style: FlutterFlowTheme.of(context) - // .bodyMedium - // .override( - // fontFamily: 'Readex Pro', - // color: Colors.white, - // letterSpacing: 0, - // fontSize: 30.rpx), - // ), - // ], - // ), - // ], - // ), - // ), - // ), - // ), - // actions: [], - // centerTitle: false, - // ), - + body: SafeArea( top: true, child: Text("小e"), diff --git a/lib/pages/main_bottom/home_page.dart b/lib/pages/main_bottom/home_page.dart index 8ac38df..d1baddb 100644 --- a/lib/pages/main_bottom/home_page.dart +++ b/lib/pages/main_bottom/home_page.dart @@ -111,11 +111,17 @@ class _HomePageState extends State { children: [ Text( "飞行的鱼", - style: TextStyle(color: Colors.white), + style: TextStyle( + color: themeController + .currentColor.sc3, + ), ), Text( "嘉兴 晴", - style: TextStyle(color: Colors.white), + style: TextStyle( + color: themeController + .currentColor.sc3, + ), ), ], ), @@ -138,7 +144,8 @@ class _HomePageState extends State { 19.rpx, 34.rpx, 0, 21.rpx), child: ClickableContainer( backgroundColor: Colors.transparent, // 容器背景色 - highlightColor: Colors.orange, // 点击时的背景色 + highlightColor: + themeController.currentColor.sc21, // 点击时的背景色 onTap: () { print('点击了容器'); }, @@ -194,7 +201,7 @@ class _HomePageState extends State { 'assets/img/icon/arrow_right.svg', width: 14.rpx, height: 14.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - color: Colors.white, + color: themeController.currentColor.sc3, ), ), ); @@ -203,436 +210,478 @@ class _HomePageState extends State { ), ), ), - Container( - //未绑定布局 - width: MediaQuery.sizeOf(context).width, - height: MediaQuery.sizeOf(context).height * 0.277, - constraints: BoxConstraints( - minWidth: 690.rpx, - minHeight: 450.rpx, - ), - decoration: BoxDecoration( - color: themeController.currentColor.sc5, - borderRadius: BorderRadius.circular( - AppConstants().normal_container_radius), // 圆角半径 - ), - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - CustomCard( - borderRadius: AppConstants() - .button_container_radius, // 圆角半径 - onTap: () { - Get.toNamed("/personPage"); - }, - colors: [ - // 渐变色 - themeController.currentColor.sc1, - themeController.currentColor.sc2, - ], - - child: Container( - width: - MediaQuery.sizeOf(context).width * 0.66, - height: - MediaQuery.sizeOf(context).height * 0.055, - constraints: BoxConstraints( - minWidth: 500.rpx, - minHeight: 90.rpx, - ), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SvgPicture.asset( - 'assets/img/icon/scan.svg', - width: 25.rpx, - height: 25.rpx, // SVG 的固定大小 - color: themeController - .currentColor.sc16, // 颜色设置 - ), - Text( - '首页.扫一扫绑定'.tr, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - color: themeController - .currentColor.sc19, - fontFamily: 'Inter', - fontSize: AppConstants() - .normal_text_fontSize, - letterSpacing: 0.0, - ), - ), - ].divide(SizedBox(width: 17.rpx)), - ), - ), + Obx(() { + return Visibility( + visible: userInfoController.model.login == 0, + child: Container( + //未绑定布局 + width: MediaQuery.sizeOf(context).width, + height: MediaQuery.sizeOf(context).height * 0.277, + constraints: BoxConstraints( + minWidth: 690.rpx, + minHeight: 450.rpx, ), - CustomCard( - borderRadius: AppConstants() - .button_container_radius, // 圆角半径 - onTap: () { - print('Button pressed ...'); - Get.toNamed("/deviceType"); - }, - colors: [ - //todo 颜色 - themeController.currentColor.sc1, - themeController.currentColor.sc2, - ], // 渐变色是同一个色,也可以根据需要调整 - - child: Container( - width: - MediaQuery.sizeOf(context).width * 0.66, - height: - MediaQuery.sizeOf(context).height * 0.055, - constraints: BoxConstraints( - minWidth: 500.rpx, - minHeight: 90.rpx, - ), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SvgPicture.asset( - 'assets/img/icon/bluetooth.svg', - width: 25.rpx, - height: 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - //todo 颜色 - color: - themeController.currentColor.sc16, - ), - Text( - '首页.蓝牙绑定'.tr, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - //todo 颜色 - color: themeController - .currentColor.sc19, - fontFamily: 'Inter', - fontSize: AppConstants() - .normal_text_fontSize, - letterSpacing: 0.0, - ), - ), - ].divide(SizedBox( - width: 17.rpx, - )), - ), - ), - ) - ].divide(SizedBox( - height: 60.rpx, - )), - ), - ), - Padding( - //未绑定标语 - padding: - EdgeInsetsDirectional.fromSTEB(0, 26.rpx, 0, 0), - child: Container( - width: MediaQuery.sizeOf(context).width, - decoration: BoxDecoration( - color: themeController.currentColor.sc6, - borderRadius: BorderRadius.circular(AppConstants() - .normal_container_radius), // 圆角半径 - ), - child: Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 25.rpx, 25.rpx, 25.rpx, 25.rpx), - child: Row( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 0.rpx, 5.rpx, 0.rpx, 0.rpx), - child: SvgPicture.asset( - 'assets/img/icon/sound.svg', - width: 30.rpx, - height: 30.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - //todo 颜色 - color: stringToColor("#FF9F66"), - ), - ), - Expanded( - child: Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - '首页.提示标题'.tr, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Inter', - fontSize: AppConstants() - .normal_text_fontSize, - letterSpacing: 0.0, - fontWeight: FontWeight.w900, - //todo 配置颜色 - color: - stringToColor("#916D46")), - ), - Text( - '首页.提示内容1'.tr, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Inter', - fontSize: AppConstants() - .normal_text_fontSize, - letterSpacing: 0.0, - //todo 配置颜色 - color: - stringToColor("#916D46")), - ), - Text( - '首页.提示内容2'.tr, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Inter', - fontSize: AppConstants() - .normal_text_fontSize, - letterSpacing: 0.0, - //todo 配置颜色 - color: - stringToColor("#916D46")), - ), - Text( - '首页.提示内容3'.tr, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Inter', - fontSize: AppConstants() - .normal_text_fontSize, - letterSpacing: 0.0, - //todo 配置颜色 - color: - stringToColor("#916D46")), - ), - ].divide(SizedBox( - height: AppConstants() - .text_padding_up_dowm_p)), - ), - ) - ].divide(SizedBox(width: 20.rpx)), + decoration: BoxDecoration( + color: themeController.currentColor.sc5, + borderRadius: BorderRadius.circular( + AppConstants() + .normal_container_radius), // 圆角半径 ), - ), - ), - ), - Padding( - padding: - EdgeInsetsDirectional.fromSTEB(0, 26.rpx, 0, 0), - child: Container( - // color: Colors.red, - width: bodySize.maxWidth, - height: bodySize.maxHeight * 0.107, - constraints: BoxConstraints( - minHeight: 240.rpx, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - ClickableContainer( - backgroundColor: - themeController.currentColor.sc5, - highlightColor: - themeController.currentColor.sc3, - borderRadius: - AppConstants().normal_container_radius, - padding: - EdgeInsets.zero, // 原始Container没有padding - onTap: () { - // 点击逻辑放这里 - }, - child: Container( - width: bodySize.maxWidth * 0.445, - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - SizedBox(height: 32.rpx), - Container( - width: 120.rpx, - height: 120.rpx, - child: Image.asset( - "assets/img/netlove.png", - fit: BoxFit.cover, - ), - ), - Text( - "首页.我的e护".tr, - style: TextStyle( - color: themeController - .currentColor.sc3, - ), - ), - SizedBox(height: 32.rpx), - ], - ), - ), - ), - ClickableContainer( - backgroundColor: - themeController.currentColor.sc5, - highlightColor: - themeController.currentColor.sc3, - borderRadius: - AppConstants().normal_container_radius, - padding: EdgeInsets - .zero, // 原本的Container没有 padding,这里设置为 zero - onTap: () { - // TODO: 替换为你需要的点击事件逻辑 - print("云关爱 被点击"); - }, - child: SizedBox( - width: bodySize.maxWidth * 0.445, - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Container( - width: 120.rpx, - height: 120.rpx, - child: Image.asset( - "assets/img/mye.png", - fit: BoxFit.cover, - ), - ), - Text( - "首页.云关爱".tr, - style: TextStyle( - color: themeController - .currentColor.sc3, - ), - ), - ] - .addToStart(SizedBox(height: 32.rpx)) - .addToEnd(SizedBox(height: 32.rpx)), - ), - ), - ), - ], - ), - ), - ), - // Generated code for this Container Widget... - Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 0, 25.rpx, 0, 25.rpx), - child: Container( - width: double.infinity, - decoration: BoxDecoration( - color: themeController.currentColor.sc5, - borderRadius: BorderRadius.circular( - AppConstants().normal_container_radius), - ), - child: Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 30.rpx, 30.rpx, 30.rpx, 30.rpx), child: Column( mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, children: [ - Container( - width: double.infinity, - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '次卧/1201/李小北', - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Inter', - fontSize: 30.rpx, - letterSpacing: 0.0, - color: themeController - .currentColor.sc3, - ), + CustomCard( + borderRadius: AppConstants() + .button_container_radius, // 圆角半径 + onTap: () { + Get.toNamed("/personPage"); + }, + colors: [ + // 渐变色 + themeController.currentColor.sc1, + themeController.currentColor.sc2, + ], + + child: Container( + width: MediaQuery.sizeOf(context).width * + 0.66, + height: + MediaQuery.sizeOf(context).height * + 0.055, + constraints: BoxConstraints( + minWidth: 500.rpx, + minHeight: 90.rpx, + ), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + SvgPicture.asset( + 'assets/img/icon/scan.svg', + width: 25.rpx, + height: 25.rpx, // SVG 的固定大小 + color: themeController + .currentColor.sc16, // 颜色设置 + ), + Text( + '首页.扫一扫绑定'.tr, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + color: themeController + .currentColor.sc19, + fontFamily: 'Inter', + fontSize: AppConstants() + .normal_text_fontSize, + letterSpacing: 0.0, + ), + ), + ].divide(SizedBox(width: 17.rpx)), + ), + ), + ), + CustomCard( + borderRadius: AppConstants() + .button_container_radius, // 圆角半径 + onTap: () { + print('Button pressed ...'); + Get.toNamed("/deviceType"); + }, + colors: [ + //todo 颜色 + themeController.currentColor.sc1, + themeController.currentColor.sc2, + ], // 渐变色是同一个色,也可以根据需要调整 + + child: Container( + width: MediaQuery.sizeOf(context).width * + 0.66, + height: + MediaQuery.sizeOf(context).height * + 0.055, + constraints: BoxConstraints( + minWidth: 500.rpx, + minHeight: 90.rpx, + ), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + SvgPicture.asset( + 'assets/img/icon/bluetooth.svg', + width: 25.rpx, + height: + 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 + //todo 颜色 + color: themeController + .currentColor.sc16, + ), + Text( + '首页.蓝牙绑定'.tr, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + //todo 颜色 + color: themeController + .currentColor.sc19, + fontFamily: 'Inter', + fontSize: AppConstants() + .normal_text_fontSize, + letterSpacing: 0.0, + ), + ), + ].divide(SizedBox( + width: 17.rpx, + )), + ), + ), + ) + ].divide(SizedBox( + height: 60.rpx, + )), + ), + ), + ); + }), + Obx(() { + return Visibility( + visible: userInfoController.model.login == 0, + child: Padding( + //未绑定标语 + padding: EdgeInsetsDirectional.fromSTEB( + 0, 26.rpx, 0, 0), + child: Container( + width: MediaQuery.sizeOf(context).width, + decoration: BoxDecoration( + color: themeController.currentColor.sc6, + borderRadius: BorderRadius.circular( + AppConstants() + .normal_container_radius), // 圆角半径 + ), + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 25.rpx, 25.rpx, 25.rpx, 25.rpx), + child: Row( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 0.rpx, 5.rpx, 0.rpx, 0.rpx), + child: SvgPicture.asset( + 'assets/img/icon/sound.svg', + width: 30.rpx, + height: + 30.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 + color: stringToColor("#FF9F66"), //固定 ), - Row( + ), + Expanded( + child: Column( mainAxisSize: MainAxisSize.max, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Text( - '首页.报告详情'.tr, + '首页.提示标题'.tr, style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'Inter', - fontSize: 26.rpx, + fontSize: AppConstants() + .normal_text_fontSize, letterSpacing: 0.0, - color: themeController - .currentColor.sc3, + fontWeight: + FontWeight.w900, + color: stringToColor( + "#916D46"), //固定 ), ), - Padding( - padding: EdgeInsetsDirectional - .fromSTEB(0, 6.rpx, 0, 0.rpx), - child: SvgPicture.asset( - 'assets/img/icon/arrow_right.svg', - width: 14.rpx, - height: 14 - .rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - color: Colors.white, + Text( + '首页.提示内容1'.tr, + style: + FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Inter', + fontSize: AppConstants() + .normal_text_fontSize, + letterSpacing: 0.0, + //todo 配置颜色 + color: stringToColor( + "#916D46"), //固定 + ), + ), + Text( + '首页.提示内容2'.tr, + style: + FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Inter', + fontSize: AppConstants() + .normal_text_fontSize, + letterSpacing: 0.0, + color: stringToColor( + "#916D46"), //固定 + ), + ), + Text( + '首页.提示内容3'.tr, + style: + FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Inter', + fontSize: AppConstants() + .normal_text_fontSize, + letterSpacing: 0.0, + //todo 配置颜色 + color: stringToColor( + "#916D46"), //固定 + ), + ), + ].divide(SizedBox( + height: AppConstants() + .text_padding_up_dowm_p)), + ), + ) + ].divide(SizedBox(width: 20.rpx)), + ), + ), + ), + ), + ); + }), + Obx(() { + return Visibility( + visible: userInfoController.model.login == 1, + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 0, 26.rpx, 0, 0), + child: Container( + width: bodySize.maxWidth, + height: bodySize.maxHeight * 0.107, + constraints: BoxConstraints( + minHeight: 240.rpx, + ), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + ClickableContainer( + backgroundColor: + themeController.currentColor.sc5, + highlightColor: + themeController.currentColor.sc3, + borderRadius: AppConstants() + .normal_container_radius, + padding: EdgeInsets + .zero, // 原始Container没有padding + onTap: () { + // 点击逻辑放这里 + }, + child: Container( + width: bodySize.maxWidth * 0.445, + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + SizedBox(height: 32.rpx), + Container( + width: 120.rpx, + height: 120.rpx, + child: Image.asset( + "assets/img/netlove.png", + fit: BoxFit.cover, ), ), - ].divide(SizedBox(width: 22.rpx)), + Text( + "首页.我的e护".tr, + style: TextStyle( + color: themeController + .currentColor.sc3, + ), + ), + SizedBox(height: 32.rpx), + ], + ), + ), + ), + ClickableContainer( + backgroundColor: + themeController.currentColor.sc5, + highlightColor: + themeController.currentColor.sc3, + borderRadius: AppConstants() + .normal_container_radius, + padding: EdgeInsets + .zero, // 原本的Container没有 padding,这里设置为 zero + onTap: () { + // TODO: 替换为你需要的点击事件逻辑 + print("云关爱 被点击"); + }, + child: SizedBox( + width: bodySize.maxWidth * 0.445, + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + width: 120.rpx, + height: 120.rpx, + child: Image.asset( + "assets/img/mye.png", + fit: BoxFit.cover, + ), + ), + Text( + "首页.云关爱".tr, + style: TextStyle( + color: themeController + .currentColor.sc3, + ), + ), + ] + .addToStart( + SizedBox(height: 32.rpx)) + .addToEnd( + SizedBox(height: 32.rpx)), + ), + ), + ), + ], + ), + ), + ), + ); + }), + // Generated code for this Container Widget... + Obx(() { + return Visibility( + visible: userInfoController.model.login == 1, + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 0, 25.rpx, 0, 25.rpx), + child: Container( + width: double.infinity, + decoration: BoxDecoration( + color: themeController.currentColor.sc5, + borderRadius: BorderRadius.circular( + AppConstants().normal_container_radius), + ), + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 30.rpx, 30.rpx, 30.rpx, 30.rpx), + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + Container( + width: double.infinity, + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + '次卧/1201/李小北', + style: + FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Inter', + fontSize: 30.rpx, + letterSpacing: 0.0, + color: themeController + .currentColor.sc3, + ), + ), + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Text( + '首页.报告详情'.tr, + style: FlutterFlowTheme.of( + context) + .bodyMedium + .override( + fontFamily: 'Inter', + fontSize: 26.rpx, + letterSpacing: 0.0, + color: themeController + .currentColor.sc3, + ), + ), + Padding( + padding: + EdgeInsetsDirectional + .fromSTEB(0, 6.rpx, + 0, 0.rpx), + child: SvgPicture.asset( + 'assets/img/icon/arrow_right.svg', + width: 14.rpx, + height: 14 + .rpx, // 如果 SVG 中没有固定颜色,可以这样设置 + color: themeController + .currentColor.sc3, + ), + ), + ].divide( + SizedBox(width: 22.rpx)), + ), + ], + ), + ), + Container( + width: double.infinity, + decoration: BoxDecoration(), + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + SleepDateWidget(), + SleepDateWidget(), + SleepDateWidget(), + SleepDateWidget(), + SleepDateWidget(), + SleepDateWidget(), + ].divide(SizedBox( + width: 20.rpx, + )), + ), + ), + ), + Container( + width: double.infinity, + decoration: BoxDecoration(), + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + SleepDataModuleWidget(), + SleepDataModuleWidget(), + SleepDataModuleWidget(), + SleepDataModuleWidget(), + SleepDataModuleWidget(), + ].divide(SizedBox( + width: + 14.rpx)), // ✅ 这里加了 .rpx + ), + ), ), ], ), ), - Container( - width: double.infinity, - decoration: BoxDecoration(), - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - SleepDateWidget(), - SleepDateWidget(), - SleepDateWidget(), - SleepDateWidget(), - SleepDateWidget(), - SleepDateWidget(), - ].divide(SizedBox( - width: 20.rpx, - )), - ), - ), - ), - Container( - width: double.infinity, - decoration: BoxDecoration(), - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - SleepDataModuleWidget(), - SleepDataModuleWidget(), - SleepDataModuleWidget(), - SleepDataModuleWidget(), - SleepDataModuleWidget(), - ].divide(SizedBox( - width: 14.rpx)), // ✅ 这里加了 .rpx - ), - ), - ), - ], - ), - ), - ), - ) + ), + )); + }), ], ), ), diff --git a/lib/pages/main_bottom/main_page_bottom_change.dart b/lib/pages/main_bottom/main_page_bottom_change.dart index de47fd5..c3f6b83 100644 --- a/lib/pages/main_bottom/main_page_bottom_change.dart +++ b/lib/pages/main_bottom/main_page_bottom_change.dart @@ -14,7 +14,6 @@ import 'package:vbvs_app/pages/main_bottom/e_page.dart'; import 'package:vbvs_app/pages/main_bottom/home_page.dart'; import 'package:vbvs_app/pages/main_bottom/message_page.dart'; import 'package:vbvs_app/pages/main_bottom/mine_page.dart'; -import 'package:vbvs_app/pages/main_bottom/sleep_report_page.dart'; class MainPageBottomChange extends GetView { GlobalController globalController = Get.find(); @@ -34,18 +33,7 @@ class MainPageBottomChange extends GetView { width: size, height: size, ), - ), - // activeIcon: Padding( - // padding: EdgeInsets.only(bottom: 6.rpx), - // child: isEmpty - // ? Container() - // : SvgPicture.asset( - // svgPath, - // color: stringToColor("#D3B684"), - // width: size, - // height: size, - // ), - // ), + ), activeIcon: Padding( padding: EdgeInsets.only(bottom: 6.rpx), child: isEmpty diff --git a/lib/pages/main_bottom/message_page.dart b/lib/pages/main_bottom/message_page.dart index 5f236f0..be6324d 100644 --- a/lib/pages/main_bottom/message_page.dart +++ b/lib/pages/main_bottom/message_page.dart @@ -18,62 +18,7 @@ class _MessagePageState extends State { return LayoutBuilder( builder: (context, boxConstraints) => GestureDetector( onTap: () => FocusScope.of(context).unfocus(), - child: Scaffold( - // appBar: AppBar( - // backgroundColor: AppColors.bg_color, - // automaticallyImplyLeading: false, - // title: Container( - // width: double.infinity, - // height: 70.rpx, - // child: Obx( - // () => InkWell( - // onTap: () { - // Get.toNamed("/editUserInfoPage"); - // }, - // child: Row( - // mainAxisSize: MainAxisSize.max, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Row( - // mainAxisSize: MainAxisSize.max, - // children: [ - // Container( - // width: 56.rpx, - // height: 56.rpx, - // clipBehavior: Clip.antiAlias, - // decoration: BoxDecoration( - // shape: BoxShape.circle, - // ), - // ), - // Container( - // width: 20.rpx, - // height: 0, - // decoration: BoxDecoration( - // color: Colors.white, - // shape: BoxShape.rectangle, - // ), - // ), - // Text( - // userInfoController.model.user!.nickName ?? '匿名', - // style: FlutterFlowTheme.of(context) - // .bodyMedium - // .override( - // fontFamily: 'Readex Pro', - // color: Colors.white, - // letterSpacing: 0, - // fontSize: 30.rpx), - // ), - // ], - // ), - // ], - // ), - // ), - // ), - // ), - // actions: [], - // centerTitle: false, - // ), - + child: Scaffold( body: SafeArea( top: true, child: Text("消息"), diff --git a/lib/pages/main_bottom/mine_page.dart b/lib/pages/main_bottom/mine_page.dart index 1e6f498..cec344a 100644 --- a/lib/pages/main_bottom/mine_page.dart +++ b/lib/pages/main_bottom/mine_page.dart @@ -7,7 +7,9 @@ import 'package:vbvs_app/common/color/appConstants.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart'; +import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; +import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/controller/user_info_controller.dart'; class MinePage extends StatefulWidget { @@ -20,500 +22,529 @@ class MinePage extends StatefulWidget { class _MinePageState extends State { GlobalController globalController = Get.find(); UserInfoController userInfoController = Get.find(); + ThemeController themeController = Get.find(); @override Widget build(BuildContext context) { SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( - statusBarColor: stringToColor("#242835"), // 这里设置你希望的颜色 + statusBarColor: Colors.transparent, // 这里设置你希望的颜色 statusBarIconBrightness: Brightness.light, // 状态栏图标的亮度 )); return LayoutBuilder( builder: (context, bodySize) => GestureDetector( onTap: () => FocusScope.of(context).unfocus(), - child: Scaffold( - // appBar: AppBar( - // backgroundColor: stringToColor("#242835"), - // // backgroundColor: Colors.transparent, - // automaticallyImplyLeading: false, - // // iconTheme: IconThemeData(color: Colors.white), - // titleSpacing: 0, - // // leading: returnIconButtom, - // // title: Container( - // // // color: Colors.grey, - // // width: double.infinity, - // // height: 180.rpx, - // // child: Stack( - // // alignment: Alignment.center, - // // children: [ - // // /// 居中标题 - // // Text( - // // '设备列表', - // // style: FlutterFlowTheme.of(context).bodyMedium.override( - // // fontFamily: 'Readex Pro', - // // color: Colors.white, - // // letterSpacing: 0, - // // fontSize: 30.rpx, - // // ), - // // ), - - // // /// 左边返回按钮 - // // Positioned( - // // left: 0, - // // child: returnIconButtom, - // // ), - // // ], - // // ), - // // ), - - // actions: [], - // centerTitle: false, - // ), - - body: SafeArea( - top: true, - child: Container( - height: bodySize.maxHeight, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/img/bgImage.png'), // 本地图片 - fit: BoxFit.fill, // 填满整个 Container - ), - ), - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - Container( - width: double.infinity, - decoration: BoxDecoration( - color: Color(0xFF242835), - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular( - AppConstants().normal_container_radius), - bottomRight: Radius.circular( - AppConstants().normal_container_radius), - topLeft: Radius.circular(0.rpx), - topRight: Radius.circular(0.rpx), + child: Container( + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/img/bgImage.png'), // 本地图片 + fit: BoxFit.fill, // 填满整个 Container + ), + ), + child: Scaffold( + backgroundColor: Colors.transparent, + body: SafeArea( + top: true, + child: Container( + height: bodySize.maxHeight, + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + Container( + width: double.infinity, + decoration: BoxDecoration( + color: Colors.transparent, + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular( + AppConstants().normal_container_radius), + bottomRight: Radius.circular( + AppConstants().normal_container_radius), + topLeft: Radius.circular(0.rpx), + topRight: Radius.circular(0.rpx), + ), ), - ), - child: Padding( - padding: - EdgeInsetsDirectional.fromSTEB(64.rpx, 0, 37.rpx, 0), - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - Padding( - padding: - EdgeInsetsDirectional.fromSTEB(0, 65.rpx, 0, 0), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - SvgPicture.asset( - 'assets/img/icon/earphone.svg', - width: 29.rpx, - height: 29.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - color: Colors.white, - ), - SvgPicture.asset( - 'assets/img/icon/setting.svg', - width: 29.rpx, - height: 29.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - color: Colors.white, - ), - ].divide(SizedBox(width: 60.rpx)), - ), - ), - Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 0, 50.rpx, 0, 66.rpx), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - Container( - width: 120.rpx, - height: 120.rpx, - clipBehavior: Clip.antiAlias, - decoration: BoxDecoration( - shape: BoxShape.circle, - ), - child: Image.network( - 'https://picsum.photos/seed/270/600', - fit: BoxFit.cover, + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 64.rpx, 0, 37.rpx, 0), + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 0, 65.rpx, 0, 0), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + SvgPicture.asset( + 'assets/img/icon/earphone.svg', + width: 29.rpx, + height: 29.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 + color: themeController.currentColor.sc3, + ), + // SvgPicture.asset( + // 'assets/img/icon/setting.svg', + // width: 29.rpx, + // height: 29.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 + // color: themeController.currentColor.sc3, + // ), + ClickableContainer( + backgroundColor: + Colors.transparent, // 容器背景色 + highlightColor: themeController + .currentColor.sc21, // 点击时的背景色 + padding: EdgeInsets + .zero, // 这里去掉外部的 padding,避免影响点击范围 + onTap: () { + Get.toNamed("/settingPage"); + }, + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 0.rpx, 0.rpx, 0.rpx, 0.rpx), + child: SvgPicture.asset( + 'assets/img/icon/setting.svg', + width: 29.rpx, + height: 29 + .rpx, // 如果 SVG 中没有固定颜色,使用 color 设置 + color: themeController.currentColor.sc3, ), ), - Column( + ), + ].divide(SizedBox(width: 60.rpx)), + ), + ), + Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 0, 50.rpx, 0, 66.rpx), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Container( + width: 120.rpx, + height: 120.rpx, + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + shape: BoxShape.circle, + ), + child: Image.network( + 'https://picsum.photos/seed/270/600', + fit: BoxFit.cover, + ), + ), + Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + '张天爱', + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Inter', + color: themeController + .currentColor.sc3, + fontSize: AppConstants() + .title_text_fontSize, + letterSpacing: 0.0, + ), + ), + Text( + '账号:135****2598', + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Inter', + color: themeController + .currentColor.sc3, + fontSize: AppConstants() + .normal_text_fontSize, + letterSpacing: 0.0, + ), + ), + ].divide(SizedBox(height: 20.rpx)), + ), + ].divide(SizedBox(width: 35.rpx)), + ), + CustomCard( + borderRadius: 0, + onTap: () { + Get.toNamed("/updateUserPage"); + }, + // colors: [themeController.currentColor.sc5], + colors: [Colors.transparent], + child: Row( mainAxisSize: MainAxisSize.max, - crossAxisAlignment: - CrossAxisAlignment.start, children: [ Text( - '张天爱', + '我的.个人信息'.tr, style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'Inter', - color: Colors.white, - fontSize: AppConstants() - .title_text_fontSize, - letterSpacing: 0.0, - ), - ), - Text( - '账号:135****2598', - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Inter', - color: stringToColor("#C8C9CC"), + color: themeController + .currentColor.sc3, fontSize: AppConstants() .normal_text_fontSize, letterSpacing: 0.0, ), ), - ].divide(SizedBox(height: 20.rpx)), - ), - ].divide(SizedBox(width: 35.rpx)), - ), - Row( - mainAxisSize: MainAxisSize.max, - children: [ - Text( - '我的.个人信息'.tr, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Inter', - color: Color(0xFFE0E4E6), - fontSize: AppConstants() - .normal_text_fontSize, - letterSpacing: 0.0, - ), - ), - Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 0, 6.rpx, 0, 0.rpx), - child: SvgPicture.asset( - 'assets/img/icon/arrow_right.svg', - width: 14.rpx, - height: 14.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - color: Colors.white, - ), - ), - ].divide(SizedBox(width: 16.rpx)), - ), - ], - ), - ), - ], - ), - ), - ), - Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 30.rpx, 25.rpx, 30.rpx, 0), - child: Container( - width: double.infinity, - decoration: BoxDecoration( - color: Color(0xFF242835), - borderRadius: BorderRadius.circular( - AppConstants().normal_container_radius), - ), - child: Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 45.rpx, 0, 45.rpx, 0), - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - ClickableContainer( - backgroundColor: Colors.transparent, // 容器背景色 - highlightColor: Colors.orange, // 点击时的背景色 - padding: EdgeInsetsDirectional.fromSTEB( - 0.rpx, 0.rpx, 0.rpx, 0.rpx), - onTap: () { - print('点击了容器'); - }, - child: Container( - child: Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 0.rpx, 20.rpx, 0.rpx, 20.rpx), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - SvgPicture.asset( - 'assets/img/icon/my_device.svg', - width: 25.rpx, - height: - 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - color: stringToColor("#00C1AA"), - ), - Text( - '我的.我的设备'.tr, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Inter', - color: Color(0xFFE0E2E4), - fontSize: AppConstants() - .title_text_fontSize, - letterSpacing: 0.0, - ), - ), - ].divide(SizedBox(width: 22.rpx)), - ), - SvgPicture.asset( - 'assets/img/icon/arrow_right.svg', - width: 8.rpx, - height: 15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - color: Colors.white, - ), - ], - ), - ), - ), - ), - ClickableContainer( - backgroundColor: Colors.transparent, // 容器背景色 - highlightColor: Colors.orange, // 点击时的背景色 - padding: EdgeInsetsDirectional.fromSTEB( - 0.rpx, 0.rpx, 0.rpx, 0.rpx), - onTap: () { - print('点击了容器'); - }, - child: Container( - child: Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 0.rpx, 20.rpx, 0.rpx, 20.rpx), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - SvgPicture.asset( - 'assets/img/icon/device_repair.svg', - width: 25.rpx, - height: - 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - color: stringToColor("#00C1AA"), - ), - Text( - '我的.设备报修'.tr, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Inter', - color: Color(0xFFE0E2E4), - fontSize: AppConstants() - .title_text_fontSize, - letterSpacing: 0.0, - ), - ), - ].divide(SizedBox(width: 22.rpx)), - ), - SvgPicture.asset( - 'assets/img/icon/arrow_right.svg', - width: 8.rpx, - height: 15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - color: Colors.white, - ), - ], - ), - ), - ), - ), - ClickableContainer( - backgroundColor: Colors.transparent, // 容器背景色 - highlightColor: Colors.orange, // 点击时的背景色 - padding: EdgeInsetsDirectional.fromSTEB( - 0.rpx, 0.rpx, 0.rpx, 0.rpx), - onTap: () { - print('点击了容器'); - }, - child: Container( - child: Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 0.rpx, 20.rpx, 0.rpx, 20.rpx), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - SvgPicture.asset( - 'assets/img/icon/op_ex.svg', - width: 25.rpx, - height: - 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - color: stringToColor("#00C1AA"), - ), - Text( - '我的.操作说明'.tr, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Inter', - color: Color(0xFFE0E2E4), - fontSize: AppConstants() - .title_text_fontSize, - letterSpacing: 0.0, - ), - ), - ].divide(SizedBox(width: 22.rpx)), - ), - SvgPicture.asset( - 'assets/img/icon/arrow_right.svg', - width: 8.rpx, - height: 14.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - color: Colors.white, - ), - ], - ), - ), - ), - ), - ClickableContainer( - backgroundColor: Colors.transparent, // 容器背景色 - highlightColor: Colors.orange, // 点击时的背景色 - padding: EdgeInsetsDirectional.fromSTEB( - 0.rpx, 0.rpx, 0.rpx, 0.rpx), - onTap: () { - print('点击了容器'); - }, - child: Container( - child: Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 0.rpx, 20.rpx, 0.rpx, 20.rpx), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - SvgPicture.asset( - 'assets/img/icon/like.svg', - width: 25.rpx, - height: - 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - color: stringToColor("#00C1AA"), - ), - Text( - '关注我们'.tr, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Inter', - color: Color(0xFFE0E2E4), - fontSize: AppConstants() - .title_text_fontSize, - letterSpacing: 0.0, - ), - ), - ].divide(SizedBox(width: 22.rpx)), - ), - SvgPicture.asset( - 'assets/img/icon/arrow_right.svg', - width: 8.rpx, - height: 15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - color: Colors.white, - ), - ], - ), - ), - ), - ), - ClickableContainer( - backgroundColor: Colors.transparent, // 容器背景色 - highlightColor: Colors.orange, // 点击时的背景色 - padding: EdgeInsetsDirectional.fromSTEB( - 0.rpx, 0.rpx, 0.rpx, 0.rpx), - onTap: () { - print('点击了容器'); - }, - child: Container( - child: Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 0.rpx, 20.rpx, 0.rpx, 20.rpx), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - SvgPicture.asset( - 'assets/img/icon/version.svg', - width: 25.rpx, - height: - 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - color: stringToColor("#00C1AA"), - ), - Text( - '我的.当前版本'.tr, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Inter', - color: Color(0xFFE0E2E4), - fontSize: AppConstants() - .title_text_fontSize, - letterSpacing: 0.0, - ), - ), - ].divide(SizedBox(width: 22.rpx)), - ), - Row( - mainAxisSize: MainAxisSize.max, - children: [ - Text( - '3.61.0', - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Inter', - color: Color(0xFFD9E3EB), - fontSize: 26.rpx, - letterSpacing: 0.0, - ), - ), - SvgPicture.asset( + Padding( + padding: + EdgeInsetsDirectional.fromSTEB( + 0, 6.rpx, 0, 0.rpx), + child: SvgPicture.asset( 'assets/img/icon/arrow_right.svg', - width: 8.rpx, + width: 14.rpx, height: - 15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 - color: Colors.white, + 14.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 + color: themeController + .currentColor.sc3, ), - ].divide(SizedBox(width: 28.rpx)), - ), - ], + ), + ].divide(SizedBox(width: 16.rpx)), + ), ), - ), + ], ), ), - ] - .divide(SizedBox(height: 0.rpx)) - .addToStart(SizedBox(height: 30.rpx)) - .addToEnd(SizedBox(height: 30.rpx)), + ], ), ), ), - ), - ], + Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 30.rpx, 25.rpx, 30.rpx, 0), + child: Container( + width: double.infinity, + decoration: BoxDecoration( + color: Color(0xFF242835), + borderRadius: BorderRadius.circular( + AppConstants().normal_container_radius), + ), + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 0.rpx, 0, 0.rpx, 0), + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + ClickableContainer( + backgroundColor: Colors.transparent, // 容器背景色 + highlightColor: themeController + .currentColor.sc21, // 点击时的背景色 + padding: EdgeInsetsDirectional.fromSTEB( + 40.rpx, 0.rpx, 40.rpx, 0.rpx), + onTap: () { + Get.toNamed("/deviceType",arguments:1); + }, + child: Container( + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 0.rpx, 20.rpx, 0.rpx, 20.rpx), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + SvgPicture.asset( + 'assets/img/icon/my_device.svg', + width: 25.rpx, + height: 25 + .rpx, // 如果 SVG 中没有固定颜色,可以这样设置 + color: stringToColor("#00C1AA"), + ), + Text( + '我的.我的设备'.tr, + style: + FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Inter', + color: themeController + .currentColor.sc3, + fontSize: AppConstants() + .title_text_fontSize, + letterSpacing: 0.0, + ), + ), + ].divide(SizedBox(width: 22.rpx)), + ), + SvgPicture.asset( + 'assets/img/icon/arrow_right.svg', + width: 8.rpx, + height: + 15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 + color: + themeController.currentColor.sc3, + ), + ], + ), + ), + ), + ), + ClickableContainer( + backgroundColor: Colors.transparent, // 容器背景色 + highlightColor: themeController + .currentColor.sc21, // 点击时的背景色 + padding: EdgeInsetsDirectional.fromSTEB( + 0.rpx, 0.rpx, 0.rpx, 0.rpx), + onTap: () { + print('点击了容器'); + }, + child: Container( + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 40.rpx, 20.rpx, 40.rpx, 20.rpx), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + SvgPicture.asset( + 'assets/img/icon/device_repair.svg', + width: 25.rpx, + height: 25 + .rpx, // 如果 SVG 中没有固定颜色,可以这样设置 + color: stringToColor("#00C1AA"), + ), + Text( + '我的.设备报修'.tr, + style: + FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Inter', + color: themeController + .currentColor.sc3, + fontSize: AppConstants() + .title_text_fontSize, + letterSpacing: 0.0, + ), + ), + ].divide(SizedBox(width: 22.rpx)), + ), + SvgPicture.asset( + 'assets/img/icon/arrow_right.svg', + width: 8.rpx, + height: + 15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 + color: + themeController.currentColor.sc3, + ), + ], + ), + ), + ), + ), + ClickableContainer( + backgroundColor: Colors.transparent, // 容器背景色 + highlightColor: themeController + .currentColor.sc21, // 点击时的背景色 + padding: EdgeInsetsDirectional.fromSTEB( + 0.rpx, 0.rpx, 0.rpx, 0.rpx), + onTap: () { + print('点击了容器'); + }, + child: Container( + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 40.rpx, 20.rpx, 40.rpx, 20.rpx), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + SvgPicture.asset( + 'assets/img/icon/op_ex.svg', + width: 25.rpx, + height: 25 + .rpx, // 如果 SVG 中没有固定颜色,可以这样设置 + color: stringToColor("#00C1AA"), + ), + Text( + '我的.操作说明'.tr, + style: + FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Inter', + color: themeController + .currentColor.sc3, + fontSize: AppConstants() + .title_text_fontSize, + letterSpacing: 0.0, + ), + ), + ].divide(SizedBox(width: 22.rpx)), + ), + SvgPicture.asset( + 'assets/img/icon/arrow_right.svg', + width: 8.rpx, + height: + 14.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 + color: + themeController.currentColor.sc3, + ), + ], + ), + ), + ), + ), + ClickableContainer( + backgroundColor: Colors.transparent, // 容器背景色 + highlightColor: themeController + .currentColor.sc21, // 点击时的背景色 + padding: EdgeInsetsDirectional.fromSTEB( + 40.rpx, 0.rpx, 40.rpx, 0.rpx), + onTap: () { + print('点击了容器'); + }, + child: Container( + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 0.rpx, 20.rpx, 0.rpx, 20.rpx), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + SvgPicture.asset( + 'assets/img/icon/like.svg', + width: 25.rpx, + height: 25 + .rpx, // 如果 SVG 中没有固定颜色,可以这样设置 + color: stringToColor("#00C1AA"), + ), + Text( + '关注我们'.tr, + style: + FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Inter', + color: themeController + .currentColor.sc3, + fontSize: AppConstants() + .title_text_fontSize, + letterSpacing: 0.0, + ), + ), + ].divide(SizedBox(width: 22.rpx)), + ), + SvgPicture.asset( + 'assets/img/icon/arrow_right.svg', + width: 8.rpx, + height: + 15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 + color: + themeController.currentColor.sc3, + ), + ], + ), + ), + ), + ), + ClickableContainer( + backgroundColor: Colors.transparent, // 容器背景色 + highlightColor: themeController + .currentColor.sc21, // 点击时的背景色 + padding: EdgeInsetsDirectional.fromSTEB( + 40.rpx, 0.rpx, 40.rpx, 0.rpx), + onTap: () { + print('点击了容器'); + }, + child: Container( + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 0.rpx, 20.rpx, 0.rpx, 20.rpx), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + SvgPicture.asset( + 'assets/img/icon/version.svg', + width: 25.rpx, + height: 25 + .rpx, // 如果 SVG 中没有固定颜色,可以这样设置 + color: stringToColor("#00C1AA"), + ), + Text( + '我的.当前版本'.tr, + style: + FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Inter', + color: themeController + .currentColor.sc3, + fontSize: AppConstants() + .title_text_fontSize, + letterSpacing: 0.0, + ), + ), + ].divide(SizedBox(width: 22.rpx)), + ), + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Text( + '1.0.0', + style: + FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Inter', + color: + Color(0xFFD9E3EB), + fontSize: 26.rpx, + letterSpacing: 0.0, + ), + ), + SvgPicture.asset( + 'assets/img/icon/arrow_right.svg', + width: 8.rpx, + height: 15 + .rpx, // 如果 SVG 中没有固定颜色,可以这样设置 + color: themeController + .currentColor.sc3, + ), + ].divide(SizedBox(width: 28.rpx)), + ), + ], + ), + ), + ), + ), + ] + .divide(SizedBox(height: 0.rpx)) + .addToStart(SizedBox(height: 30.rpx)) + .addToEnd(SizedBox(height: 30.rpx)), + ), + ), + ), + ), + ], + ), ), ), ), diff --git a/lib/pages/main_bottom/sleep_report_page.dart b/lib/pages/main_bottom/sleep_report_page.dart index 6033745..52afb41 100644 --- a/lib/pages/main_bottom/sleep_report_page.dart +++ b/lib/pages/main_bottom/sleep_report_page.dart @@ -19,61 +19,7 @@ class _SleepReportPageState extends State { builder: (context, boxConstraints) => GestureDetector( onTap: () => FocusScope.of(context).unfocus(), child: Scaffold( - // appBar: AppBar( - // backgroundColor: AppColors.bg_color, - // automaticallyImplyLeading: false, - // title: Container( - // width: double.infinity, - // height: 70.rpx, - // child: Obx( - // () => InkWell( - // onTap: () { - // Get.toNamed("/editUserInfoPage"); - // }, - // child: Row( - // mainAxisSize: MainAxisSize.max, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Row( - // mainAxisSize: MainAxisSize.max, - // children: [ - // Container( - // width: 56.rpx, - // height: 56.rpx, - // clipBehavior: Clip.antiAlias, - // decoration: BoxDecoration( - // shape: BoxShape.circle, - // ), - // ), - // Container( - // width: 20.rpx, - // height: 0, - // decoration: BoxDecoration( - // color: Colors.white, - // shape: BoxShape.rectangle, - // ), - // ), - // Text( - // userInfoController.model.user!.nickName ?? '匿名', - // style: FlutterFlowTheme.of(context) - // .bodyMedium - // .override( - // fontFamily: 'Readex Pro', - // color: Colors.white, - // letterSpacing: 0, - // fontSize: 30.rpx), - // ), - // ], - // ), - // ], - // ), - // ), - // ), - // ), - // actions: [], - // centerTitle: false, - // ), - + body: SafeArea( top: true, child: Text("睡眠报告"), diff --git a/lib/pages/person/person_page.dart b/lib/pages/person/person_page.dart index e29fa35..97bd137 100644 --- a/lib/pages/person/person_page.dart +++ b/lib/pages/person/person_page.dart @@ -8,6 +8,7 @@ import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart'; import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; import 'package:vbvs_app/controller/person/person_controller.dart'; +import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/pages/person/select_time.dart'; @@ -23,6 +24,7 @@ class _EPageState extends State { UserInfoController userInfoController = Get.find(); BlueteethBindController blueteethBindController = Get.find(); PersonController personController = Get.find(); + ThemeController themeController = Get.find(); @override void initState() { @@ -43,15 +45,15 @@ class _EPageState extends State { ), child: Scaffold( backgroundColor: Colors.transparent, // 加上这一行 - appBar: AppBar( - backgroundColor: stringToColor("#242835"), - // backgroundColor: Colors.transparent, + appBar: AppBar( + backgroundColor: themeController.currentColor.sc17, automaticallyImplyLeading: false, - iconTheme: IconThemeData(color: Colors.white), + iconTheme: IconThemeData( + color: themeController.currentColor.sc3, + ), titleSpacing: 0, // leading: returnIconButtom, title: Container( - // color: Colors.grey, width: double.infinity, height: 180.rpx, child: Stack( @@ -62,7 +64,7 @@ class _EPageState extends State { '人员资料.标题'.tr, style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx, ), @@ -80,10 +82,9 @@ class _EPageState extends State { onTap: () async { Get.offAllNamed("/bindDeviceSuccess"); }, - colors: [ - stringToColor("#45D989"), - stringToColor("#00C1AA"), + themeController.currentColor.sc1, + themeController.currentColor.sc2, ], child: Container( width: 100.rpx, @@ -97,7 +98,7 @@ class _EPageState extends State { .titleSmall .override( fontFamily: 'Inter Tight', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0.0, ), ), @@ -145,9 +146,10 @@ class _EPageState extends State { labelStyle: FlutterFlowTheme.of(context) .labelMedium .override( - fontFamily: 'Inter', - letterSpacing: 0.0, - color: Colors.white), + fontFamily: 'Inter', + letterSpacing: 0.0, + color: themeController.currentColor.sc3, + ), hintText: '人员资料.名字输入提示'.tr, hintStyle: FlutterFlowTheme.of(context) .labelMedium @@ -189,9 +191,10 @@ class _EPageState extends State { style: FlutterFlowTheme.of(context) .bodyMedium .override( - fontFamily: 'Inter', - letterSpacing: 0.0, - color: Colors.white), + fontFamily: 'Inter', + letterSpacing: 0.0, + color: themeController.currentColor.sc3, + ), textAlign: TextAlign.center, cursorColor: FlutterFlowTheme.of(context).primaryText, @@ -239,7 +242,8 @@ class _EPageState extends State { .bodyMedium .override( fontFamily: 'Inter', - color: Colors.white, + color: themeController + .currentColor.sc3, fontSize: 26.rpx, letterSpacing: 0.0, ), @@ -270,7 +274,8 @@ class _EPageState extends State { .bodyMedium .override( fontFamily: 'Inter', - color: Colors.white, + color: themeController + .currentColor.sc3, fontSize: 26.rpx, letterSpacing: 0.0, ), @@ -286,71 +291,6 @@ class _EPageState extends State { Padding( padding: EdgeInsetsDirectional.fromSTEB( 70.rpx, 50.rpx, 70.rpx, 0), - // child: Container( - // width: double.infinity, - // height: 100.rpx, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(50.rpx), - // border: Border.all( - // color: Color(0xFFF3EDED), - // ), - // ), - // child: Align( - // alignment: AlignmentDirectional(0, 0), - // child: Obx( - // () => Container( - // width: double.infinity, - // height: - // MediaQuery.sizeOf(context).height * 0.064, - // decoration: BoxDecoration(), - // child: InkWell( - // onTap: () { - // // 触摸收起键盘 - // FocusScope.of(context) - // .requestFocus(FocusNode()); - // Future.delayed( - // const Duration(milliseconds: 250), () { - // // 延迟执行的代码 - // showDateSelectionDialog(context, - // checkDate: - // personController.model.birthday ?? - // DateTime.now(), - // checkChange: (DateTime d) { - // personController.model.birthday = d; - // personController.updateAll(); - // print("$d"); - // }).then((d) { - // // Timer(Duration.zero, () { - // // FocusScope.of(context).unfocus(); - // // }); - // }); - // }); - // }, - // child: Container( - // constraints: - // BoxConstraints(minWidth: 200.rpx), - // child: Text( - // personController.model.birthday != null - // ? DateFormat("yyyy年MM月dd日").format( - // personController.model.birthday!) - // : '人员资料.生日输入提示'.tr, - // textAlign: TextAlign.right, - // style: FlutterFlowTheme.of(context) - // .bodyMedium - // .override( - // fontFamily: 'Readex Pro', - // color: Colors.white, - // fontSize: 30.rpx, - // letterSpacing: 0, - // ), - // ), - // ), - // ), - // ), - // ), - // ), - // ), - child: Container( height: 100.rpx, decoration: BoxDecoration( @@ -385,8 +325,8 @@ class _EPageState extends State { fontFamily: 'Readex Pro', color: personController.model.birthday != null - ? Colors.white - : Colors.grey, + ? themeController.currentColor.sc3 + : themeController.currentColor.sc4, fontSize: AppConstants().normal_text_fontSize, letterSpacing: 0, @@ -429,10 +369,10 @@ class _EPageState extends State { .labelMedium .override( fontFamily: 'Inter', - color: personController.model.birthday != + color: personController.model.weight != null - ? Colors.white - : Colors.grey, + ? themeController.currentColor.sc3 + : themeController.currentColor.sc4, fontSize: AppConstants().normal_text_fontSize, letterSpacing: 0.0, @@ -472,7 +412,7 @@ class _EPageState extends State { .override( fontFamily: 'Inter', letterSpacing: 0.0, - color: Colors.white, + color: themeController.currentColor.sc3, ), textAlign: TextAlign.center, cursorColor: @@ -580,9 +520,7 @@ class _EPageState extends State { } } }, - // colors: [Colors.white.withOpacity(0.06)], // 背景色 - colors: [stringToColor("#242835")], // 背景色 - + colors: [themeController.currentColor.sc17], // 背景色 child: Container( width: double.infinity, height: MediaQuery.sizeOf(context).height * 0.135, diff --git a/lib/pages/person/select_time.dart b/lib/pages/person/select_time.dart index 073374f..8c612f4 100644 --- a/lib/pages/person/select_time.dart +++ b/lib/pages/person/select_time.dart @@ -8,7 +8,7 @@ import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; Future showDateSelectionDialog(BuildContext context, {required DateTime checkDate, Function? checkChange, String title = "生日"}) { - Color checkColor = stringToColor("#D3B684"); + ThemeController themeController = Get.find(); List years = [], months = [], days = []; var days_select = [].obs; int day_len = 31; @@ -31,9 +31,7 @@ Future showDateSelectionDialog(BuildContext context, .day; days_select.value = days.sublist(0, day_len); int dayIndex = days.lastIndexOf(checkDate.day); - ThemeController themeController = Get.find(); return showDialog( - // barrierColor: stringToColor("#000320"), context: context, barrierDismissible: true, // 点击对话框外部可关闭 builder: (BuildContext context) { @@ -46,8 +44,7 @@ Future showDateSelectionDialog(BuildContext context, child: Material( color: Colors.transparent, child: Dialog( - backgroundColor: stringToColor("#242835"), - // backgroundColor: Colors.transparent, + backgroundColor: themeController.currentColor.sc17, insetPadding: EdgeInsets.zero, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(0), @@ -83,7 +80,7 @@ Future showDateSelectionDialog(BuildContext context, .bodyMedium .override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: AppConstants() .normal_text_fontSize), @@ -98,7 +95,7 @@ Future showDateSelectionDialog(BuildContext context, .bodyMedium .override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: AppConstants().title_text_fontSize), @@ -111,7 +108,7 @@ Future showDateSelectionDialog(BuildContext context, .bodyMedium .override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: AppConstants() .normal_text_fontSize), @@ -161,7 +158,8 @@ Future showDateSelectionDialog(BuildContext context, .bodyMedium .override( fontFamily: 'Readex Pro', - color: Colors.white, + color: + themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx), ), @@ -195,7 +193,8 @@ Future showDateSelectionDialog(BuildContext context, .bodyMedium .override( fontFamily: 'Readex Pro', - color: Colors.white, + color: + themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx), ), @@ -226,7 +225,8 @@ Future showDateSelectionDialog(BuildContext context, .bodyMedium .override( fontFamily: 'Readex Pro', - color: Colors.white, + color: + themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx), ), @@ -249,6 +249,7 @@ Future showDateSelectionDialog(BuildContext context, getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged, {bool looping = false}) { + ThemeController themeController = Get.find(); return CupertinoPicker( key: UniqueKey(), useMagnifier: false, @@ -268,19 +269,10 @@ getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged, return Container( alignment: Alignment.center, width: 400.rpx, - decoration: BoxDecoration( - // border: Border( - // bottom: index != arr.length - // ? BorderSide( - // color: stringToColor("#8D95B0"), - // ) - // : BorderSide.none, - // ), - ), child: Text("${arr[index]}", style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'Readex Pro', - color: Colors.white, + color: themeController.currentColor.sc3, letterSpacing: 0, fontSize: 30.rpx)), ); diff --git a/lib/repository/help_repository.dart b/lib/repository/help_repository.dart deleted file mode 100644 index cf637b9..0000000 --- a/lib/repository/help_repository.dart +++ /dev/null @@ -1,21 +0,0 @@ -import 'package:ef/ef.dart'; - -//问题与帮助 -class HelpRepository { - //查询记录 - Future findHelpInfos({int limit = 10, int offset = 0}) async { - try { - var response = await ef.client - .from('app_help_list') - .select() - // .eq('deleted', 0) - .eq('status', 1) - .order("priority", ascending: true) - .order("created_at", ascending: false); - return response as List; - } catch (e) { - print('Error fetching repairs: $e'); - return []; - } - } -} diff --git a/lib/routers/routers.dart b/lib/routers/routers.dart index 30b63f8..04e8522 100644 --- a/lib/routers/routers.dart +++ b/lib/routers/routers.dart @@ -12,6 +12,9 @@ import 'package:vbvs_app/pages/main_bottom/message_page.dart'; import 'package:vbvs_app/pages/main_bottom/mine_page.dart'; import 'package:vbvs_app/pages/main_bottom/sleep_report_page.dart'; import 'package:vbvs_app/pages/person/person_page.dart'; +import 'package:vbvs_app/pages/user/about_us_page.dart'; +import 'package:vbvs_app/pages/user/setting_page.dart'; +import 'package:vbvs_app/pages/user/update_user_page.dart'; @@ -24,13 +27,16 @@ var routes = { "/minePage": (contxt) => MinePage(), "/mianPageBottomChange": (contxt) => MainPageBottomChange(), "/loginPage": (contxt) => LoginPage(), - "/deviceType": (contxt) => DeviceTypePage(), + "/deviceType": (contxt, {arguments}) => DeviceTypePage(type: arguments??0,), "/blueteethDevice": (contxt) => BlueteethDevicePage(), "/personPage": (contxt) => PersonPage(), "/bindDeviceSuccess": (contxt) => BindDeviceSuccess(), - // "/wifiPage": (contxt, {arguments}) => WifiPage(connectedDeviceProp: arguments), - "/wifiPage": (contxt, {arguments}) => WifiPage(bluetoothDevice: arguments), + "/wifiPage": (contxt, {arguments}) => WifiPage(bleDevice: arguments), + // "/wifiPage": (contxt) => WifiPage(), "/otherLoginPage": (contxt) => OtherLoginPage(), + "/updateUserPage": (contxt) => UpdateUserPage(), + "/settingPage": (contxt) => SettingPage(), + "/aboutUsPage": (contxt) => AboutUsPage(), }; //2、配置onGenerateRoute 固定写法 这个方法也相当于一个中间件,这里可以做权限判断 diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index e00002e..c81b8d5 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -8,7 +8,7 @@ import Foundation import app_links import device_info_plus import file_picker -import flutter_blue_plus_darwin +import flutter_blue_plus import flutter_localization import flutter_web_auth_2 import package_info_plus diff --git a/pubspec.lock b/pubspec.lock index c21cf72..6e9c514 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -6,7 +6,7 @@ packages: description: path: "." ref: master - resolved-ref: "491165184a7d090657e91be2fe749a9b0fccccfc" + resolved-ref: "700479d131b6230d87aebae94ea610ca3a8decfc" url: "http://git.real.he-info.cn:8080/r/~qmqz/EasyDartModule.git" source: git version: "1.0.0" @@ -159,14 +159,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "5.7.0" - bluez: - dependency: transitive - description: - name: bluez - sha256: "61a7204381925896a374301498f2f5399e59827c6498ae1e924aaa598751b545" - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.8.3" boolean_selector: dependency: transitive description: @@ -415,14 +407,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.5.16" - dbus: - dependency: transitive - description: - name: dbus - sha256: "79e0c23480ff85dc68de79e2cd6334add97e48f7f4865d17686dd6ea81a47e8c" - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.7.11" decimal: dependency: transitive description: @@ -479,6 +463,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.0.3" + easydevice: + dependency: "direct main" + description: + path: "C:\\Users\\wyf\\Desktop\\blue\\easydevice" + relative: false + source: path + version: "0.0.1" ed25519_edwards: dependency: transitive description: @@ -609,50 +600,10 @@ packages: dependency: "direct main" description: name: flutter_blue_plus - sha256: "2d926dbef0fd6c58d4be8fca9eaaf1ba747c0ccb8373ddd5386665317e26eb61" + sha256: d2ac9fac56c4b3b08eb68752380e2d45e64c61db629b70e61bb36c95cb65d431 url: "https://pub.flutter-io.cn" source: hosted - version: "1.35.3" - flutter_blue_plus_android: - dependency: transitive - description: - name: flutter_blue_plus_android - sha256: c1d83f84b514e46345a8a58599c428f20b11e78379521e0d3b0611c7b7cbf2c1 - url: "https://pub.flutter-io.cn" - source: hosted - version: "3.0.0" - flutter_blue_plus_darwin: - dependency: transitive - description: - name: flutter_blue_plus_darwin - sha256: "8d0a0f11f83b13dda173396b7e4028b4e8656bc8dbbc82c26a7e49aafc62644b" - url: "https://pub.flutter-io.cn" - source: hosted - version: "3.0.0" - flutter_blue_plus_linux: - dependency: transitive - description: - name: flutter_blue_plus_linux - sha256: "1d367ed378b2bd6c3b9685fda7044e1d2f169884802b7dec7badb31a99a72660" - url: "https://pub.flutter-io.cn" - source: hosted - version: "3.0.0" - flutter_blue_plus_platform_interface: - dependency: transitive - description: - name: flutter_blue_plus_platform_interface - sha256: "114f8e85a03a28a48d707a4df6cc9218e1f2005cf260c5e815e5585a00da5778" - url: "https://pub.flutter-io.cn" - source: hosted - version: "3.0.0" - flutter_blue_plus_web: - dependency: transitive - description: - name: flutter_blue_plus_web - sha256: db70cdc41bc743763dc0d47e8c7c10f3923cbbe71b33d9dc21deea482affeb4d - url: "https://pub.flutter-io.cn" - source: hosted - version: "3.0.0" + version: "1.34.5" flutter_cache_manager: dependency: transitive description: @@ -881,10 +832,10 @@ packages: dependency: transitive description: name: html - sha256: "1fc58edeaec4307368c60d59b7e15b9d658b57d7f3125098b6294153c75337ec" + sha256: "9475be233c437f0e3637af55e7702cbbe5c23a68bd56e8a5fa2d426297b7c6c8" url: "https://pub.flutter-io.cn" source: hosted - version: "0.15.5" + version: "0.15.5+1" http: dependency: transitive description: @@ -1021,6 +972,22 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "4.0.0" + loading_indicator: + dependency: "direct main" + description: + name: loading_indicator + sha256: a101ffb2aa3e646137d7810bfa90b50525dd3f72c01235b6df7491cf6af6f284 + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.1" + localstorage: + dependency: "direct main" + description: + name: localstorage + sha256: "6340acefdd3a969cceb044a69cde2dc5877c5b861b2e02d0803930ed483dbe91" + url: "https://pub.flutter-io.cn" + source: hosted + version: "5.0.0" logging: dependency: transitive description: @@ -1727,10 +1694,10 @@ packages: dependency: transitive description: name: stop_watch_timer - sha256: "86482d05a58bba03909781cd97683b91def80273e071a8cde6f9f423f59e291d" + sha256: "01441a71ea3d804b73025c172313f2f1bb253da40ecd1390bd3ada7553548c43" url: "https://pub.flutter-io.cn" source: hosted - version: "3.2.1" + version: "3.2.2" storage_client: dependency: transitive description: @@ -2023,18 +1990,18 @@ packages: dependency: transitive description: name: web_socket - sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" + sha256: bfe6f435f6ec49cb6c01da1e275ae4228719e59a6b067048c51e72d9d63bcc4b url: "https://pub.flutter-io.cn" source: hosted - version: "0.1.6" + version: "1.0.0" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: "0b8e2457400d8a859b7b2030786835a28a8e80836ef64402abef392ff4f1d0e5" + sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 url: "https://pub.flutter-io.cn" source: hosted - version: "3.0.2" + version: "3.0.3" webview_flutter: dependency: transitive description: @@ -2055,18 +2022,18 @@ packages: dependency: transitive description: name: webview_flutter_platform_interface - sha256: d937581d6e558908d7ae3dc1989c4f87b786891ab47bb9df7de548a151779d8d + sha256: "18b1640839cf6546784a524c72aded5b6e86b23e7167dc2311cc96f7658b64bd" url: "https://pub.flutter-io.cn" source: hosted - version: "2.10.0" + version: "2.11.0" webview_flutter_wkwebview: dependency: transitive description: name: webview_flutter_wkwebview - sha256: c14455137ce60a68e1ccaf4e8f2dae8cebcb3465ddaa2fcfb57584fb7c5afe4d + sha256: c9f9be526fa0d3347374ceaa05c4b3acb85f4f112abd62f7d74b7d301fa515ff url: "https://pub.flutter-io.cn" source: hosted - version: "3.18.5" + version: "3.20.0" webviewx_plus: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 5e7383d..c5b3be2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -31,7 +31,13 @@ dependencies: lottie: ^3.2.0 flutter_blue_plus: ^1.35.3 permission_handler: ^12.0.0+1 + loading_indicator: ^3.1.1 # geolocator: ^13.0.4 + easydevice: + path: C:\Users\wyf\Desktop\blue\easydevice + # url: http:///enchantedwyf@git.it.real.he-info.cn:90/r/easydevice.git + # ref: main + localstorage: ^5.0.0 dev_dependencies: @@ -45,6 +51,7 @@ dependency_overrides: http_parser: ^4.1.0 collection: ^1.19.0 data_table_2: 2.5.16 # 2.5.17版本以后会报错,data_table_2.dart:525:47: Error:The method 'withValues' isn't defined ffor the class 'Color' + flutter_blue_plus: 1.34.5 # 1.35.0 版本android连接蓝牙有问题 flutter: