更新登录对接

This commit is contained in:
wyf
2025-04-18 18:13:21 +08:00
parent 1765403f21
commit 850c34b408
40 changed files with 2101 additions and 1745 deletions

View File

@@ -71,7 +71,11 @@
"无法绑定1":"检测到该设备", "无法绑定1":"检测到该设备",
"无法绑定2":"已被绑定", "无法绑定2":"已被绑定",
"无法绑定3":",绑定前请先进行解绑,有疑问请联系客服", "无法绑定3":",绑定前请先进行解绑,有疑问请联系客服",
"知道了":"知道了" "知道了":"知道了",
"是":"是",
"否":"否",
"确定绑定提示":"确定绑定该设备吗?",
"连接成功":"连接成功"
}, },
"登录页":{ "登录页":{
"欢迎使用太和e护":"欢迎使用太和e护", "欢迎使用太和e护":"欢迎使用太和e护",
@@ -84,7 +88,8 @@
"协议4":"《隐私政策》", "协议4":"《隐私政策》",
"协议5":"以及", "协议5":"以及",
"协议6":"《用户使用条款》", "协议6":"《用户使用条款》",
"其他登录方式":"欢迎使用太和e护" "其他登录方式":"欢迎使用太和e护",
"未同意协议":"请确认同意协议"
}, },
"人员资料":{ "人员资料":{
"标题":"人员资料", "标题":"人员资料",
@@ -123,8 +128,38 @@
"输入内容":"输入手机号码/邮箱", "输入内容":"输入手机号码/邮箱",
"输入验证码":"输入验证码", "输入验证码":"输入验证码",
"获取验证码":"获取验证码", "获取验证码":"获取验证码",
"登录":"登录" "登录":"登录",
"请输入手机号":"请输入手机号/邮箱",
"不正确手机号":"请输入正确的手机号或者邮箱",
"请输入验证码":"请输入验证码",
"登录成功":"登录成功",
"秒":"秒",
"发送成功":"验证码发送成功",
"发送失败":"验证码发送失败",
"登录失败":"登录失败"
},
"修改资料页":{
"个人信息":"个人信息",
"保存":"保存",
"点击更换头像":"点击更换头像",
"保存成功":"保存成功!",
"保存失败":"保存失败!"
},
"设置页":{
"标题":"设置",
"主题模式":"主题模式",
"选择语言":"选择语言",
"关于我们":"关于我们",
"用户协议":"用户协议",
"隐私协议":"隐私协议",
"退出登录":"退出登录",
"注销账号":"注销账号"
},
"关于我们":{
"标题":"关于我们"
},
"服务器":{
"失败":"服务器内部错误,请联系管理员"
} }
} }

View File

