320 lines
15 KiB
Dart
320 lines
15 KiB
Dart
import 'package:ef/base/widget/flutterflow/FlutterFlowTheme.dart';
|
||
import 'package:ef/ef.dart';
|
||
import 'package:flutter/material.dart';
|
||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||
import 'package:vbvs_app/common/color/appColors.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/CustomCard.dart';
|
||
import 'package:vbvs_app/controller/mh_controller/mhdevice_share_controller.dart';
|
||
import 'package:vbvs_app/pages/common/selectDialog.dart';
|
||
|
||
import '../../common/color/appFontsize.dart';
|
||
|
||
class ShareDeviceDetailWidget extends GetView {
|
||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
MHDeviceShareController deviceShareController = Get.find();
|
||
var shareInfo = deviceShareController.model.mainShare;
|
||
RxInt type = 1.obs;
|
||
type.value = shareInfo['op_type'];
|
||
|
||
return GestureDetector(
|
||
onTap: () => FocusScope.of(context).unfocus(),
|
||
child: Scaffold(
|
||
key: scaffoldKey,
|
||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||
appBar: AppBar(
|
||
backgroundColor: Colors.transparent,
|
||
automaticallyImplyLeading: false,
|
||
iconTheme: IconThemeData(color: Colors.white),
|
||
titleSpacing: 0,
|
||
// leading: returnIconButtomAddCallback(() {
|
||
// controller.saveDataApi();
|
||
// updateParm(isShowToast: false);
|
||
// }),
|
||
// leading: returnIconButtomNew,
|
||
title: Container(
|
||
width: double.infinity,
|
||
height: 180.rpx,
|
||
child: Stack(
|
||
alignment: Alignment.center,
|
||
children: [
|
||
// 中间居中的标题
|
||
Text(
|
||
'详情',
|
||
textAlign: TextAlign.center,
|
||
style: TextStyle(
|
||
color: Colors.white,
|
||
fontSize: 30.rpx,
|
||
),
|
||
),
|
||
// 左侧图标
|
||
Positioned(
|
||
left: 0.rpx,
|
||
child: returnIconButtomNew,
|
||
),
|
||
],
|
||
),
|
||
),
|
||
|
||
actions: [],
|
||
centerTitle: false,
|
||
),
|
||
body: Container(
|
||
width: MediaQuery.sizeOf(context).width,
|
||
height: MediaQuery.sizeOf(context).height * 1,
|
||
decoration: BoxDecoration(
|
||
color: Color(0xFFF6F6F6),
|
||
),
|
||
child: Padding(
|
||
padding: EdgeInsetsDirectional.fromSTEB(15, 0, 15, 0),
|
||
child: Column(
|
||
mainAxisSize: MainAxisSize.max,
|
||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
children: [
|
||
Padding(
|
||
padding: EdgeInsetsDirectional.fromSTEB(0, 13, 0, 0),
|
||
child: Container(
|
||
width: MediaQuery.sizeOf(context).width,
|
||
decoration: BoxDecoration(
|
||
color: FlutterFlowTheme.of(context).secondaryBackground,
|
||
borderRadius: BorderRadius.circular(8),
|
||
),
|
||
child: Padding(
|
||
padding: EdgeInsetsDirectional.fromSTEB(16, 13, 16, 15),
|
||
child: Column(
|
||
mainAxisSize: MainAxisSize.max,
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Column(
|
||
mainAxisSize: MainAxisSize.max,
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Text(
|
||
'${shareInfo['userName']}',
|
||
style: FlutterFlowTheme.of(context)
|
||
.bodyMedium
|
||
.override(
|
||
fontFamily: 'Readex Pro',
|
||
color: Color(0xFF333333),
|
||
fontSize: 15,
|
||
letterSpacing: 0.0,
|
||
fontWeight: FontWeight.bold,
|
||
),
|
||
),
|
||
Text(
|
||
'分享时间:${MyUtils.timestampToDateString(int.parse(shareInfo['startTime'].toString()))}',
|
||
style: FlutterFlowTheme.of(context)
|
||
.bodyMedium
|
||
.override(
|
||
fontFamily: 'Readex Pro',
|
||
color: Color(0xFF9EA4B7),
|
||
fontSize: 11,
|
||
letterSpacing: 0.0,
|
||
),
|
||
),
|
||
].divide(SizedBox(height: 5)),
|
||
),
|
||
Obx(
|
||
() => GestureDetector(
|
||
onTap: () {
|
||
// 当点击时,将 type 设置为 0(允许控制)
|
||
type.value = 1;
|
||
controller.updateAll();
|
||
},
|
||
child: Container(
|
||
width: MediaQuery.sizeOf(context).width,
|
||
constraints: BoxConstraints(
|
||
minHeight: 46,
|
||
),
|
||
decoration: BoxDecoration(
|
||
borderRadius: BorderRadius.circular(0),
|
||
),
|
||
child: Row(
|
||
mainAxisSize: MainAxisSize.max,
|
||
mainAxisAlignment:
|
||
MainAxisAlignment.spaceBetween,
|
||
children: [
|
||
Text(
|
||
'允许对方控制和查看该设备'.tr,
|
||
style: FlutterFlowTheme.of(context)
|
||
.bodyMedium
|
||
.override(
|
||
fontFamily: 'Readex Pro',
|
||
color: Color(0xFF333333),
|
||
fontSize: 13,
|
||
letterSpacing: 0.0,
|
||
),
|
||
),
|
||
Align(
|
||
alignment: AlignmentDirectional(0, -1),
|
||
child: Icon(
|
||
type.value == 1
|
||
? Icons.check_circle // 选中时为实心圆
|
||
: Icons
|
||
.radio_button_unchecked, // 未选中时为空心圆
|
||
color: type.value == 1
|
||
? Color(0xFFD3B684) // 选中时的颜色
|
||
: Colors.grey, // 未选中时的颜色
|
||
size: 18,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
),
|
||
Obx(
|
||
() => GestureDetector(
|
||
onTap: () {
|
||
// 当点击时,将 type 设置为 1(仅允许查看)
|
||
type.value = 2;
|
||
controller.updateAll();
|
||
},
|
||
child: Container(
|
||
width: MediaQuery.sizeOf(context).width,
|
||
constraints: BoxConstraints(
|
||
minHeight: 46,
|
||
),
|
||
decoration: BoxDecoration(
|
||
borderRadius: BorderRadius.circular(0),
|
||
),
|
||
child: Row(
|
||
mainAxisSize: MainAxisSize.max,
|
||
mainAxisAlignment:
|
||
MainAxisAlignment.spaceBetween,
|
||
children: [
|
||
Text(
|
||
'仅允许对方查看该设备'.tr,
|
||
style: FlutterFlowTheme.of(context)
|
||
.bodyMedium
|
||
.override(
|
||
fontFamily: 'Readex Pro',
|
||
color: Color(0xFF333333),
|
||
fontSize: 13,
|
||
letterSpacing: 0.0,
|
||
),
|
||
),
|
||
Align(
|
||
alignment: AlignmentDirectional(0, -1),
|
||
child: Icon(
|
||
type.value == 2
|
||
? Icons.check_circle // 选中时为实心圆
|
||
: Icons
|
||
.radio_button_unchecked, // 未选中时为空心圆
|
||
color: type.value == 2
|
||
? Color(0xFFD3B684) // 选中时的颜色
|
||
: Colors.grey, // 未选中时的颜色
|
||
size: 18,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
),
|
||
].divide(SizedBox(height: 13)),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
Padding(
|
||
padding: EdgeInsetsDirectional.fromSTEB(
|
||
15, 0, 15, AppConstants.page_button_bottom_padding),
|
||
child: Container(
|
||
width: MediaQuery.sizeOf(context).width,
|
||
height: MediaQuery.sizeOf(context).height * 0.056,
|
||
constraints: BoxConstraints(
|
||
minHeight: 46,
|
||
),
|
||
decoration: BoxDecoration(
|
||
color: FlutterFlowTheme.of(context).secondaryBackground,
|
||
),
|
||
child: Container(
|
||
width: MediaQuery.sizeOf(context).width,
|
||
height: MediaQuery.sizeOf(context).height * 0.056,
|
||
decoration: BoxDecoration(
|
||
color:
|
||
FlutterFlowTheme.of(context).secondaryBackground,
|
||
borderRadius: BorderRadius.circular(12),
|
||
),
|
||
child: CustomCard(
|
||
borderRadius: 16.rpx,
|
||
gradientDirection: GradientDirection.vertical,
|
||
onTap: () async {},
|
||
colors: const [
|
||
Color(0xFFFCFCFC),
|
||
Color(0xFFF8FAF9),
|
||
Color(0XFFECF6F3),
|
||
Color(0XFFD9F0E9),
|
||
Color(0xFFCEECE3)
|
||
],
|
||
child: Container(
|
||
width: double.infinity,
|
||
height: 90.rpx,
|
||
alignment: Alignment.center,
|
||
decoration: BoxDecoration(
|
||
borderRadius: BorderRadius.circular(6),
|
||
),
|
||
child: Text("解除分享".tr,
|
||
style: TextStyle(
|
||
color: const Color(0xFF003058),
|
||
fontSize: 30.rpx,
|
||
)),
|
||
),
|
||
)
|
||
|
||
// FFButtonWidget(
|
||
// onPressed: () {
|
||
// showCustomConfirmDialog(context, "是否确定删除?").then((v) {
|
||
// if ('confirm' == v) {
|
||
// // deviceShareController
|
||
// // .deleteShare(shareInfo)
|
||
// // .then((d) {
|
||
// // deviceShareController.initData();
|
||
// // deviceShareController.updateAll();
|
||
// // Get.back();
|
||
// // });
|
||
// // print("showCustomConfirmDialog $v");
|
||
// }
|
||
// });
|
||
// },
|
||
// text: '删除',
|
||
// options: FFButtonOptions(
|
||
// height: 40,
|
||
// padding: EdgeInsetsDirectional.fromSTEB(24, 0, 24, 0),
|
||
// iconPadding:
|
||
// EdgeInsetsDirectional.fromSTEB(0, 0, 0, 0),
|
||
// color: Color(0xFFE55E92),
|
||
// textStyle:
|
||
// FlutterFlowTheme.of(context).titleSmall.override(
|
||
// fontFamily: 'Readex Pro',
|
||
// color: Colors.white,
|
||
// fontSize: 13,
|
||
// letterSpacing: 0.0,
|
||
// ),
|
||
// elevation: 3,
|
||
// borderSide: BorderSide(
|
||
// color: Colors.transparent,
|
||
// width: 1,
|
||
// ),
|
||
// borderRadius: BorderRadius.circular(8),
|
||
// ),
|
||
// ),
|
||
|
||
),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
),
|
||
);
|
||
}
|
||
}
|