import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_svg/svg.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/TopSlideNotification.dart'; class BluetoothPage extends GetView { Map data; BluetoothPage({required this.data}); BoxConstraints? bodysize; @override Widget build(BuildContext context) { return LayoutBuilder(builder: (context, cc) { bodysize = cc; return GestureDetector( onTap: () => FocusScope.of(context).unfocus(), child: Container( decoration: const BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/new_background.png'), // 本地图片 fit: BoxFit.fill, // 填满整个 Container ), ), child: Scaffold( backgroundColor: Colors.transparent, appBar: AppBar( backgroundColor: Colors.transparent, iconTheme: const IconThemeData(color: Colors.white), automaticallyImplyLeading: false, titleSpacing: 0, title: SizedBox( 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: 20.rpx, child: returnIconButtomNew, ), ], ), ), centerTitle: false, ), body: SafeArea( top: true, child: Padding( padding: EdgeInsets.fromLTRB(0.rpx, 115.rpx, 0.rpx, 0), child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start, children: [ Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( data['name']?.toString() ?? '未命名', style: TextStyle( color: Colors.white, fontSize: 40.rpx, ), ), SizedBox(width: 27.rpx), ClickableContainer( backgroundColor: Colors.transparent, highlightColor: const Color(0xFF055466), padding: EdgeInsets.only(left: 0), onTap: () { Get.toNamed("/editBedPage", arguments: data); }, child: Container( width: 42.rpx, height: 42.rpx, child: SvgPicture.asset( "assets/img/icon/bluetooth_edit.svg", color: Colors.white, ))) ], ), const SizedBox(height: 4), Text(data['mac']?.toString() ?? '未命名', style: TextStyle( color: Colors.white70, fontSize: 26.rpx)), const SizedBox(height: 16), // 蓝牙连接状态 Column( children: [ Image.asset( 'assets/images/active_bluetooth.png', width: 68.rpx, height: 68.rpx, ), SizedBox(height: 4), Text('已连接', style: TextStyle( color: Color(0xFF6BFDAC), fontSize: 26.rpx)), ], ), ], ), const SizedBox(height: 24), // 按钮列表 Expanded( child: ListView( padding: EdgeInsets.symmetric(horizontal: 30.rpx), children: [ _buildMenuButton( context, '详情', "/devicePeopleInfo", arguments: data), _buildMenuButton( context, '人员资料', "/peopleInfoPage", arguments: data), _buildMenuButton( context, '房间选择', "/roomPickerPage",arguments: data), _buildMenuButton(context, '设备校准', ""), _buildMenuButton(context, '体征传感器', ""), _buildMenuButton(context, 'WIFI配置', ""), _buildMenuButton( context, '睡眠习惯', "/sleepHabitPage"), _buildMenuButton( context, '分享设备', "/deviceSharePage"), _buildMenuButton(context, '解绑', ""), ], ), ), ], ), )), ))); }); } Widget _buildMenuButton(BuildContext context, String title, String? path, {Map? arguments}) { return Padding( padding: EdgeInsets.only(bottom: 19.rpx), child: ClickableContainer( backgroundColor: Colors.transparent, highlightColor: Color(0XFF055466), padding: EdgeInsets.only(left: 0), onTap: () { if (path?.isNotEmpty == true) { if (arguments != null) { Get.toNamed(path!, arguments: arguments); } else { Get.toNamed(path!); } } else { TopSlideNotification.show( context, text: "功能开发中...", ); } }, child: Container( height: MediaQuery.sizeOf(context).height * 0.0566, decoration: BoxDecoration( color: const Color(0xFF003058), borderRadius: BorderRadius.circular(16.rpx), ), child: Center( child: Text( title, style: const TextStyle(color: Colors.white, fontSize: 16), ), ), ), ), ); } }