更新登录对接

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

View File

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

View File

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

View File

@@ -32,4 +32,6 @@ class CommonVariables {
static String shareText = "您的朋友邀请您使用《智慧眠花糖》APP请复制后面链接在浏览器中打开 " +
shoph5Url +
"/#/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:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/CommonVariables.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/model/api_response.dart';
ThemeController themeController = Get.find();
Future<void> initDataEf({String key = ""}) async {
await ef.init(
@@ -16,6 +21,25 @@ Future<void> initDataEf({String key = ""}) async {
}
class MyUtils {
static ApiResponse formatResponse(
ApiResponse res,
String successMsg,
String errorMsg,
) {
if (res.code == HttpStatusCodes.ok) {
// 成功但 msg 为空时填默认成功提示
if (res.msg == null || res.msg!.isEmpty) {
res.msg = successMsg;
}
} else {
// 失败且 msg 为空时填默认失败提示
if (res.msg == null || res.msg!.isEmpty) {
res.msg = errorMsg;
}
}
return res;
}
static String timestampToDateString(int timestamp) {
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(timestamp);
@@ -43,6 +67,13 @@ class MyUtils {
return phoneRegExp.hasMatch(phoneNumber);
}
static bool isValidEmail(String email) {
final RegExp emailRegExp = RegExp(
r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$',
);
return emailRegExp.hasMatch(email);
}
static Future<void> makePhoneCall(String phoneNumber) async {
final Uri launchUri = Uri(
scheme: 'tel',
@@ -114,7 +145,6 @@ showToast(String msg,
// gravity: ToastGravity.CENTER,
// timeInSecForIosWeb: 1,
// backgroundColor: color == null ? color_error : color,
// textColor: Colors.white,
// fontSize: 14.0,
// );
final context = Get.overlayContext; // 获取 Overlay 的上下文
@@ -211,7 +241,7 @@ var closeIconWhite = GestureDetector(
alignment: Alignment.center,
child: Icon(
Icons.close,
color: Colors.white,
color: themeController.currentColor.sc3,
),
),
),
@@ -263,6 +293,7 @@ enum LoadingDialogIcon { ble, wifi, none }
class LoadingDialog {
static show(String name, {LoadingDialogIcon icon = LoadingDialogIcon.none}) {
ThemeController themeController = Get.find();
String iconUrl = "";
if (icon == LoadingDialogIcon.wifi) {
iconUrl = "wifi";
@@ -296,18 +327,18 @@ class LoadingDialog {
Text(
textAlign: TextAlign.center,
name,
style: const TextStyle(
style: TextStyle(
fontSize: 16,
color: Colors.white,
color: themeController.currentColor.sc3,
decoration: TextDecoration.none),
),
SizedBox(
height: 30.rpx,
),
const CircularProgressIndicator(
CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.white,
themeController.currentColor.sc3,
),
),
],

View File

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

View File

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

View File

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

View File

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

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:json_annotation/json_annotation.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/model/BleDeviceData.dart';
import 'package:vbvs_app/model/api_response.dart';
part 'blueteeth_bind_controller.g.dart'; // 由json_serializable自动生成的部分
@@ -8,7 +19,8 @@ class BlueteethBindModel {
int? read = 1; //是否不再提示教程 0 不再提示 1 需要提示
double? singal = -70; //扫描信号强度
List? devicelist = []; //蓝牙扫描到的设备数据列表
List<BleDeviceData>? devicelist = []; //蓝牙扫描到的设备数据列表
List<BleDeviceData>? betDevicelist = []; //请求的
List? blelist = []; //蓝牙扫描到的设备数据列表
List? wifiList = [];
@@ -46,21 +58,122 @@ class BlueteethBindController extends GetControllerEx<BlueteethBindModel> {
attr = GetModel(BlueteethBindModel()).obs;
}
void updateDeviceStatus() {
// try {
Timer? _statusTimer;
// } catch (e) {
// print(e);
// EasyDartModule.logger.info("向后端请求设备绑定状态报错了:$e");
// } finally {
// EasyDartModule.logger.info("向后端请求设备绑定状态");
// }
BLEDevice? currentDevice;
// 启动每10秒获取设备状态
void startStatusPolling() {
if (_statusTimer == null) {
_statusTimer = Timer.periodic(Duration(seconds: 10), (timer) {
updateDeviceStatus();
});
}
}
Future bindDevice(d) async {
print("绑定参数:$d");
await Future.delayed(Duration(seconds: 1));
// return ApiService.request
// .post("/api/device/info/bind", data: formdata.FormData.fromMap(d));
// 停止轮询
void stopStatusPolling() {
_statusTimer?.cancel();
_statusTimer = null;
}
// 你的已有方法
Future<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:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:get_storage/get_storage.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/model/api_response.dart';
part 'login_controller.g.dart';
@JsonSerializable()
@@ -13,7 +21,7 @@ class LoginModel {
String? account = '17649984946'; //账户
String? password = 'wyf123,.'; //密码
String? phone; //手机号
String? phone; //手机号/邮箱
String? code; //验证码
String? register_code;
@@ -47,88 +55,87 @@ class LoginController extends GetControllerEx<LoginModel> {
}
//登录
Future<String> login(BuildContext context) async {
// return '';
String message = '';
String account = '';
String password = '';
// if (model.loginStyle == 1) {
// //账号登录
// if (model.account == null || model.account!.isEmpty) {
// message = '账户不能为空';
// showToast(message);
// return message;
// }
// if (model.password == null || model.password!.isEmpty) {
// message = '密码不能为空';
// showToast(message);
// return message;
// }
// account = model.account!;
// password = model.password!;
// }
// if (model.loginStyle == 2) {
// //账号登录
// if (model.phone == null || model.phone!.isEmpty) {
// message = '手机号不能为空';
// showToast(message);
// return message;
// }
// if (!MyUtils.isValidPhoneNumber(model.phone!)) {
// message = '请输入正确的手机号';
// showToast(message);
// return message;
// }
// if (model.code == null || model.code!.isEmpty) {
// message = '验证码不能为空';
// showToast(message);
// return message;
// }
// account = model.phone!;
// password = model.code!;
// }
// RegisterController registerController = Get.find();
// if (registerController.model.register_agree == null ||
// registerController.model.register_agree != true) {
// message = "需要同意协议";
// showToast(message);
// return message;
// }
// message = await repository.login(
// model.loginStyle!, account, password, model.forceLogin);
// model.forceLogin = 0;
return message;
Future<ApiResponse> login(BuildContext context) async {
ApiResponse apiResponse = ApiResponse(code: -1, msg: "其他手机登录页.登录失败".tr);
if (model.phone == null || model.phone!.isEmpty) {
apiResponse.msg = "其他手机登录页.请输入手机号".tr;
return apiResponse;
}
if (model.code == null || model.code!.isEmpty) {
apiResponse.msg = "其他手机登录页.请输入验证码".tr;
return apiResponse;
}
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.login;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
var data = {
"type": 1,
"userName": model.phone,
"password": model.code,
};
var response =
await EasyDartModule.dio.post(queryUrl, data: jsonEncode(data));
if (response != null) {
var responseData =
response.data is String ? jsonDecode(response.data) : response.data;
ApiResponse res = ApiResponse.fromJson(responseData, (object) => object);
MyUtils.formatResponse(apiResponse, "其他手机登录页.登陆成功".tr, "其他手机登录页.登陆失败".tr);
if (res.code == HttpStatusCodes.ok) {
UserInfoController userInfoController = Get.find();
userInfoController.model.login = 1;
String token = response.headers['token']!.first;
EasyDartModule.dio.token = token;
final box = GetStorage();
box.write('token', userInfoController.model.token); // 存储 token
}
return res;
} else {
return ApiResponse(code: -1, msg: "服务器.失败".tr);
}
}
Future<String> getCode(BuildContext context) async {
String message = "";
Future<ApiResponse> getCode(BuildContext context) async {
ApiResponse apiResponse = ApiResponse(code: -1, msg: "其他手机登录页.发送失败".tr);
if (model.register_agree == null || model.register_agree != true) {
// message = "需要同意协议";
// showToast(message);
return message;
apiResponse.msg = "登录页.未同意协议".tr;
return apiResponse;
}
if (model.phone == null || model.phone!.isEmpty) {
message = "请输入手机号";
// showToast(message);
return message;
apiResponse.msg = "其他手机登录页.请输入手机号".tr;
return apiResponse;
}
if (!MyUtils.isValidPhoneNumber(model.phone!)) {
message = '请输入正确的手机号';
showToast(message);
return message;
if (!MyUtils.isValidPhoneNumber(model.phone!) &&
!MyUtils.isValidEmail(model.phone!)) {
apiResponse.msg = '其他手机登录页.不正确手机号'.tr;
return apiResponse;
}
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 {
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 {
int read = 1;
DateTime? birthday;//是否不再提示教程 0 不再提示 1 需要提示
DateTime? birthday;
double? weight;
PersonModel();

View File

@@ -22,7 +22,7 @@ class UserInfoModel {
User? superbase_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:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get_storage/get_storage.dart';
import 'package:localstorage/localstorage.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/util/CommonVariables.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
import 'package:vbvs_app/controller/login/login_controller.dart';
@@ -27,6 +35,8 @@ Future<void> main() async {
// ApiService.init();
// await GetStorage.init();
// 初始化登录
await initLocalStorage();
initEasyDartModule();
await initLogin();
await initLog();
// 检查网络
@@ -41,13 +51,43 @@ Future<void> main() async {
.then((_) {
runApp(MyApp());
});
// runApp(const MyApp());
}
initLog() {
void initEasyDartModule() {
//初始化
EasyDartModule.init(
loggerConfig:
LoggerConfig(host: ServiceConstant.logService, serviceName: "web"),
webSocketConfig:
WebSocketConfig(ServiceConstant.webSocketService, (data) {
// 接收到服务消息
var json = jsonDecode(data);
if (json["path"] != null) {
var call = CommonVariables.callMap[json["path"]];
if (call != null) {
try {
call(json["data"]);
} catch (e) {
print(e);
}
} else {
print("未找到当前路径: ${json["path"]} 回调函数");
}
}
// print(data);
}, onOpen: () {
//连接建立完毕
// EasyDartModule.websocket
// .sendData(jsonEncode({"path": "/aa/bb", "type": 1}));
}));
EasyDartModule.dio.token = localStorage.getItem('token');
// document.onContextMenu.listen((event) {
// event.preventDefault();
// });
EasyDartModule.dio.token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiI2ODAxY2JmMzY5YjJhODQ5MWQwMDAwMDAiLCJ0aWQiOiI2N2Y1ZDk2ZTI2ZWYzMTA0NjMwMDAwMDAiLCJsZXZlbCI6NSwiaWF0IjoxNzQ0OTQ4MjExfQ._XXG3WzEHuOzWdj01NXJxLJpxe3SU20XQqShBZUHCUU";
}
initLog() {}
Future<void> initLogin() async {
// 初始化控制器
@@ -70,9 +110,10 @@ Future<void> initLogin() async {
userInfoController.model.user = user;
}
if (token != null) {
// userInfoController.model.login = 1;
userInfoController.model.login = 1;
// 根据token去请求
// await userInfoController.autoLogin(token);
EasyDartModule.dio.token = token;
} else {
// 如果没有 token则将用户标记为未登录
userInfoController.model.login = 0;
@@ -150,7 +191,6 @@ class MyApp extends StatelessWidget {
],
supportedLocales: [
const Locale('zh', 'CN'), // 中文
// 其他支持的语言
],
debugShowCheckedModeBanner: false,
title: '',

View File

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

View File

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

View File

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

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

View File

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

View File

@@ -1,4 +1,6 @@
import 'package:flutter/material.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
class FancyCircleCheckbox extends StatefulWidget {
final bool value;
@@ -59,8 +61,8 @@ class _FancyCircleCheckboxState extends State<FancyCircleCheckbox>
return GestureDetector(
onTap: () => widget.onChanged(!widget.value),
child: Container(
width: 24,
height: 24,
width: 32.rpx,
height: 32.rpx,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
@@ -73,7 +75,7 @@ class _FancyCircleCheckboxState extends State<FancyCircleCheckbox>
child: ScaleTransition(
scale: _scaleAnimation,
child: Container(
margin: EdgeInsets.all(5),
margin: EdgeInsets.all(8.rpx),
decoration: BoxDecoration(
shape: BoxShape.circle,
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:flutter/material.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/model/BleDeviceData.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/pages/device_bind/blueteeth_device_page.dart';
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
class SingleBlueteethDeviceCompoentWidget extends StatefulWidget {
// final BleDeviceData device;
final bleDevice;
const SingleBlueteethDeviceCompoentWidget({
super.key,
// required this.device,
required this.bleDevice,
});
@@ -27,9 +30,10 @@ class SingleBlueteethDeviceCompoentWidget extends StatefulWidget {
class _SingleBlueteethDeviceCompoentWidgetState
extends State<SingleBlueteethDeviceCompoentWidget> {
ThemeController themeController = Get.find();
BlueteethBindController blueteethBindController = Get.find();
@override
Widget build(BuildContext context) {
var bleDevice = widget.bleDevice;
List<int> rawData =
widget.bleDevice.advertisementData.manufacturerData[0xFFED]!;
BleDeviceData deviceData = parseBleData(rawData);
@@ -37,45 +41,80 @@ class _SingleBlueteethDeviceCompoentWidgetState
deviceData.rssi = widget.bleDevice.rssi;
deviceData.mac = deviceData.deviceId.replaceAll(':', '');
BleDeviceData device = deviceData;
device = blueteethBindController.model.devicelist!.firstWhere(
(d) => d.mac == device.mac,
orElse: () => device,
);
ThemeController themeController = Get.find();
return ClickableContainer(
backgroundColor: themeController.currentColor.sc5,
highlightColor: Colors.white,
highlightColor: themeController.currentColor.sc21,
borderRadius: 20.rpx,
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 36.rpx, 0, 52.rpx),
onTap: () async {
//todo 请求绑定
print(device.mac);
// try {
// await bleDevice.device.connect(autoConnect: false);
// List<BluetoothService> services =
// await bleDevice.device.discoverServices();
// BluetoothCharacteristic? wifiListChar;
// BluetoothCharacteristic? wifiSsidChar;
// BluetoothCharacteristic? wifiPasswordChar;
// BluetoothCharacteristic? startProvisionChar;
// for (BluetoothService service in services) {
// for (BluetoothCharacteristic c in service.characteristics) {
// if (c.uuid.toString() == 'YOUR_WIFI_LIST_UUID') {
// wifiListChar = c;
// } else if (c.uuid.toString() == 'YOUR_WIFI_SSID_UUID') {
// wifiSsidChar = c;
// } else if (c.uuid.toString() == 'YOUR_WIFI_PWD_UUID') {
// wifiPasswordChar = c;
// } else if (c.uuid.toString() == 'YOUR_WIFI_START_UUID') {
// startProvisionChar = c;
// }
// }
// }
// } catch (e) {
// print("蓝牙连接失败");
// }
//
// Get.toNamed('/wifiPage', arguments: bleDevice.device);
showBindDoubleDialog(context,[]);
// showHaveBindDialog(context);
try {
if (device.bind == true) {
showHaveBindDialog(context);
// showBindDoubleDialog(context, []);
} else {
showConfirmDialog(
context,
Container(),
'蓝牙绑定.确定绑定提示'.tr,
onConfirm: () async {
ApiResponse response =
await blueteethBindController.bindDeviceAndMAC(device);
if (response.code == HttpStatusCodes.ok) {
showLoadingDialog(context); // 显示 loading
BLEDevice bledevice =
BLEDevice(device: widget.bleDevice.device);
var res1 = bledevice.isConnected;
print("res1: $res1");
await bledevice.device.connect();
var res2 = bledevice.isConnected;
print("res2: $res2");
if (res2) {
Navigator.pop(context);
TopSlideNotification.show(
context,
text: "蓝牙绑定.连接成功".tr,
textColor: themeController.currentColor.sc2,
);
blueteethBindController.currentDevice = bledevice;
// Get.toNamed("/wifiPage", arguments: {bledevice});
Get.toNamed("/wifiPage");
} else {
Navigator.pop(context);
TopSlideNotification.show(
context,
text: "蓝牙绑定.连接失败".tr,
textColor: themeController.currentColor.sc9,
);
}
} else {
TopSlideNotification.show(
context,
text: "蓝牙绑定.连接异常".tr,
textColor: themeController.currentColor.sc9,
);
}
},
onCancel: () {
print('用户点击了取消');
// 执行取消后的处理逻辑
},
);
}
} catch (e) {
Navigator.pop(context);
TopSlideNotification.show(
context,
text: "蓝牙绑定.连接异常".tr,
textColor: themeController.currentColor.sc9,
);
edm.EasyDartModule.logger.info("蓝牙绑定.连接异常: $e");
DailyLogUtils.writeLog("蓝牙绑定.连接异常: $e");
}
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -156,10 +195,12 @@ class _SingleBlueteethDeviceCompoentWidgetState
),
),
Text(
device.status == 1 ? '蓝牙绑定.可绑定'.tr : '蓝牙绑定.已被绑定'.tr,
device.bind == false ? '蓝牙绑定.可绑定'.tr : '蓝牙绑定.已被绑定'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
color: const Color(0xFF1AD2B5),
color: device.bind == false
? const Color(0xFF1AD2B5)
: themeController.currentColor.sc9,
fontSize: 26.rpx,
letterSpacing: 0.0,
),

View File

@@ -1,8 +1,7 @@
import 'dart:ui';
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:loading_indicator/loading_indicator.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
@@ -45,7 +44,8 @@ void showBindDoubleDialog(BuildContext context, List<BleDeviceData> devices) {
Align(
alignment: AlignmentDirectional(0, 0),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(0.rpx, 93.rpx, 0, 0),
padding:
EdgeInsetsDirectional.fromSTEB(0.rpx, 93.rpx, 0, 0),
child: Text(
'蓝牙绑定.双人版绑定标题'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override(
@@ -74,7 +74,7 @@ void showBindDoubleDialog(BuildContext context, List<BleDeviceData> devices) {
// 主设备
_buildCheckboxRow(
context,
title: '蓝牙绑定.主设备'.tr,
title: '蓝牙绑定.主设备'.tr + "asasasasasas(已被绑定)",
value: () => blueteethBindController.model.deviceIndex1!,
onChanged: (v) {
if (!blueteethBindController.model.deviceIndex1!) {
@@ -130,8 +130,6 @@ void showBindDoubleDialog(BuildContext context, List<BleDeviceData> devices) {
);
}
void showHaveBindDialog(BuildContext context) {
ThemeController themeController = Get.find();
@@ -187,7 +185,7 @@ void showHaveBindDialog(BuildContext context) {
TextSpan(
text: "蓝牙绑定.无法绑定2".tr,
style: TextStyle(
color: themeController.currentColor.sc10,
color: themeController.currentColor.sc8,
fontSize: AppConstants().normal_text_fontSize,
),
),
@@ -228,10 +226,9 @@ void showHaveBindDialog(BuildContext context) {
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
color: Colors.white,
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize:
AppConstants().normal_text_fontSize,
fontSize: AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
),
@@ -251,6 +248,85 @@ void showHaveBindDialog(BuildContext context) {
);
}
void showLoadingDialog(BuildContext context) {
ThemeController themeController = Get.find();
showDialog(
context: context,
barrierDismissible: true,
barrierColor: Colors.black.withOpacity(0.5),
builder: (BuildContext context) {
return FrostedDialog(
blurSigma: 3.0,
child: Container(
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(20.0),
),
padding: EdgeInsetsDirectional.fromSTEB(60.rpx, 0, 60.rpx, 0),
child: Container(
width: double.infinity,
constraints: BoxConstraints(
maxHeight: MediaQuery.sizeOf(context).height * 0.656,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// Align(
// alignment: AlignmentDirectional(0, 0),
// child: Padding(
// padding: EdgeInsetsDirectional.fromSTEB(
// 0.rpx, 93.rpx, 0.rpx, 0.rpx),
// child: Text(
// '蓝牙绑定.无法绑定'.tr,
// style: FlutterFlowTheme.of(context).bodyMedium.override(
// fontFamily: 'Inter',
// fontSize: 30.rpx,
// letterSpacing: 0.0,
// color: themeController.currentColor.sc3,
// ),
// ),
// ),
// ),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 93.rpx, 0.rpx, 0.rpx),
child: SizedBox(
width: 120.rpx,
height: 120.rpx,
child: LoadingIndicator(
indicatorType: Indicator.ballSpinFadeLoader,
colors: [
themeController.currentColor.sc3,
],
strokeWidth: 1,
backgroundColor: Colors.transparent,
pathBackgroundColor: themeController.currentColor.sc3),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 27.rpx, 0.rpx, 56.rpx),
child: RichText(
text: TextSpan(children: [
TextSpan(
text: "连接中...".tr,
style: TextStyle(
color: themeController.currentColor.sc3,
fontSize: AppConstants().normal_text_fontSize,
),
),
]),
),
),
],
),
),
),
);
},
);
}
Widget _buildCheckboxRow(
BuildContext context, {
@@ -260,7 +336,7 @@ Widget _buildCheckboxRow(
}) {
ThemeController themeController = Get.find();
return Padding(
padding: EdgeInsetsDirectional.fromSTEB(60.rpx, 64.rpx, 0.rpx, 0.rpx),
padding: EdgeInsetsDirectional.fromSTEB(20.rpx, 64.rpx, 0.rpx, 0.rpx),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
@@ -270,7 +346,8 @@ Widget _buildCheckboxRow(
value: value(),
onChanged: onChanged,
)),
Text(
Expanded(
child: Text(
title,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
@@ -279,6 +356,7 @@ Widget _buildCheckboxRow(
color: themeController.currentColor.sc3,
),
),
),
].divide(SizedBox(width: 21.rpx)),
),
);
@@ -311,7 +389,7 @@ Widget _buildActionButton(
Text(
text,
style: FlutterFlowTheme.of(context).bodyMedium.override(
color: Colors.white,
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize: AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
@@ -322,3 +400,145 @@ Widget _buildActionButton(
),
);
}
void showConfirmDialog(
BuildContext context,
Widget widget,
String title, {
required VoidCallback onConfirm,
required VoidCallback onCancel,
}) {
ThemeController themeController = Get.find();
BlueteethBindController blueteethBindController = Get.find();
showDialog(
context: context,
barrierDismissible: true,
barrierColor: Colors.black.withOpacity(0.5), // 背景模糊色
builder: (BuildContext context) {
return FrostedDialog(
blurSigma: 3.0,
child: Container(
decoration: BoxDecoration(
color: themeController.currentColor.sc17,
borderRadius: BorderRadius.circular(20.0),
),
padding: EdgeInsetsDirectional.fromSTEB(64.rpx, 0, 64.rpx, 0),
child: Container(
width: double.infinity,
constraints: BoxConstraints(
maxHeight: MediaQuery.sizeOf(context).height * 0.656,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// 标题
Align(
alignment: AlignmentDirectional(0, 0),
child: Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0.rpx, 93.rpx, 0, 0),
child: Text(
title,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
fontSize: 30.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
),
),
),
),
widget,
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 58.rpx, 0, 60.rpx),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
Get.back();
onConfirm();
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: MediaQuery.sizeOf(context).width * 0.115,
height: MediaQuery.sizeOf(context).height * 0.055,
constraints: BoxConstraints(
minWidth: 160.rpx,
minHeight: 90.rpx,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"蓝牙绑定.是".tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize:
AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 17.rpx)),
),
),
),
CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
Get.back();
onCancel();
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: MediaQuery.sizeOf(context).width * 0.215,
height: MediaQuery.sizeOf(context).height * 0.055,
constraints: BoxConstraints(
minWidth: 160.rpx,
minHeight: 90.rpx,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"蓝牙绑定.否".tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize:
AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 17.rpx)),
),
),
),
].divide(SizedBox(
width: 70.rpx,
)),
),
),
],
),
),
),
);
},
);
}

View File

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

View File

@@ -1,11 +1,10 @@
import 'dart:async';
import 'package:easydevice/easydevice.dart';
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/Ble.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
@@ -14,14 +13,12 @@ import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/person/person_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/common/util/Ble.dart' as ble;
import 'package:vbvs_app/pages/common/selectDialog.dart';
class WifiPage extends StatefulWidget {
// ble.ConnectedDeviceProp connectedDeviceProp;
BluetoothDevice bluetoothDevice;
// WifiPage({super.key, required this.connectedDeviceProp});
WifiPage({super.key, required this.bluetoothDevice});
BLEDevice bleDevice;
WifiPage({super.key, required this.bleDevice});
// WifiPage({super.key});
@override
State<WifiPage> createState() => _WifiPageState();
@@ -33,12 +30,10 @@ class _WifiPageState extends State<WifiPage> {
BlueteethBindController blueteethBindController = Get.find();
PersonController personController = Get.find();
ThemeController themeController = Get.find();
late ble.ConnectedDeviceProp connectedDeviceProp;
@override
void initState() {
super.initState();
connectToDevice(widget.bluetoothDevice);
// connectedDeviceProp = widget.connectedDeviceProp;
Timer(const Duration(microseconds: 100), () {
getWifiList();
@@ -60,14 +55,12 @@ class _WifiPageState extends State<WifiPage> {
child: Scaffold(
backgroundColor: Colors.transparent, // 加上这一行
appBar: AppBar(
backgroundColor: stringToColor("#242835"),
// backgroundColor: Colors.transparent,
backgroundColor: themeController.currentColor.sc17,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: Colors.white),
iconTheme: IconThemeData(color: themeController.currentColor.sc3),
titleSpacing: 0,
// leading: returnIconButtom,
title: Container(
// color: Colors.grey,
width: double.infinity,
height: 180.rpx,
child: Stack(
@@ -78,7 +71,7 @@ class _WifiPageState extends State<WifiPage> {
'wifi页.标题'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: Colors.white,
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx,
),
@@ -97,8 +90,8 @@ class _WifiPageState extends State<WifiPage> {
Get.offAllNamed("/bindDeviceSuccess");
},
colors: [
stringToColor("#45D989"),
stringToColor("#00C1AA"),
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: 100.rpx,
@@ -112,7 +105,7 @@ class _WifiPageState extends State<WifiPage> {
.titleSmall
.override(
fontFamily: 'Inter Tight',
color: Colors.white,
color: themeController.currentColor.sc3,
letterSpacing: 0.0,
),
),
@@ -390,8 +383,7 @@ class _WifiPageState extends State<WifiPage> {
}
}
},
// colors: [Colors.white.withOpacity(0.06)], // 背景色
colors: [stringToColor("#242835")], // 背景色
colors: [themeController.currentColor.sc17], // 背景色
child: Container(
width: double.infinity,
@@ -430,46 +422,12 @@ class _WifiPageState extends State<WifiPage> {
getWifiList({int time = 3}) {
// LoadingDialog.show("扫描WIFI列表中...", icon: LoadingDialogIcon.wifi);
try {
var device = widget.bluetoothDevice;
String log = "";
Function logAdd = (l) {
log += l;
};
connectedDeviceProp.receiveLogArr.add(logAdd);
connectedDeviceProp.write3OfString("wscan scan", success: () {
Timer.periodic(const Duration(milliseconds: 1000), (timer) async {
if (timer.tick > 8) {
timer.cancel();
connectedDeviceProp.receiveLogArr.remove(logAdd);
LoadingDialog.hide();
if (time > 0) {
getWifiList(time: time - 1);
}
}
Iterable<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();
});
// var device = widget.bluetoothDevice;
// String log = "";
// Function logAdd = (l) {
// log += l;
// };
} catch (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/controller/login/login_controller.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
class LoginPage extends StatefulWidget {
@@ -22,6 +23,7 @@ class _EPageState extends State<LoginPage> {
GlobalController globalController = Get.find();
UserInfoController userInfoController = Get.find();
LoginController loginController = Get.find();
ThemeController themeController = Get.find();
@override
Widget build(BuildContext context) {
@@ -53,7 +55,8 @@ class _EPageState extends State<LoginPage> {
),
ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色
highlightColor: Colors.green, // 点击时的背景色
highlightColor:
themeController.currentColor.sc21, // 点击时的背景色
padding:
EdgeInsets.zero, // 这里去掉外部的 padding避免影响点击范围
onTap: () {
@@ -66,7 +69,7 @@ class _EPageState extends State<LoginPage> {
'assets/img/icon/close.svg',
width: 25.rpx,
height: 25.rpx, // 如果 SVG 中没有固定颜色,使用 color 设置
color: Colors.white, // 这里设置了颜色
color: themeController.currentColor.sc3,
),
),
),
@@ -96,7 +99,8 @@ class _EPageState extends State<LoginPage> {
fontSize: 48.rpx,
letterSpacing: 0.0,
//todo 颜色
color: stringToColor("#FFFFFF"),
color: themeController
.currentColor.sc3,
),
),
),
@@ -122,7 +126,8 @@ class _EPageState extends State<LoginPage> {
fontSize: 30.rpx,
letterSpacing: 0.0,
//todo 颜色
color: stringToColor("#FFFFFF"),
color: themeController
.currentColor.sc3,
),
),
),
@@ -148,7 +153,8 @@ class _EPageState extends State<LoginPage> {
fontSize: 48.rpx,
letterSpacing: 0.0,
//todo 颜色
color: stringToColor("#FFFFFF"),
color: themeController
.currentColor.sc3,
),
),
),
@@ -162,8 +168,8 @@ class _EPageState extends State<LoginPage> {
borderRadius: AppConstants()
.button_container_radius, // 圆角半径
onTap: () {
bool agree = loginController
.model.register_agree!;
bool agree =
loginController.model.register_agree!;
if (!agree) {
print('未授权 ...');
} else {
@@ -172,8 +178,8 @@ class _EPageState extends State<LoginPage> {
},
colors: [
//todo 颜色
stringToColor("45D989"),
stringToColor("00C1AA")
themeController.currentColor.sc1,
themeController.currentColor.sc2,
], // 渐变色是同一个色,也可以根据需要调整
child: Container(
@@ -197,7 +203,8 @@ class _EPageState extends State<LoginPage> {
.bodyMedium
.override(
//todo 颜色
color: Colors.white,
color: themeController
.currentColor.sc3,
fontFamily: 'Inter',
fontSize: AppConstants()
.normal_text_fontSize,
@@ -216,7 +223,8 @@ class _EPageState extends State<LoginPage> {
),
ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色
highlightColor: Colors.orange, // 点击时的背景色
highlightColor: themeController
.currentColor.sc21, // 点击时的背景色
padding: EdgeInsetsDirectional.fromSTEB(
16.rpx, 10.rpx, 16.rpx, 10.rpx),
onTap: () {
@@ -228,7 +236,7 @@ class _EPageState extends State<LoginPage> {
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
color: Colors.white,
color: themeController.currentColor.sc3,
),
),
),
@@ -414,8 +422,7 @@ class _EPageState extends State<LoginPage> {
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
//todo 颜色
color: stringToColor("#FFFFFF"),
color: themeController.currentColor.sc3,
),
),
),

View File

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

View File

@@ -19,60 +19,6 @@ class _EPageState extends State<EPage> {
builder: (context, boxConstraints) => GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Scaffold(
// appBar: AppBar(
// backgroundColor: AppColors.bg_color,
// automaticallyImplyLeading: false,
// title: Container(
// width: double.infinity,
// height: 70.rpx,
// child: Obx(
// () => InkWell(
// onTap: () {
// Get.toNamed("/editUserInfoPage");
// },
// child: Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Row(
// mainAxisSize: MainAxisSize.max,
// children: [
// Container(
// width: 56.rpx,
// height: 56.rpx,
// clipBehavior: Clip.antiAlias,
// decoration: BoxDecoration(
// shape: BoxShape.circle,
// ),
// ),
// Container(
// width: 20.rpx,
// height: 0,
// decoration: BoxDecoration(
// color: Colors.white,
// shape: BoxShape.rectangle,
// ),
// ),
// Text(
// userInfoController.model.user!.nickName ?? '匿名',
// style: FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Readex Pro',
// color: Colors.white,
// letterSpacing: 0,
// fontSize: 30.rpx),
// ),
// ],
// ),
// ],
// ),
// ),
// ),
// ),
// actions: [],
// centerTitle: false,
// ),
body: SafeArea(
top: true,

View File

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

View File

@@ -19,61 +19,6 @@ class _MessagePageState extends State<MessagePage> {
builder: (context, boxConstraints) => GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Scaffold(
// appBar: AppBar(
// backgroundColor: AppColors.bg_color,
// automaticallyImplyLeading: false,
// title: Container(
// width: double.infinity,
// height: 70.rpx,
// child: Obx(
// () => InkWell(
// onTap: () {
// Get.toNamed("/editUserInfoPage");
// },
// child: Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Row(
// mainAxisSize: MainAxisSize.max,
// children: [
// Container(
// width: 56.rpx,
// height: 56.rpx,
// clipBehavior: Clip.antiAlias,
// decoration: BoxDecoration(
// shape: BoxShape.circle,
// ),
// ),
// Container(
// width: 20.rpx,
// height: 0,
// decoration: BoxDecoration(
// color: Colors.white,
// shape: BoxShape.rectangle,
// ),
// ),
// Text(
// userInfoController.model.user!.nickName ?? '匿名',
// style: FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Readex Pro',
// color: Colors.white,
// letterSpacing: 0,
// fontSize: 30.rpx),
// ),
// ],
// ),
// ],
// ),
// ),
// ),
// ),
// actions: [],
// centerTitle: false,
// ),
body: SafeArea(
top: true,
child: Text("消息"),

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

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/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/person/person_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/pages/person/select_time.dart';
@@ -23,6 +24,7 @@ class _EPageState extends State<PersonPage> {
UserInfoController userInfoController = Get.find();
BlueteethBindController blueteethBindController = Get.find();
PersonController personController = Get.find();
ThemeController themeController = Get.find();
@override
void initState() {
@@ -44,14 +46,14 @@ class _EPageState extends State<PersonPage> {
child: Scaffold(
backgroundColor: Colors.transparent, // 加上这一行
appBar: AppBar(
backgroundColor: stringToColor("#242835"),
// backgroundColor: Colors.transparent,
backgroundColor: themeController.currentColor.sc17,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: Colors.white),
iconTheme: IconThemeData(
color: themeController.currentColor.sc3,
),
titleSpacing: 0,
// leading: returnIconButtom,
title: Container(
// color: Colors.grey,
width: double.infinity,
height: 180.rpx,
child: Stack(
@@ -62,7 +64,7 @@ class _EPageState extends State<PersonPage> {
'人员资料.标题'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: Colors.white,
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx,
),
@@ -80,10 +82,9 @@ class _EPageState extends State<PersonPage> {
onTap: () async {
Get.offAllNamed("/bindDeviceSuccess");
},
colors: [
stringToColor("#45D989"),
stringToColor("#00C1AA"),
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: 100.rpx,
@@ -97,7 +98,7 @@ class _EPageState extends State<PersonPage> {
.titleSmall
.override(
fontFamily: 'Inter Tight',
color: Colors.white,
color: themeController.currentColor.sc3,
letterSpacing: 0.0,
),
),
@@ -147,7 +148,8 @@ class _EPageState extends State<PersonPage> {
.override(
fontFamily: 'Inter',
letterSpacing: 0.0,
color: Colors.white),
color: themeController.currentColor.sc3,
),
hintText: '人员资料.名字输入提示'.tr,
hintStyle: FlutterFlowTheme.of(context)
.labelMedium
@@ -191,7 +193,8 @@ class _EPageState extends State<PersonPage> {
.override(
fontFamily: 'Inter',
letterSpacing: 0.0,
color: Colors.white),
color: themeController.currentColor.sc3,
),
textAlign: TextAlign.center,
cursorColor:
FlutterFlowTheme.of(context).primaryText,
@@ -239,7 +242,8 @@ class _EPageState extends State<PersonPage> {
.bodyMedium
.override(
fontFamily: 'Inter',
color: Colors.white,
color: themeController
.currentColor.sc3,
fontSize: 26.rpx,
letterSpacing: 0.0,
),
@@ -270,7 +274,8 @@ class _EPageState extends State<PersonPage> {
.bodyMedium
.override(
fontFamily: 'Inter',
color: Colors.white,
color: themeController
.currentColor.sc3,
fontSize: 26.rpx,
letterSpacing: 0.0,
),
@@ -286,71 +291,6 @@ class _EPageState extends State<PersonPage> {
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 50.rpx, 70.rpx, 0),
// child: Container(
// width: double.infinity,
// height: 100.rpx,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(50.rpx),
// border: Border.all(
// color: Color(0xFFF3EDED),
// ),
// ),
// child: Align(
// alignment: AlignmentDirectional(0, 0),
// child: Obx(
// () => Container(
// width: double.infinity,
// height:
// MediaQuery.sizeOf(context).height * 0.064,
// decoration: BoxDecoration(),
// child: InkWell(
// onTap: () {
// // 触摸收起键盘
// FocusScope.of(context)
// .requestFocus(FocusNode());
// Future.delayed(
// const Duration(milliseconds: 250), () {
// // 延迟执行的代码
// showDateSelectionDialog(context,
// checkDate:
// personController.model.birthday ??
// DateTime.now(),
// checkChange: (DateTime d) {
// personController.model.birthday = d;
// personController.updateAll();
// print("$d");
// }).then((d) {
// // Timer(Duration.zero, () {
// // FocusScope.of(context).unfocus();
// // });
// });
// });
// },
// child: Container(
// constraints:
// BoxConstraints(minWidth: 200.rpx),
// child: Text(
// personController.model.birthday != null
// ? DateFormat("yyyy年MM月dd日").format(
// personController.model.birthday!)
// : '人员资料.生日输入提示'.tr,
// textAlign: TextAlign.right,
// style: FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Readex Pro',
// color: Colors.white,
// fontSize: 30.rpx,
// letterSpacing: 0,
// ),
// ),
// ),
// ),
// ),
// ),
// ),
// ),
child: Container(
height: 100.rpx,
decoration: BoxDecoration(
@@ -385,8 +325,8 @@ class _EPageState extends State<PersonPage> {
fontFamily: 'Readex Pro',
color: personController.model.birthday !=
null
? Colors.white
: Colors.grey,
? themeController.currentColor.sc3
: themeController.currentColor.sc4,
fontSize:
AppConstants().normal_text_fontSize,
letterSpacing: 0,
@@ -429,10 +369,10 @@ class _EPageState extends State<PersonPage> {
.labelMedium
.override(
fontFamily: 'Inter',
color: personController.model.birthday !=
color: personController.model.weight !=
null
? Colors.white
: Colors.grey,
? themeController.currentColor.sc3
: themeController.currentColor.sc4,
fontSize:
AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
@@ -472,7 +412,7 @@ class _EPageState extends State<PersonPage> {
.override(
fontFamily: 'Inter',
letterSpacing: 0.0,
color: Colors.white,
color: themeController.currentColor.sc3,
),
textAlign: TextAlign.center,
cursorColor:
@@ -580,9 +520,7 @@ class _EPageState extends State<PersonPage> {
}
}
},
// colors: [Colors.white.withOpacity(0.06)], // 背景色
colors: [stringToColor("#242835")], // 背景色
colors: [themeController.currentColor.sc17], // 背景色
child: Container(
width: double.infinity,
height: MediaQuery.sizeOf(context).height * 0.135,

View File

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

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

View File

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

View File

@@ -6,7 +6,7 @@ packages:
description:
path: "."
ref: master
resolved-ref: "491165184a7d090657e91be2fe749a9b0fccccfc"
resolved-ref: "700479d131b6230d87aebae94ea610ca3a8decfc"
url: "http://git.real.he-info.cn:8080/r/~qmqz/EasyDartModule.git"
source: git
version: "1.0.0"
@@ -159,14 +159,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.7.0"
bluez:
dependency: transitive
description:
name: bluez
sha256: "61a7204381925896a374301498f2f5399e59827c6498ae1e924aaa598751b545"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.8.3"
boolean_selector:
dependency: transitive
description:
@@ -415,14 +407,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.5.16"
dbus:
dependency: transitive
description:
name: dbus
sha256: "79e0c23480ff85dc68de79e2cd6334add97e48f7f4865d17686dd6ea81a47e8c"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.7.11"
decimal:
dependency: transitive
description:
@@ -479,6 +463,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.3"
easydevice:
dependency: "direct main"
description:
path: "C:\\Users\\wyf\\Desktop\\blue\\easydevice"
relative: false
source: path
version: "0.0.1"
ed25519_edwards:
dependency: transitive
description:
@@ -609,50 +600,10 @@ packages:
dependency: "direct main"
description:
name: flutter_blue_plus
sha256: "2d926dbef0fd6c58d4be8fca9eaaf1ba747c0ccb8373ddd5386665317e26eb61"
sha256: d2ac9fac56c4b3b08eb68752380e2d45e64c61db629b70e61bb36c95cb65d431
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.35.3"
flutter_blue_plus_android:
dependency: transitive
description:
name: flutter_blue_plus_android
sha256: c1d83f84b514e46345a8a58599c428f20b11e78379521e0d3b0611c7b7cbf2c1
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.0"
flutter_blue_plus_darwin:
dependency: transitive
description:
name: flutter_blue_plus_darwin
sha256: "8d0a0f11f83b13dda173396b7e4028b4e8656bc8dbbc82c26a7e49aafc62644b"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.0"
flutter_blue_plus_linux:
dependency: transitive
description:
name: flutter_blue_plus_linux
sha256: "1d367ed378b2bd6c3b9685fda7044e1d2f169884802b7dec7badb31a99a72660"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.0"
flutter_blue_plus_platform_interface:
dependency: transitive
description:
name: flutter_blue_plus_platform_interface
sha256: "114f8e85a03a28a48d707a4df6cc9218e1f2005cf260c5e815e5585a00da5778"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.0"
flutter_blue_plus_web:
dependency: transitive
description:
name: flutter_blue_plus_web
sha256: db70cdc41bc743763dc0d47e8c7c10f3923cbbe71b33d9dc21deea482affeb4d
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.0"
version: "1.34.5"
flutter_cache_manager:
dependency: transitive
description:
@@ -881,10 +832,10 @@ packages:
dependency: transitive
description:
name: html
sha256: "1fc58edeaec4307368c60d59b7e15b9d658b57d7f3125098b6294153c75337ec"
sha256: "9475be233c437f0e3637af55e7702cbbe5c23a68bd56e8a5fa2d426297b7c6c8"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.15.5"
version: "0.15.5+1"
http:
dependency: transitive
description:
@@ -1021,6 +972,22 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.0.0"
loading_indicator:
dependency: "direct main"
description:
name: loading_indicator
sha256: a101ffb2aa3e646137d7810bfa90b50525dd3f72c01235b6df7491cf6af6f284
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.1"
localstorage:
dependency: "direct main"
description:
name: localstorage
sha256: "6340acefdd3a969cceb044a69cde2dc5877c5b861b2e02d0803930ed483dbe91"
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.0.0"
logging:
dependency: transitive
description:
@@ -1727,10 +1694,10 @@ packages:
dependency: transitive
description:
name: stop_watch_timer
sha256: "86482d05a58bba03909781cd97683b91def80273e071a8cde6f9f423f59e291d"
sha256: "01441a71ea3d804b73025c172313f2f1bb253da40ecd1390bd3ada7553548c43"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.2.1"
version: "3.2.2"
storage_client:
dependency: transitive
description:
@@ -2023,18 +1990,18 @@ packages:
dependency: transitive
description:
name: web_socket
sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83"
sha256: bfe6f435f6ec49cb6c01da1e275ae4228719e59a6b067048c51e72d9d63bcc4b
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.6"
version: "1.0.0"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
sha256: "0b8e2457400d8a859b7b2030786835a28a8e80836ef64402abef392ff4f1d0e5"
sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.2"
version: "3.0.3"
webview_flutter:
dependency: transitive
description:
@@ -2055,18 +2022,18 @@ packages:
dependency: transitive
description:
name: webview_flutter_platform_interface
sha256: d937581d6e558908d7ae3dc1989c4f87b786891ab47bb9df7de548a151779d8d
sha256: "18b1640839cf6546784a524c72aded5b6e86b23e7167dc2311cc96f7658b64bd"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.10.0"
version: "2.11.0"
webview_flutter_wkwebview:
dependency: transitive
description:
name: webview_flutter_wkwebview
sha256: c14455137ce60a68e1ccaf4e8f2dae8cebcb3465ddaa2fcfb57584fb7c5afe4d
sha256: c9f9be526fa0d3347374ceaa05c4b3acb85f4f112abd62f7d74b7d301fa515ff
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.18.5"
version: "3.20.0"
webviewx_plus:
dependency: transitive
description:

View File

@@ -31,7 +31,13 @@ dependencies:
lottie: ^3.2.0
flutter_blue_plus: ^1.35.3
permission_handler: ^12.0.0+1
loading_indicator: ^3.1.1
# geolocator: ^13.0.4
easydevice:
path: C:\Users\wyf\Desktop\blue\easydevice
# url: http:///enchantedwyf@git.it.real.he-info.cn:90/r/easydevice.git
# ref: main
localstorage: ^5.0.0
dev_dependencies:
@@ -45,6 +51,7 @@ dependency_overrides:
http_parser: ^4.1.0
collection: ^1.19.0
data_table_2: 2.5.16 # 2.5.17版本以后会报错,data_table_2.dart:525:47: Error:The method 'withValues' isn't defined ffor the class 'Color'
flutter_blue_plus: 1.34.5 # 1.35.0 版本android连接蓝牙有问题
flutter: