This commit is contained in:
wyf
2025-05-24 17:02:47 +08:00
parent acfb262812
commit 3d45b7d991
22 changed files with 2990 additions and 1649 deletions

View File

@@ -85,7 +85,7 @@ class _EPageState extends State<BindDeviceSuccess> {
highlightColor: Colors
.grey, // 可以设置为 themeController.currentColor.sc3 之类
borderRadius: 8.rpx,
padding: EdgeInsets.all(0.rpx), // 增加可点击区域
padding: EdgeInsets.all(8.rpx), // 增加可点击区域
child: SvgPicture.asset(
'assets/img/icon/close.svg',
width: 25.rpx,
@@ -101,215 +101,210 @@ class _EPageState extends State<BindDeviceSuccess> {
actions: [],
centerTitle: false,
),
body: SafeArea(
top: true,
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(113.rpx, 0, 113.rpx, 0),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 74.rpx, 0, 0),
child: Container(
width: 124.rpx,
height: 124.rpx,
// width: double.infinity,
decoration: BoxDecoration(),
child: SvgPicture.asset(
'assets/img/icon/tick.svg',
fit: BoxFit.cover,
color: themeController.currentColor.sc3,
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
height: bodySize.maxHeight * 0.15,
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 0),
child: Container(
width: 124.rpx,
height: 124.rpx,
// width: double.infinity,
decoration: BoxDecoration(),
child: SvgPicture.asset(
'assets/img/icon/tick.svg',
fit: BoxFit.cover,
color: themeController.currentColor.sc3,
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 42.rpx, 0, 0),
child: Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: Text(
'绑定成功.绑定成功'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 48.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
),
),
),
),
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 42.rpx, 0, 0),
child: Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: Text(
'绑定成功.绑定成功'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 48.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 65.rpx, 0, 0),
child: Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: Text(
'绑定成功.分享标题'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 30.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
),
),
),
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 265.rpx, 0, 0),
child: Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Align(
alignment: AlignmentDirectional(0, 0),
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, 48.rpx, 0, 0),
child: Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Align(
alignment: AlignmentDirectional(-1, 0),
child: Text(
'绑定成功.分享内容'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
),
),
),
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 48.rpx, 0, 0),
child: Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Align(
alignment: AlignmentDirectional(-1, 0),
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, 110.rpx, 0, 0),
child: CustomCard(
borderRadius:
AppConstants().button_container_radius, // 圆角半径
onTap: () async {
PersonController personController = Get.find();
String deviceID =
personController.currentPersonId.value;
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 110.rpx, 0, 0),
child: CustomCard(
borderRadius:
AppConstants().button_container_radius, // 圆角半径
onTap: () async {
PersonController personController = Get.find();
String deviceID =
personController.currentPersonId.value;
BodyDeviceController bodyDeviceController =
Get.find();
await bodyDeviceController.getDeviceList();
List deviceList =
bodyDeviceController.deviceList.value;
BodyDeviceController bodyDeviceController =
Get.find();
await bodyDeviceController.getDeviceList();
List deviceList =
bodyDeviceController.deviceList.value;
if (deviceList != null && deviceList.isNotEmpty) {
// 查找第一个 _id 匹配的设备
final matchedDevice = deviceList.firstWhere(
(element) => element['_id'] == deviceID,
orElse: () => null,
);
if (deviceList != null && deviceList.isNotEmpty) {
// 查找第一个 _id 匹配的设备
final matchedDevice = deviceList.firstWhere(
(element) => element['_id'] == deviceID,
orElse: () => null,
);
if (matchedDevice != null) {
// 跳转并传入设备
Get.toNamed("/deviceSharePage",
arguments: matchedDevice);
} else {
print("未找到匹配的设备");
}
if (matchedDevice != null) {
// 跳转并传入设备
Get.toNamed("/deviceSharePage",
arguments: matchedDevice);
} else {
print("设备列表为空");
print("未找到匹配的设备");
}
},
colors: [
// 渐变色
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: MediaQuery.sizeOf(context).width * 0.66,
height: MediaQuery.sizeOf(context).height * 0.055,
constraints: BoxConstraints(
minWidth: 500.rpx,
minHeight: 90.rpx,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset(
'assets/img/icon/share.svg',
width: 25.rpx,
height: 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color: Colors.white,
),
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)),
),
} else {
print("设备列表为空");
}
},
colors: [
// 渐变色
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: MediaQuery.sizeOf(context).width * 0.66,
height: MediaQuery.sizeOf(context).height * 0.055,
constraints: BoxConstraints(
minWidth: 500.rpx,
minHeight: 90.rpx,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset(
'assets/img/icon/share.svg',
width: 25.rpx,
height: 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color: Colors.white,
),
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)),
),
),
),
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 18.rpx, 0, 0),
child: CustomCard(
borderRadius:
AppConstants().button_container_radius, // 圆角半径
onTap: () {
Get.offAllNamed("/mianPageBottomChange");
},
colors: [
// 渐变色
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 18.rpx, 0, 0),
child: CustomCard(
borderRadius:
AppConstants().button_container_radius, // 圆角半径
onTap: () {
Get.offAllNamed("/mianPageBottomChange");
},
colors: [
// 渐变色
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: MediaQuery.sizeOf(context).width * 0.66,
height: MediaQuery.sizeOf(context).height * 0.055,
constraints: BoxConstraints(
minWidth: 500.rpx,
minHeight: 90.rpx,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
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)),
),
child: Container(
width: MediaQuery.sizeOf(context).width * 0.66,
height: MediaQuery.sizeOf(context).height * 0.055,
constraints: BoxConstraints(
minWidth: 500.rpx,
minHeight: 90.rpx,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
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)),
),
),
),
],
),
),
],
),
),
),
@@ -318,51 +313,4 @@ class _EPageState extends State<BindDeviceSuccess> {
),
);
}
Widget _buildDeviceCard(BuildContext context,
{required String title, required String imageUrl, required String type}) {
return CustomCard(
borderRadius: 20.rpx, // 圆角大小
onTap: () {
if (type != null) {
if (type == '1') {
Get.toNamed("/blueteethDevice");
}
}
},
colors: [themeController.currentColor.sc17], // 背景色
child: Container(
width: double.infinity,
height: MediaQuery.sizeOf(context).height * 0.135,
constraints: BoxConstraints(
minHeight: 220.rpx,
),
padding: EdgeInsetsDirectional.fromSTEB(77.rpx, 0, 21.rpx, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
color: const Color(0xFFC2CED7),
fontSize: 30.rpx,
letterSpacing: 0.0,
),
),
ClipRRect(
borderRadius: BorderRadius.circular(8.rpx),
child: Image.asset(
imageUrl,
width: 212.rpx,
height: 168.rpx,
),
),
],
),
),
);
}
}

