初始化项目
This commit is contained in:
366
lib/pages/device_bind/device_type.dart
Normal file
366
lib/pages/device_bind/device_type.dart
Normal file
@@ -0,0 +1,366 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.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/device/blueteeth_bind_controller.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
|
||||
class DeviceTypePage extends StatefulWidget {
|
||||
const DeviceTypePage({super.key});
|
||||
|
||||
@override
|
||||
State<DeviceTypePage> createState() => _EPageState();
|
||||
}
|
||||
|
||||
class _EPageState extends State<DeviceTypePage> {
|
||||
GlobalController globalController = Get.find();
|
||||
UserInfoController userInfoController = Get.find();
|
||||
BlueteethBindController blueteethBindController = Get.find();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// 延迟到 build 完成后执行弹窗逻辑
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (blueteethBindController.model.read == 1) {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return Dialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20.0),
|
||||
),
|
||||
backgroundColor: Colors.transparent,
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: MediaQuery.sizeOf(context).height * 0.656,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0, 26.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFFBF5D5),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConstants()
|
||||
.normal_container_radius), // 圆角半径
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
25.rpx, 25.rpx, 25.rpx, 25.rpx),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.volume_mute,
|
||||
color:
|
||||
FlutterFlowTheme.of(context)
|
||||
.primaryText,
|
||||
size: 30.rpx,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'绑定引导.说明标题'.tr,
|
||||
style: FlutterFlowTheme.of(
|
||||
context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
fontWeight:
|
||||
FontWeight.w500,
|
||||
color:
|
||||
Colors.orange),
|
||||
),
|
||||
Text(
|
||||
'绑定引导.说明正文'.tr,
|
||||
style: FlutterFlowTheme.of(
|
||||
context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(
|
||||
height: AppConstants()
|
||||
.text_padding_up_dowm_p)),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 20.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: MediaQuery.sizeOf(context).height *
|
||||
0.26,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 421.rpx,
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius:
|
||||
BorderRadius.circular(20.rpx),
|
||||
child: Image.network(
|
||||
'https://picsum.photos/seed/861/600',
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(height: 25.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0, 210.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_back,
|
||||
color: FlutterFlowTheme.of(context)
|
||||
.primaryText,
|
||||
size: 24.rpx,
|
||||
),
|
||||
Text(
|
||||
'绑定引导.不再提示'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: Colors.white),
|
||||
),
|
||||
].divide(SizedBox(width: 22.rpx)),
|
||||
),
|
||||
),
|
||||
CustomCard(
|
||||
borderRadius: 50.rpx,
|
||||
onTap: () async {
|
||||
await Future.delayed(
|
||||
Duration(seconds: 1));
|
||||
Get.back(); // 关闭当前弹窗或页面
|
||||
},
|
||||
colors: [
|
||||
Colors.yellow,
|
||||
Colors.green
|
||||
], // 单色背景也用渐变写法
|
||||
title: '',
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width *
|
||||
0.66,
|
||||
height:
|
||||
MediaQuery.sizeOf(context).height *
|
||||
0.055,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 500.rpx,
|
||||
minHeight: 90.rpx,
|
||||
),
|
||||
alignment: Alignment.center, // 居中对齐
|
||||
child: Text(
|
||||
'绑定引导.跳过'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
].divide(SizedBox(height: 42.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
int read = blueteethBindController.model.read;
|
||||
if (blueteethBindController.model.read == 1) {
|
||||
//需要弹窗显示教程
|
||||
}
|
||||
return LayoutBuilder(
|
||||
builder: (context, bodySize) => GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('assets/img/bgNoImg.png'), // 本地图片
|
||||
fit: BoxFit.fill, // 填满整个 Container
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent, // 加上这一行
|
||||
appBar: AppBar(
|
||||
backgroundColor: stringToColor("#242835"),
|
||||
// backgroundColor: Colors.transparent,
|
||||
automaticallyImplyLeading: false,
|
||||
// iconTheme: IconThemeData(color: Colors.white),
|
||||
titleSpacing: 0,
|
||||
// leading: returnIconButtom,
|
||||
title: Container(
|
||||
// color: Colors.grey,
|
||||
width: double.infinity,
|
||||
height: 180.rpx,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
/// 居中标题
|
||||
Text(
|
||||
'设备列表',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
|
||||
/// 左边返回按钮
|
||||
Positioned(
|
||||
left: 0,
|
||||
child: returnIconButtom,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
actions: [],
|
||||
centerTitle: false,
|
||||
),
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
_buildDeviceCard(
|
||||
context,
|
||||
title: '设备类型.体征监测设备'.tr,
|
||||
imageUrl: 'assets/img/device.png',
|
||||
),
|
||||
_buildDeviceCard(
|
||||
context,
|
||||
title: '设备类型.智能床/床垫'.tr,
|
||||
imageUrl: 'assets/img/bed.png',
|
||||
),
|
||||
_buildDeviceCard(
|
||||
context,
|
||||
title: '设备类型.摄像头'.tr,
|
||||
imageUrl: 'assets/img/camera.png',
|
||||
),
|
||||
]
|
||||
.divide(SizedBox(height: 26.rpx))
|
||||
.addToStart(SizedBox(height: 26.rpx))
|
||||
.addToEnd(SizedBox(height: 26.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDeviceCard(BuildContext context,
|
||||
{required String title, required String imageUrl}) {
|
||||
return CustomCard(
|
||||
borderRadius: 20.rpx, // 圆角大小
|
||||
onTap: () {
|
||||
print('点击了 $title');
|
||||
},
|
||||
// colors: [Colors.white.withOpacity(0.06)], // 背景色
|
||||
colors: [stringToColor("45D989"), stringToColor("00C1AA")], // 背景色
|
||||
title: title,
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user