更新分享设备权限

This commit is contained in:
wyf
2025-12-08 11:06:54 +08:00
parent db51c42664
commit 8285599aa9
14 changed files with 935 additions and 108 deletions

View File

@@ -29,6 +29,7 @@ class _DeviceSharePageState extends State<DeviceSharePage> {
deviceShareController.msg = "".obs;
deviceShareController.code = 0.obs;
deviceShareController.account = "".obs;
deviceShareController.type = 1.obs;
super.initState();
}
@@ -139,32 +140,184 @@ class _DeviceSharePageState extends State<DeviceSharePage> {
),
].divide(SizedBox(width: 20.rpx)),
),
// Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Obx(() => FancyCircleCheckbox(
// borderColor:
// themeController.currentColor.sc3,
// fillColor:
// themeController.currentColor.sc2,
// value: true,
// onChanged: (value) {},
// )),
// Text(
// '主设备蓝盈盈A9876451',
// style: FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color:
// themeController.currentColor.sc3,
// ),
// ),
// ].divide(SizedBox(width: 20.rpx)),
// ),
Container(
child: Padding(
padding: EdgeInsetsDirectional.only(
start: 0.rpx,
top: 0.rpx,
end: 0.rpx,
bottom: 0.rpx),
child: Column(
children: [
GestureDetector(
onTap: () {
// 当点击时,将 type 设置为 0允许控制
// data['info'][3]['opType'] = 1;
// opType.value = 1;
updateWifiConfigSwitch();
deviceShareController.updateAll();
},
child: Container(
width: MediaQuery.sizeOf(context).width,
constraints: const BoxConstraints(
minHeight: 46,
),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(0),
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'允许对方配置wifi'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: const Color(0xFFFFFFFF),
fontSize: 27.rpx,
letterSpacing: 0.0,
),
),
Obx(() {
return Container(
height: 33.rpx,
child: AspectRatio(
aspectRatio: 1,
child: Center(
child: Container(
height: 33.rpx,
width: 33.rpx,
decoration: BoxDecoration(
borderRadius:
BorderRadius
.circular(
33.rpx / 2),
border: Border.all(
width:
getWifiConfigSwitch()
? 1
: 0.5,
color:
Color(0xFFC8CBD2),
),
),
child:
getWifiConfigSwitch()
? Center(
child:
ClipOval(
child:
Container(
width:
33.rpx *
0.6,
height:
33.rpx *
0.6,
color: const Color(
0xFF6BFDAC),
),
),
)
: null,
),
),
),
);
})
],
),
),
),
// GestureDetector(
// onTap: () {
// // 当点击时,将 type 设置为 1仅允许查看
// // data['info'][3]['opType'] = 2;
// // opType.value = 2;
// },
// child: Container(
// width: MediaQuery.sizeOf(context)
// .width,
// constraints: const BoxConstraints(
// minHeight: 46,
// ),
// decoration: BoxDecoration(
// borderRadius:
// BorderRadius.circular(0),
// ),
// child: Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment:
// MainAxisAlignment
// .spaceBetween,
// children: [
// Text(
// '仅允许对方查看该设备'.tr,
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color:
// const Color(0xFFFFFFFF),
// fontSize: 27.rpx,
// letterSpacing: 0.0,
// ),
// ),
// Obx(() {
// flag2;
// return Container(
// height: 33.rpx,
// child: AspectRatio(
// aspectRatio: 1,
// child: Center(
// child: Container(
// height: 33.rpx,
// width: 33.rpx,
// decoration:
// BoxDecoration(
// borderRadius:
// BorderRadius
// .circular(
// 33.rpx /
// 2),
// border: Border.all(
// width: 2 == 2
// ? 1
// : 0.5,
// color: Color(
// 0xFFC8CBD2),
// ),
// ),
// child: 2 == 2
// ? Center(
// child:
// ClipOval(
// child:
// Container(
// width:
// 33.rpx *
// 0.6,
// height:
// 33.rpx *
// 0.6,
// color: const Color(
// 0xFF6BFDAC),
// ),
// ),
// )
// : null,
// ),
// ),
// ),
// );
// })
// ],
// ),
// ),
// ),
],
),
)),
].divide(SizedBox(height: 64.rpx)),
),
),
@@ -361,4 +514,19 @@ class _DeviceSharePageState extends State<DeviceSharePage> {
),
);
}
getWifiConfigSwitch() {
if (deviceShareController.type.value == 1) {
return true;
}
return false;
}
void updateWifiConfigSwitch() {
if (deviceShareController.type.value == 1) {
deviceShareController.type.value = 2;
} else if (deviceShareController.type.value == 2) {
deviceShareController.type.value = 1;
}
}
}