View File

@@ -98,14 +98,14 @@ class _BlueteethDevicePageState extends State<BlueteethDevicePage> {
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text("权限提示"),
content: Text("应用需要蓝牙和位置权限才能扫描设备。请授予权限。"),
title: Text("权限提示".tr),
content: Text("应用需要蓝牙和位置权限才能扫描设备。请授予权限。".tr),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text("确定"),
child: Text("确定".tr),
),
],
);

View File

@@ -414,172 +414,175 @@ void showConfirmDialog(
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(31.rpx, 0, 31.rpx, 0),
try {
showDialog(
context: context,
barrierDismissible: true,
barrierColor: Colors.black.withOpacity(0.5), // 背景模糊色
builder: (BuildContext context) {
return FrostedDialog(
blurSigma: 3.0,
child: Container(
width: double.infinity,
constraints: BoxConstraints(
maxHeight: MediaQuery.sizeOf(context).height * 0.656,
decoration: BoxDecoration(
color: themeController.currentColor.sc17,
borderRadius: BorderRadius.circular(20.0),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// 标题
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色
highlightColor:
themeController.currentColor.sc21, // 点击时的背景色
padding: EdgeInsets.zero, // 这里去掉外部的 padding避免影响点击范围
onTap: () {
Get.back();
onCancel();
},
child: Padding(
// padding:
// EdgeInsetsDirectional.fromSTEB(0, 33.rpx, 0, 0.rpx),
padding: EdgeInsetsDirectional.fromSTEB(
33.rpx, 33.rpx, 33.rpx, 33.rpx),
child: SvgPicture.asset(
'assets/img/icon/close.svg',
width: 25.rpx,
height: 25.rpx, // 如果 SVG 中没有固定颜色,使用 color 设置
color: themeController.currentColor.sc3,
),
),
),
],
),
Align(
alignment: AlignmentDirectional(0, 0),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
33.rpx, 60.rpx, 33.rpx, 33.rpx),
child: Text(
title,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
fontSize: 30.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
33.rpx, 0.rpx, 33.rpx, 0.rpx),
child: widget,
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
33.rpx, 58.rpx, 33.rpx, 60.rpx),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
padding: EdgeInsetsDirectional.fromSTEB(31.rpx, 0, 31.rpx, 0),
child: Container(
width: double.infinity,
constraints: BoxConstraints(
maxHeight: MediaQuery.sizeOf(context).height * 0.656,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// 标题
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () async {
ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色
highlightColor:
themeController.currentColor.sc21, // 点击时的背景色
padding: EdgeInsets.zero, // 这里去掉外部的 padding避免影响点击范围
onTap: () {
Get.back();
onCancel();
},
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)),
child: Padding(
// padding:
// EdgeInsetsDirectional.fromSTEB(0, 33.rpx, 0, 0.rpx),
padding: EdgeInsetsDirectional.fromSTEB(
33.rpx, 33.rpx, 33.rpx, 33.rpx),
child: SvgPicture.asset(
'assets/img/icon/close.svg',
width: 25.rpx,
height: 25.rpx, // 如果 SVG 中没有固定颜色,使用 color 设置
color: themeController.currentColor.sc3,
),
),
),
CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
Get.back();
onConfirm();
// await Future.delayed(Duration(milliseconds: 300));
},
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,
)),
],
),
),
],
Align(
alignment: AlignmentDirectional(0, 0),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
33.rpx, 60.rpx, 33.rpx, 33.rpx),
child: Text(
title,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
fontSize: 30.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
33.rpx, 0.rpx, 33.rpx, 0.rpx),
child: widget,
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
33.rpx, 58.rpx, 33.rpx, 60.rpx),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () async {
Get.back();
onCancel();
},
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();
onConfirm();
// await Future.delayed(Duration(milliseconds: 300));
},
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,
)),
),
),
],
),
),
),
),
);
},
);
);
},
);
} catch (e) {
print(e);
}
}
void showSingleConfirmDialog(
BuildContext context,
Widget widget,
@@ -667,7 +670,6 @@ void showSingleConfirmDialog(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
@@ -706,7 +708,6 @@ void showSingleConfirmDialog(
),
),
),
].divide(SizedBox(
width: 70.rpx,
)),