@@ -19,6 +19,7 @@ class AppConstants {
double text_padding_up_dowm_p = 5.rpx; //段落文字上下间距 double text_padding_up_dowm_p = 5.rpx; //段落文字上下间距
double smaller_text_fontSize = 18.rpx; //普通文字字号
double small_text_fontSize = 20.rpx; //普通文字字号 double small_text_fontSize = 20.rpx; //普通文字字号
double normal_text_fontSize = 26.rpx; //普通文字字号 double normal_text_fontSize = 26.rpx; //普通文字字号
double title_text_fontSize = 30.rpx; //标题文字字号 double title_text_fontSize = 30.rpx; //标题文字字号

View File

@@ -694,7 +694,10 @@ void setOther(device, connectedDeviceProp, fun) async {
// 连接设备 // 连接设备
void connectToDevice(fun) async { void connectToDevice(fun) async {
BluetoothDevice device = fun['device']; if (fun != null) {
return;
}
BluetoothDevice device = fun.device;
ConnectedDeviceProp? connectedDeviceProp = ConnectedDeviceProp? connectedDeviceProp =
getOneConnectedDeviceProp(device.remoteId.str); getOneConnectedDeviceProp(device.remoteId.str);
if (connectedDeviceProp != null) { if (connectedDeviceProp != null) {
@@ -710,11 +713,6 @@ void connectToDevice(fun) async {
print("device.connect success"); print("device.connect success");
ConnectedDevicePropType connectedDevicePropType = ConnectedDevicePropType connectedDevicePropType =
ConnectedDevicePropType.JunHe; ConnectedDevicePropType.JunHe;
if (isQuanShiDevice(device.advName)) {
connectedDevicePropType = ConnectedDevicePropType.QuanShi;
} else if (isMHTSWES(device.advName)) {
connectedDevicePropType = ConnectedDevicePropType.MHT;
}
connectedDeviceProp = ConnectedDeviceProp( connectedDeviceProp = ConnectedDeviceProp(
connectDevice: device, connectDevice: device,
fun: fun, 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) { void disconnect(ConnectedDeviceProp connectedDeviceProp) {
connectedDeviceProp.closeHeartBeat(); connectedDeviceProp.closeHeartBeat();
connectList.remove(connectedDeviceProp.id); connectList.remove(connectedDeviceProp.id);

View File

@@ -32,4 +32,6 @@ class CommonVariables {
static String shareText = "您的朋友邀请您使用《智慧眠花糖》APP请复制后面链接在浏览器中打开 " + static String shareText = "您的朋友邀请您使用《智慧眠花糖》APP请复制后面链接在浏览器中打开 " +
shoph5Url + shoph5Url +
"/#/pages/download/download"; "/#/pages/download/download";
static Map<String, Function(dynamic)> callMap = {};
} }

View File

@@ -3,9 +3,14 @@ import 'dart:async';
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.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/CommonVariables.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:url_launcher/url_launcher.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<void> initDataEf({String key = ""}) async { Future<void> initDataEf({String key = ""}) async {
await ef.init( await ef.init(
@@ -16,6 +21,25 @@ Future<void> initDataEf({String key = ""}) async {
} }
class MyUtils { 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) { static String timestampToDateString(int timestamp) {
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(timestamp); DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(timestamp);
@@ -43,6 +67,13 @@ class MyUtils {
return phoneRegExp.hasMatch(phoneNumber); 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<void> makePhoneCall(String phoneNumber) async { static Future<void> makePhoneCall(String phoneNumber) async {
final Uri launchUri = Uri( final Uri launchUri = Uri(
scheme: 'tel', scheme: 'tel',
@@ -114,7 +145,6 @@ showToast(String msg,
// gravity: ToastGravity.CENTER, // gravity: ToastGravity.CENTER,
// timeInSecForIosWeb: 1, // timeInSecForIosWeb: 1,
// backgroundColor: color == null ? color_error : color, // backgroundColor: color == null ? color_error : color,
// textColor: Colors.white,
// fontSize: 14.0, // fontSize: 14.0,
// ); // );
final context = Get.overlayContext; // 获取 Overlay 的上下文 final context = Get.overlayContext; // 获取 Overlay 的上下文
@@ -211,7 +241,7 @@ var closeIconWhite = GestureDetector(
alignment: Alignment.center, alignment: Alignment.center,
child: Icon( child: Icon(
Icons.close, Icons.close,
color: Colors.white, color: themeController.currentColor.sc3,
), ),
), ),
), ),
@@ -263,6 +293,7 @@ enum LoadingDialogIcon { ble, wifi, none }
class LoadingDialog { class LoadingDialog {
static show(String name, {LoadingDialogIcon icon = LoadingDialogIcon.none}) { static show(String name, {LoadingDialogIcon icon = LoadingDialogIcon.none}) {
ThemeController themeController = Get.find();
String iconUrl = ""; String iconUrl = "";
if (icon == LoadingDialogIcon.wifi) { if (icon == LoadingDialogIcon.wifi) {
iconUrl = "wifi"; iconUrl = "wifi";
@@ -296,18 +327,18 @@ class LoadingDialog {
Text( Text(
textAlign: TextAlign.center, textAlign: TextAlign.center,
name, name,
style: const TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
color: Colors.white, color: themeController.currentColor.sc3,
decoration: TextDecoration.none), decoration: TextDecoration.none),
), ),
SizedBox( SizedBox(
height: 30.rpx, height: 30.rpx,
), ),
const CircularProgressIndicator( CircularProgressIndicator(
strokeWidth: 2, strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>( valueColor: AlwaysStoppedAnimation<Color>(
Colors.white, themeController.currentColor.sc3,
), ),
), ),
], ],

View File

@@ -2,6 +2,7 @@ import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
class ConfirmDialog extends GetView { class ConfirmDialog extends GetView {
ConfirmDialog(); ConfirmDialog();
@@ -9,6 +10,7 @@ class ConfirmDialog extends GetView {
Future showConfirmCustomDialog(BuildContext context, Future showConfirmCustomDialog(BuildContext context,
{String name = "是否确认取消?"}) async { {String name = "是否确认取消?"}) async {
// Completer<String> completer = Completer<String>(); // Completer<String> completer = Completer<String>();
ThemeController themeController = Get.find();
TextEditingController textEditingController = TextEditingController(); TextEditingController textEditingController = TextEditingController();
return showDialog( return showDialog(
context: context, context: context,
@@ -49,7 +51,7 @@ class ConfirmDialog extends GetView {
color: stringToColor("#D3B684")), color: stringToColor("#D3B684")),
child: Text( child: Text(
'确定', '确定',
style: TextStyle(color: Colors.white, fontSize: 30.rpx), style: TextStyle( color: themeController.currentColor.sc3, fontSize: 30.rpx),
), ),
), ),
), ),

View File

@@ -39,7 +39,7 @@ class _SleepDataModuleWidgetState extends State<SleepDataModuleWidget> {
minWidth: 200.rpx, minWidth: 200.rpx,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: stringToColor("#313541"), color: themeController.currentColor.sc5,
borderRadius: BorderRadius.circular(20.rpx), borderRadius: BorderRadius.circular(20.rpx),
), ),
child: Padding( child: Padding(
@@ -113,7 +113,7 @@ class _SleepDataModuleWidgetState extends State<SleepDataModuleWidget> {
height: 40.rpx, height: 40.rpx,
padding: padding:
EdgeInsetsDirectional.fromSTEB(0.rpx, 0, 0.rpx, 0), EdgeInsetsDirectional.fromSTEB(0.rpx, 0, 0.rpx, 0),
color: stringToColor("#FF7159"), color: themeController.currentColor.sc14,
textStyle: textStyle:
FlutterFlowTheme.of(context).titleSmall.override( FlutterFlowTheme.of(context).titleSmall.override(
fontFamily: 'Inter Tight', fontFamily: 'Inter Tight',
@@ -134,7 +134,7 @@ class _SleepDataModuleWidgetState extends State<SleepDataModuleWidget> {
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: AppConstants().small_text_fontSize, fontSize: AppConstants().small_text_fontSize,
letterSpacing: 0.0, letterSpacing: 0.0,
color: Colors.grey), color: themeController.currentColor.sc4),
), ),
], ],
), ),

View File

@@ -118,7 +118,7 @@ class _SleepDateWidgetState extends State<SleepDateWidget> {
textStyle: textStyle:
FlutterFlowTheme.of(context).titleSmall.override( FlutterFlowTheme.of(context).titleSmall.override(
fontFamily: 'Inter Tight', fontFamily: 'Inter Tight',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0.0, letterSpacing: 0.0,
), ),
elevation: 0, elevation: 0,

View File

@@ -1,12 +1,12 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class ClickableContainer extends StatelessWidget { class ClickableContainer extends StatelessWidget {
final Color backgroundColor; // 容器背景色 final Color backgroundColor;
final Color highlightColor; // 点击时背景色 final Color highlightColor;
final EdgeInsetsGeometry padding; // 内部间距 final EdgeInsetsGeometry padding;
final VoidCallback onTap; // 点击回调 final VoidCallback onTap;
final Widget child; // 子组件 final Widget child;
final double borderRadius; // 容器圆角可选默认为0 final double borderRadius;
const ClickableContainer({ const ClickableContainer({
Key? key, Key? key,
@@ -15,13 +15,13 @@ class ClickableContainer extends StatelessWidget {
required this.padding, required this.padding,
required this.onTap, required this.onTap,
required this.child, required this.child,
this.borderRadius = 0, // 默认无圆角 this.borderRadius = 0,
}) : super(key: key); }) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return Theme(
onTap: onTap, data: Theme.of(context).copyWith(splashFactory: InkRipple.splashFactory),
child: Material( child: Material(
color: Colors.transparent, color: Colors.transparent,
child: Ink( child: Ink(
@@ -32,10 +32,10 @@ class ClickableContainer extends StatelessWidget {
child: InkWell( child: InkWell(
borderRadius: BorderRadius.circular(borderRadius), borderRadius: BorderRadius.circular(borderRadius),
onTap: onTap, onTap: onTap,
splashColor: highlightColor.withOpacity(0.3), // 点击时的波纹效果 splashColor: highlightColor.withOpacity(0.2),
child: Padding( child: Padding(
padding: padding, padding: padding,
child: child, // 内容自适应 child: child,
), ),
), ),
), ),

View File

@@ -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:ef/ef.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/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自动生成的部分 part 'blueteeth_bind_controller.g.dart'; // 由json_serializable自动生成的部分
@@ -8,7 +19,8 @@ class BlueteethBindModel {
int? read = 1; //是否不再提示教程 0 不再提示 1 需要提示 int? read = 1; //是否不再提示教程 0 不再提示 1 需要提示
double? singal = -70; //扫描信号强度 double? singal = -70; //扫描信号强度
List? devicelist = []; //蓝牙扫描到的设备数据列表 List<BleDeviceData>? devicelist = []; //蓝牙扫描到的设备数据列表
List<BleDeviceData>? betDevicelist = []; //请求的
List? blelist = []; //蓝牙扫描到的设备数据列表 List? blelist = []; //蓝牙扫描到的设备数据列表
List? wifiList = []; List? wifiList = [];
@@ -46,21 +58,122 @@ class BlueteethBindController extends GetControllerEx<BlueteethBindModel> {
attr = GetModel(BlueteethBindModel()).obs; attr = GetModel(BlueteethBindModel()).obs;
} }
void updateDeviceStatus() { Timer? _statusTimer;
// try {
// } catch (e) { BLEDevice? currentDevice;
// print(e);
// EasyDartModule.logger.info("向后端请求设备绑定状态报错了:$e"); // 启动每10秒获取设备状态
// } finally { void startStatusPolling() {
// EasyDartModule.logger.info("向后端请求设备绑定状态"); if (_statusTimer == null) {
// } _statusTimer = Timer.periodic(Duration(seconds: 10), (timer) {
updateDeviceStatus();
});
}
} }
Future bindDevice(d) async { // 停止轮询
print("绑定参数:$d"); void stopStatusPolling() {
await Future.delayed(Duration(seconds: 1)); _statusTimer?.cancel();
// return ApiService.request _statusTimer = null;
// .post("/api/device/info/bind", data: formdata.FormData.fromMap(d)); }
// 你的已有方法
Future<void> 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<dynamic> responseList = response.data['data'];
Map<String, BleDeviceData> deviceMap = {
for (var d in model.devicelist!)
if (d.mac != null) d.mac!: d
};
List<String> 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<ApiResponse> 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<String, dynamic> map) {}
}

View File

@@ -1,9 +1,17 @@
import 'dart:convert';
import 'package:EasyDartModule/EasyDartModule.dart';
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:get_storage/get_storage.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/MyUtils.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'; part 'login_controller.g.dart';
@JsonSerializable() @JsonSerializable()
@@ -13,7 +21,7 @@ class LoginModel {
String? account = '17649984946'; //账户 String? account = '17649984946'; //账户
String? password = 'wyf123,.'; //密码 String? password = 'wyf123,.'; //密码
String? phone; //手机号 String? phone; //手机号/邮箱
String? code; //验证码 String? code; //验证码
String? register_code; String? register_code;
@@ -47,88 +55,87 @@ class LoginController extends GetControllerEx<LoginModel> {
} }
//登录 //登录
Future<String> login(BuildContext context) async { Future<ApiResponse> login(BuildContext context) async {
// return ''; ApiResponse apiResponse = ApiResponse(code: -1, msg: "其他手机登录页.登录失败".tr);
String message = ''; if (model.phone == null || model.phone!.isEmpty) {
String account = ''; apiResponse.msg = "其他手机登录页.请输入手机号".tr;
String password = ''; return apiResponse;
// if (model.loginStyle == 1) { }
// //账号登录 if (model.code == null || model.code!.isEmpty) {
// if (model.account == null || model.account!.isEmpty) { apiResponse.msg = "其他手机登录页.请输入验证码".tr;
// message = '账户不能为空'; return apiResponse;
// showToast(message); }
// return message; String serviceAddress = ServiceConstant.service_address;
// } String serviceName = ServiceConstant.server_service;
// if (model.password == null || model.password!.isEmpty) { String serviceApi = ServiceConstant.login;
// message = '密码不能为空'; String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
// showToast(message); var data = {
// return message; "type": 1,
// } "userName": model.phone,
// account = model.account!; "password": model.code,
// password = model.password!; };
// } var response =
// if (model.loginStyle == 2) { await EasyDartModule.dio.post(queryUrl, data: jsonEncode(data));
// //账号登录 if (response != null) {
// if (model.phone == null || model.phone!.isEmpty) { var responseData =
// message = '手机号不能为空'; response.data is String ? jsonDecode(response.data) : response.data;
ApiResponse res = ApiResponse.fromJson(responseData, (object) => object);
// showToast(message); MyUtils.formatResponse(apiResponse, "其他手机登录页.登陆成功".tr, "其他手机登录页.登陆失败".tr);
// return message; if (res.code == HttpStatusCodes.ok) {
// } UserInfoController userInfoController = Get.find();
// if (!MyUtils.isValidPhoneNumber(model.phone!)) { userInfoController.model.login = 1;
// message = '请输入正确的手机号'; String token = response.headers['token']!.first;
EasyDartModule.dio.token = token;
// showToast(message); final box = GetStorage();
// return message; box.write('token', userInfoController.model.token); // 存储 token
// } }
// if (model.code == null || model.code!.isEmpty) { return res;
// message = '验证码不能为空'; } else {
return ApiResponse(code: -1, msg: "服务器.失败".tr);
// 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<String> getCode(BuildContext context) async { Future<ApiResponse> getCode(BuildContext context) async {
String message = ""; ApiResponse apiResponse = ApiResponse(code: -1, msg: "其他手机登录页.发送失败".tr);
if (model.register_agree == null || model.register_agree != true) { if (model.register_agree == null || model.register_agree != true) {
// message = "需要同意协议"; apiResponse.msg = "登录页.未同意协议".tr;
// showToast(message); return apiResponse;
return message;
} }
if (model.phone == null || model.phone!.isEmpty) { if (model.phone == null || model.phone!.isEmpty) {
message = "请输入手机号"; apiResponse.msg = "其他手机登录页.请输入手机号".tr;
// showToast(message); return apiResponse;
return message;
} }
if (!MyUtils.isValidPhoneNumber(model.phone!)) { if (!MyUtils.isValidPhoneNumber(model.phone!) &&
message = '请输入正确的手机号'; !MyUtils.isValidEmail(model.phone!)) {
showToast(message); apiResponse.msg = '其他手机登录页.不正确手机号'.tr;
return message; return apiResponse;
}
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;
} }
// message = await repository.sendRegisterCode(model.phone!);
if (message.isNotEmpty) {
showToast(message ?? "发送失败,请稍后再试!");
return "发送失败,请稍后再试!";
} else { } else {
showToast("发送验证码成功!", color: color_success); if (res.msg == null || res.msg!.isEmpty) {
res.msg = "其他手机登录页.发送成功".tr;
}
}
return res;
} else {
return ApiResponse(code: -1, msg: "服务器.失败".tr);
} }
return '';
} }
//微信登录 //微信登录

View File

@@ -7,7 +7,8 @@ part 'person_controller.g.dart'; // 由json_serializable自动生成的部分
class PersonModel { class PersonModel {
int read = 1; int read = 1;
DateTime? birthday;//是否不再提示教程 0 不再提示 1 需要提示 DateTime? birthday;
double? weight;
PersonModel(); PersonModel();

View File

@@ -22,7 +22,7 @@ class UserInfoModel {
User? superbase_user; User? superbase_user;
String? img_bucket = 'user'; String? img_bucket = 'user';
int? login = 1; //0未登录 1 登录 int? login = 0; //0未登录 1 登录

View File

@@ -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:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:get_storage/get_storage.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/common/util/FitTool.dart';
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart'; import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
import 'package:vbvs_app/controller/login/login_controller.dart'; import 'package:vbvs_app/controller/login/login_controller.dart';
@@ -27,6 +35,8 @@ Future<void> main() async {
// ApiService.init(); // ApiService.init();
// await GetStorage.init(); // await GetStorage.init();
// 初始化登录 // 初始化登录
await initLocalStorage();
initEasyDartModule();
await initLogin(); await initLogin();
await initLog(); await initLog();
// 检查网络 // 检查网络
@@ -41,13 +51,43 @@ Future<void> main() async {
.then((_) { .then((_) {
runApp(MyApp()); 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<void> initLogin() async { Future<void> initLogin() async {
// 初始化控制器 // 初始化控制器
@@ -70,9 +110,10 @@ Future<void> initLogin() async {
userInfoController.model.user = user; userInfoController.model.user = user;
} }
if (token != null) { if (token != null) {
// userInfoController.model.login = 1; userInfoController.model.login = 1;
// 根据token去请求 // 根据token去请求
// await userInfoController.autoLogin(token); // await userInfoController.autoLogin(token);
EasyDartModule.dio.token = token;
} else { } else {
// 如果没有 token则将用户标记为未登录 // 如果没有 token则将用户标记为未登录
userInfoController.model.login = 0; userInfoController.model.login = 0;
@@ -150,7 +191,6 @@ class MyApp extends StatelessWidget {
], ],
supportedLocales: [ supportedLocales: [
const Locale('zh', 'CN'), // 中文 const Locale('zh', 'CN'), // 中文
// 其他支持的语言
], ],
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
title: '', title: '',

View File

@@ -8,11 +8,13 @@ class BleDeviceData {
final int flag; // 设备属性 final int flag; // 设备属性
final int version; // 软件版本 final int version; // 软件版本
final int qsn; // 广播帧序列号高16位 final int qsn; // 广播帧序列号高16位
int? status; // 设备状态 bool? bind = true; // 设备状态
String? name; //设备名称 String? name; //设备名称
int? rssi; int? rssi;
String? mac; //mac地址 String? mac; //mac地址
BleDeviceData? slave;//从设备
BleDeviceData({ BleDeviceData({
required this.type, required this.type,
required this.sn, required this.sn,

View File

@@ -24,6 +24,7 @@ class CustomThemeColor {
final String color19; final String color19;
final String color20; final String color20;
final String color21; final String color21;
final String color22;
final String color25; final String color25;
final String color26; final String color26;
final String color27; final String color27;
@@ -61,6 +62,7 @@ class CustomThemeColor {
required this.color19, required this.color19,
required this.color20, required this.color20,
required this.color21, required this.color21,
required this.color22,
required this.color25, required this.color25,
required this.color26, required this.color26,
required this.color27, required this.color27,
@@ -98,7 +100,8 @@ class CustomThemeColor {
color18: "#FFFFFF", color18: "#FFFFFF",
color19: "#FFFFFF", color19: "#FFFFFF",
color20: "#f7f8fa", color20: "#f7f8fa",
color21: "#5EE00A", color21: "#eaeaea",
color22: "#eaeaea",
color25: "#FF7159", color25: "#FF7159",
color26: "#4AD8FA", color26: "#4AD8FA",
color27: "#f7f8fa", color27: "#f7f8fa",
@@ -134,7 +137,8 @@ class CustomThemeColor {
color18: "#EAEAEA", color18: "#EAEAEA",
color19: "#FFFFFF", color19: "#FFFFFF",
color20: "#f7f8fa", color20: "#f7f8fa",
color21: "#5EE00A", color21: "#333844",
color22: "#333844",
color25: "#FF7159", color25: "#FF7159",
color26: "#4AD8FA", color26: "#4AD8FA",
color27: "#f7f8fa", color27: "#f7f8fa",
@@ -180,6 +184,7 @@ class CustomThemeColor {
Color get sc19 => getColor(color19); Color get sc19 => getColor(color19);
Color get sc20 => getColor(color20); Color get sc20 => getColor(color20);
Color get sc21 => getColor(color21); Color get sc21 => getColor(color21);
Color get sc22 => getColor(color22);
Color get sc25 => getColor(color25); Color get sc25 => getColor(color25);
Color get sc26 => getColor(color26); Color get sc26 => getColor(color26);
Color get sc27 => getColor(color27); Color get sc27 => getColor(color27);
@@ -238,6 +243,7 @@ class CustomThemeColor {
color19: json['color19'], color19: json['color19'],
color20: json['color20'], color20: json['color20'],
color21: json['color21'], color21: json['color21'],
color22: json['color22'],
color25: json['color25'], color25: json['color25'],
color26: json['color26'], color26: json['color26'],
color27: json['color27'], color27: json['color27'],
@@ -274,6 +280,7 @@ class CustomThemeColor {
'color19': color19, 'color19': color19,
'color20': color20, 'color20': color20,
'color21': color21, 'color21': color21,
'color22': color22,
'color25': color25, 'color25': color25,
'color26': color26, 'color26': color26,
'color27': color27, 'color27': color27,

View File

@@ -3,10 +3,11 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged, getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged,
{bool looping = false}) { {bool looping = false}) {
ThemeController themeController = Get.find();
return CupertinoPicker( return CupertinoPicker(
key: UniqueKey(), key: UniqueKey(),
useMagnifier: false, useMagnifier: false,
@@ -38,7 +39,7 @@ getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged,
child: Text("${arr[index]}", child: Text("${arr[index]}",
style: FlutterFlowTheme.of(context).bodyMedium.override( style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx)), fontSize: 30.rpx)),
); );
@@ -51,6 +52,7 @@ Future showDateSelectionDialog(BuildContext context,
{required DateTime checkDate, {required DateTime checkDate,
Function? checkChange, Function? checkChange,
String title = "选择生日"}) { String title = "选择生日"}) {
ThemeController themeController = Get.find();
Color checkColor = stringToColor("#D3B684"); Color checkColor = stringToColor("#D3B684");
List years = [], months = [], days = []; List years = [], months = [], days = [];
var days_select = [].obs; var days_select = [].obs;
@@ -113,7 +115,7 @@ Future showDateSelectionDialog(BuildContext context,
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx), fontSize: 30.rpx),
), ),
@@ -152,7 +154,7 @@ Future showDateSelectionDialog(BuildContext context,
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx), fontSize: 30.rpx),
), ),
@@ -182,7 +184,7 @@ Future showDateSelectionDialog(BuildContext context,
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx), fontSize: 30.rpx),
), ),
@@ -213,7 +215,7 @@ Future showDateSelectionDialog(BuildContext context,
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx), fontSize: 30.rpx),
), ),
@@ -240,7 +242,7 @@ Future showDateSelectionDialog(BuildContext context,
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx), fontSize: 30.rpx),
), ),
@@ -260,6 +262,7 @@ Future showDateSelectionDialog(BuildContext context,
Future showDayTimeSelectionDialog(BuildContext context, Future showDayTimeSelectionDialog(BuildContext context,
{required List<int> dayTimeArr, Function? checkChange, String title = ""}) { {required List<int> dayTimeArr, Function? checkChange, String title = ""}) {
ThemeController themeController = Get.find();
Color checkColor = stringToColor("#D3B684"); Color checkColor = stringToColor("#D3B684");
List hours = [], minutes = []; List hours = [], minutes = [];
for (var i = 0; i < 24; i++) { for (var i = 0; i < 24; i++) {
@@ -309,7 +312,7 @@ Future showDayTimeSelectionDialog(BuildContext context,
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx), fontSize: 30.rpx),
), ),
@@ -340,7 +343,7 @@ Future showDayTimeSelectionDialog(BuildContext context,
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx), fontSize: 30.rpx),
), ),
@@ -362,7 +365,7 @@ Future showDayTimeSelectionDialog(BuildContext context,
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx), fontSize: 30.rpx),
), ),
@@ -389,7 +392,7 @@ Future showDayTimeSelectionDialog(BuildContext context,
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx), fontSize: 30.rpx),
), ),
@@ -412,6 +415,7 @@ Future showOneSelectionDialog(BuildContext context,
int checkIndex = 0, int checkIndex = 0,
Function? checkChange, Function? checkChange,
String title = "选择性别"}) { String title = "选择性别"}) {
ThemeController themeController = Get.find();
Color checkColor = stringToColor("#D3B684"); Color checkColor = stringToColor("#D3B684");
return showDialog( return showDialog(
// barrierColor: stringToColor("#000320"), // barrierColor: stringToColor("#000320"),
@@ -452,7 +456,7 @@ Future showOneSelectionDialog(BuildContext context,
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx), fontSize: 30.rpx),
), ),
@@ -490,7 +494,7 @@ Future showOneSelectionDialog(BuildContext context,
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx), fontSize: 30.rpx),
), ),
@@ -537,6 +541,7 @@ enum ConfirmDialogIcon {
Future showCustomConfirmDialog(BuildContext context, String name, Future showCustomConfirmDialog(BuildContext context, String name,
{String btnName = "确定", {String btnName = "确定",
ConfirmDialogIcon icon = ConfirmDialogIcon.warn}) async { ConfirmDialogIcon icon = ConfirmDialogIcon.warn}) async {
ThemeController themeController = Get.find();
return showDialog( return showDialog(
context: context, context: context,
barrierDismissible: true, barrierDismissible: true,
@@ -589,7 +594,9 @@ Future showCustomConfirmDialog(BuildContext context, String name,
color: stringToColor("#D3B684")), color: stringToColor("#D3B684")),
child: Text( child: Text(
'$btnName', '$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, Future showCustomConfirmAndCancelDialog(BuildContext context, String name,
{String confirmName = "确定", {String confirmName = "确定",
String cancelName = "取消", String cancelName = "取消",
ConfirmDialogIcon icon = ConfirmDialogIcon.warn}) async { ConfirmDialogIcon icon = ConfirmDialogIcon.warn}) async {
ThemeController themeController = Get.find();
return showDialog( return showDialog(
context: context, context: context,
barrierDismissible: true, barrierDismissible: true,
@@ -684,8 +691,9 @@ Future showCustomConfirmAndCancelDialog(BuildContext context, String name,
color: stringToColor("#D3B684")), color: stringToColor("#D3B684")),
child: Text( child: Text(
'$confirmName', '$confirmName',
style: style: TextStyle(
TextStyle(color: Colors.white, fontSize: 30.rpx), color: themeController.currentColor.sc3,
fontSize: 30.rpx),
), ),
), ),
) )
@@ -702,6 +710,7 @@ Future showCustomConfirmAndCancelDialog(BuildContext context, String name,
//权限说明弹窗 //权限说明弹窗
void showPermissionInfoDialog(BuildContext context, List data) { void showPermissionInfoDialog(BuildContext context, List data) {
ThemeController themeController = Get.find();
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, // 点击对话框外部可关闭 barrierDismissible: false, // 点击对话框外部可关闭
@@ -715,7 +724,7 @@ void showPermissionInfoDialog(BuildContext context, List data) {
child: Material( child: Material(
color: Colors.transparent, color: Colors.transparent,
child: Dialog( child: Dialog(
backgroundColor: Colors.white, backgroundColor: themeController.currentColor.sc3,
insetPadding: EdgeInsets.fromLTRB(0, 0, 0, 0), insetPadding: EdgeInsets.fromLTRB(0, 0, 0, 0),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),

View File

@@ -8,6 +8,7 @@ import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.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/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/controller/user_info_controller.dart';
class BindDeviceSuccess extends StatefulWidget { class BindDeviceSuccess extends StatefulWidget {
@@ -21,6 +22,7 @@ class _EPageState extends State<BindDeviceSuccess> {
GlobalController globalController = Get.find(); GlobalController globalController = Get.find();
UserInfoController userInfoController = Get.find(); UserInfoController userInfoController = Get.find();
BlueteethBindController blueteethBindController = Get.find(); BlueteethBindController blueteethBindController = Get.find();
ThemeController themeController = Get.find();
@override @override
void initState() { void initState() {
@@ -42,14 +44,14 @@ class _EPageState extends State<BindDeviceSuccess> {
child: Scaffold( child: Scaffold(
backgroundColor: Colors.transparent, // 加上这一行 backgroundColor: Colors.transparent, // 加上这一行
appBar: AppBar( appBar: AppBar(
backgroundColor: stringToColor("#242835"), backgroundColor: themeController.currentColor.sc17,
// backgroundColor: Colors.transparent,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: Colors.white), iconTheme: IconThemeData(
color: themeController.currentColor.sc3,
),
titleSpacing: 0, titleSpacing: 0,
// leading: returnIconButtom, // leading: returnIconButtom,
title: Container( title: Container(
// color: Colors.grey,
width: double.infinity, width: double.infinity,
height: 180.rpx, height: 180.rpx,
child: Stack( child: Stack(
@@ -60,7 +62,7 @@ class _EPageState extends State<BindDeviceSuccess> {
'绑定成功.标题'.tr, '绑定成功.标题'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override( style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx, fontSize: 30.rpx,
), ),
@@ -98,7 +100,7 @@ class _EPageState extends State<BindDeviceSuccess> {
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/img/icon/tick.svg', 'assets/img/icon/tick.svg',
fit: BoxFit.cover, fit: BoxFit.cover,
color: Colors.white, color: themeController.currentColor.sc3,
), ),
), ),
), ),
@@ -118,7 +120,7 @@ class _EPageState extends State<BindDeviceSuccess> {
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: 48.rpx, fontSize: 48.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
color: Colors.white, color: themeController.currentColor.sc3,
), ),
), ),
), ),
@@ -140,7 +142,7 @@ class _EPageState extends State<BindDeviceSuccess> {
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: 30.rpx, fontSize: 30.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
color: Colors.white, color: themeController.currentColor.sc3,
), ),
), ),
), ),
@@ -162,7 +164,7 @@ class _EPageState extends State<BindDeviceSuccess> {
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: 30.rpx, fontSize: 30.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
color: Colors.white, color: themeController.currentColor.sc3,
), ),
), ),
), ),
@@ -180,8 +182,8 @@ class _EPageState extends State<BindDeviceSuccess> {
}, },
colors: [ colors: [
// 渐变色 // 渐变色
stringToColor("45D989"), // 左侧渐变色 themeController.currentColor.sc1,
stringToColor("00C1AA"), // 右侧渐变色 themeController.currentColor.sc2,
], ],
child: Container( child: Container(
width: MediaQuery.sizeOf(context).width * 0.66, width: MediaQuery.sizeOf(context).width * 0.66,
@@ -198,14 +200,14 @@ class _EPageState extends State<BindDeviceSuccess> {
'assets/img/icon/share.svg', 'assets/img/icon/share.svg',
width: 25.rpx, width: 25.rpx,
height: 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 height: 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color: Colors.white, // 设置图标颜色为白色 color: themeController.currentColor.sc3,
), ),
Text( Text(
'绑定成功.立即分享'.tr, '绑定成功.立即分享'.tr,
style: FlutterFlowTheme.of(context) style: FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
color: Colors.white, // 文字颜色 color: themeController.currentColor.sc3,
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: AppConstants() fontSize: AppConstants()
.normal_text_fontSize, // 自定义字体大小 .normal_text_fontSize, // 自定义字体大小
@@ -228,8 +230,8 @@ class _EPageState extends State<BindDeviceSuccess> {
}, },
colors: [ colors: [
// 渐变色 // 渐变色
stringToColor("45D989"), // 左侧渐变色 themeController.currentColor.sc1,
stringToColor("00C1AA"), // 右侧渐变色 themeController.currentColor.sc2,
], ],
child: Container( child: Container(
@@ -248,7 +250,7 @@ class _EPageState extends State<BindDeviceSuccess> {
style: FlutterFlowTheme.of(context) style: FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
color: Colors.white, // 文字颜色 color: themeController.currentColor.sc3,
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: AppConstants() fontSize: AppConstants()
.normal_text_fontSize, // 自定义字体大小 .normal_text_fontSize, // 自定义字体大小
@@ -282,8 +284,8 @@ class _EPageState extends State<BindDeviceSuccess> {
} }
} }
}, },
// colors: [Colors.white.withOpacity(0.06)], // 背景色
colors: [stringToColor("#242835")], // 背景色 colors: [themeController.currentColor.sc17], // 背景色
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: MediaQuery.sizeOf(context).height * 0.135, height: MediaQuery.sizeOf(context).height * 0.135,

View File

@@ -1,6 +1,7 @@
import 'dart:async'; import 'dart:async';
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutter_svg/svg.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/common/util/MyUtils.dart';
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.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/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/controller/user_info_controller.dart';
import 'package:vbvs_app/model/BleDeviceData.dart'; import 'package:vbvs_app/model/BleDeviceData.dart';
import 'package:vbvs_app/pages/common/selectDialog.dart'; import 'package:vbvs_app/pages/common/selectDialog.dart';
@@ -28,6 +30,7 @@ class _EPageState extends State<BlueteethDevicePage> {
GlobalController globalController = Get.find(); GlobalController globalController = Get.find();
UserInfoController userInfoController = Get.find(); UserInfoController userInfoController = Get.find();
BlueteethBindController blueteethBindController = Get.find(); BlueteethBindController blueteethBindController = Get.find();
ThemeController themeController = Get.find();
late FlutterBluePlus flutterBlue; // 声明 flutterBlue 实例 late FlutterBluePlus flutterBlue; // 声明 flutterBlue 实例
List<ScanResult> scanResults = []; // 存储扫描到的设备 List<ScanResult> scanResults = []; // 存储扫描到的设备
bool isScanning = false; // 扫描状态控制 bool isScanning = false; // 扫描状态控制
@@ -48,6 +51,7 @@ class _EPageState extends State<BlueteethDevicePage> {
super.initState(); super.initState();
flutterBlue = FlutterBluePlus(); // 初始化flutterBlue实例 flutterBlue = FlutterBluePlus(); // 初始化flutterBlue实例
_checkBluetoothPermission(); // 检查蓝牙权限 _checkBluetoothPermission(); // 检查蓝牙权限
Get.find<BlueteethBindController>().startStatusPolling();
} }
// 检查蓝牙权限 // 检查蓝牙权限
@@ -125,29 +129,6 @@ class _EPageState extends State<BlueteethDevicePage> {
await FlutterBluePlus.startScan(timeout: Duration(seconds: 10)); 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) { FlutterBluePlus.scanResults.listen((results) {
final signalThreshold = blueteethBindController.model.singal!; final signalThreshold = blueteethBindController.model.singal!;
final filteredResults = results final filteredResults = results
@@ -173,24 +154,35 @@ class _EPageState extends State<BlueteethDevicePage> {
} }
} }
// 使用一个临时变量 lastDeviceList 来比较是否有变化
setState(() { setState(() {
scanResults = filteredResults; bool hasChanges = false;
// 存入 controller 中 // 如果 devicelist 长度不同或内容有差异,认为有变化
blueteethBindController.model.blelist = filteredResults; 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;
}
}
}
// 如果有变化,更新 devicelist 和 blelist
if (hasChanges) {
blueteethBindController.model.devicelist = parsedDeviceList; blueteethBindController.model.devicelist = parsedDeviceList;
blueteethBindController.updateDeviceStatus(); blueteethBindController.model.blelist = filteredResults;
blueteethBindController.updateAll(); // blueteethBindController.updateDeviceStatus();
}
// 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 广播数据");
// }
}); });
}); });
@@ -637,8 +629,8 @@ class _EPageState extends State<BlueteethDevicePage> {
child: Scaffold( child: Scaffold(
backgroundColor: Colors.transparent, // 加上这一行 backgroundColor: Colors.transparent, // 加上这一行
appBar: AppBar( appBar: AppBar(
iconTheme: IconThemeData(color: Colors.white), iconTheme: IconThemeData(color: themeController.currentColor.sc3),
backgroundColor: stringToColor("#242835"), backgroundColor: themeController.currentColor.sc17,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
titleSpacing: 0, titleSpacing: 0,
title: Container( title: Container(
@@ -651,7 +643,7 @@ class _EPageState extends State<BlueteethDevicePage> {
'蓝牙绑定.标题'.tr, '蓝牙绑定.标题'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override( style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx, fontSize: 30.rpx,
), ),
@@ -763,7 +755,7 @@ class _EPageState extends State<BlueteethDevicePage> {
Container( Container(
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: themeController.currentColor.sc3,
borderRadius: BorderRadius.circular(20.rpx), borderRadius: BorderRadius.circular(20.rpx),
), ),
child: Padding( child: Padding(
@@ -788,7 +780,7 @@ class _EPageState extends State<BlueteethDevicePage> {
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/img/icon/query.svg', 'assets/img/icon/query.svg',
fit: BoxFit.cover, fit: BoxFit.cover,
color: Colors.black, color: stringToColor("#333333"), //固定
), ),
), ),
), ),
@@ -861,10 +853,9 @@ class _EPageState extends State<BlueteethDevicePage> {
borderRadius: borderRadius:
BorderRadius.circular(8.rpx), BorderRadius.circular(8.rpx),
), ),
filled: true, filled: false,
fillColor: fillColor: themeController
FlutterFlowTheme.of(context) .currentColor.sc22,
.secondaryBackground,
), ),
style: FlutterFlowTheme.of(context) style: FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
@@ -896,8 +887,7 @@ class _EPageState extends State<BlueteethDevicePage> {
height: 50.rpx, height: 50.rpx,
child: VerticalDivider( child: VerticalDivider(
thickness: 2.rpx, thickness: 2.rpx,
color: FlutterFlowTheme.of(context) color: stringToColor("#333333"), //固定
.alternate,
), ),
), ),
Text( Text(
@@ -908,6 +898,7 @@ class _EPageState extends State<BlueteethDevicePage> {
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: 30.rpx, fontSize: 30.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
color: stringToColor("#333333"), //固定
), ),
), ),
].divide(SizedBox(width: 26.rpx)), ].divide(SizedBox(width: 26.rpx)),
@@ -934,12 +925,14 @@ class _EPageState extends State<BlueteethDevicePage> {
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: 30.rpx, fontSize: 30.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
color: Colors.white), color: themeController.currentColor.sc3,
), ),
), ),
), ),
), ),
Expanded( ),
Obx(() {
return Expanded(
child: Container( child: Container(
width: double.infinity, width: double.infinity,
child: SingleChildScrollView( child: SingleChildScrollView(
@@ -959,7 +952,8 @@ class _EPageState extends State<BlueteethDevicePage> {
), ),
), ),
), ),
), );
}),
].divide(SizedBox(height: 30.rpx)), ].divide(SizedBox(height: 30.rpx)),
), ),
), ),

