更新登录对接

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

@@ -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) {
@@ -709,12 +712,7 @@ void connectToDevice(fun) async {
await device.connect(timeout: const Duration(seconds: 8));
print("device.connect success");
ConnectedDevicePropType connectedDevicePropType =
ConnectedDevicePropType.JunHe;
if (isQuanShiDevice(device.advName)) {
connectedDevicePropType = ConnectedDevicePropType.QuanShi;
} else if (isMHTSWES(device.advName)) {
connectedDevicePropType = ConnectedDevicePropType.MHT;
}
ConnectedDevicePropType.JunHe;
connectedDeviceProp = ConnectedDeviceProp(
connectDevice: device,
fun: fun,
@@ -735,6 +733,11 @@ void connectToDevice(fun) async {
}
}
bool jsJunHe(String name) {
return "$name".contains("AITH-V2") || "$name".contains("AITH-V2") || "$name".contains("AITH-V2");
}
void disconnect(ConnectedDeviceProp connectedDeviceProp) {
connectedDeviceProp.closeHeartBeat();
connectList.remove(connectedDeviceProp.id);

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),
),
),
),