File diff suppressed because it is too large Load Diff

View File

@@ -46,8 +46,11 @@ class _WifiPageState extends State<WifiPage> {
blueteethBindController.wifiStatus = 0.obs;
blueteethBindController.connect_wifi.value = {};
blueteethBindController.selectWifi.value = {};
if (widget.type == null) {
if (widget.type != null) {
blueteethBindController.wifiStatus.value =
widget.type['status']['status'];
}
if (widget.type['mac'] == null) {
THapp bledevice = blueteethBindController.currentDevice!;
bledevice.device.connect().then((Value) {
var res2 = bledevice.isConnected;
@@ -85,11 +88,18 @@ class _WifiPageState extends State<WifiPage> {
Get.toNamed("/calibrationPage", arguments: 1);
});
} else if (aa == 'unknown') {
TopSlideNotification.show(
context,
text: "获取设备网络类型失败".tr,
textColor: themeController.currentColor.sc9,
);
// TopSlideNotification.show(
// context,
// text: "获取设备网络类型失败".tr,
// textColor: themeController.currentColor.sc9,
// );
WidgetsBinding.instance.addPostFrameCallback((_) {
TopSlideNotification.show(
context,
text: "获取设备网络类型失败".tr,
textColor: themeController.currentColor.sc9,
);
});
} else {
await initWifiStatusAndWifiList();
}
@@ -106,7 +116,7 @@ class _WifiPageState extends State<WifiPage> {
}
});
} else {
dealWifi(widget.type).then((aa) {
dealWifi(widget.type['mac']).then((aa) {
print("object");
});
}
@@ -188,7 +198,7 @@ class _WifiPageState extends State<WifiPage> {
left: 0,
child: returnIconButtom,
),
if (widget.type == null)
if (widget.type['mac'] == null)
Positioned(
right: 20.rpx,
child: CustomCard(