View File

@@ -2,15 +2,25 @@ import 'package:ef/base/widget/flutterflow/FlutterFlowTheme.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/model/BleDeviceData.dart';
class DoubleBlueteethDeviceCompoentWidget extends StatefulWidget { class DoubleBlueteethDeviceCompoentWidget extends StatefulWidget {
const DoubleBlueteethDeviceCompoentWidget({super.key}); final BleDeviceData masterDevice; // 主设备
final BleDeviceData? slaveDevice; // 从设备(可为空)
// 构造函数,接受参数
const DoubleBlueteethDeviceCompoentWidget({
super.key,
required this.masterDevice,
this.slaveDevice,
});
@override @override
State<DoubleBlueteethDeviceCompoentWidget> createState() => State<DoubleBlueteethDeviceCompoentWidget> createState() =>
_DoubleBlueteethDeviceCompoentWidgetState(); _DoubleBlueteethDeviceCompoentWidgetState();
} }
class _DoubleBlueteethDeviceCompoentWidgetState class _DoubleBlueteethDeviceCompoentWidgetState
extends State<DoubleBlueteethDeviceCompoentWidget> { extends State<DoubleBlueteethDeviceCompoentWidget> {
@override @override

View File

@@ -1,4 +1,6 @@
import 'package:flutter/material.dart'; 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 { class FancyCircleCheckbox extends StatefulWidget {
final bool value; final bool value;
@@ -59,8 +61,8 @@ class _FancyCircleCheckboxState extends State<FancyCircleCheckbox>
return GestureDetector( return GestureDetector(
onTap: () => widget.onChanged(!widget.value), onTap: () => widget.onChanged(!widget.value),
child: Container( child: Container(
width: 24, width: 32.rpx,
height: 24, height: 32.rpx,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
border: Border.all( border: Border.all(
@@ -73,7 +75,7 @@ class _FancyCircleCheckboxState extends State<FancyCircleCheckbox>
child: ScaleTransition( child: ScaleTransition(
scale: _scaleAnimation, scale: _scaleAnimation,
child: Container( child: Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.all(8.rpx),
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: widget.fillColor, color: widget.fillColor,

View File

@@ -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:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutterflow_ui/flutterflow_ui.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/common/util/FitTool.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.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/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/model/BleDeviceData.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/blueteeth_device_page.dart';
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart'; import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
class SingleBlueteethDeviceCompoentWidget extends StatefulWidget { class SingleBlueteethDeviceCompoentWidget extends StatefulWidget {
// final BleDeviceData device;
final bleDevice; final bleDevice;
const SingleBlueteethDeviceCompoentWidget({ const SingleBlueteethDeviceCompoentWidget({
super.key, super.key,
// required this.device,
required this.bleDevice, required this.bleDevice,
}); });
@@ -27,9 +30,10 @@ class SingleBlueteethDeviceCompoentWidget extends StatefulWidget {
class _SingleBlueteethDeviceCompoentWidgetState class _SingleBlueteethDeviceCompoentWidgetState
extends State<SingleBlueteethDeviceCompoentWidget> { extends State<SingleBlueteethDeviceCompoentWidget> {
ThemeController themeController = Get.find();
BlueteethBindController blueteethBindController = Get.find();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var bleDevice = widget.bleDevice;
List<int> rawData = List<int> rawData =
widget.bleDevice.advertisementData.manufacturerData[0xFFED]!; widget.bleDevice.advertisementData.manufacturerData[0xFFED]!;
BleDeviceData deviceData = parseBleData(rawData); BleDeviceData deviceData = parseBleData(rawData);
@@ -37,45 +41,80 @@ class _SingleBlueteethDeviceCompoentWidgetState
deviceData.rssi = widget.bleDevice.rssi; deviceData.rssi = widget.bleDevice.rssi;
deviceData.mac = deviceData.deviceId.replaceAll(':', ''); deviceData.mac = deviceData.deviceId.replaceAll(':', '');
BleDeviceData device = deviceData; BleDeviceData device = deviceData;
device = blueteethBindController.model.devicelist!.firstWhere(
(d) => d.mac == device.mac,
orElse: () => device,
);
ThemeController themeController = Get.find();
return ClickableContainer( return ClickableContainer(
backgroundColor: themeController.currentColor.sc5, backgroundColor: themeController.currentColor.sc5,
highlightColor: Colors.white, highlightColor: themeController.currentColor.sc21,
borderRadius: 20.rpx, borderRadius: 20.rpx,
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 36.rpx, 0, 52.rpx), padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 36.rpx, 0, 52.rpx),
onTap: () async { onTap: () async {
//todo 请求绑定 try {
print(device.mac); if (device.bind == true) {
// try { showHaveBindDialog(context);
// await bleDevice.device.connect(autoConnect: false); // showBindDoubleDialog(context, []);
// List<BluetoothService> services = } else {
// await bleDevice.device.discoverServices(); showConfirmDialog(
// BluetoothCharacteristic? wifiListChar; context,
// BluetoothCharacteristic? wifiSsidChar; Container(),
// BluetoothCharacteristic? wifiPasswordChar; '蓝牙绑定.确定绑定提示'.tr,
// BluetoothCharacteristic? startProvisionChar; onConfirm: () async {
ApiResponse response =
// for (BluetoothService service in services) { await blueteethBindController.bindDeviceAndMAC(device);
// for (BluetoothCharacteristic c in service.characteristics) { if (response.code == HttpStatusCodes.ok) {
// if (c.uuid.toString() == 'YOUR_WIFI_LIST_UUID') { showLoadingDialog(context); // 显示 loading
// wifiListChar = c; BLEDevice bledevice =
// } else if (c.uuid.toString() == 'YOUR_WIFI_SSID_UUID') { BLEDevice(device: widget.bleDevice.device);
// wifiSsidChar = c; var res1 = bledevice.isConnected;
// } else if (c.uuid.toString() == 'YOUR_WIFI_PWD_UUID') { print("res1: $res1");
// wifiPasswordChar = c; await bledevice.device.connect();
// } else if (c.uuid.toString() == 'YOUR_WIFI_START_UUID') { var res2 = bledevice.isConnected;
// startProvisionChar = c; print("res2: $res2");
// } if (res2) {
// } Navigator.pop(context);
// } TopSlideNotification.show(
// } catch (e) { context,
// print("蓝牙连接失败"); text: "蓝牙绑定.连接成功".tr,
// } textColor: themeController.currentColor.sc2,
// );
// Get.toNamed('/wifiPage', arguments: bleDevice.device); blueteethBindController.currentDevice = bledevice;
showBindDoubleDialog(context,[]); // Get.toNamed("/wifiPage", arguments: {bledevice});
// showHaveBindDialog(context); 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( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@@ -156,10 +195,12 @@ class _SingleBlueteethDeviceCompoentWidgetState
), ),
), ),
Text( Text(
device.status == 1 ? '蓝牙绑定.可绑定'.tr : '蓝牙绑定.已被绑定'.tr, device.bind == false ? '蓝牙绑定.可绑定'.tr : '蓝牙绑定.已被绑定'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override( style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter', fontFamily: 'Inter',
color: const Color(0xFF1AD2B5), color: device.bind == false
? const Color(0xFF1AD2B5)
: themeController.currentColor.sc9,
fontSize: 26.rpx, fontSize: 26.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
), ),

View File

@@ -1,8 +1,7 @@
import 'dart:ui';
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:loading_indicator/loading_indicator.dart';
import 'package:vbvs_app/common/color/appConstants.dart'; import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart';
@@ -45,7 +44,8 @@ void showBindDoubleDialog(BuildContext context, List<BleDeviceData> devices) {
Align( Align(
alignment: AlignmentDirectional(0, 0), alignment: AlignmentDirectional(0, 0),
child: Padding( child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(0.rpx, 93.rpx, 0, 0), padding:
EdgeInsetsDirectional.fromSTEB(0.rpx, 93.rpx, 0, 0),
child: Text( child: Text(
'蓝牙绑定.双人版绑定标题'.tr, '蓝牙绑定.双人版绑定标题'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override( style: FlutterFlowTheme.of(context).bodyMedium.override(
@@ -74,7 +74,7 @@ void showBindDoubleDialog(BuildContext context, List<BleDeviceData> devices) {
// 主设备 // 主设备
_buildCheckboxRow( _buildCheckboxRow(
context, context,
title: '蓝牙绑定.主设备'.tr, title: '蓝牙绑定.主设备'.tr + "asasasasasas(已被绑定)",
value: () => blueteethBindController.model.deviceIndex1!, value: () => blueteethBindController.model.deviceIndex1!,
onChanged: (v) { onChanged: (v) {
if (!blueteethBindController.model.deviceIndex1!) { if (!blueteethBindController.model.deviceIndex1!) {
@@ -130,8 +130,6 @@ void showBindDoubleDialog(BuildContext context, List<BleDeviceData> devices) {
); );
} }
void showHaveBindDialog(BuildContext context) { void showHaveBindDialog(BuildContext context) {
ThemeController themeController = Get.find(); ThemeController themeController = Get.find();
@@ -187,7 +185,7 @@ void showHaveBindDialog(BuildContext context) {
TextSpan( TextSpan(
text: "蓝牙绑定.无法绑定2".tr, text: "蓝牙绑定.无法绑定2".tr,
style: TextStyle( style: TextStyle(
color: themeController.currentColor.sc10, color: themeController.currentColor.sc8,
fontSize: AppConstants().normal_text_fontSize, fontSize: AppConstants().normal_text_fontSize,
), ),
), ),
@@ -228,10 +226,9 @@ void showHaveBindDialog(BuildContext context) {
style: FlutterFlowTheme.of(context) style: FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
color: Colors.white, color: themeController.currentColor.sc3,
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: fontSize: AppConstants().normal_text_fontSize,
AppConstants().normal_text_fontSize,
letterSpacing: 0.0, 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( Widget _buildCheckboxRow(
BuildContext context, { BuildContext context, {
@@ -260,7 +336,7 @@ Widget _buildCheckboxRow(
}) { }) {
ThemeController themeController = Get.find(); ThemeController themeController = Get.find();
return Padding( 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( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
@@ -270,7 +346,8 @@ Widget _buildCheckboxRow(
value: value(), value: value(),
onChanged: onChanged, onChanged: onChanged,
)), )),
Text( Expanded(
child: Text(
title, title,
style: FlutterFlowTheme.of(context).bodyMedium.override( style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter', fontFamily: 'Inter',
@@ -279,6 +356,7 @@ Widget _buildCheckboxRow(
color: themeController.currentColor.sc3, color: themeController.currentColor.sc3,
), ),
), ),
),
].divide(SizedBox(width: 21.rpx)), ].divide(SizedBox(width: 21.rpx)),
), ),
); );
@@ -311,7 +389,7 @@ Widget _buildActionButton(
Text( Text(
text, text,
style: FlutterFlowTheme.of(context).bodyMedium.override( style: FlutterFlowTheme.of(context).bodyMedium.override(
color: Colors.white, color: themeController.currentColor.sc3,
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: AppConstants().normal_text_fontSize, fontSize: AppConstants().normal_text_fontSize,
letterSpacing: 0.0, 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,
)),
),
),
],
),
),
),
);
},
);
}

View File

@@ -13,7 +13,8 @@ import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/controller/user_info_controller.dart';
class DeviceTypePage extends StatefulWidget { class DeviceTypePage extends StatefulWidget {
const DeviceTypePage({super.key}); int type = 0;//0绑定设备 1.查询我的设备
DeviceTypePage({super.key,this.type = 0});
@override @override
State<DeviceTypePage> createState() => _EPageState(); State<DeviceTypePage> createState() => _EPageState();
@@ -30,7 +31,7 @@ class _EPageState extends State<DeviceTypePage> {
super.initState(); super.initState();
// 延迟到 build 完成后执行弹窗逻辑 // 延迟到 build 完成后执行弹窗逻辑
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (blueteethBindController.model.read == 1) { if (blueteethBindController.model.read == 1 && widget.type == 0) {
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
@@ -84,8 +85,7 @@ class _EPageState extends State<DeviceTypePage> {
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/img/icon/sound.svg', 'assets/img/icon/sound.svg',
fit: BoxFit.fill, fit: BoxFit.fill,
color: themeController color: stringToColor("#ff9f66"),
.currentColor.sc8,
), ),
), ),
), ),
@@ -97,8 +97,8 @@ class _EPageState extends State<DeviceTypePage> {
children: [ children: [
Text( Text(
'绑定引导.说明标题'.tr, '绑定引导.说明标题'.tr,
style: FlutterFlowTheme.of( style:
context) FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
@@ -107,7 +107,9 @@ class _EPageState extends State<DeviceTypePage> {
letterSpacing: 0.0, letterSpacing: 0.0,
fontWeight: fontWeight:
FontWeight.w500, FontWeight.w500,
color: Colors.orange), color: stringToColor(
"#916d46"),
),
), ),
Text( Text(
'绑定引导.说明正文'.tr, '绑定引导.说明正文'.tr,
@@ -119,6 +121,8 @@ class _EPageState extends State<DeviceTypePage> {
fontSize: AppConstants() fontSize: AppConstants()
.normal_text_fontSize, .normal_text_fontSize,
letterSpacing: 0.0, letterSpacing: 0.0,
color: stringToColor(
"#916d46"),
), ),
), ),
].divide(SizedBox( ].divide(SizedBox(
@@ -226,7 +230,9 @@ class _EPageState extends State<DeviceTypePage> {
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: 26.rpx, fontSize: 26.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
color: Colors.white), color: themeController
.currentColor.sc3,
),
), ),
].divide(SizedBox(width: 22.rpx)), ].divide(SizedBox(width: 22.rpx)),
), ),
@@ -239,9 +245,8 @@ class _EPageState extends State<DeviceTypePage> {
Get.back(); // 关闭当前弹窗或页面 Get.back(); // 关闭当前弹窗或页面
}, },
colors: [ colors: [
//todo 颜色 themeController.currentColor.sc1,
stringToColor("45D989"), themeController.currentColor.sc2,
stringToColor("00C1AA")
], // 单色背景也用渐变写法 ], // 单色背景也用渐变写法
child: Container( child: Container(
@@ -300,14 +305,13 @@ class _EPageState extends State<DeviceTypePage> {
child: Scaffold( child: Scaffold(
backgroundColor: Colors.transparent, // 加上这一行 backgroundColor: Colors.transparent, // 加上这一行
appBar: AppBar( appBar: AppBar(
backgroundColor: stringToColor("#242835"), backgroundColor: themeController.currentColor.sc17,
// backgroundColor: Colors.transparent, // backgroundColor: Colors.transparent,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: Colors.white), iconTheme: IconThemeData(color: themeController.currentColor.sc3),
titleSpacing: 0, titleSpacing: 0,
// leading: returnIconButtom, // leading: returnIconButtom,
title: Container( title: Container(
// color: Colors.grey,
width: double.infinity, width: double.infinity,
height: 180.rpx, height: 180.rpx,
child: Stack( child: Stack(
@@ -318,7 +322,7 @@ class _EPageState extends State<DeviceTypePage> {
'设备列表', '设备列表',
style: FlutterFlowTheme.of(context).bodyMedium.override( style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx, fontSize: 30.rpx,
), ),
@@ -391,7 +395,7 @@ class _EPageState extends State<DeviceTypePage> {
} }
} }
}, },
colors: [stringToColor("#242835")], // 背景色 colors: [themeController.currentColor.sc17], // 背景色
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: MediaQuery.sizeOf(context).height * 0.135, height: MediaQuery.sizeOf(context).height * 0.135,

View File

@@ -1,11 +1,10 @@
import 'dart:async'; import 'dart:async';
import 'package:easydevice/easydevice.dart';
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appConstants.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/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/CustomCard.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/person/person_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.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'; import 'package:vbvs_app/pages/common/selectDialog.dart';
class WifiPage extends StatefulWidget { class WifiPage extends StatefulWidget {
// ble.ConnectedDeviceProp connectedDeviceProp; BLEDevice bleDevice;
BluetoothDevice bluetoothDevice; WifiPage({super.key, required this.bleDevice});
// WifiPage({super.key, required this.connectedDeviceProp}); // WifiPage({super.key});
WifiPage({super.key, required this.bluetoothDevice});
@override @override
State<WifiPage> createState() => _WifiPageState(); State<WifiPage> createState() => _WifiPageState();
@@ -33,12 +30,10 @@ class _WifiPageState extends State<WifiPage> {
BlueteethBindController blueteethBindController = Get.find(); BlueteethBindController blueteethBindController = Get.find();
PersonController personController = Get.find(); PersonController personController = Get.find();
ThemeController themeController = Get.find(); ThemeController themeController = Get.find();
late ble.ConnectedDeviceProp connectedDeviceProp;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
connectToDevice(widget.bluetoothDevice);
// connectedDeviceProp = widget.connectedDeviceProp; // connectedDeviceProp = widget.connectedDeviceProp;
Timer(const Duration(microseconds: 100), () { Timer(const Duration(microseconds: 100), () {
getWifiList(); getWifiList();
@@ -60,14 +55,12 @@ class _WifiPageState extends State<WifiPage> {
child: Scaffold( child: Scaffold(
backgroundColor: Colors.transparent, // 加上这一行 backgroundColor: Colors.transparent, // 加上这一行
appBar: AppBar( appBar: AppBar(
backgroundColor: stringToColor("#242835"), backgroundColor: themeController.currentColor.sc17,
// backgroundColor: Colors.transparent,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: Colors.white), iconTheme: IconThemeData(color: themeController.currentColor.sc3),
titleSpacing: 0, titleSpacing: 0,
// leading: returnIconButtom, // leading: returnIconButtom,
title: Container( title: Container(
// color: Colors.grey,
width: double.infinity, width: double.infinity,
height: 180.rpx, height: 180.rpx,
child: Stack( child: Stack(
@@ -78,7 +71,7 @@ class _WifiPageState extends State<WifiPage> {
'wifi页.标题'.tr, 'wifi页.标题'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override( style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx, fontSize: 30.rpx,
), ),
@@ -97,8 +90,8 @@ class _WifiPageState extends State<WifiPage> {
Get.offAllNamed("/bindDeviceSuccess"); Get.offAllNamed("/bindDeviceSuccess");
}, },
colors: [ colors: [
stringToColor("#45D989"), themeController.currentColor.sc1,
stringToColor("#00C1AA"), themeController.currentColor.sc2,
], ],
child: Container( child: Container(
width: 100.rpx, width: 100.rpx,
@@ -112,7 +105,7 @@ class _WifiPageState extends State<WifiPage> {
.titleSmall .titleSmall
.override( .override(
fontFamily: 'Inter Tight', fontFamily: 'Inter Tight',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0.0, letterSpacing: 0.0,
), ),
), ),
@@ -390,8 +383,7 @@ class _WifiPageState extends State<WifiPage> {
} }
} }
}, },
// colors: [Colors.white.withOpacity(0.06)], // 背景色 colors: [themeController.currentColor.sc17], // 背景色
colors: [stringToColor("#242835")], // 背景色
child: Container( child: Container(
width: double.infinity, width: double.infinity,
@@ -430,46 +422,12 @@ class _WifiPageState extends State<WifiPage> {
getWifiList({int time = 3}) { getWifiList({int time = 3}) {
// LoadingDialog.show("扫描WIFI列表中...", icon: LoadingDialogIcon.wifi); // LoadingDialog.show("扫描WIFI列表中...", icon: LoadingDialogIcon.wifi);
try { try {
var device = widget.bluetoothDevice; // var device = widget.bluetoothDevice;
String log = ""; // String log = "";
Function logAdd = (l) { // Function logAdd = (l) {
log += 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<RegExpMatch> 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();
});
} catch (e) { } catch (e) {
print(e); print(e);
} }

View File

@@ -9,6 +9,7 @@ import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/controller/login/login_controller.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/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/controller/user_info_controller.dart';
class LoginPage extends StatefulWidget { class LoginPage extends StatefulWidget {
@@ -22,6 +23,7 @@ class _EPageState extends State<LoginPage> {
GlobalController globalController = Get.find(); GlobalController globalController = Get.find();
UserInfoController userInfoController = Get.find(); UserInfoController userInfoController = Get.find();
LoginController loginController = Get.find(); LoginController loginController = Get.find();
ThemeController themeController = Get.find();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -53,7 +55,8 @@ class _EPageState extends State<LoginPage> {
), ),
ClickableContainer( ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色 backgroundColor: Colors.transparent, // 容器背景色
highlightColor: Colors.green, // 点击时的背景色 highlightColor:
themeController.currentColor.sc21, // 点击时的背景色
padding: padding:
EdgeInsets.zero, // 这里去掉外部的 padding避免影响点击范围 EdgeInsets.zero, // 这里去掉外部的 padding避免影响点击范围
onTap: () { onTap: () {
@@ -66,7 +69,7 @@ class _EPageState extends State<LoginPage> {
'assets/img/icon/close.svg', 'assets/img/icon/close.svg',
width: 25.rpx, width: 25.rpx,
height: 25.rpx, // 如果 SVG 中没有固定颜色,使用 color 设置 height: 25.rpx, // 如果 SVG 中没有固定颜色,使用 color 设置
color: Colors.white, // 这里设置了颜色 color: themeController.currentColor.sc3,
), ),
), ),
), ),
@@ -96,7 +99,8 @@ class _EPageState extends State<LoginPage> {
fontSize: 48.rpx, fontSize: 48.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
//todo 颜色 //todo 颜色
color: stringToColor("#FFFFFF"), color: themeController
.currentColor.sc3,
), ),
), ),
), ),
@@ -122,7 +126,8 @@ class _EPageState extends State<LoginPage> {
fontSize: 30.rpx, fontSize: 30.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
//todo 颜色 //todo 颜色
color: stringToColor("#FFFFFF"), color: themeController
.currentColor.sc3,
), ),
), ),
), ),
@@ -148,7 +153,8 @@ class _EPageState extends State<LoginPage> {
fontSize: 48.rpx, fontSize: 48.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
//todo 颜色 //todo 颜色
color: stringToColor("#FFFFFF"), color: themeController
.currentColor.sc3,
), ),
), ),
), ),
@@ -162,8 +168,8 @@ class _EPageState extends State<LoginPage> {
borderRadius: AppConstants() borderRadius: AppConstants()
.button_container_radius, // 圆角半径 .button_container_radius, // 圆角半径
onTap: () { onTap: () {
bool agree = loginController bool agree =
.model.register_agree!; loginController.model.register_agree!;
if (!agree) { if (!agree) {
print('未授权 ...'); print('未授权 ...');
} else { } else {
@@ -172,8 +178,8 @@ class _EPageState extends State<LoginPage> {
}, },
colors: [ colors: [
//todo 颜色 //todo 颜色
stringToColor("45D989"), themeController.currentColor.sc1,
stringToColor("00C1AA") themeController.currentColor.sc2,
], // 渐变色是同一个色,也可以根据需要调整 ], // 渐变色是同一个色,也可以根据需要调整
child: Container( child: Container(
@@ -197,7 +203,8 @@ class _EPageState extends State<LoginPage> {
.bodyMedium .bodyMedium
.override( .override(
//todo 颜色 //todo 颜色
color: Colors.white, color: themeController
.currentColor.sc3,
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: AppConstants() fontSize: AppConstants()
.normal_text_fontSize, .normal_text_fontSize,
@@ -216,7 +223,8 @@ class _EPageState extends State<LoginPage> {
), ),
ClickableContainer( ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色 backgroundColor: Colors.transparent, // 容器背景色
highlightColor: Colors.orange, // 点击时的背景色 highlightColor: themeController
.currentColor.sc21, // 点击时的背景色
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
16.rpx, 10.rpx, 16.rpx, 10.rpx), 16.rpx, 10.rpx, 16.rpx, 10.rpx),
onTap: () { onTap: () {
@@ -228,7 +236,7 @@ class _EPageState extends State<LoginPage> {
style: TextStyle( style: TextStyle(
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: 26.rpx, fontSize: 26.rpx,
color: Colors.white, color: themeController.currentColor.sc3,
), ),
), ),
), ),
@@ -414,8 +422,7 @@ class _EPageState extends State<LoginPage> {
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: 26.rpx, fontSize: 26.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
//todo 颜色 color: themeController.currentColor.sc3,
color: stringToColor("#FFFFFF"),
), ),
), ),
), ),

View File

@@ -1,17 +1,24 @@
import 'dart:io';
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appConstants.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/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/CustomCard.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/login/login_controller.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/time/countdown_controller.dart'; import 'package:vbvs_app/controller/time/countdown_controller.dart';
import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/model/api_response.dart';
class OtherLoginPage extends StatefulWidget { class OtherLoginPage extends StatefulWidget {
const OtherLoginPage({super.key}); const OtherLoginPage({super.key});
@@ -57,7 +64,8 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
), ),
ClickableContainer( ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色 backgroundColor: Colors.transparent, // 容器背景色
highlightColor: Colors.green, // 点击时的背景色 highlightColor:
themeController.currentColor.sc21, // 点击时的背景色
padding: padding:
EdgeInsets.zero, // 这里去掉外部的 padding避免影响点击范围 EdgeInsets.zero, // 这里去掉外部的 padding避免影响点击范围
onTap: () { onTap: () {
@@ -70,7 +78,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
'assets/img/icon/arrow_left.svg', 'assets/img/icon/arrow_left.svg',
width: 25.rpx, width: 25.rpx,
height: 25.rpx, // 如果 SVG 中没有固定颜色,使用 color 设置 height: 25.rpx, // 如果 SVG 中没有固定颜色,使用 color 设置
color: Colors.white, // 这里设置了颜色 color: themeController.currentColor.sc3,
), ),
), ),
), ),
@@ -99,8 +107,8 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: 48.rpx, fontSize: 48.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
//todo 颜色 color: themeController
color: stringToColor("#FFFFFF"), .currentColor.sc3,
), ),
), ),
), ),
@@ -125,8 +133,8 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: 30.rpx, fontSize: 30.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
//todo 颜色 color: themeController
color: stringToColor("#FFFFFF"), .currentColor.sc3,
), ),
), ),
), ),
@@ -147,7 +155,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
AppConstants() AppConstants()
.button_container_radius), .button_container_radius),
border: Border.all( border: Border.all(
color: Colors.white, color: themeController.currentColor.sc3,
width: 1.rpx, width: 1.rpx,
), ),
), ),
@@ -168,6 +176,10 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
alignment: alignment:
AlignmentDirectional(-1, 0), AlignmentDirectional(-1, 0),
child: TextFormField( child: TextFormField(
onChanged: (value) {
loginController
.model.phone = value;
},
autofocus: false, autofocus: false,
obscureText: false, obscureText: false,
decoration: InputDecoration( decoration: InputDecoration(
@@ -285,7 +297,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
AppConstants() AppConstants()
.button_container_radius), .button_container_radius),
border: Border.all( border: Border.all(
color: Colors.white, color: themeController.currentColor.sc3,
width: 1.rpx, width: 1.rpx,
), ),
), ),
@@ -306,6 +318,10 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
alignment: alignment:
AlignmentDirectional(-1, 0), AlignmentDirectional(-1, 0),
child: TextFormField( child: TextFormField(
onChanged: (value) {
loginController.model.code =
value;
},
autofocus: false, autofocus: false,
obscureText: false, obscureText: false,
decoration: InputDecoration( decoration: InputDecoration(
@@ -418,21 +434,6 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.currentColor.sc7, .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(() { Obx(() {
final CountdownController final CountdownController
countdownController = countdownController =
@@ -440,18 +441,51 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
CountdownController>(); CountdownController>();
return InkWell( return InkWell(
onTap: () async { onTap: () async {
try {
await DailyLogUtils
.writeLog(
"点击获取验证码");
if (countdownController if (countdownController
.countdown .countdown
.value != .value !=
0) { 0) {
return; return;
} }
ApiResponse
String msg = apiResponse =
await loginController await loginController
.getCode(context); .getCode(
if (msg.isNotEmpty) { context);
if (apiResponse.code !=
HttpStatusCodes.ok) {
TopSlideNotification
.show(
context,
text: apiResponse
.msg!,
textColor:
themeController
.currentColor
.sc9,
);
await DailyLogUtils
.writeLog(
"获取验证码成功,${apiResponse}");
return; return;
} else {
TopSlideNotification
.show(
context,
text: apiResponse
.msg!,
textColor:
themeController
.currentColor
.sc2,
);
await DailyLogUtils
.writeLog(
"获取验证码失败,${apiResponse}");
} }
countdownController countdownController
.countdown .countdown
@@ -462,6 +496,15 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
AppConstants AppConstants
.code_time) .code_time)
: null; : null;
} catch (e) {
await DailyLogUtils
.writeLog(
"获取验证码异常,${e}");
edm.EasyDartModule
.logger
.info(
"获取验证码异常:${e}");
}
}, },
child: Container( child: Container(
alignment: alignment:
@@ -475,13 +518,14 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.countdown .countdown
.value == .value ==
0 0
? '获取验证码' ? '其他手机登录页.获取验证码'.tr
: '${countdownController.countdown.value}', : '${countdownController.countdown.value}' +
"其他手机登录页.秒".tr,
style: TextStyle( style: TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
color: color: themeController
Color(0xFF333333), .currentColor.sc2,
fontSize: AppConstants() fontSize: AppConstants()
.title_text_fontSize, .title_text_fontSize,
letterSpacing: 0, letterSpacing: 0,
@@ -505,25 +549,53 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
child: CustomCard( child: CustomCard(
borderRadius: AppConstants() borderRadius: AppConstants()
.button_container_radius, // 圆角半径 .button_container_radius, // 圆角半径
onTap: () { onTap: () async {
try {
await DailyLogUtils.writeLog("点击登录");
bool agree = bool agree =
loginController.model.register_agree!; loginController.model.register_agree!;
if (!agree) { if (!agree) {
print('未授权 ...'); TopSlideNotification.show(
context,
text: "登录页.未同意协议".tr,
textColor:
themeController.currentColor.sc9,
);
} else { } else {
print('已授权 ...'); 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: [ colors: [
//todo 颜色 themeController.currentColor.sc1,
stringToColor("45D989"), themeController.currentColor.sc2,
stringToColor("00C1AA") ],
], // 渐变色是同一个色,也可以根据需要调整
child: Container( child: Container(
width: width: bodysize.maxWidth,
// MediaQuery.sizeOf(context).width * 0.66,
bodysize.maxWidth,
height: MediaQuery.sizeOf(context).height * height: MediaQuery.sizeOf(context).height *
0.055, 0.055,
constraints: BoxConstraints( constraints: BoxConstraints(
@@ -540,8 +612,8 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
style: FlutterFlowTheme.of(context) style: FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
//todo 颜色 color: themeController
color: Colors.white, .currentColor.sc3,
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: AppConstants() fontSize: AppConstants()
.normal_text_fontSize, .normal_text_fontSize,
@@ -604,7 +676,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.secondaryText, .secondaryText,
), ),
activeColor: activeColor:
stringToColor("#FF9F66"), stringToColor("#FF9F66"), //固定
checkColor: checkColor:
FlutterFlowTheme.of(context) FlutterFlowTheme.of(context)
.info, .info,
@@ -633,8 +705,8 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
fontFamily: 'Inter', fontFamily: 'Inter',
letterSpacing: 0.0, letterSpacing: 0.0,
fontSize: 26.rpx, fontSize: 26.rpx,
color: Colors color: themeController
.white, // 可以调整为你想要的颜色 .currentColor.sc3,
), ),
), ),
TextSpan( TextSpan(
@@ -659,8 +731,8 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
fontFamily: 'Inter', fontFamily: 'Inter',
letterSpacing: 0.0, letterSpacing: 0.0,
fontSize: 26.rpx, fontSize: 26.rpx,
color: Colors color: themeController
.white, // 可以调整为你想要的颜色 .currentColor.sc3,
), ),
), ),
TextSpan( TextSpan(
@@ -685,8 +757,8 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
fontFamily: 'Inter', fontFamily: 'Inter',
letterSpacing: 0.0, letterSpacing: 0.0,
fontSize: 26.rpx, fontSize: 26.rpx,
color: Colors color: themeController
.white, // 可以调整为你想要的颜色 .currentColor.sc3,
), ),
), ),
TextSpan( TextSpan(
@@ -737,8 +809,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: 26.rpx, fontSize: 26.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
//todo 颜色 color: themeController.currentColor.sc3,
color: stringToColor("#FFFFFF"),
), ),
), ),
), ),

View File

@@ -19,60 +19,6 @@ class _EPageState extends State<EPage> {
builder: (context, boxConstraints) => GestureDetector( builder: (context, boxConstraints) => GestureDetector(
onTap: () => FocusScope.of(context).unfocus(), onTap: () => FocusScope.of(context).unfocus(),
child: Scaffold( 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( body: SafeArea(
top: true, top: true,

View File

@@ -111,11 +111,17 @@ class _HomePageState extends State<HomePage> {
children: [ children: [
Text( Text(
"飞行的鱼", "飞行的鱼",
style: TextStyle(color: Colors.white), style: TextStyle(
color: themeController
.currentColor.sc3,
),
), ),
Text( Text(
"嘉兴 晴", "嘉兴 晴",
style: TextStyle(color: Colors.white), style: TextStyle(
color: themeController
.currentColor.sc3,
),
), ),
], ],
), ),
@@ -138,7 +144,8 @@ class _HomePageState extends State<HomePage> {
19.rpx, 34.rpx, 0, 21.rpx), 19.rpx, 34.rpx, 0, 21.rpx),
child: ClickableContainer( child: ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色 backgroundColor: Colors.transparent, // 容器背景色
highlightColor: Colors.orange, // 点击时的背景色 highlightColor:
themeController.currentColor.sc21, // 点击时的背景色
onTap: () { onTap: () {
print('点击了容器'); print('点击了容器');
}, },
@@ -194,7 +201,7 @@ class _HomePageState extends State<HomePage> {
'assets/img/icon/arrow_right.svg', 'assets/img/icon/arrow_right.svg',
width: 14.rpx, width: 14.rpx,
height: 14.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 height: 14.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color: Colors.white, color: themeController.currentColor.sc3,
), ),
), ),
); );
@@ -203,7 +210,10 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
), ),
Container( Obx(() {
return Visibility(
visible: userInfoController.model.login == 0,
child: Container(
//未绑定布局 //未绑定布局
width: MediaQuery.sizeOf(context).width, width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.277, height: MediaQuery.sizeOf(context).height * 0.277,
@@ -214,7 +224,8 @@ class _HomePageState extends State<HomePage> {
decoration: BoxDecoration( decoration: BoxDecoration(
color: themeController.currentColor.sc5, color: themeController.currentColor.sc5,
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
AppConstants().normal_container_radius), // 圆角半径 AppConstants()
.normal_container_radius), // 圆角半径
), ),
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@@ -233,17 +244,19 @@ class _HomePageState extends State<HomePage> {
], ],
child: Container( child: Container(
width: width: MediaQuery.sizeOf(context).width *
MediaQuery.sizeOf(context).width * 0.66, 0.66,
height: height:
MediaQuery.sizeOf(context).height * 0.055, MediaQuery.sizeOf(context).height *
0.055,
constraints: BoxConstraints( constraints: BoxConstraints(
minWidth: 500.rpx, minWidth: 500.rpx,
minHeight: 90.rpx, minHeight: 90.rpx,
), ),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment:
MainAxisAlignment.center,
children: [ children: [
SvgPicture.asset( SvgPicture.asset(
'assets/img/icon/scan.svg', 'assets/img/icon/scan.svg',
@@ -283,25 +296,28 @@ class _HomePageState extends State<HomePage> {
], // 渐变色是同一个色,也可以根据需要调整 ], // 渐变色是同一个色,也可以根据需要调整
child: Container( child: Container(
width: width: MediaQuery.sizeOf(context).width *
MediaQuery.sizeOf(context).width * 0.66, 0.66,
height: height:
MediaQuery.sizeOf(context).height * 0.055, MediaQuery.sizeOf(context).height *
0.055,
constraints: BoxConstraints( constraints: BoxConstraints(
minWidth: 500.rpx, minWidth: 500.rpx,
minHeight: 90.rpx, minHeight: 90.rpx,
), ),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment:
MainAxisAlignment.center,
children: [ children: [
SvgPicture.asset( SvgPicture.asset(
'assets/img/icon/bluetooth.svg', 'assets/img/icon/bluetooth.svg',
width: 25.rpx, width: 25.rpx,
height: 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 height:
25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
//todo 颜色 //todo 颜色
color: color: themeController
themeController.currentColor.sc16, .currentColor.sc16,
), ),
Text( Text(
'首页.蓝牙绑定'.tr, '首页.蓝牙绑定'.tr,
@@ -328,15 +344,21 @@ class _HomePageState extends State<HomePage> {
)), )),
), ),
), ),
Padding( );
}),
Obx(() {
return Visibility(
visible: userInfoController.model.login == 0,
child: Padding(
//未绑定标语 //未绑定标语
padding: padding: EdgeInsetsDirectional.fromSTEB(
EdgeInsetsDirectional.fromSTEB(0, 26.rpx, 0, 0), 0, 26.rpx, 0, 0),
child: Container( child: Container(
width: MediaQuery.sizeOf(context).width, width: MediaQuery.sizeOf(context).width,
decoration: BoxDecoration( decoration: BoxDecoration(
color: themeController.currentColor.sc6, color: themeController.currentColor.sc6,
borderRadius: BorderRadius.circular(AppConstants() borderRadius: BorderRadius.circular(
AppConstants()
.normal_container_radius), // 圆角半径 .normal_container_radius), // 圆角半径
), ),
child: Padding( child: Padding(
@@ -344,7 +366,8 @@ class _HomePageState extends State<HomePage> {
25.rpx, 25.rpx, 25.rpx, 25.rpx), 25.rpx, 25.rpx, 25.rpx, 25.rpx),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
@@ -352,9 +375,9 @@ class _HomePageState extends State<HomePage> {
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/img/icon/sound.svg', 'assets/img/icon/sound.svg',
width: 30.rpx, width: 30.rpx,
height: 30.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 height:
//todo 颜色 30.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color: stringToColor("#FF9F66"), color: stringToColor("#FF9F66"), //固定
), ),
), ),
Expanded( Expanded(
@@ -365,21 +388,24 @@ class _HomePageState extends State<HomePage> {
children: [ children: [
Text( Text(
'首页.提示标题'.tr, '首页.提示标题'.tr,
style: FlutterFlowTheme.of(context) style:
FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: AppConstants() fontSize: AppConstants()
.normal_text_fontSize, .normal_text_fontSize,
letterSpacing: 0.0, letterSpacing: 0.0,
fontWeight: FontWeight.w900, fontWeight:
//todo 配置颜色 FontWeight.w900,
color: color: stringToColor(
stringToColor("#916D46")), "#916D46"), //固定
),
), ),
Text( Text(
'首页.提示内容1'.tr, '首页.提示内容1'.tr,
style: FlutterFlowTheme.of(context) style:
FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
@@ -387,25 +413,28 @@ class _HomePageState extends State<HomePage> {
.normal_text_fontSize, .normal_text_fontSize,
letterSpacing: 0.0, letterSpacing: 0.0,
//todo 配置颜色 //todo 配置颜色
color: color: stringToColor(
stringToColor("#916D46")), "#916D46"), //固定
),
), ),
Text( Text(
'首页.提示内容2'.tr, '首页.提示内容2'.tr,
style: FlutterFlowTheme.of(context) style:
FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: AppConstants() fontSize: AppConstants()
.normal_text_fontSize, .normal_text_fontSize,
letterSpacing: 0.0, letterSpacing: 0.0,
//todo 配置颜色 color: stringToColor(
color: "#916D46"), //固定
stringToColor("#916D46")), ),
), ),
Text( Text(
'首页.提示内容3'.tr, '首页.提示内容3'.tr,
style: FlutterFlowTheme.of(context) style:
FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
@@ -413,8 +442,9 @@ class _HomePageState extends State<HomePage> {
.normal_text_fontSize, .normal_text_fontSize,
letterSpacing: 0.0, letterSpacing: 0.0,
//todo 配置颜色 //todo 配置颜色
color: color: stringToColor(
stringToColor("#916D46")), "#916D46"), //固定
),
), ),
].divide(SizedBox( ].divide(SizedBox(
height: AppConstants() height: AppConstants()
@@ -426,28 +456,33 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
), ),
Padding( );
padding: }),
EdgeInsetsDirectional.fromSTEB(0, 26.rpx, 0, 0), Obx(() {
return Visibility(
visible: userInfoController.model.login == 1,
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 26.rpx, 0, 0),
child: Container( child: Container(
// color: Colors.red,
width: bodySize.maxWidth, width: bodySize.maxWidth,
height: bodySize.maxHeight * 0.107, height: bodySize.maxHeight * 0.107,
constraints: BoxConstraints( constraints: BoxConstraints(
minHeight: 240.rpx, minHeight: 240.rpx,
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
ClickableContainer( ClickableContainer(
backgroundColor: backgroundColor:
themeController.currentColor.sc5, themeController.currentColor.sc5,
highlightColor: highlightColor:
themeController.currentColor.sc3, themeController.currentColor.sc3,
borderRadius: borderRadius: AppConstants()
AppConstants().normal_container_radius, .normal_container_radius,
padding: padding: EdgeInsets
EdgeInsets.zero, // 原始Container没有padding .zero, // 原始Container没有padding
onTap: () { onTap: () {
// 点击逻辑放这里 // 点击逻辑放这里
}, },
@@ -483,8 +518,8 @@ class _HomePageState extends State<HomePage> {
themeController.currentColor.sc5, themeController.currentColor.sc5,
highlightColor: highlightColor:
themeController.currentColor.sc3, themeController.currentColor.sc3,
borderRadius: borderRadius: AppConstants()
AppConstants().normal_container_radius, .normal_container_radius,
padding: EdgeInsets padding: EdgeInsets
.zero, // 原本的Container没有 padding这里设置为 zero .zero, // 原本的Container没有 padding这里设置为 zero
onTap: () { onTap: () {
@@ -513,8 +548,10 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
] ]
.addToStart(SizedBox(height: 32.rpx)) .addToStart(
.addToEnd(SizedBox(height: 32.rpx)), SizedBox(height: 32.rpx))
.addToEnd(
SizedBox(height: 32.rpx)),
), ),
), ),
), ),
@@ -522,8 +559,13 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
), ),
);
}),
// Generated code for this Container Widget... // Generated code for this Container Widget...
Padding( Obx(() {
return Visibility(
visible: userInfoController.model.login == 1,
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
0, 25.rpx, 0, 25.rpx), 0, 25.rpx, 0, 25.rpx),
child: Container( child: Container(
@@ -548,7 +590,8 @@ class _HomePageState extends State<HomePage> {
children: [ children: [
Text( Text(
'次卧/1201/李小北', '次卧/1201/李小北',
style: FlutterFlowTheme.of(context) style:
FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
@@ -563,8 +606,8 @@ class _HomePageState extends State<HomePage> {
children: [ children: [
Text( Text(
'首页.报告详情'.tr, '首页.报告详情'.tr,
style: style: FlutterFlowTheme.of(
FlutterFlowTheme.of(context) context)
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
@@ -575,17 +618,21 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
Padding( Padding(
padding: EdgeInsetsDirectional padding:
.fromSTEB(0, 6.rpx, 0, 0.rpx), EdgeInsetsDirectional
.fromSTEB(0, 6.rpx,
0, 0.rpx),
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/img/icon/arrow_right.svg', 'assets/img/icon/arrow_right.svg',
width: 14.rpx, width: 14.rpx,
height: 14 height: 14
.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 .rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color: Colors.white, color: themeController
.currentColor.sc3,
), ),
), ),
].divide(SizedBox(width: 22.rpx)), ].divide(
SizedBox(width: 22.rpx)),
), ),
], ],
), ),
@@ -624,7 +671,8 @@ class _HomePageState extends State<HomePage> {
SleepDataModuleWidget(), SleepDataModuleWidget(),
SleepDataModuleWidget(), SleepDataModuleWidget(),
].divide(SizedBox( ].divide(SizedBox(
width: 14.rpx)), // ✅ 这里加了 .rpx width:
14.rpx)), // ✅ 这里加了 .rpx
), ),
), ),
), ),
@@ -632,7 +680,8 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
), ),
) ));
}),
], ],
), ),
), ),

View File

@@ -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/home_page.dart';
import 'package:vbvs_app/pages/main_bottom/message_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/mine_page.dart';
import 'package:vbvs_app/pages/main_bottom/sleep_report_page.dart';
class MainPageBottomChange extends GetView<MainPageController> { class MainPageBottomChange extends GetView<MainPageController> {
GlobalController globalController = Get.find(); GlobalController globalController = Get.find();
@@ -35,17 +34,6 @@ class MainPageBottomChange extends GetView<MainPageController> {
height: 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( activeIcon: Padding(
padding: EdgeInsets.only(bottom: 6.rpx), padding: EdgeInsets.only(bottom: 6.rpx),
child: isEmpty child: isEmpty

View File

@@ -19,61 +19,6 @@ class _MessagePageState extends State<MessagePage> {
builder: (context, boxConstraints) => GestureDetector( builder: (context, boxConstraints) => GestureDetector(
onTap: () => FocusScope.of(context).unfocus(), onTap: () => FocusScope.of(context).unfocus(),
child: Scaffold( 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( body: SafeArea(
top: true, top: true,
child: Text("消息"), child: Text("消息"),

View File

@@ -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/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.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/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/controller/user_info_controller.dart';
class MinePage extends StatefulWidget { class MinePage extends StatefulWidget {
@@ -20,72 +22,37 @@ class MinePage extends StatefulWidget {
class _MinePageState extends State<MinePage> { class _MinePageState extends State<MinePage> {
GlobalController globalController = Get.find(); GlobalController globalController = Get.find();
UserInfoController userInfoController = Get.find(); UserInfoController userInfoController = Get.find();
ThemeController themeController = Get.find();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: stringToColor("#242835"), // 这里设置你希望的颜色 statusBarColor: Colors.transparent, // 这里设置你希望的颜色
statusBarIconBrightness: Brightness.light, // 状态栏图标的亮度 statusBarIconBrightness: Brightness.light, // 状态栏图标的亮度
)); ));
return LayoutBuilder( return LayoutBuilder(
builder: (context, bodySize) => GestureDetector( builder: (context, bodySize) => GestureDetector(
onTap: () => FocusScope.of(context).unfocus(), 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( child: Container(
height: bodySize.maxHeight,
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage('assets/img/bgImage.png'), // 本地图片 image: AssetImage('assets/img/bgImage.png'), // 本地图片
fit: BoxFit.fill, // 填满整个 Container fit: BoxFit.fill, // 填满整个 Container
), ),
), ),
child: Scaffold(
backgroundColor: Colors.transparent,
body: SafeArea(
top: true,
child: Container(
height: bodySize.maxHeight,
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
Container( Container(
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFF242835), color: Colors.transparent,
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
bottomLeft: Radius.circular( bottomLeft: Radius.circular(
AppConstants().normal_container_radius), AppConstants().normal_container_radius),
@@ -96,14 +63,14 @@ class _MinePageState extends State<MinePage> {
), ),
), ),
child: Padding( child: Padding(
padding: padding: EdgeInsetsDirectional.fromSTEB(
EdgeInsetsDirectional.fromSTEB(64.rpx, 0, 37.rpx, 0), 64.rpx, 0, 37.rpx, 0),
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
Padding( Padding(
padding: padding: EdgeInsetsDirectional.fromSTEB(
EdgeInsetsDirectional.fromSTEB(0, 65.rpx, 0, 0), 0, 65.rpx, 0, 0),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
@@ -112,13 +79,35 @@ class _MinePageState extends State<MinePage> {
'assets/img/icon/earphone.svg', 'assets/img/icon/earphone.svg',
width: 29.rpx, width: 29.rpx,
height: 29.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 height: 29.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color: Colors.white, color: themeController.currentColor.sc3,
), ),
SvgPicture.asset( // 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', 'assets/img/icon/setting.svg',
width: 29.rpx, width: 29.rpx,
height: 29.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 height: 29
color: Colors.white, .rpx, // 如果 SVG 中没有固定颜色,使用 color 设置
color: themeController.currentColor.sc3,
),
),
), ),
].divide(SizedBox(width: 60.rpx)), ].divide(SizedBox(width: 60.rpx)),
), ),
@@ -128,7 +117,8 @@ class _MinePageState extends State<MinePage> {
0, 50.rpx, 0, 66.rpx), 0, 50.rpx, 0, 66.rpx),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
Row( Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@@ -156,7 +146,8 @@ class _MinePageState extends State<MinePage> {
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
color: Colors.white, color: themeController
.currentColor.sc3,
fontSize: AppConstants() fontSize: AppConstants()
.title_text_fontSize, .title_text_fontSize,
letterSpacing: 0.0, letterSpacing: 0.0,
@@ -168,7 +159,8 @@ class _MinePageState extends State<MinePage> {
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
color: stringToColor("#C8C9CC"), color: themeController
.currentColor.sc3,
fontSize: AppConstants() fontSize: AppConstants()
.normal_text_fontSize, .normal_text_fontSize,
letterSpacing: 0.0, letterSpacing: 0.0,
@@ -178,7 +170,14 @@ class _MinePageState extends State<MinePage> {
), ),
].divide(SizedBox(width: 35.rpx)), ].divide(SizedBox(width: 35.rpx)),
), ),
Row( CustomCard(
borderRadius: 0,
onTap: () {
Get.toNamed("/updateUserPage");
},
// colors: [themeController.currentColor.sc5],
colors: [Colors.transparent],
child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
Text( Text(
@@ -187,24 +186,29 @@ class _MinePageState extends State<MinePage> {
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
color: Color(0xFFE0E4E6), color: themeController
.currentColor.sc3,
fontSize: AppConstants() fontSize: AppConstants()
.normal_text_fontSize, .normal_text_fontSize,
letterSpacing: 0.0, letterSpacing: 0.0,
), ),
), ),
Padding( Padding(
padding: EdgeInsetsDirectional.fromSTEB( padding:
EdgeInsetsDirectional.fromSTEB(
0, 6.rpx, 0, 0.rpx), 0, 6.rpx, 0, 0.rpx),
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/img/icon/arrow_right.svg', 'assets/img/icon/arrow_right.svg',
width: 14.rpx, width: 14.rpx,
height: 14.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 height:
color: Colors.white, 14.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color: themeController
.currentColor.sc3,
), ),
), ),
].divide(SizedBox(width: 16.rpx)), ].divide(SizedBox(width: 16.rpx)),
), ),
),
], ],
), ),
), ),
@@ -224,17 +228,18 @@ class _MinePageState extends State<MinePage> {
), ),
child: Padding( child: Padding(
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
45.rpx, 0, 45.rpx, 0), 0.rpx, 0, 0.rpx, 0),
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
ClickableContainer( ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色 backgroundColor: Colors.transparent, // 容器背景色
highlightColor: Colors.orange, // 点击时的背景色 highlightColor: themeController
.currentColor.sc21, // 点击时的背景色
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0.rpx, 0.rpx, 0.rpx), 40.rpx, 0.rpx, 40.rpx, 0.rpx),
onTap: () { onTap: () {
print('点击了容器'); Get.toNamed("/deviceType",arguments:1);
}, },
child: Container( child: Container(
child: Padding( child: Padding(
@@ -251,17 +256,19 @@ class _MinePageState extends State<MinePage> {
SvgPicture.asset( SvgPicture.asset(
'assets/img/icon/my_device.svg', 'assets/img/icon/my_device.svg',
width: 25.rpx, width: 25.rpx,
height: height: 25
25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 .rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color: stringToColor("#00C1AA"), color: stringToColor("#00C1AA"),
), ),
Text( Text(
'我的.我的设备'.tr, '我的.我的设备'.tr,
style: FlutterFlowTheme.of(context) style:
FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
color: Color(0xFFE0E2E4), color: themeController
.currentColor.sc3,
fontSize: AppConstants() fontSize: AppConstants()
.title_text_fontSize, .title_text_fontSize,
letterSpacing: 0.0, letterSpacing: 0.0,
@@ -272,8 +279,10 @@ class _MinePageState extends State<MinePage> {
SvgPicture.asset( SvgPicture.asset(
'assets/img/icon/arrow_right.svg', 'assets/img/icon/arrow_right.svg',
width: 8.rpx, width: 8.rpx,
height: 15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 height:
color: Colors.white, 15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color:
themeController.currentColor.sc3,
), ),
], ],
), ),
@@ -282,7 +291,8 @@ class _MinePageState extends State<MinePage> {
), ),
ClickableContainer( ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色 backgroundColor: Colors.transparent, // 容器背景色
highlightColor: Colors.orange, // 点击时的背景色 highlightColor: themeController
.currentColor.sc21, // 点击时的背景色
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0.rpx, 0.rpx, 0.rpx), 0.rpx, 0.rpx, 0.rpx, 0.rpx),
onTap: () { onTap: () {
@@ -291,7 +301,7 @@ class _MinePageState extends State<MinePage> {
child: Container( child: Container(
child: Padding( child: Padding(
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 20.rpx, 0.rpx, 20.rpx), 40.rpx, 20.rpx, 40.rpx, 20.rpx),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: mainAxisAlignment:
@@ -303,17 +313,19 @@ class _MinePageState extends State<MinePage> {
SvgPicture.asset( SvgPicture.asset(
'assets/img/icon/device_repair.svg', 'assets/img/icon/device_repair.svg',
width: 25.rpx, width: 25.rpx,
height: height: 25
25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 .rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color: stringToColor("#00C1AA"), color: stringToColor("#00C1AA"),
), ),
Text( Text(
'我的.设备报修'.tr, '我的.设备报修'.tr,
style: FlutterFlowTheme.of(context) style:
FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
color: Color(0xFFE0E2E4), color: themeController
.currentColor.sc3,
fontSize: AppConstants() fontSize: AppConstants()
.title_text_fontSize, .title_text_fontSize,
letterSpacing: 0.0, letterSpacing: 0.0,
@@ -324,8 +336,10 @@ class _MinePageState extends State<MinePage> {
SvgPicture.asset( SvgPicture.asset(
'assets/img/icon/arrow_right.svg', 'assets/img/icon/arrow_right.svg',
width: 8.rpx, width: 8.rpx,
height: 15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 height:
color: Colors.white, 15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color:
themeController.currentColor.sc3,
), ),
], ],
), ),
@@ -334,7 +348,8 @@ class _MinePageState extends State<MinePage> {
), ),
ClickableContainer( ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色 backgroundColor: Colors.transparent, // 容器背景色
highlightColor: Colors.orange, // 点击时的背景色 highlightColor: themeController
.currentColor.sc21, // 点击时的背景色
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0.rpx, 0.rpx, 0.rpx), 0.rpx, 0.rpx, 0.rpx, 0.rpx),
onTap: () { onTap: () {
@@ -343,7 +358,7 @@ class _MinePageState extends State<MinePage> {
child: Container( child: Container(
child: Padding( child: Padding(
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 20.rpx, 0.rpx, 20.rpx), 40.rpx, 20.rpx, 40.rpx, 20.rpx),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: mainAxisAlignment:
@@ -355,17 +370,19 @@ class _MinePageState extends State<MinePage> {
SvgPicture.asset( SvgPicture.asset(
'assets/img/icon/op_ex.svg', 'assets/img/icon/op_ex.svg',
width: 25.rpx, width: 25.rpx,
height: height: 25
25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 .rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color: stringToColor("#00C1AA"), color: stringToColor("#00C1AA"),
), ),
Text( Text(
'我的.操作说明'.tr, '我的.操作说明'.tr,
style: FlutterFlowTheme.of(context) style:
FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
color: Color(0xFFE0E2E4), color: themeController
.currentColor.sc3,
fontSize: AppConstants() fontSize: AppConstants()
.title_text_fontSize, .title_text_fontSize,
letterSpacing: 0.0, letterSpacing: 0.0,
@@ -376,8 +393,10 @@ class _MinePageState extends State<MinePage> {
SvgPicture.asset( SvgPicture.asset(
'assets/img/icon/arrow_right.svg', 'assets/img/icon/arrow_right.svg',
width: 8.rpx, width: 8.rpx,
height: 14.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 height:
color: Colors.white, 14.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color:
themeController.currentColor.sc3,
), ),
], ],
), ),
@@ -386,9 +405,10 @@ class _MinePageState extends State<MinePage> {
), ),
ClickableContainer( ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色 backgroundColor: Colors.transparent, // 容器背景色
highlightColor: Colors.orange, // 点击时的背景色 highlightColor: themeController
.currentColor.sc21, // 点击时的背景色
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0.rpx, 0.rpx, 0.rpx), 40.rpx, 0.rpx, 40.rpx, 0.rpx),
onTap: () { onTap: () {
print('点击了容器'); print('点击了容器');
}, },
@@ -407,17 +427,19 @@ class _MinePageState extends State<MinePage> {
SvgPicture.asset( SvgPicture.asset(
'assets/img/icon/like.svg', 'assets/img/icon/like.svg',
width: 25.rpx, width: 25.rpx,
height: height: 25
25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 .rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color: stringToColor("#00C1AA"), color: stringToColor("#00C1AA"),
), ),
Text( Text(
'关注我们'.tr, '关注我们'.tr,
style: FlutterFlowTheme.of(context) style:
FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
color: Color(0xFFE0E2E4), color: themeController
.currentColor.sc3,
fontSize: AppConstants() fontSize: AppConstants()
.title_text_fontSize, .title_text_fontSize,
letterSpacing: 0.0, letterSpacing: 0.0,
@@ -428,8 +450,10 @@ class _MinePageState extends State<MinePage> {
SvgPicture.asset( SvgPicture.asset(
'assets/img/icon/arrow_right.svg', 'assets/img/icon/arrow_right.svg',
width: 8.rpx, width: 8.rpx,
height: 15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 height:
color: Colors.white, 15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color:
themeController.currentColor.sc3,
), ),
], ],
), ),
@@ -438,9 +462,10 @@ class _MinePageState extends State<MinePage> {
), ),
ClickableContainer( ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色 backgroundColor: Colors.transparent, // 容器背景色
highlightColor: Colors.orange, // 点击时的背景色 highlightColor: themeController
.currentColor.sc21, // 点击时的背景色
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0.rpx, 0.rpx, 0.rpx), 40.rpx, 0.rpx, 40.rpx, 0.rpx),
onTap: () { onTap: () {
print('点击了容器'); print('点击了容器');
}, },
@@ -459,17 +484,19 @@ class _MinePageState extends State<MinePage> {
SvgPicture.asset( SvgPicture.asset(
'assets/img/icon/version.svg', 'assets/img/icon/version.svg',
width: 25.rpx, width: 25.rpx,
height: height: 25
25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 .rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color: stringToColor("#00C1AA"), color: stringToColor("#00C1AA"),
), ),
Text( Text(
'我的.当前版本'.tr, '我的.当前版本'.tr,
style: FlutterFlowTheme.of(context) style:
FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
color: Color(0xFFE0E2E4), color: themeController
.currentColor.sc3,
fontSize: AppConstants() fontSize: AppConstants()
.title_text_fontSize, .title_text_fontSize,
letterSpacing: 0.0, letterSpacing: 0.0,
@@ -481,12 +508,14 @@ class _MinePageState extends State<MinePage> {
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
Text( Text(
'3.61.0', '1.0.0',
style: FlutterFlowTheme.of(context) style:
FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
color: Color(0xFFD9E3EB), color:
Color(0xFFD9E3EB),
fontSize: 26.rpx, fontSize: 26.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
), ),
@@ -494,9 +523,10 @@ class _MinePageState extends State<MinePage> {
SvgPicture.asset( SvgPicture.asset(
'assets/img/icon/arrow_right.svg', 'assets/img/icon/arrow_right.svg',
width: 8.rpx, width: 8.rpx,
height: height: 15
15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置 .rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color: Colors.white, color: themeController
.currentColor.sc3,
), ),
].divide(SizedBox(width: 28.rpx)), ].divide(SizedBox(width: 28.rpx)),
), ),
@@ -519,6 +549,7 @@ class _MinePageState extends State<MinePage> {
), ),
), ),
), ),
),
); );
} }
} }

