更新
This commit is contained in:
123
lib/pages/device_bind/componnet/DeviceShareInfoWidget.dart
Normal file
123
lib/pages/device_bind/componnet/DeviceShareInfoWidget.dart
Normal file
@@ -0,0 +1,123 @@
|
||||
import 'package:ef/ef.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/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/controller/device/device_share_list_controller.dart';
|
||||
import 'package:vbvs_app/controller/message/message_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
|
||||
class DeviceShareInfoWidget extends StatefulWidget {
|
||||
final data;
|
||||
|
||||
const DeviceShareInfoWidget({super.key, required this.data});
|
||||
|
||||
@override
|
||||
State<DeviceShareInfoWidget> createState() => _DeviceShareInfoWidgetState();
|
||||
}
|
||||
|
||||
class _DeviceShareInfoWidgetState extends State<DeviceShareInfoWidget> {
|
||||
ThemeController themeController = Get.find();
|
||||
MessageController messageController = Get.find();
|
||||
DeviceShareListController deviceShareListController = Get.find();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bool selected = false;
|
||||
return ClickableContainer(
|
||||
backgroundColor: themeController.currentColor.sc5,
|
||||
highlightColor: themeController.currentColor.sc3,
|
||||
borderRadius: 20.rpx,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0.rpx, 33.rpx, 0.rpx, 33.rpx),
|
||||
onTap: () {},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Obx(() {
|
||||
return Theme(
|
||||
data: ThemeData(
|
||||
checkboxTheme: CheckboxThemeData(
|
||||
visualDensity: VisualDensity.compact,
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(64),
|
||||
),
|
||||
),
|
||||
unselectedWidgetColor: Color(0xFFD3D3D3),
|
||||
),
|
||||
child: Checkbox(
|
||||
value: deviceShareListController.selectedShareInfo.value
|
||||
.contains(widget.data[0]['k']),
|
||||
onChanged: (newValue) async {
|
||||
if (newValue != null) {
|
||||
if (newValue == true) {
|
||||
deviceShareListController.selectedShareInfo.value
|
||||
.add(widget.data[0]['k']);
|
||||
} else {
|
||||
deviceShareListController.selectedShareInfo.value
|
||||
.remove(widget.data[0]['k']);
|
||||
}
|
||||
}
|
||||
final selectedCount =
|
||||
deviceShareListController.selectedShareInfo.length;
|
||||
final totalCount =
|
||||
deviceShareListController.shareInfoList.length;
|
||||
|
||||
deviceShareListController.model.all =
|
||||
(selectedCount == totalCount) ? 1 : 0;
|
||||
deviceShareListController.selectedShareInfo
|
||||
.refresh(); // ✅ 关键代码
|
||||
deviceShareListController.updateAll();
|
||||
},
|
||||
side: BorderSide(
|
||||
width: 1.5,
|
||||
color: FlutterFlowTheme.of(context).secondaryText,
|
||||
),
|
||||
activeColor: stringToColor("#16C89F"),
|
||||
checkColor: FlutterFlowTheme.of(context).info,
|
||||
),
|
||||
);
|
||||
}),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 30.rpx,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: List.generate(widget.data.length, (index) {
|
||||
final item = widget.data[index];
|
||||
return Container(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 62.rpx,
|
||||
),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Text(
|
||||
"${item['k']}" + ":" + "${item['v']}",
|
||||
style:
|
||||
FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 50.rpx)),
|
||||
),
|
||||
].divide(SizedBox(
|
||||
width: 10.rpx,
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,7 @@ class _SingleBlueteethDeviceCompoentWidgetState
|
||||
deviceData.rssi = widget.bleDevice.rssi;
|
||||
deviceData.mac = deviceData.deviceId.replaceAll(':', '');
|
||||
BleDeviceData device = deviceData;
|
||||
blueteethBindController.currentDeviceMac = device.mac;
|
||||
device = blueteethBindController.model.betDevicelist!.firstWhere(
|
||||
(d) => d.mac == device.mac,
|
||||
orElse: () => device,
|
||||
@@ -208,7 +209,7 @@ class _SingleBlueteethDeviceCompoentWidgetState
|
||||
],
|
||||
),
|
||||
Text(
|
||||
'版本:${device.version ?? '-'}',
|
||||
"版本".tr + '${device.version ?? '-'}',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: const Color(0xFFF6FAFD),
|
||||
|
||||
@@ -708,3 +708,133 @@ void showWifiDialog(
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void showTipDialog(
|
||||
BuildContext context,
|
||||
Widget widget,
|
||||
// String title,
|
||||
) {
|
||||
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, 93.rpx, 0, 74.rpx),
|
||||
// child: Text(
|
||||
// title,
|
||||
// style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
// fontFamily: 'Inter',
|
||||
// fontSize: 30.rpx,
|
||||
// letterSpacing: 0.0,
|
||||
// color: themeController.currentColor.sc3,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 93.rpx, 0, 74.rpx),
|
||||
child: widget,
|
||||
),
|
||||
),
|
||||
// widget,
|
||||
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0, 19.rpx, 0, 60.rpx),
|
||||
child: CustomCard(
|
||||
borderRadius: AppConstants().button_container_radius,
|
||||
onTap: () {
|
||||
Get.back();
|
||||
},
|
||||
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: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(
|
||||
width: 17.rpx,
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user