2197 lines
86 KiB
Dart
2197 lines
86 KiB
Dart
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: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/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/FrostedDialog.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/pages/device_bind/componnet/FancyCircleCheckbox.dart';
|
||
|
||
void showBindDoubleDialog(
|
||
BuildContext context,
|
||
List<BleDeviceData> devices, {
|
||
required void Function(int selectedIndex) onConfirm,
|
||
required VoidCallback onCancel,
|
||
}) {
|
||
ThemeController themeController = Get.find();
|
||
BlueteethBindController blueteethBindController = Get.find();
|
||
|
||
// 初始化默认选中 deviceIndex0 为 true
|
||
blueteethBindController.model.deviceIndex0 = true;
|
||
blueteethBindController.model.deviceIndex1 = false;
|
||
blueteethBindController.model.deviceIndex2 = false;
|
||
|
||
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(0.rpx, 0, 0.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(
|
||
'双人版绑定标题'.tr,
|
||
style: TextStyle(
|
||
fontFamily: 'Inter',
|
||
fontSize: 30.rpx,
|
||
letterSpacing: 0.0,
|
||
color: themeController.currentColor.sc3,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
// 全选
|
||
_buildCheckboxRow(
|
||
context,
|
||
title: '绑定全部'.tr,
|
||
value: () => blueteethBindController.model.deviceIndex0!,
|
||
onChanged: (v) {
|
||
if (!blueteethBindController.model.deviceIndex0!) {
|
||
blueteethBindController.model.deviceIndex0 = true;
|
||
blueteethBindController.model.deviceIndex1 = false;
|
||
blueteethBindController.model.deviceIndex2 = false;
|
||
blueteethBindController.updateAll();
|
||
}
|
||
},
|
||
),
|
||
// 主设备
|
||
_buildCheckboxRow(
|
||
context,
|
||
title: '主设备'.tr +
|
||
"${devices[0].mac}" +
|
||
(devices[0].bind == false ? "可绑定".tr : "已被绑定".tr),
|
||
value: () => blueteethBindController.model.deviceIndex1!,
|
||
onChanged: (v) {
|
||
if (!blueteethBindController.model.deviceIndex1!) {
|
||
blueteethBindController.model.deviceIndex0 = false;
|
||
blueteethBindController.model.deviceIndex1 = true;
|
||
blueteethBindController.model.deviceIndex2 = false;
|
||
blueteethBindController.updateAll();
|
||
}
|
||
},
|
||
),
|
||
// 从设备
|
||
_buildCheckboxRow(
|
||
context,
|
||
title: '从设备'.tr +
|
||
"${devices[1].mac}" +
|
||
(devices[1].bind == false ? "可绑定".tr : "已被绑定".tr),
|
||
value: () => blueteethBindController.model.deviceIndex2!,
|
||
onChanged: (v) {
|
||
if (!blueteethBindController.model.deviceIndex2!) {
|
||
blueteethBindController.model.deviceIndex0 = false;
|
||
blueteethBindController.model.deviceIndex1 = false;
|
||
blueteethBindController.model.deviceIndex2 = true;
|
||
blueteethBindController.updateAll();
|
||
}
|
||
},
|
||
),
|
||
|
||
// 确定按钮
|
||
Padding(
|
||
padding: EdgeInsetsDirectional.fromSTEB(
|
||
60.rpx, 100.rpx, 60.rpx, 0),
|
||
child: _buildActionButton(
|
||
context,
|
||
text: '确定'.tr,
|
||
onTap: () {
|
||
Get.back();
|
||
|
||
int selectedIndex =
|
||
blueteethBindController.model.deviceIndex0!
|
||
? 0
|
||
: (blueteethBindController.model.deviceIndex1!
|
||
? 1
|
||
: 2);
|
||
|
||
onConfirm(selectedIndex);
|
||
},
|
||
),
|
||
),
|
||
// 取消按钮
|
||
Padding(
|
||
padding: EdgeInsetsDirectional.fromSTEB(
|
||
60.rpx, 19.rpx, 60.rpx, 60.rpx),
|
||
child: _buildActionButton(
|
||
context,
|
||
text: '取消'.tr,
|
||
onTap: () {
|
||
Get.back();
|
||
onCancel();
|
||
},
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
},
|
||
);
|
||
}
|
||
|
||
Future<void> showHaveBindDialog(BuildContext context) async {
|
||
ThemeController themeController = Get.find();
|
||
|
||
return 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(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: TextStyle(
|
||
fontFamily: 'Inter',
|
||
fontSize: 30.rpx,
|
||
letterSpacing: 0.0,
|
||
color: themeController.currentColor.sc3,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
Padding(
|
||
padding: EdgeInsetsDirectional.fromSTEB(
|
||
0.rpx, 70.rpx, 0.rpx, 56.rpx),
|
||
child: RichText(
|
||
text: TextSpan(children: [
|
||
TextSpan(
|
||
text: "蓝牙绑定.无法绑定1".tr,
|
||
style: TextStyle(
|
||
color: themeController.currentColor.sc3,
|
||
fontSize: AppConstants().normal_text_fontSize,
|
||
),
|
||
),
|
||
TextSpan(
|
||
text: "蓝牙绑定.无法绑定2".tr,
|
||
style: TextStyle(
|
||
color: themeController.currentColor.sc8,
|
||
fontSize: AppConstants().normal_text_fontSize,
|
||
),
|
||
),
|
||
TextSpan(
|
||
text: "蓝牙绑定.无法绑定3".tr,
|
||
style: TextStyle(
|
||
color: themeController.currentColor.sc3,
|
||
fontSize: AppConstants().normal_text_fontSize,
|
||
),
|
||
),
|
||
]),
|
||
),
|
||
),
|
||
Padding(
|
||
padding: EdgeInsetsDirectional.fromSTEB(0, 19.rpx, 0, 60.rpx),
|
||
child: CustomCard(
|
||
borderRadius: AppConstants().button_container_radius,
|
||
onTap: () {
|
||
Get.back(result: true);
|
||
},
|
||
colors: [
|
||
themeController.currentColor.sc1,
|
||
themeController.currentColor.sc2,
|
||
],
|
||
child: Container(
|
||
width: MediaQuery.sizeOf(context).width,
|
||
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: TextStyle(
|
||
color: themeController.currentColor.sc3,
|
||
fontFamily: 'Inter',
|
||
fontSize: AppConstants().normal_text_fontSize,
|
||
letterSpacing: 0.0,
|
||
),
|
||
),
|
||
].divide(SizedBox(
|
||
width: 17.rpx,
|
||
)),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
},
|
||
);
|
||
}
|
||
|
||
void showLoadingDialog(BuildContext context, {String? title}) {
|
||
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: TextStyle(
|
||
// 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: title ?? "连接中...".tr,
|
||
style: TextStyle(
|
||
color: themeController.currentColor.sc3,
|
||
fontSize: AppConstants().normal_text_fontSize,
|
||
),
|
||
),
|
||
]),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
},
|
||
);
|
||
}
|
||
|
||
Widget _buildCheckboxRow(
|
||
BuildContext context, {
|
||
required String title,
|
||
required bool Function() value,
|
||
required void Function(bool) onChanged,
|
||
}) {
|
||
ThemeController themeController = Get.find();
|
||
return Padding(
|
||
padding: EdgeInsetsDirectional.fromSTEB(60.rpx, 64.rpx, 0.rpx, 0.rpx),
|
||
child: Row(
|
||
mainAxisSize: MainAxisSize.max,
|
||
children: [
|
||
Obx(() => FancyCircleCheckbox(
|
||
borderColor: themeController.currentColor.sc3,
|
||
fillColor: themeController.currentColor.sc2,
|
||
value: value(),
|
||
onChanged: onChanged,
|
||
)),
|
||
Expanded(
|
||
child: Builder(
|
||
builder: (_) {
|
||
final bool isBindable = title.contains('可绑定'.tr);
|
||
final bool isBound = title.contains('已被绑定'.tr);
|
||
|
||
// 提取主文本部分
|
||
final String mainText =
|
||
title.replaceAll('可绑定'.tr, '').replaceAll('已被绑定'.tr, '');
|
||
|
||
return RichText(
|
||
text: TextSpan(
|
||
children: [
|
||
TextSpan(
|
||
text: mainText,
|
||
style: TextStyle(
|
||
fontFamily: 'Inter',
|
||
letterSpacing: 0.0,
|
||
fontSize: AppConstants().normal_text_fontSize,
|
||
color: themeController.currentColor.sc3,
|
||
),
|
||
),
|
||
if (isBindable)
|
||
TextSpan(
|
||
text: "(" + '可绑定'.tr + ")",
|
||
style: TextStyle(
|
||
fontSize: AppConstants().normal_text_fontSize,
|
||
color: themeController.currentColor.sc1,
|
||
),
|
||
),
|
||
if (isBound)
|
||
TextSpan(
|
||
text: "(" + '已被绑定'.tr + ")",
|
||
style: TextStyle(
|
||
fontSize: AppConstants().normal_text_fontSize,
|
||
color: themeController.currentColor.sc9,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
);
|
||
},
|
||
),
|
||
),
|
||
].divide(SizedBox(width: 21.rpx)),
|
||
),
|
||
);
|
||
}
|
||
|
||
Widget _buildActionButton(
|
||
BuildContext context, {
|
||
required String text,
|
||
required VoidCallback onTap,
|
||
}) {
|
||
ThemeController themeController = Get.find();
|
||
return CustomCard(
|
||
borderRadius: AppConstants().button_container_radius,
|
||
onTap: onTap,
|
||
colors: '确定'.tr == text
|
||
? [
|
||
themeController.currentColor.sc1,
|
||
themeController.currentColor.sc2,
|
||
]
|
||
: [Colors.transparent],
|
||
child: Container(
|
||
width: MediaQuery.sizeOf(context).width,
|
||
height: MediaQuery.sizeOf(context).height * 0.055,
|
||
constraints: BoxConstraints(
|
||
minWidth: 500.rpx,
|
||
minHeight: 90.rpx,
|
||
),
|
||
decoration: '确定'.tr == text
|
||
? BoxDecoration()
|
||
: BoxDecoration(
|
||
border: Border.all(
|
||
color: themeController.currentColor.sc3, // 你可以换成指定颜色
|
||
width: 1.0.rpx,
|
||
),
|
||
borderRadius: BorderRadius.circular(50.rpx), // 可选:加圆角
|
||
),
|
||
child: Row(
|
||
mainAxisSize: MainAxisSize.max,
|
||
mainAxisAlignment: MainAxisAlignment.center,
|
||
children: [
|
||
Text(
|
||
text,
|
||
style: TextStyle(
|
||
color: themeController.currentColor.sc3,
|
||
fontFamily: 'Inter',
|
||
fontSize: AppConstants().normal_text_fontSize,
|
||
letterSpacing: 0.0,
|
||
),
|
||
),
|
||
].divide(SizedBox(width: 17.rpx)),
|
||
),
|
||
),
|
||
);
|
||
}
|
||
|
||
void showConfirmDialog(
|
||
BuildContext context,
|
||
Widget widget,
|
||
String title, {
|
||
required VoidCallback onConfirm,
|
||
required VoidCallback onCancel,
|
||
}) {
|
||
ThemeController themeController = Get.find();
|
||
BlueteethBindController blueteethBindController = Get.find();
|
||
|
||
try {
|
||
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),
|
||
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: [
|
||
// 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: TextStyle(
|
||
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: TextStyle(
|
||
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: TextStyle(
|
||
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,
|
||
String title, {
|
||
required VoidCallback onConfirm,
|
||
required VoidCallback onCancel,
|
||
String confirmText = "确定",
|
||
}) {
|
||
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),
|
||
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: [
|
||
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, 64.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, 33.rpx, 33.rpx, 33.rpx),
|
||
child: Text(
|
||
title,
|
||
style: TextStyle(
|
||
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: () {
|
||
Get.back();
|
||
onConfirm();
|
||
// await Future.delayed(Duration(milliseconds: 300));
|
||
},
|
||
colors: [
|
||
themeController.currentColor.sc1,
|
||
themeController.currentColor.sc2,
|
||
],
|
||
child: Container(
|
||
width: MediaQuery.sizeOf(context).width * 0.43,
|
||
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(
|
||
confirmText,
|
||
style: TextStyle(
|
||
color: themeController.currentColor.sc3,
|
||
fontFamily: 'Inter',
|
||
fontSize: AppConstants().normal_text_fontSize,
|
||
letterSpacing: 0.0,
|
||
),
|
||
),
|
||
].divide(SizedBox(width: 17.rpx)),
|
||
),
|
||
),
|
||
),
|
||
].divide(SizedBox(
|
||
width: 70.rpx,
|
||
)),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
},
|
||
);
|
||
}
|
||
|
||
void showWifiDialog(
|
||
BuildContext context,
|
||
Widget widget,
|
||
String title, {
|
||
required VoidCallback onConfirm,
|
||
}) {
|
||
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: [
|
||
// 标题
|
||
Row(
|
||
mainAxisAlignment: MainAxisAlignment.end,
|
||
children: [
|
||
ClickableContainer(
|
||
backgroundColor: Colors.transparent, // 容器背景色
|
||
highlightColor:
|
||
themeController.currentColor.sc21, // 点击时的背景色
|
||
padding: EdgeInsets.zero, // 这里去掉外部的 padding,避免影响点击范围
|
||
onTap: () {
|
||
Get.back();
|
||
},
|
||
child: Padding(
|
||
padding:
|
||
EdgeInsetsDirectional.fromSTEB(0, 33.rpx, 0, 0.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(0.rpx, 40.rpx, 0, 0),
|
||
child: Text(
|
||
title,
|
||
style: TextStyle(
|
||
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: () {
|
||
if (blueteethBindController.model.wifiPass == null ||
|
||
blueteethBindController.model.wifiPass!.isEmpty) {
|
||
TopSlideNotification.show(
|
||
context,
|
||
text: "wifi页.密码为空".tr,
|
||
textColor: themeController.currentColor.sc9,
|
||
);
|
||
} else {
|
||
onConfirm();
|
||
Get.back();
|
||
}
|
||
},
|
||
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: TextStyle(
|
||
color: themeController.currentColor.sc3,
|
||
fontFamily: 'Inter',
|
||
fontSize: AppConstants().normal_text_fontSize,
|
||
letterSpacing: 0.0,
|
||
),
|
||
),
|
||
].divide(SizedBox(width: 17.rpx)),
|
||
),
|
||
),
|
||
),
|
||
].divide(SizedBox(
|
||
width: 70.rpx,
|
||
)),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
},
|
||
);
|
||
}
|
||
|
||
Future<void> showTipDialog(
|
||
BuildContext context,
|
||
Widget widget, {
|
||
Color? backgroundColor,
|
||
List<Color>? colors,
|
||
}) {
|
||
ThemeController themeController = Get.find();
|
||
// BlueteethBindController blueteethBindController = Get.find();
|
||
|
||
return showDialog(
|
||
context: context,
|
||
barrierDismissible: true,
|
||
barrierColor: Colors.black.withOpacity(0.5),
|
||
builder: (BuildContext context) {
|
||
return FrostedDialog(
|
||
blurSigma: 3.0,
|
||
child: Container(
|
||
decoration: BoxDecoration(
|
||
color: backgroundColor ?? 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, 74.rpx),
|
||
child: widget,
|
||
),
|
||
),
|
||
Padding(
|
||
padding: EdgeInsetsDirectional.fromSTEB(0, 19.rpx, 0, 60.rpx),
|
||
child: CustomCard(
|
||
borderRadius: AppConstants().button_container_radius,
|
||
onTap: () {
|
||
Get.back(); // 关闭对话框
|
||
},
|
||
colors: colors ??
|
||
[
|
||
themeController.currentColor.sc1,
|
||
themeController.currentColor.sc2,
|
||
],
|
||
child: Container(
|
||
width: MediaQuery.sizeOf(context).width,
|
||
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: TextStyle(
|
||
color: themeController.currentColor.sc3,
|
||
fontFamily: 'Inter',
|
||
fontSize: AppConstants().normal_text_fontSize,
|
||
letterSpacing: 0.0,
|
||
),
|
||
),
|
||
].divide(SizedBox(width: 17.rpx)),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
},
|
||
);
|
||
}
|
||
|
||
// Future<void> showUnBindTipDialog(
|
||
// BuildContext context,
|
||
// Widget widget, {
|
||
// Color? backgroundColor,
|
||
// VoidCallback? onConfirm, // “继续”按钮回调
|
||
// VoidCallback? onCancel, // “下次再说”按钮回调
|
||
// VoidCallback? onNoTip, // “下次再说”按钮回调
|
||
// }) {
|
||
// ThemeController themeController = Get.find();
|
||
// BlueteethBindController blueteethBindController = Get.find();
|
||
|
||
// return showDialog(
|
||
// context: context,
|
||
// barrierDismissible: true,
|
||
// barrierColor: Colors.black.withOpacity(0.5),
|
||
// builder: (BuildContext context) {
|
||
// return FrostedDialog(
|
||
// blurSigma: 3.0,
|
||
// child: Container(
|
||
// decoration: BoxDecoration(
|
||
// color: backgroundColor ?? 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, 30.rpx),
|
||
// child: widget,
|
||
// ),
|
||
// ),
|
||
// Padding(
|
||
// padding: EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 10.rpx),
|
||
// child: CustomCard(
|
||
// borderRadius: AppConstants().button_container_radius,
|
||
// onTap: () {
|
||
// Get.back(); // 关闭对话框
|
||
// if (onConfirm != null) {
|
||
// onConfirm(); // 调用确认回调
|
||
// }
|
||
// },
|
||
// colors: [
|
||
// themeController.currentColor.sc1,
|
||
// themeController.currentColor.sc2,
|
||
// ],
|
||
// child: Container(
|
||
// width: MediaQuery.sizeOf(context).width,
|
||
// 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: TextStyle(
|
||
// color: themeController.currentColor.sc3,
|
||
// fontFamily: 'Inter',
|
||
// fontSize: AppConstants().normal_text_fontSize,
|
||
// letterSpacing: 0.0,
|
||
// ),
|
||
// ),
|
||
// ].divide(SizedBox(width: 17.rpx)),
|
||
// ),
|
||
// ),
|
||
// ),
|
||
// ),
|
||
// Padding(
|
||
// padding: EdgeInsetsDirectional.fromSTEB(0, 19.rpx, 0, 60.rpx),
|
||
// child: CustomCard(
|
||
// borderRadius: AppConstants().button_container_radius,
|
||
// onTap: () {
|
||
// Get.back(); // 关闭对话框
|
||
// if (onCancel != null) {
|
||
// onCancel(); // 调用取消回调
|
||
// }
|
||
// },
|
||
// colors: [Colors.transparent],
|
||
// child: Container(
|
||
// width: MediaQuery.sizeOf(context).width,
|
||
// height: MediaQuery.sizeOf(context).height * 0.055,
|
||
// decoration: BoxDecoration(
|
||
// border: Border.all(
|
||
// color: Colors.white,
|
||
// width: 0.5.rpx,
|
||
// ),
|
||
// borderRadius: BorderRadius.circular(
|
||
// AppConstants().button_container_radius),
|
||
// ),
|
||
// constraints: BoxConstraints(
|
||
// minWidth: 500.rpx,
|
||
// minHeight: 90.rpx,
|
||
// ),
|
||
// child: Row(
|
||
// mainAxisSize: MainAxisSize.max,
|
||
// mainAxisAlignment: MainAxisAlignment.center,
|
||
// children: [
|
||
// Text(
|
||
// '下次再说'.tr,
|
||
// style: TextStyle(
|
||
// color: themeController.currentColor.sc3,
|
||
// fontFamily: 'Inter',
|
||
// fontSize: AppConstants().normal_text_fontSize,
|
||
// letterSpacing: 0.0,
|
||
// ),
|
||
// ),
|
||
// ].divide(SizedBox(width: 17.rpx)),
|
||
// ),
|
||
// ),
|
||
// ),
|
||
// ),
|
||
// Padding(
|
||
// padding: EdgeInsets.fromLTRB(0, 0, 0, 30.rpx),
|
||
// child: Container(
|
||
// width: double.infinity,
|
||
// child: Column(
|
||
// mainAxisSize: MainAxisSize.max,
|
||
// children: [
|
||
// Container(
|
||
// width: double.infinity,
|
||
// child: Row(
|
||
// mainAxisSize: MainAxisSize.max,
|
||
// mainAxisAlignment: MainAxisAlignment.center,
|
||
// children: [
|
||
// Theme(
|
||
// data: ThemeData(
|
||
// checkboxTheme: CheckboxThemeData(
|
||
// visualDensity: VisualDensity.compact,
|
||
// materialTapTargetSize:
|
||
// MaterialTapTargetSize.shrinkWrap,
|
||
// shape: RoundedRectangleBorder(
|
||
// borderRadius: BorderRadius.circular(64),
|
||
// ),
|
||
// ),
|
||
// unselectedWidgetColor: Color(0xFFD3D3D3),
|
||
// ),
|
||
// child: Obx(
|
||
// () => Checkbox(
|
||
// value:
|
||
// blueteethBindController.model.read ==
|
||
// 1
|
||
// ? false
|
||
// : true,
|
||
// onChanged: (newValue) async {
|
||
// blueteethBindController.model.read =
|
||
// newValue == true ? 0 : 1;
|
||
// blueteethBindController.updateAll();
|
||
// },
|
||
// side: BorderSide(
|
||
// width: 1.5,
|
||
// color: Colors.white,
|
||
// ),
|
||
// activeColor: stringToColor("#16C89F"),
|
||
// ),
|
||
// )),
|
||
// Text(
|
||
// '绑定引导.不再提示'.tr,
|
||
// style: TextStyle(
|
||
// fontFamily: 'Inter',
|
||
// fontSize: 26.rpx,
|
||
// letterSpacing: 0.0,
|
||
// color: themeController.currentColor.sc3,
|
||
// ),
|
||
// ),
|
||
// ].divide(SizedBox(width: 22.rpx)),
|
||
// ),
|
||
// ),
|
||
// ].divide(SizedBox(height: 42.rpx)),
|
||
// ),
|
||
// ),
|
||
// )
|
||
// ],
|
||
// ),
|
||
// ),
|
||
// ),
|
||
// );
|
||
// },
|
||
// );
|
||
// }
|
||
|
||
Future<void> showUnBindTipDialog(
|
||
BuildContext context,
|
||
Widget widget, {
|
||
Color? backgroundColor,
|
||
VoidCallback? onConfirm, // “继续”按钮回调
|
||
VoidCallback? onCancel, // “下次再说”按钮回调
|
||
bool initialNoTipValue = false, // 初始的"不再提示"值,从外部传入
|
||
ValueChanged<bool>? onNoTipChanged, // "不再提示"值变化时的回调
|
||
}) {
|
||
ThemeController themeController = Get.find();
|
||
// 移除原来的控制器依赖,使用传入的初始值
|
||
// BlueteethBindController blueteethBindController = Get.find();
|
||
|
||
// 使用局部状态管理不再提示的值
|
||
bool noTipValue = initialNoTipValue;
|
||
|
||
return showDialog(
|
||
context: context,
|
||
barrierDismissible: true,
|
||
barrierColor: Colors.black.withOpacity(0.5),
|
||
builder: (BuildContext context) {
|
||
// 使用StatefulBuilder来管理局部状态
|
||
return StatefulBuilder(
|
||
builder: (context, setState) {
|
||
return FrostedDialog(
|
||
blurSigma: 3.0,
|
||
child: Container(
|
||
decoration: BoxDecoration(
|
||
color: backgroundColor ?? 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, 30.rpx),
|
||
child: widget,
|
||
),
|
||
),
|
||
Padding(
|
||
padding:
|
||
EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 10.rpx),
|
||
child: CustomCard(
|
||
borderRadius: AppConstants().button_container_radius,
|
||
onTap: () {
|
||
Get.back(); // 关闭对话框
|
||
if (onConfirm != null) {
|
||
onConfirm(); // 调用确认回调
|
||
}
|
||
},
|
||
colors: [
|
||
themeController.currentColor.sc1,
|
||
themeController.currentColor.sc2,
|
||
],
|
||
child: Container(
|
||
width: MediaQuery.sizeOf(context).width,
|
||
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: TextStyle(
|
||
color: themeController.currentColor.sc3,
|
||
fontFamily: 'Inter',
|
||
fontSize: AppConstants().normal_text_fontSize,
|
||
letterSpacing: 0.0,
|
||
),
|
||
),
|
||
].divide(SizedBox(width: 17.rpx)),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
Padding(
|
||
padding:
|
||
EdgeInsetsDirectional.fromSTEB(0, 19.rpx, 0, 60.rpx),
|
||
child: CustomCard(
|
||
borderRadius: AppConstants().button_container_radius,
|
||
onTap: () {
|
||
Get.back(); // 关闭对话框
|
||
if (onCancel != null) {
|
||
onCancel(); // 调用取消回调
|
||
}
|
||
},
|
||
colors: [Colors.transparent],
|
||
child: Container(
|
||
width: MediaQuery.sizeOf(context).width,
|
||
height: MediaQuery.sizeOf(context).height * 0.055,
|
||
decoration: BoxDecoration(
|
||
border: Border.all(
|
||
color: Colors.white,
|
||
width: 0.5.rpx,
|
||
),
|
||
borderRadius: BorderRadius.circular(
|
||
AppConstants().button_container_radius),
|
||
),
|
||
constraints: BoxConstraints(
|
||
minWidth: 500.rpx,
|
||
minHeight: 90.rpx,
|
||
),
|
||
child: Row(
|
||
mainAxisSize: MainAxisSize.max,
|
||
mainAxisAlignment: MainAxisAlignment.center,
|
||
children: [
|
||
Text(
|
||
'下次再说'.tr,
|
||
style: TextStyle(
|
||
color: themeController.currentColor.sc3,
|
||
fontFamily: 'Inter',
|
||
fontSize: AppConstants().normal_text_fontSize,
|
||
letterSpacing: 0.0,
|
||
),
|
||
),
|
||
].divide(SizedBox(width: 17.rpx)),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
Padding(
|
||
padding: EdgeInsets.fromLTRB(0, 0, 0, 30.rpx),
|
||
child: Container(
|
||
width: double.infinity,
|
||
child: Column(
|
||
mainAxisSize: MainAxisSize.max,
|
||
children: [
|
||
Container(
|
||
width: double.infinity,
|
||
child: Row(
|
||
mainAxisSize: MainAxisSize.max,
|
||
mainAxisAlignment: MainAxisAlignment.center,
|
||
children: [
|
||
Theme(
|
||
data: ThemeData(
|
||
checkboxTheme: CheckboxThemeData(
|
||
visualDensity: VisualDensity.compact,
|
||
materialTapTargetSize:
|
||
MaterialTapTargetSize.shrinkWrap,
|
||
shape: RoundedRectangleBorder(
|
||
borderRadius:
|
||
BorderRadius.circular(64),
|
||
),
|
||
),
|
||
unselectedWidgetColor: Color(0xFFD3D3D3),
|
||
),
|
||
child: Checkbox(
|
||
value: noTipValue,
|
||
onChanged: (newValue) {
|
||
if (newValue != null) {
|
||
setState(() {
|
||
noTipValue = newValue;
|
||
});
|
||
|
||
// 回调新的值给外部
|
||
if (onNoTipChanged != null) {
|
||
onNoTipChanged(noTipValue);
|
||
}
|
||
}
|
||
},
|
||
side: BorderSide(
|
||
width: 1.5,
|
||
color: Colors.white,
|
||
),
|
||
activeColor: stringToColor("#16C89F"),
|
||
),
|
||
),
|
||
Text(
|
||
'绑定引导.不再提示'.tr,
|
||
style: TextStyle(
|
||
fontFamily: 'Inter',
|
||
fontSize: 26.rpx,
|
||
letterSpacing: 0.0,
|
||
color: themeController.currentColor.sc3,
|
||
),
|
||
),
|
||
].divide(SizedBox(width: 22.rpx)),
|
||
),
|
||
),
|
||
].divide(SizedBox(height: 42.rpx)),
|
||
),
|
||
),
|
||
)
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
},
|
||
);
|
||
},
|
||
);
|
||
}
|
||
|
||
Future<void> showUnbindConfirmDialog({
|
||
required BuildContext context,
|
||
required VoidCallback onConfirm,
|
||
required VoidCallback onCancel,
|
||
required String title,
|
||
}) async {
|
||
await showDialog(
|
||
context: context,
|
||
barrierDismissible: true,
|
||
builder: (BuildContext context) {
|
||
return FrostedDialog(
|
||
blurSigma: 3.0,
|
||
child: Container(
|
||
width: 520.rpx,
|
||
height: 460.rpx,
|
||
decoration: BoxDecoration(
|
||
color: Colors.white,
|
||
borderRadius: BorderRadius.circular(20.0),
|
||
),
|
||
child: Padding(
|
||
padding: EdgeInsets.only(
|
||
left: 45.rpx, right: 45.rpx, top: 90.rpx, bottom: 60.rpx),
|
||
child: Column(
|
||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
mainAxisSize: MainAxisSize.min,
|
||
children: [
|
||
Text(
|
||
title,
|
||
style: TextStyle(
|
||
fontSize: 30.rpx,
|
||
color: Colors.black,
|
||
),
|
||
),
|
||
const SizedBox(height: 12),
|
||
RichText(
|
||
textAlign: TextAlign.center,
|
||
text: TextSpan(
|
||
style: TextStyle(fontSize: 26.rpx, color: Colors.black87),
|
||
children: [
|
||
TextSpan(
|
||
text: '该设备只可被一个用户绑定,'.tr,
|
||
style: TextStyle(fontSize: 26.rpx)),
|
||
TextSpan(
|
||
text: '解绑后'.tr,
|
||
style: TextStyle(color: Colors.red, fontSize: 26.rpx),
|
||
),
|
||
TextSpan(
|
||
text: '其他用户才可以绑定'.tr,
|
||
style: TextStyle(fontSize: 26.rpx)),
|
||
],
|
||
),
|
||
),
|
||
const SizedBox(height: 24),
|
||
Row(
|
||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
children: [
|
||
CustomCard(
|
||
gradientDirection: GradientDirection.vertical,
|
||
borderRadius: 16.rpx,
|
||
onTap: () {
|
||
Get.back();
|
||
onCancel();
|
||
},
|
||
colors: [
|
||
Color(0xFF1592AA),
|
||
Color(0XFF0C83A7),
|
||
Color(0XFF006FA3)
|
||
],
|
||
child: Container(
|
||
width: 200.rpx,
|
||
height: 90.rpx,
|
||
alignment: Alignment.center,
|
||
child: Text(
|
||
'取消'.tr,
|
||
style: TextStyle(
|
||
fontSize: 26.rpx, color: Colors.white),
|
||
),
|
||
)),
|
||
CustomCard(
|
||
borderRadius: 16.rpx,
|
||
onTap: () {
|
||
Get.back();
|
||
onConfirm();
|
||
},
|
||
colors: [
|
||
Color(0xFF1592AA),
|
||
Color(0XFF0C83A7),
|
||
Color(0XFF006FA3)
|
||
],
|
||
child: Container(
|
||
width: 200.rpx,
|
||
height: 90.rpx,
|
||
alignment: Alignment.center,
|
||
child: Text(
|
||
'解绑'.tr,
|
||
style: TextStyle(
|
||
fontSize: 26.rpx, color: Colors.white),
|
||
),
|
||
))
|
||
// _buildButton(
|
||
// text: '解绑',
|
||
// onPressed: () {
|
||
// Navigator.pop(context);
|
||
// onConfirm();
|
||
// },
|
||
// isGradient: true,
|
||
// ),
|
||
],
|
||
)
|
||
],
|
||
),
|
||
),
|
||
));
|
||
},
|
||
);
|
||
}
|
||
|
||
Future<void> showDeleteDeviceConfirmDialog({
|
||
required BuildContext context,
|
||
required VoidCallback onConfirm,
|
||
required VoidCallback onCancel,
|
||
required String title,
|
||
}) async {
|
||
await showDialog(
|
||
context: context,
|
||
barrierDismissible: true,
|
||
builder: (BuildContext context) {
|
||
return FrostedDialog(
|
||
blurSigma: 3.0,
|
||
child: Container(
|
||
width: 520.rpx,
|
||
height: 460.rpx,
|
||
decoration: BoxDecoration(
|
||
color: Colors.white,
|
||
borderRadius: BorderRadius.circular(20.0),
|
||
),
|
||
child: Padding(
|
||
padding: EdgeInsets.only(
|
||
left: 45.rpx, right: 45.rpx, top: 90.rpx, bottom: 60.rpx),
|
||
child: Column(
|
||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
mainAxisSize: MainAxisSize.min,
|
||
children: [
|
||
Text(
|
||
title,
|
||
style: TextStyle(
|
||
fontSize: 30.rpx,
|
||
color: Colors.black,
|
||
),
|
||
),
|
||
const SizedBox(height: 12),
|
||
RichText(
|
||
textAlign: TextAlign.center,
|
||
text: TextSpan(
|
||
style: TextStyle(fontSize: 26.rpx, color: Colors.black87),
|
||
children: [
|
||
TextSpan(
|
||
text: '删除后,'.tr,
|
||
style:
|
||
TextStyle(color: Colors.red, fontSize: 26.rpx)),
|
||
TextSpan(
|
||
text: '该设备的历史数据将被清除'.tr,
|
||
style: TextStyle(fontSize: 26.rpx),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
const SizedBox(height: 24),
|
||
Row(
|
||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
children: [
|
||
CustomCard(
|
||
gradientDirection: GradientDirection.vertical,
|
||
borderRadius: 16.rpx,
|
||
onTap: () {
|
||
Get.back();
|
||
onCancel();
|
||
},
|
||
colors: [
|
||
Color(0xFF1592AA),
|
||
Color(0XFF0C83A7),
|
||
Color(0XFF006FA3)
|
||
],
|
||
child: Container(
|
||
width: 200.rpx,
|
||
height: 90.rpx,
|
||
alignment: Alignment.center,
|
||
child: Text(
|
||
'取消'.tr,
|
||
style: TextStyle(
|
||
fontSize: 26.rpx, color: Colors.white),
|
||
),
|
||
)),
|
||
CustomCard(
|
||
borderRadius: 16.rpx,
|
||
onTap: () {
|
||
Get.back();
|
||
onConfirm();
|
||
},
|
||
colors: [
|
||
Color(0xFF1592AA),
|
||
Color(0XFF0C83A7),
|
||
Color(0XFF006FA3)
|
||
],
|
||
child: Container(
|
||
width: 200.rpx,
|
||
height: 90.rpx,
|
||
alignment: Alignment.center,
|
||
child: Text(
|
||
'删除'.tr,
|
||
style: TextStyle(
|
||
fontSize: 26.rpx, color: Colors.white),
|
||
),
|
||
))
|
||
// _buildButton(
|
||
// text: '解绑',
|
||
// onPressed: () {
|
||
// Navigator.pop(context);
|
||
// onConfirm();
|
||
// },
|
||
// isGradient: true,
|
||
// ),
|
||
],
|
||
)
|
||
],
|
||
),
|
||
),
|
||
));
|
||
},
|
||
);
|
||
|
||
//消息弹窗
|
||
}
|
||
|
||
// Future<void> showMessageConfirmDialog({
|
||
// required BuildContext context,
|
||
// required VoidCallback onConfirm,
|
||
// required VoidCallback onCancel,
|
||
// required String title,
|
||
// }) async {
|
||
// await showDialog(
|
||
// context: context,
|
||
// barrierDismissible: true,
|
||
// builder: (BuildContext context) {
|
||
// return FrostedDialog(
|
||
// blurSigma: 3.0,
|
||
// child: Container(
|
||
// width: 520.rpx,
|
||
// height: 460.rpx,
|
||
// decoration: BoxDecoration(
|
||
// color: Colors.white,
|
||
// borderRadius: BorderRadius.circular(20.0),
|
||
// ),
|
||
// child: Padding(
|
||
// padding: EdgeInsets.only(
|
||
// left: 45.rpx, right: 45.rpx, top: 90.rpx, bottom: 60.rpx),
|
||
// child: Column(
|
||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
// mainAxisSize: MainAxisSize.min,
|
||
// children: [
|
||
// Text(
|
||
// title,
|
||
// style: TextStyle(
|
||
// fontSize: 30.rpx,
|
||
// color: Colors.black,
|
||
// ),
|
||
// ),
|
||
// const SizedBox(height: 12),
|
||
// RichText(
|
||
// textAlign: TextAlign.center,
|
||
// text: TextSpan(
|
||
// style: TextStyle(fontSize: 26.rpx, color: Colors.black87),
|
||
// children: [
|
||
// TextSpan(
|
||
// text: '有一条新的设备分享消息,'.tr,
|
||
// style:
|
||
// TextStyle(color: Colors.red, fontSize: 26.rpx)),
|
||
// ],
|
||
// ),
|
||
// ),
|
||
// const SizedBox(height: 24),
|
||
// Row(
|
||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
// children: [
|
||
// CustomCard(
|
||
// gradientDirection: GradientDirection.vertical,
|
||
// borderRadius: 16.rpx,
|
||
// onTap: () {
|
||
// Get.back();
|
||
// onCancel();
|
||
// },
|
||
// colors: [
|
||
// Color(0xFF1592AA),
|
||
// Color(0XFF0C83A7),
|
||
// Color(0XFF006FA3)
|
||
// ],
|
||
// child: Container(
|
||
// width: 200.rpx,
|
||
// height: 90.rpx,
|
||
// alignment: Alignment.center,
|
||
// child: Text(
|
||
// '取消'.tr,
|
||
// style: TextStyle(
|
||
// fontSize: 26.rpx, color: Colors.white),
|
||
// ),
|
||
// )),
|
||
// CustomCard(
|
||
// borderRadius: 16.rpx,
|
||
// onTap: () {
|
||
// Get.back();
|
||
// onConfirm();
|
||
// },
|
||
// colors: [
|
||
// Color(0xFF1592AA),
|
||
// Color(0XFF0C83A7),
|
||
// Color(0XFF006FA3)
|
||
// ],
|
||
// child: Container(
|
||
// width: 200.rpx,
|
||
// height: 90.rpx,
|
||
// alignment: Alignment.center,
|
||
// child: Text(
|
||
// '去查看'.tr,
|
||
// style: TextStyle(
|
||
// fontSize: 26.rpx, color: Colors.white),
|
||
// ),
|
||
// ))
|
||
// ],
|
||
// )
|
||
// ],
|
||
// ),
|
||
// ),
|
||
// ));
|
||
// },
|
||
// );
|
||
// }
|
||
Future<String?> showMessageConfirmDialog({
|
||
required String title,
|
||
List<Color> colorsList = const [
|
||
Color(0xFF1592AA),
|
||
Color(0XFF0C83A7),
|
||
Color(0XFF006FA3)
|
||
],
|
||
Color backgroundColor = Colors.white,
|
||
Color textColor = Colors.black,
|
||
}) async {
|
||
return await Get.dialog<String>(
|
||
FrostedDialog(
|
||
blurSigma: 3.0,
|
||
child: Container(
|
||
width: 520.rpx,
|
||
height: 460.rpx,
|
||
decoration: BoxDecoration(
|
||
color: backgroundColor,
|
||
borderRadius: BorderRadius.circular(20.0),
|
||
),
|
||
child: Padding(
|
||
padding: EdgeInsets.only(
|
||
left: 45.rpx, right: 45.rpx, top: 90.rpx, bottom: 60.rpx),
|
||
child: Column(
|
||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
mainAxisSize: MainAxisSize.min,
|
||
children: [
|
||
Text(
|
||
title,
|
||
style: TextStyle(fontSize: 30.rpx, color: textColor),
|
||
),
|
||
const SizedBox(height: 12),
|
||
RichText(
|
||
textAlign: TextAlign.center,
|
||
text: TextSpan(
|
||
style: TextStyle(fontSize: 26.rpx, color: Colors.black),
|
||
children: [
|
||
TextSpan(
|
||
text: '有一条新的设备分享消息'.tr,
|
||
style: TextStyle(color: textColor, fontSize: 26.rpx)),
|
||
],
|
||
),
|
||
),
|
||
const SizedBox(height: 24),
|
||
Row(
|
||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
children: [
|
||
CustomCard(
|
||
enableBorder: true,
|
||
borderColor: themeController.currentColor.sc4,
|
||
gradientDirection: GradientDirection.vertical,
|
||
borderRadius: 16.rpx,
|
||
onTap: () {
|
||
Get.back(result: 'cancel');
|
||
},
|
||
colors: [Colors.transparent],
|
||
child: Container(
|
||
width: 200.rpx,
|
||
height: 90.rpx,
|
||
alignment: Alignment.center,
|
||
child: Text(
|
||
'取消'.tr,
|
||
style: TextStyle(fontSize: 26.rpx, color: Colors.black),
|
||
),
|
||
),
|
||
),
|
||
CustomCard(
|
||
borderRadius: 16.rpx,
|
||
onTap: () {
|
||
Get.back(result: 'confirm');
|
||
},
|
||
colors: colorsList,
|
||
child: Container(
|
||
width: 200.rpx,
|
||
height: 90.rpx,
|
||
alignment: Alignment.center,
|
||
child: Text(
|
||
'去查看'.tr,
|
||
style: TextStyle(fontSize: 26.rpx, color: Colors.white),
|
||
),
|
||
),
|
||
)
|
||
],
|
||
)
|
||
],
|
||
),
|
||
),
|
||
),
|
||
),
|
||
barrierDismissible: true,
|
||
);
|
||
}
|
||
|
||
Future<String?> showUnShareMessageDialog({
|
||
required String title,
|
||
required String mac,
|
||
List<Color> colorsList = const [
|
||
Color(0xFF1592AA),
|
||
Color(0XFF0C83A7),
|
||
Color(0XFF006FA3)
|
||
],
|
||
Color backgroundColor = Colors.white,
|
||
Color textColor = Colors.black,
|
||
}) async {
|
||
return await Get.dialog<String>(
|
||
FrostedDialog(
|
||
blurSigma: 3.0,
|
||
child: Container(
|
||
width: 520.rpx,
|
||
height: 460.rpx,
|
||
decoration: BoxDecoration(
|
||
color: backgroundColor,
|
||
borderRadius: BorderRadius.circular(20.0),
|
||
),
|
||
child: Padding(
|
||
padding: EdgeInsets.only(
|
||
left: 45.rpx, right: 45.rpx, top: 90.rpx, bottom: 60.rpx),
|
||
child: Column(
|
||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
mainAxisSize: MainAxisSize.min,
|
||
children: [
|
||
Text(
|
||
title,
|
||
style: TextStyle(fontSize: 30.rpx, color: textColor),
|
||
),
|
||
const SizedBox(height: 12),
|
||
RichText(
|
||
textAlign: TextAlign.center,
|
||
text: TextSpan(
|
||
style: TextStyle(fontSize: 26.rpx, color: Colors.black),
|
||
children: [
|
||
TextSpan(
|
||
text: mac,
|
||
style: TextStyle(color: Colors.blue, fontSize: 26.rpx)),
|
||
TextSpan(
|
||
text: " " + '设备已被用户解绑,将取消当前分享!'.tr,
|
||
style: TextStyle(color: textColor, fontSize: 26.rpx)),
|
||
],
|
||
),
|
||
),
|
||
const SizedBox(height: 24),
|
||
Row(
|
||
mainAxisAlignment: MainAxisAlignment.center,
|
||
children: [
|
||
CustomCard(
|
||
borderRadius: 16.rpx,
|
||
onTap: () {
|
||
Get.back(result: 'confirm');
|
||
},
|
||
colors: colorsList,
|
||
child: Container(
|
||
width: 200.rpx,
|
||
height: 90.rpx,
|
||
alignment: Alignment.center,
|
||
child: Text(
|
||
'确定'.tr,
|
||
style: TextStyle(fontSize: 26.rpx, color: Colors.white),
|
||
),
|
||
),
|
||
)
|
||
],
|
||
)
|
||
],
|
||
),
|
||
),
|
||
),
|
||
),
|
||
barrierDismissible: true,
|
||
);
|
||
}
|
||
|
||
//升级传感器弹窗
|
||
void showConfirmUpDialog(
|
||
BuildContext context,
|
||
Widget widget,
|
||
String title, {
|
||
required VoidCallback onConfirm,
|
||
required VoidCallback onCancel,
|
||
Color? backgroundColor, // ✅ 可选背景色
|
||
String confirmText = "是", // ✅ 新增:确认按钮文字
|
||
String cancelText = "否", // ✅ 新增:取消按钮文字
|
||
}) {
|
||
ThemeController themeController = Get.find();
|
||
try {
|
||
showDialog(
|
||
context: context,
|
||
barrierDismissible: true,
|
||
barrierColor: Colors.black.withOpacity(0.5), // 背景模糊色
|
||
builder: (BuildContext context) {
|
||
return FrostedDialog(
|
||
blurSigma: 3.0,
|
||
child: Container(
|
||
decoration: BoxDecoration(
|
||
color: backgroundColor ?? themeController.currentColor.sc17,
|
||
borderRadius: BorderRadius.circular(20.0),
|
||
),
|
||
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: [
|
||
Align(
|
||
alignment: AlignmentDirectional(0, 0),
|
||
child: Padding(
|
||
padding: EdgeInsetsDirectional.fromSTEB(
|
||
33.rpx, 60.rpx, 33.rpx, 33.rpx),
|
||
// 如果以后要显示标题,可以在这里加回 Text(title)
|
||
),
|
||
),
|
||
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: Column(
|
||
mainAxisAlignment: MainAxisAlignment.center,
|
||
children: [
|
||
// ✅ 确认按钮
|
||
CustomCard(
|
||
borderRadius: AppConstants().button_container_radius,
|
||
onTap: () {
|
||
Get.back();
|
||
onConfirm();
|
||
},
|
||
colors: AppConstants().mhtNormalButton,
|
||
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(
|
||
confirmText.tr, // ✅ 支持传参
|
||
style: TextStyle(
|
||
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: () async {
|
||
Get.back();
|
||
onCancel();
|
||
},
|
||
colors: [Colors.transparent],
|
||
child: Container(
|
||
// width: MediaQuery.sizeOf(context).width * 0.115,
|
||
height: MediaQuery.sizeOf(context).height * 0.055,
|
||
decoration: BoxDecoration(
|
||
color: Colors.white, // 背景色
|
||
border: Border.all(
|
||
color: stringToColor("#929699"), // 边框颜色
|
||
width: 1.rpx, // 边框宽度
|
||
),
|
||
borderRadius: BorderRadius.circular(
|
||
AppConstants().button_container_radius), // 圆角
|
||
),
|
||
constraints: BoxConstraints(
|
||
minWidth: 160.rpx,
|
||
minHeight: 90.rpx,
|
||
),
|
||
child: Row(
|
||
mainAxisSize: MainAxisSize.max,
|
||
mainAxisAlignment: MainAxisAlignment.center,
|
||
children: [
|
||
Text(
|
||
cancelText.tr, // ✅ 支持传参
|
||
style: TextStyle(
|
||
color: stringToColor("#333333"),
|
||
fontFamily: 'Inter',
|
||
fontSize:
|
||
AppConstants().normal_text_fontSize,
|
||
letterSpacing: 0.0,
|
||
),
|
||
),
|
||
].divide(SizedBox(width: 17.rpx)),
|
||
),
|
||
),
|
||
),
|
||
].divide(SizedBox(height: 19.rpx)),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
},
|
||
);
|
||
} catch (e) {
|
||
print(e);
|
||
}
|
||
}
|
||
|
||
//取消升级弹窗
|
||
void showConfirmCancelDialog(
|
||
BuildContext context,
|
||
Widget widget,
|
||
String title, {
|
||
required VoidCallback onConfirm,
|
||
required VoidCallback onCancel,
|
||
Color? backgroundColor, // ✅ 整个弹窗背景色
|
||
String confirmText = "是", // ✅ 确认按钮文字
|
||
String cancelText = "否", // ✅ 取消按钮文字
|
||
Color? confirmButtonColor, // ✅ 新增:确认按钮背景色
|
||
Color? cancelButtonColor, // ✅ 新增:取消按钮背景色
|
||
}) {
|
||
ThemeController themeController = Get.find();
|
||
try {
|
||
showDialog(
|
||
context: context,
|
||
barrierDismissible: true,
|
||
barrierColor: Colors.black.withOpacity(0.5), // 背景模糊色
|
||
builder: (BuildContext context) {
|
||
return FrostedDialog(
|
||
blurSigma: 3.0,
|
||
child: Container(
|
||
decoration: BoxDecoration(
|
||
color: backgroundColor ?? themeController.currentColor.sc17,
|
||
borderRadius: BorderRadius.circular(20.0),
|
||
),
|
||
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: [
|
||
Align(
|
||
alignment: AlignmentDirectional(0, 0),
|
||
child: Padding(
|
||
padding: EdgeInsetsDirectional.fromSTEB(
|
||
33.rpx, 60.rpx, 33.rpx, 33.rpx),
|
||
// 如果以后要显示标题,可以在这里加回 Text(title)
|
||
),
|
||
),
|
||
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: Column(
|
||
mainAxisAlignment: MainAxisAlignment.center,
|
||
children: [
|
||
// ✅ 确认按钮
|
||
CustomCard(
|
||
borderRadius: AppConstants().button_container_radius,
|
||
onTap: () {
|
||
Get.back();
|
||
onConfirm();
|
||
},
|
||
colors: confirmButtonColor != null
|
||
? [confirmButtonColor] // 使用自定义背景
|
||
: AppConstants().mhtNormalButton, // 默认背景
|
||
child: Container(
|
||
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(
|
||
confirmText.tr,
|
||
style: TextStyle(
|
||
color: themeController.currentColor.sc3,
|
||
fontFamily: 'Inter',
|
||
fontSize:
|
||
AppConstants().normal_text_fontSize,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
// ❌ 取消按钮
|
||
CustomCard(
|
||
borderRadius: AppConstants().button_container_radius,
|
||
onTap: () {
|
||
Get.back();
|
||
onCancel();
|
||
},
|
||
colors: [Colors.transparent],
|
||
child: Container(
|
||
height: MediaQuery.sizeOf(context).height * 0.055,
|
||
decoration: BoxDecoration(
|
||
color: cancelButtonColor ??
|
||
Colors.white, // ✅ 可传入自定义背景色
|
||
border: Border.all(
|
||
color: stringToColor("#929699"),
|
||
width: 1.rpx,
|
||
),
|
||
borderRadius: BorderRadius.circular(
|
||
AppConstants().button_container_radius,
|
||
),
|
||
),
|
||
constraints: BoxConstraints(
|
||
minWidth: 160.rpx,
|
||
minHeight: 90.rpx,
|
||
),
|
||
child: Row(
|
||
mainAxisSize: MainAxisSize.max,
|
||
mainAxisAlignment: MainAxisAlignment.center,
|
||
children: [
|
||
Text(
|
||
cancelText.tr,
|
||
style: TextStyle(
|
||
color: stringToColor("#333333"),
|
||
fontFamily: 'Inter',
|
||
fontSize:
|
||
AppConstants().normal_text_fontSize,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
].divide(SizedBox(height: 19.rpx)),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
},
|
||
);
|
||
} catch (e) {
|
||
print(e);
|
||
}
|
||
}
|