View File

@@ -19,60 +19,6 @@ class _SleepReportPageState extends State<SleepReportPage> {
builder: (context, boxConstraints) => GestureDetector( builder: (context, boxConstraints) => GestureDetector(
onTap: () => FocusScope.of(context).unfocus(), onTap: () => FocusScope.of(context).unfocus(),
child: Scaffold( 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( body: SafeArea(
top: true, top: true,

View File

@@ -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/device/blueteeth_bind_controller.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/person/person_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/controller/user_info_controller.dart';
import 'package:vbvs_app/pages/person/select_time.dart'; import 'package:vbvs_app/pages/person/select_time.dart';
@@ -23,6 +24,7 @@ class _EPageState extends State<PersonPage> {
UserInfoController userInfoController = Get.find(); UserInfoController userInfoController = Get.find();
BlueteethBindController blueteethBindController = Get.find(); BlueteethBindController blueteethBindController = Get.find();
PersonController personController = Get.find(); PersonController personController = Get.find();
ThemeController themeController = Get.find();
@override @override
void initState() { void initState() {
@@ -44,14 +46,14 @@ class _EPageState extends State<PersonPage> {
child: Scaffold( child: Scaffold(
backgroundColor: Colors.transparent, // 加上这一行 backgroundColor: Colors.transparent, // 加上这一行
appBar: AppBar( appBar: AppBar(
backgroundColor: stringToColor("#242835"), backgroundColor: themeController.currentColor.sc17,
// backgroundColor: Colors.transparent,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: Colors.white), iconTheme: IconThemeData(
color: themeController.currentColor.sc3,
),
titleSpacing: 0, titleSpacing: 0,
// leading: returnIconButtom, // leading: returnIconButtom,
title: Container( title: Container(
// color: Colors.grey,
width: double.infinity, width: double.infinity,
height: 180.rpx, height: 180.rpx,
child: Stack( child: Stack(
@@ -62,7 +64,7 @@ class _EPageState extends State<PersonPage> {
'人员资料.标题'.tr, '人员资料.标题'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override( style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx, fontSize: 30.rpx,
), ),
@@ -80,10 +82,9 @@ class _EPageState extends State<PersonPage> {
onTap: () async { onTap: () async {
Get.offAllNamed("/bindDeviceSuccess"); Get.offAllNamed("/bindDeviceSuccess");
}, },
colors: [ colors: [
stringToColor("#45D989"), themeController.currentColor.sc1,
stringToColor("#00C1AA"), themeController.currentColor.sc2,
], ],
child: Container( child: Container(
width: 100.rpx, width: 100.rpx,
@@ -97,7 +98,7 @@ class _EPageState extends State<PersonPage> {
.titleSmall .titleSmall
.override( .override(
fontFamily: 'Inter Tight', fontFamily: 'Inter Tight',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0.0, letterSpacing: 0.0,
), ),
), ),
@@ -147,7 +148,8 @@ class _EPageState extends State<PersonPage> {
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
letterSpacing: 0.0, letterSpacing: 0.0,
color: Colors.white), color: themeController.currentColor.sc3,
),
hintText: '人员资料.名字输入提示'.tr, hintText: '人员资料.名字输入提示'.tr,
hintStyle: FlutterFlowTheme.of(context) hintStyle: FlutterFlowTheme.of(context)
.labelMedium .labelMedium
@@ -191,7 +193,8 @@ class _EPageState extends State<PersonPage> {
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
letterSpacing: 0.0, letterSpacing: 0.0,
color: Colors.white), color: themeController.currentColor.sc3,
),
textAlign: TextAlign.center, textAlign: TextAlign.center,
cursorColor: cursorColor:
FlutterFlowTheme.of(context).primaryText, FlutterFlowTheme.of(context).primaryText,
@@ -239,7 +242,8 @@ class _EPageState extends State<PersonPage> {
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
color: Colors.white, color: themeController
.currentColor.sc3,
fontSize: 26.rpx, fontSize: 26.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
), ),
@@ -270,7 +274,8 @@ class _EPageState extends State<PersonPage> {
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
color: Colors.white, color: themeController
.currentColor.sc3,
fontSize: 26.rpx, fontSize: 26.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
), ),
@@ -286,71 +291,6 @@ class _EPageState extends State<PersonPage> {
Padding( Padding(
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 50.rpx, 70.rpx, 0), 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( child: Container(
height: 100.rpx, height: 100.rpx,
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -385,8 +325,8 @@ class _EPageState extends State<PersonPage> {
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: personController.model.birthday != color: personController.model.birthday !=
null null
? Colors.white ? themeController.currentColor.sc3
: Colors.grey, : themeController.currentColor.sc4,
fontSize: fontSize:
AppConstants().normal_text_fontSize, AppConstants().normal_text_fontSize,
letterSpacing: 0, letterSpacing: 0,
@@ -429,10 +369,10 @@ class _EPageState extends State<PersonPage> {
.labelMedium .labelMedium
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
color: personController.model.birthday != color: personController.model.weight !=
null null
? Colors.white ? themeController.currentColor.sc3
: Colors.grey, : themeController.currentColor.sc4,
fontSize: fontSize:
AppConstants().normal_text_fontSize, AppConstants().normal_text_fontSize,
letterSpacing: 0.0, letterSpacing: 0.0,
@@ -472,7 +412,7 @@ class _EPageState extends State<PersonPage> {
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
letterSpacing: 0.0, letterSpacing: 0.0,
color: Colors.white, color: themeController.currentColor.sc3,
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
cursorColor: cursorColor:
@@ -580,9 +520,7 @@ class _EPageState extends State<PersonPage> {
} }
} }
}, },
// colors: [Colors.white.withOpacity(0.06)], // 背景色 colors: [themeController.currentColor.sc17], // 背景色
colors: [stringToColor("#242835")], // 背景色
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: MediaQuery.sizeOf(context).height * 0.135, height: MediaQuery.sizeOf(context).height * 0.135,

View File

@@ -8,7 +8,7 @@ import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
Future showDateSelectionDialog(BuildContext context, Future showDateSelectionDialog(BuildContext context,
{required DateTime checkDate, Function? checkChange, String title = "生日"}) { {required DateTime checkDate, Function? checkChange, String title = "生日"}) {
Color checkColor = stringToColor("#D3B684"); ThemeController themeController = Get.find();
List years = [], months = [], days = []; List years = [], months = [], days = [];
var days_select = [].obs; var days_select = [].obs;
int day_len = 31; int day_len = 31;
@@ -31,9 +31,7 @@ Future showDateSelectionDialog(BuildContext context,
.day; .day;
days_select.value = days.sublist(0, day_len); days_select.value = days.sublist(0, day_len);
int dayIndex = days.lastIndexOf(checkDate.day); int dayIndex = days.lastIndexOf(checkDate.day);
ThemeController themeController = Get.find();
return showDialog( return showDialog(
// barrierColor: stringToColor("#000320"),
context: context, context: context,
barrierDismissible: true, // 点击对话框外部可关闭 barrierDismissible: true, // 点击对话框外部可关闭
builder: (BuildContext context) { builder: (BuildContext context) {
@@ -46,8 +44,7 @@ Future showDateSelectionDialog(BuildContext context,
child: Material( child: Material(
color: Colors.transparent, color: Colors.transparent,
child: Dialog( child: Dialog(
backgroundColor: stringToColor("#242835"), backgroundColor: themeController.currentColor.sc17,
// backgroundColor: Colors.transparent,
insetPadding: EdgeInsets.zero, insetPadding: EdgeInsets.zero,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0), borderRadius: BorderRadius.circular(0),
@@ -83,7 +80,7 @@ Future showDateSelectionDialog(BuildContext context,
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: AppConstants() fontSize: AppConstants()
.normal_text_fontSize), .normal_text_fontSize),
@@ -98,7 +95,7 @@ Future showDateSelectionDialog(BuildContext context,
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: fontSize:
AppConstants().title_text_fontSize), AppConstants().title_text_fontSize),
@@ -111,7 +108,7 @@ Future showDateSelectionDialog(BuildContext context,
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: AppConstants() fontSize: AppConstants()
.normal_text_fontSize), .normal_text_fontSize),
@@ -161,7 +158,8 @@ Future showDateSelectionDialog(BuildContext context,
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color:
themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx), fontSize: 30.rpx),
), ),
@@ -195,7 +193,8 @@ Future showDateSelectionDialog(BuildContext context,
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color:
themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx), fontSize: 30.rpx),
), ),
@@ -226,7 +225,8 @@ Future showDateSelectionDialog(BuildContext context,
.bodyMedium .bodyMedium
.override( .override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color:
themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx), fontSize: 30.rpx),
), ),
@@ -249,6 +249,7 @@ Future showDateSelectionDialog(BuildContext context,
getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged, getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged,
{bool looping = false}) { {bool looping = false}) {
ThemeController themeController = Get.find();
return CupertinoPicker( return CupertinoPicker(
key: UniqueKey(), key: UniqueKey(),
useMagnifier: false, useMagnifier: false,
@@ -268,19 +269,10 @@ getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged,
return Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
width: 400.rpx, width: 400.rpx,
decoration: BoxDecoration(
// border: Border(
// bottom: index != arr.length
// ? BorderSide(
// color: stringToColor("#8D95B0"),
// )
// : BorderSide.none,
// ),
),
child: Text("${arr[index]}", child: Text("${arr[index]}",
style: FlutterFlowTheme.of(context).bodyMedium.override( style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: themeController.currentColor.sc3,
letterSpacing: 0, letterSpacing: 0,
fontSize: 30.rpx)), fontSize: 30.rpx)),
); );

View File

@@ -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<dynamic>;
} catch (e) {
print('Error fetching repairs: $e');
return [];
}
}
}

View File

@@ -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/mine_page.dart';
import 'package:vbvs_app/pages/main_bottom/sleep_report_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/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(), "/minePage": (contxt) => MinePage(),
"/mianPageBottomChange": (contxt) => MainPageBottomChange(), "/mianPageBottomChange": (contxt) => MainPageBottomChange(),
"/loginPage": (contxt) => LoginPage(), "/loginPage": (contxt) => LoginPage(),
"/deviceType": (contxt) => DeviceTypePage(), "/deviceType": (contxt, {arguments}) => DeviceTypePage(type: arguments??0,),
"/blueteethDevice": (contxt) => BlueteethDevicePage(), "/blueteethDevice": (contxt) => BlueteethDevicePage(),
"/personPage": (contxt) => PersonPage(), "/personPage": (contxt) => PersonPage(),
"/bindDeviceSuccess": (contxt) => BindDeviceSuccess(), "/bindDeviceSuccess": (contxt) => BindDeviceSuccess(),
// "/wifiPage": (contxt, {arguments}) => WifiPage(connectedDeviceProp: arguments), "/wifiPage": (contxt, {arguments}) => WifiPage(bleDevice: arguments),
"/wifiPage": (contxt, {arguments}) => WifiPage(bluetoothDevice: arguments), // "/wifiPage": (contxt) => WifiPage(),
"/otherLoginPage": (contxt) => OtherLoginPage(), "/otherLoginPage": (contxt) => OtherLoginPage(),
"/updateUserPage": (contxt) => UpdateUserPage(),
"/settingPage": (contxt) => SettingPage(),
"/aboutUsPage": (contxt) => AboutUsPage(),
}; };
//2、配置onGenerateRoute 固定写法 这个方法也相当于一个中间件,这里可以做权限判断 //2、配置onGenerateRoute 固定写法 这个方法也相当于一个中间件,这里可以做权限判断

View File

@@ -8,7 +8,7 @@ import Foundation
import app_links import app_links
import device_info_plus import device_info_plus
import file_picker import file_picker
import flutter_blue_plus_darwin import flutter_blue_plus
import flutter_localization import flutter_localization
import flutter_web_auth_2 import flutter_web_auth_2
import package_info_plus import package_info_plus

View File

@@ -6,7 +6,7 @@ packages:
description: description:
path: "." path: "."
ref: master ref: master
resolved-ref: "491165184a7d090657e91be2fe749a9b0fccccfc" resolved-ref: "700479d131b6230d87aebae94ea610ca3a8decfc"
url: "http://git.real.he-info.cn:8080/r/~qmqz/EasyDartModule.git" url: "http://git.real.he-info.cn:8080/r/~qmqz/EasyDartModule.git"
source: git source: git
version: "1.0.0" version: "1.0.0"
@@ -159,14 +159,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "5.7.0" 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: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@@ -415,14 +407,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.5.16" 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: decimal:
dependency: transitive dependency: transitive
description: description:
@@ -479,6 +463,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.3" 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: ed25519_edwards:
dependency: transitive dependency: transitive
description: description:
@@ -609,50 +600,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: flutter_blue_plus name: flutter_blue_plus
sha256: "2d926dbef0fd6c58d4be8fca9eaaf1ba747c0ccb8373ddd5386665317e26eb61" sha256: d2ac9fac56c4b3b08eb68752380e2d45e64c61db629b70e61bb36c95cb65d431
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.35.3" version: "1.34.5"
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"
flutter_cache_manager: flutter_cache_manager:
dependency: transitive dependency: transitive
description: description:
@@ -881,10 +832,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: html name: html
sha256: "1fc58edeaec4307368c60d59b7e15b9d658b57d7f3125098b6294153c75337ec" sha256: "9475be233c437f0e3637af55e7702cbbe5c23a68bd56e8a5fa2d426297b7c6c8"
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.15.5" version: "0.15.5+1"
http: http:
dependency: transitive dependency: transitive
description: description:
@@ -1021,6 +972,22 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.0.0" 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: logging:
dependency: transitive dependency: transitive
description: description:
@@ -1727,10 +1694,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: stop_watch_timer name: stop_watch_timer
sha256: "86482d05a58bba03909781cd97683b91def80273e071a8cde6f9f423f59e291d" sha256: "01441a71ea3d804b73025c172313f2f1bb253da40ecd1390bd3ada7553548c43"
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.2.1" version: "3.2.2"
storage_client: storage_client:
dependency: transitive dependency: transitive
description: description:
@@ -2023,18 +1990,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: web_socket name: web_socket
sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" sha256: bfe6f435f6ec49cb6c01da1e275ae4228719e59a6b067048c51e72d9d63bcc4b
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.1.6" version: "1.0.0"
web_socket_channel: web_socket_channel:
dependency: transitive dependency: transitive
description: description:
name: web_socket_channel name: web_socket_channel
sha256: "0b8e2457400d8a859b7b2030786835a28a8e80836ef64402abef392ff4f1d0e5" sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.2" version: "3.0.3"
webview_flutter: webview_flutter:
dependency: transitive dependency: transitive
description: description:
@@ -2055,18 +2022,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: webview_flutter_platform_interface name: webview_flutter_platform_interface
sha256: d937581d6e558908d7ae3dc1989c4f87b786891ab47bb9df7de548a151779d8d sha256: "18b1640839cf6546784a524c72aded5b6e86b23e7167dc2311cc96f7658b64bd"
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.10.0" version: "2.11.0"
webview_flutter_wkwebview: webview_flutter_wkwebview:
dependency: transitive dependency: transitive
description: description:
name: webview_flutter_wkwebview name: webview_flutter_wkwebview
sha256: c14455137ce60a68e1ccaf4e8f2dae8cebcb3465ddaa2fcfb57584fb7c5afe4d sha256: c9f9be526fa0d3347374ceaa05c4b3acb85f4f112abd62f7d74b7d301fa515ff
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.18.5" version: "3.20.0"
webviewx_plus: webviewx_plus:
dependency: transitive dependency: transitive
description: description:

View File

@@ -31,7 +31,13 @@ dependencies:
lottie: ^3.2.0 lottie: ^3.2.0
flutter_blue_plus: ^1.35.3 flutter_blue_plus: ^1.35.3
permission_handler: ^12.0.0+1 permission_handler: ^12.0.0+1
loading_indicator: ^3.1.1
# geolocator: ^13.0.4 # 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: dev_dependencies:
@@ -45,6 +51,7 @@ dependency_overrides:
http_parser: ^4.1.0 http_parser: ^4.1.0
collection: ^1.19.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' 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: flutter: