This commit is contained in:
wyf
2025-05-13 11:59:04 +08:00
parent eae7a2284d
commit fb5c3864a3
101 changed files with 8427 additions and 1953 deletions

View File

@@ -1,8 +1,10 @@
import 'package:ef/ef.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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/TopSlideNotification.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged,
@@ -780,3 +782,133 @@ void showPermissionInfoDialog(BuildContext context, List data) {
},
);
}
void showProgressDialog(
BuildContext context,
ValueNotifier<double> progressNotifier,
ValueNotifier<bool> failureNotifier,
) {
ThemeController themeController = Get.find();
showDialog(
context: context,
barrierDismissible: false, // 点击对话框外部不可关闭
builder: (BuildContext dialogContext) {
return Stack(
children: [
Positioned(
top: MediaQuery.of(context).size.height * 0.4,
left: MediaQuery.of(context).size.width * 0.05,
right: MediaQuery.of(context).size.width * 0.05,
child: Material(
color: Colors.transparent,
child: Dialog(
backgroundColor: Colors.transparent,
insetPadding: EdgeInsets.zero,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
child: Container(
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
),
child: ValueListenableBuilder<double>(
valueListenable: progressNotifier,
builder: (context, progress, _) {
return ValueListenableBuilder<bool>(
valueListenable: failureNotifier,
builder: (context, isFailure, __) {
// 关闭弹窗的逻辑
if (isFailure) {
// 延迟关闭弹窗和提示错误
Future.delayed(Duration(milliseconds: 300), () {
if (Navigator.canPop(dialogContext)) {
Navigator.of(dialogContext).pop();
}
TopSlideNotification.show(
context,
text: "设备校准失败".tr,
textColor: Colors.red,
);
});
} else if (progress >= 1.0) {
// 延迟关闭弹窗和提示成功(可选)
Future.delayed(Duration(milliseconds: 300), () {
if (Navigator.canPop(dialogContext)) {
Navigator.of(dialogContext).pop();
}
TopSlideNotification.show(
context,
text: "设备校准完成".tr,
textColor: themeController.currentColor.sc3,
);
});
}
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
isFailure
? '失败'.tr
: '${(progress * 100).toStringAsFixed(0)}%',
style: TextStyle(
fontSize: 26.rpx,
color: isFailure
? Colors.red
: themeController.currentColor.sc3,
),
),
SizedBox(height: 40.rpx),
Stack(
children: [
Container(
width: double.infinity,
height: 21.rpx,
decoration: BoxDecoration(
color: stringToColor("#D9D9D9"),
borderRadius: BorderRadius.circular(
AppConstants().button_container_radius,
),
),
),
Container(
width: progress *
MediaQuery.of(context).size.width *
0.8,
height: 10.rpx,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: isFailure
? [themeController.currentColor.sc9]
: [
themeController
.currentColor.sc1,
themeController
.currentColor.sc2,
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
borderRadius:
BorderRadius.circular(5.rpx),
),
),
],
),
],
);
},
);
},
),
),
),
),
),
],
);
},
);
}

View File

@@ -1,3 +1,5 @@
import 'dart:async';
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
@@ -26,6 +28,7 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
final BodyDeviceController bodyDeviceController = Get.find();
final GlobalKey addIconKey = GlobalKey();
OverlayEntry? _popupEntry;
Timer? _timer;
void _showPopup() {
final renderBox =
@@ -95,7 +98,7 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
width: double.infinity,
child: Center(
child: Text(
'扫一扫'.tr,
'扫一扫.标题'.tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
@@ -119,7 +122,7 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
width: double.infinity,
child: Center(
child: Text(
'蓝牙绑定'.tr,
'蓝牙绑定.标题'.tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
@@ -151,6 +154,16 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
void initState() {
bodyDeviceController.keyWord.value = "";
super.initState();
// 初次请求一次
_fetchDeviceList();
// 每 5 秒定时请求一次
_timer = Timer.periodic(Duration(seconds: 5), (timer) {
_fetchDeviceList();
});
}
void _fetchDeviceList() {
bodyDeviceController.getDeviceList().then((apiResponse) {
if (apiResponse.code != HttpStatusCodes.ok) {
TopSlideNotification.show(
@@ -162,6 +175,12 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
});
}
@override
void dispose() {
_timer?.cancel(); // 页面销毁时取消定时器
super.dispose();
}
@override
Widget build(BuildContext context) {
return LayoutBuilder(
@@ -265,127 +284,6 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// Row(
// mainAxisSize: MainAxisSize.max,
// children: [
// Obx(() {
// return ClickableContainer(
// backgroundColor:
// Colors.transparent, // 或者你想设置的背景色
// highlightColor: themeController
// .currentColor.sc3, // 点击涟漪颜色
// borderRadius: 8.rpx, // 自定义圆角
// padding: EdgeInsets.all(
// 0), // 外部已经排版,这里不用加内边距
// onTap: () async {
// // 点击事件处理逻辑
// bodyDeviceController.model.type = 1;
// await bodyDeviceController
// .getDeviceList();
// bodyDeviceController.updateAll();
// },
// child: Column(
// mainAxisSize: MainAxisSize.max,
// children: [
// Text(
// '体征检测设备.我的e护'.tr,
// style:
// FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Inter',
// fontSize: AppConstants()
// .title_text_fontSize,
// letterSpacing: 0.0,
// color:
// bodyDeviceController
// .model
// .type ==
// 2
// ? themeController
// .currentColor
// .sc3
// : themeController
// .currentColor
// .sc2,
// ),
// ),
// SizedBox(
// width: 100.rpx,
// child: Divider(
// height: 1.rpx,
// thickness: 2.rpx,
// color: bodyDeviceController
// .model.type ==
// 2
// ? Colors.transparent
// : themeController
// .currentColor.sc2,
// ),
// ),
// ].divide(SizedBox(height: 10.rpx)),
// ),
// );
// }),
// Obx(() {
// return ClickableContainer(
// backgroundColor: Colors.transparent,
// highlightColor:
// themeController.currentColor.sc3,
// borderRadius: 8.rpx,
// padding: EdgeInsets.all(0),
// onTap: () async {
// // 这里写你的点击逻辑
// bodyDeviceController.model.type = 2;
// await bodyDeviceController
// .getDeviceList();
// bodyDeviceController.updateAll();
// },
// child: Column(
// mainAxisSize: MainAxisSize.max,
// children: [
// Text(
// '体征检测设备.云关爱'.tr,
// style:
// FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Inter',
// fontSize: 30.rpx,
// letterSpacing: 0.0,
// color:
// bodyDeviceController
// .model
// .type ==
// 1
// ? themeController
// .currentColor
// .sc3
// : themeController
// .currentColor
// .sc2,
// ),
// ),
// SizedBox(
// width: 100.rpx,
// child: Divider(
// height: 1.rpx,
// thickness: 2.rpx,
// color: bodyDeviceController
// .model.type ==
// 1
// ? Colors.transparent
// : themeController
// .currentColor.sc2,
// ),
// ),
// ].divide(SizedBox(height: 10.rpx)),
// ),
// );
// }),
// ].divide(SizedBox(width: 60.rpx)),
// ),
Stack(
alignment: Alignment.bottomLeft,
children: [
@@ -520,7 +418,6 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
}),
],
),
Container(
width:
MediaQuery.sizeOf(context).width * 0.38,
@@ -661,20 +558,6 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
.currentColor.sc2,
),
),
// Text(
// '体征检测设备.搜索'.tr,
// style:
// FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Inter',
// fontSize: AppConstants()
// .normal_text_fontSize,
// letterSpacing: 0.0,
// color: themeController
// .currentColor.sc2,
// ),
// ),
ClickableContainer(
backgroundColor:
Colors.transparent,
@@ -722,27 +605,26 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
Obx(() {
final isEmpty =
bodyDeviceController.deviceList.value.isEmpty;
return isEmpty
? Expanded(
child: NullDataWidget(),
)
: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 26.rpx, 30.rpx, 0),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: bodyDeviceController
.deviceList.value
.map((device) =>
DeviceDataComponentWidget(
device: device))
.toList()
.divide(SizedBox(height: 25.rpx)),
return Expanded(
child: isEmpty
? NullDataWidget()
: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 26.rpx, 30.rpx, 0),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: bodyDeviceController
.deviceList.value
.map((device) =>
DeviceDataComponentWidget(
device: device))
.toList()
.divide(SizedBox(height: 25.rpx)),
),
),
),
);
);
}),
],
),

File diff suppressed because it is too large Load Diff

View File

@@ -281,15 +281,6 @@ class _DeviceDetailPageState extends State<DeviceDetailPage> {
color: FlutterFlowTheme.of(context)
.secondaryBackground,
),
// child: ClipRRect(
// borderRadius: BorderRadius.circular(8.rpx),
// child: Image.network(
// 'https://picsum.photos/seed/851/600',
// width: 200.rpx,
// height: 200.rpx,
// fit: BoxFit.cover,
// ),
// ),
child: QrImageView(
data: '1234567890',
version: QrVersions.auto,
@@ -320,7 +311,7 @@ class _DeviceDetailPageState extends State<DeviceDetailPage> {
child: Align(
alignment: AlignmentDirectional(-1.rpx, 0.rpx),
child: Text(
'${widget.device['person']['name'] ?? '未命名'.tr}',
'${widget.device['person']?['name'] ?? '未命名'.tr}',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
@@ -446,7 +437,7 @@ class _DeviceDetailPageState extends State<DeviceDetailPage> {
child: Align(
alignment: AlignmentDirectional(-1.rpx, 0.rpx),
child: Text(
'${widget.device['update_time'] ?? '-'.tr}',
'${widget.device['status']?['updateTime'] == null ? '-'.tr : MyUtils.timestampToDateString(widget.device['status']?['updateTime'])}',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(

View File

@@ -226,7 +226,7 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
CrossAxisAlignment.start,
children: [
Text(
'${device['person']['name'] ?? '未命名'.tr}',
'${device['person']?['name'] ?? '未命名'.tr}',
style:
FlutterFlowTheme.of(context)
.bodyMedium
@@ -239,7 +239,7 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
),
),
Text(
'${MyUtils.getAgeByDate(MyUtils.formatBirthdayTime(device['person']['birthday'])) ?? '未知数据'.tr}',
'${MyUtils.getAgeByDate(MyUtils.formatBirthdayTime(device['person']?['birthday'])) ?? '未知数据'.tr}',
style:
FlutterFlowTheme.of(context)
.bodyMedium
@@ -306,8 +306,8 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
CrossAxisAlignment.start,
children: [
Text(
// '${device['_id']??'未知数据'.tr}',
"D11250300003",
'${device['code'] ?? '未知数据'.tr}',
// "D11250300003",
style:
FlutterFlowTheme.of(context)
.bodyMedium
@@ -320,7 +320,7 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
),
),
Text(
'${device['person']['weight'] ?? '未知数据'.tr}kg',
'${device['person']?['weight'] ?? '未知数据'.tr}kg',
style:
FlutterFlowTheme.of(context)
.bodyMedium

View File

@@ -69,7 +69,6 @@ class _BlueteethDevicePageState extends State<BlueteethDevicePage> {
}
Future<void> _requestBluetoothPermission() async {
// Android 13+ 使用新的蓝牙权限
Map<Permission, PermissionStatus> statuses = await [
Permission.bluetoothScan,
Permission.bluetoothConnect,
@@ -113,7 +112,9 @@ class _BlueteethDevicePageState extends State<BlueteethDevicePage> {
// 开始扫描蓝牙设备
void _startScanning() async {
if (!mounted) return;
if (!mounted || isScanning) return;
_scanSubscription?.cancel();
var bluetoothState = await FlutterBluePlus.isOn;
if (!bluetoothState && !_isDialogShowing) {
_isDialogShowing = true;
@@ -131,6 +132,7 @@ class _BlueteethDevicePageState extends State<BlueteethDevicePage> {
// await FlutterBluePlus.startScan(timeout: Duration(minutes: 30));
_scanSubscription = FlutterBluePlus.scanResults.listen((results) {
if (!mounted) return; // 确保页面未销毁
final signalThreshold = blueteethBindController.model.singal!;
final filteredResults = results
.where((r) =>
@@ -334,7 +336,7 @@ class _BlueteethDevicePageState extends State<BlueteethDevicePage> {
mainAxisSize: MainAxisSize.max,
children: [
Text(
'最小信号强度',
'最小信号强度'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
@@ -415,7 +417,7 @@ class _BlueteethDevicePageState extends State<BlueteethDevicePage> {
Expanded(
child: Container(
width: 100.rpx,
height: 100.rpx,
height: 80.rpx,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context)
.secondaryBackground,
@@ -519,7 +521,7 @@ class _BlueteethDevicePageState extends State<BlueteethDevicePage> {
),
),
Text(
'搜索',
'搜索'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
@@ -547,7 +549,8 @@ class _BlueteethDevicePageState extends State<BlueteethDevicePage> {
EdgeInsetsDirectional.fromSTEB(19.rpx, 0, 0, 0),
child: Obx(() {
return Text(
'匹配出的外围设备${blueteethBindController.model.betDevicelist!.length}',
'匹配出的外围设备'.tr +
"${blueteethBindController.model.betDevicelist!.length}",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(

View 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,
)),
),
);
}
}

View File

@@ -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),

View File

@@ -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,
)),
),
),
),
),
],
),
),
),
);
},
);
}

View File

@@ -0,0 +1,617 @@
import 'dart:async';
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/ServiceConstant.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/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
import 'package:vbvs_app/controller/device/device_calibration_controller.dart';
import 'package:vbvs_app/pages/common/selectDialog.dart';
class CalibrationPage extends StatefulWidget {
int? type; //1.绑定时 2.绑定后
CalibrationPage({super.key, required this.type});
@override
State<CalibrationPage> createState() => _CalibrationPageState();
}
class _CalibrationPageState extends State<CalibrationPage> {
DeviceCalibrationController deviceCalibrationController = Get.find();
@override
void initState() {
super.initState();
deviceCalibrationController.process.value = 0;
deviceCalibrationController.bed_calibration.value = 0;
deviceCalibrationController.position_calibration.value = 0;
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
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,
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
backgroundColor: themeController.currentColor.sc17,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: themeController.currentColor.sc3),
titleSpacing: 0,
title: Container(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
Text(
'设备校准'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx,
),
),
Positioned(
left: 0,
child: returnIconButtom,
),
if (widget.type == 1)
Positioned(
right: 20.rpx,
child: CustomCard(
borderRadius: 20.rpx,
onTap: () async {
Get.toNamed("/personPage");
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: 100.rpx,
height: 60.rpx,
alignment: Alignment.center,
padding: EdgeInsetsDirectional.fromSTEB(
16.rpx, 0, 16.rpx, 0),
child: Text(
'跳过'.tr,
style: TextStyle(
fontFamily: 'Inter Tight',
color: themeController.currentColor.sc3,
letterSpacing: 0.0,
),
),
),
),
),
],
),
),
actions: [],
centerTitle: false,
),
body: SafeArea(
top: true,
// child: Container(),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 0.rpx, 30.rpx, 0.rpx),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0.rpx, 30.rpx, 0, 0),
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: themeController.currentColor.sc5,
borderRadius: BorderRadius.circular(16.rpx),
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
10.rpx, 20.rpx, 34.rpx, 20.rpx),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor:
themeController.currentColor.sc21,
borderRadius: 0, // 可按需设置圆角
padding: EdgeInsets.symmetric(
vertical: 10.rpx), // 可自定义内边距
onTap: () {
deviceCalibrationController.process.value = 0;
deviceCalibrationController.updateAll();
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Obx(() {
return Visibility(
maintainState: true,
maintainAnimation: true,
maintainSize: true,
visible: deviceCalibrationController
.process.value ==
0,
child: SvgPicture.asset(
'assets/img/icon/select_arrow.svg',
width: 17.rpx,
height: 17.rpx,
color: themeController
.currentColor.sc9,
),
);
}),
SizedBox(width: 8.rpx),
Text(
'离床校准'.tr,
style: TextStyle(
fontSize: 30.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
],
),
Obx(() {
return Text(
deviceCalibrationController
.bed_calibration.value ==
0
? '未完成'.tr
: "已完成".tr,
style: TextStyle(
fontSize: 26.rpx,
letterSpacing: 0.0,
color: deviceCalibrationController
.bed_calibration.value ==
0
? themeController.currentColor.sc3
: themeController
.currentColor.sc1,
),
);
}),
],
),
),
SizedBox(height: 41.rpx),
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor:
themeController.currentColor.sc21,
borderRadius: 0, // 可根据需要设为圆角
padding: EdgeInsets.symmetric(
vertical: 10.rpx), // 可根据需要调整上下内边距
onTap: () {
deviceCalibrationController.process.value = 1;
deviceCalibrationController.updateAll();
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Obx(() {
return Visibility(
maintainState: true,
maintainAnimation: true,
maintainSize: true,
visible: deviceCalibrationController
.process.value ==
1,
child: SvgPicture.asset(
'assets/img/icon/select_arrow.svg',
width: 17.rpx,
height: 17.rpx,
color: themeController
.currentColor.sc9,
),
);
}),
SizedBox(width: 8.rpx),
Text(
'位置校准'.tr,
style: TextStyle(
fontSize: 30.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
],
),
Obx(() {
return Text(
deviceCalibrationController
.position_calibration
.value ==
0
? '未完成'.tr
: "已完成".tr,
style: TextStyle(
fontSize: 26.rpx,
letterSpacing: 0.0,
color: deviceCalibrationController
.position_calibration
.value ==
0
? themeController.currentColor.sc3
: themeController
.currentColor.sc1,
),
);
}),
],
),
),
],
),
),
),
),
Obx(() {
return Expanded(
child: SizedBox(
width: double.infinity,
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
100.rpx, 55.rpx, 100.rpx, 0),
child: Stack(
clipBehavior: Clip.none,
children: [
Container(
width:
MediaQuery.sizeOf(context).width * 0.65,
height:
MediaQuery.sizeOf(context).height * 0.3,
child: Stack(
children: [
// Image.asset(
// deviceCalibrationController
// .bed_type.value ==
// 0
// ? "assets/img/single_pillow.png"
// : "assets/img/double_pillow.png",
// width: double.infinity,
// height: double.infinity,
// fit: BoxFit.contain,
// ),
Image.asset(
deviceCalibrationController
.process.value ==
1 &&
deviceCalibrationController
.position_calibration
.value ==
1
? (deviceCalibrationController
.bed_type.value ==
0
? "assets/img/single_person.png"
: "assets/img/double_person.png")
: (deviceCalibrationController
.bed_type.value ==
0
? "assets/img/single_pillow.png"
: "assets/img/double_pillow.png"),
width: double.infinity,
height: double.infinity,
fit: BoxFit.contain,
),
// 床头文字
Positioned(
top: 23.rpx,
left:
(MediaQuery.sizeOf(context).width *
0.65) /
2 -
26.rpx,
child: Text(
'床头'.tr,
style: TextStyle(
fontSize: 26.rpx,
color: themeController
.currentColor.sc4,
),
),
),
],
),
),
Obx(() {
final double centerLeft =
(bodySize.maxWidth * 0.56) / 2;
if (deviceCalibrationController
.bed_type.value ==
0 &&
deviceCalibrationController
.process.value ==
1) {
//单人床位置校准
return Positioned(
top: -40.rpx,
left: centerLeft - 0.rpx,
child: Container(
width: bodySize.maxWidth * 0.087,
height: bodySize.maxHeight * 0.06,
constraints: BoxConstraints(
minWidth: 65.rpx,
minHeight: 76.rpx,
),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
'assets/img/tip_arrow.gif'),
fit: BoxFit.cover,
),
),
),
);
}
if (deviceCalibrationController
.bed_type.value ==
1 &&
deviceCalibrationController
.process.value ==
1) {
//双人人床位置校准
return Positioned(
top: -40.rpx,
left: (MediaQuery.sizeOf(context).width *
0.65) *
0.22 -
0.rpx,
child: Container(
width: bodySize.maxWidth * 0.087,
height: bodySize.maxHeight * 0.06,
constraints: BoxConstraints(
minWidth: 65.rpx,
minHeight: 76.rpx,
),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
'assets/img/tip_arrow.gif'),
fit: BoxFit.cover,
),
),
),
);
}
return Container();
}),
Positioned(
top: MediaQuery.sizeOf(context).height * 0.3 +
82.rpx,
left: 0,
right: 0,
child: Obx(() {
return Column(
children: [
Text(
(deviceCalibrationController
.process.value ==
0 &&
deviceCalibrationController
.bed_calibration
.value ==
1) ||
(deviceCalibrationController
.process.value ==
1 &&
deviceCalibrationController
.position_calibration
.value ==
1)
? '校准完成'.tr
: deviceCalibrationController
.process.value ==
0
? '离床校准提示'.tr
: '位置校准提示'.tr,
style: TextStyle(
fontSize: 38.rpx,
letterSpacing: 0.0,
color: ((deviceCalibrationController
.process
.value ==
0 &&
deviceCalibrationController
.bed_calibration
.value ==
1) ||
(deviceCalibrationController
.process
.value ==
1 &&
deviceCalibrationController
.position_calibration
.value ==
1))
? themeController
.currentColor.sc1
: themeController
.currentColor.sc9,
),
),
],
);
}),
),
],
),
),
),
);
}),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
100.rpx, 0.rpx, 100.rpx, 60.rpx),
child: CustomCard(
borderRadius:
AppConstants().button_container_radius, // 圆角半径
onTap: () async {
BlueteethBindController blueteethBindController =
Get.find();
requestWithLog(
logTitle: "设备校准",
method: MyHttpMethod.post,
queryUrl: ServiceConstant.start_calibration,
data: {
"deviceId":
blueteethBindController.currentDeviceMac
},
onSuccess: (res) {
final ValueNotifier<double> progressNotifier =
ValueNotifier<double>(0.0);
final ValueNotifier<bool> failureNotifier =
ValueNotifier<bool>(false);
Timer? pollingTimer;
// 定义请求函数
void requestCalibrationProgress() {
requestWithLog(
logTitle: "设备校准进度",
method: MyHttpMethod.post,
queryUrl: ServiceConstant.calibration_process,
data: {
"deviceId":
blueteethBindController.currentDeviceMac
},
onSuccess: (res) {
double process =
(res.data['process'] ?? 0).toDouble();
progressNotifier.value = process;
if (process >= 100) {
if (deviceCalibrationController
.process.value ==
0) {
deviceCalibrationController
.bed_calibration.value = 1;
deviceCalibrationController.updateAll();
}
if (deviceCalibrationController
.process.value ==
1) {
deviceCalibrationController
.position_calibration.value = 1;
deviceCalibrationController.updateAll();
}
pollingTimer?.cancel();
}
},
onFailure: (res) {
pollingTimer?.cancel();
failureNotifier.value = true;
TopSlideNotification.show(
context,
text: res.msg ?? "服务器.失败".tr,
textColor:
themeController.currentColor.sc9,
);
},
);
}
// 启动轮询
pollingTimer =
Timer.periodic(Duration(seconds: 2), (timer) {
requestCalibrationProgress();
});
// 初始调用一次
requestCalibrationProgress();
// 显示进度弹窗
showProgressDialog(
context, progressNotifier, failureNotifier);
},
onFailure: (res) {
TopSlideNotification.show(
context,
text: res.msg ?? "服务器.失败".tr,
textColor: themeController.currentColor.sc9,
);
},
);
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: bodySize.maxWidth,
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(
//todo 颜色
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize:
AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(
width: 17.rpx,
)),
),
),
),
),
],
),
),
),
),
),
),
);
}
}

View File

@@ -0,0 +1,461 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.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/NullDataComponentWidget.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/controller/device/device_share_list_controller.dart';
import 'package:vbvs_app/model/BleDeviceData.dart';
import 'package:vbvs_app/pages/device_bind/componnet/DeviceShareInfoWidget.dart';
class DeviceShareListPage extends StatefulWidget {
String device = "";
DeviceShareListPage({super.key, required this.device});
@override
State<DeviceShareListPage> createState() => _DeviceShareListPageState();
}
class _DeviceShareListPageState extends State<DeviceShareListPage> {
DeviceShareListController deviceShareListController = Get.find();
@override
void initState() {
deviceShareListController.model.key = null;
deviceShareListController.shareInfoList.value = [];
deviceShareListController.selectedShareInfo.value = [];
deviceShareListController.getDeviceShareList(widget.device);
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, boxConstraints) => 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(
iconTheme: IconThemeData(color: themeController.currentColor.sc3),
backgroundColor: themeController.currentColor.sc17,
automaticallyImplyLeading: false,
titleSpacing: 0,
title: Container(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
Text(
'已分享'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx,
),
),
//todo 返回刷新列表
Positioned(
left: 0,
child: returnIconButtom,
),
],
),
),
actions: [],
centerTitle: false,
),
body: SafeArea(
top: true,
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
SizedBox(
height: 40.rpx,
),
Container(
width: double.infinity,
decoration: BoxDecoration(
color: themeController.currentColor.sc3,
borderRadius: BorderRadius.circular(20.rpx),
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
35.rpx, 0, 35.rpx, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 0.rpx, 0, 0),
child: Container(
width: 25.rpx,
height: 25.rpx,
// width: double.infinity,
decoration: BoxDecoration(),
child: SvgPicture.asset(
'assets/img/icon/query.svg',
fit: BoxFit.cover,
color: stringToColor("#333333"), //固定
),
),
),
Expanded(
child: Container(
width: 100.rpx,
height: 80.rpx,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context)
.secondaryBackground,
),
child: Align(
alignment: AlignmentDirectional(-1, 0),
child: TextFormField(
onChanged: (value) {
deviceShareListController
.model.key = value;
},
autofocus: false,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelStyle:
FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
),
hintText: '输入关键字'.tr,
hintStyle:
FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color:
FlutterFlowTheme.of(context)
.error,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
focusedErrorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color:
FlutterFlowTheme.of(context)
.error,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
filled: false,
fillColor: themeController
.currentColor.sc22,
),
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
),
cursorColor:
FlutterFlowTheme.of(context)
.primaryText,
),
),
),
),
].divide(SizedBox(width: 6.rpx)),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
26.rpx, 0, 0, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
SizedBox(
height: 50.rpx,
child: VerticalDivider(
thickness: 2.rpx,
color: stringToColor("#333333"), //固定
),
),
ClickableContainer(
onTap: () async {
// ApiResponse apiResponse =
// await deviceShareListController
// .getDeviceShareList(
// key: deviceShareListController
// .model.key);
// if (apiResponse.code ==
// HttpStatusCodes.ok) {
// TopSlideNotification.show(
// context,
// text: apiResponse.msg!,
// textColor:
// themeController.currentColor.sc2,
// );
// deviceShareListController.updateAll();
// } else {
// TopSlideNotification.show(
// context,
// text: apiResponse.msg!,
// textColor:
// themeController.currentColor.sc9,
// );
// }
},
padding: EdgeInsets.symmetric(
horizontal: 10.rpx, vertical: 6.rpx),
borderRadius: 12.rpx,
backgroundColor: Colors.transparent,
highlightColor: stringToColor("#333333")
.withOpacity(0.08), // 可选点击反馈色
child: Text(
'搜索'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 30.rpx,
letterSpacing: 0.0,
color:
stringToColor("#333333"), //固定
),
),
),
].divide(SizedBox(width: 26.rpx)),
),
),
],
),
),
),
Container(
constraints: BoxConstraints(
minHeight: 100.rpx,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Theme(
data: ThemeData(
checkboxTheme: CheckboxThemeData(
visualDensity: VisualDensity.compact,
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(64),
),
),
unselectedWidgetColor: Color(0xFFD3D3D3),
),
child: Obx(
() => Checkbox(
value:
deviceShareListController.model.all ==
0
? false
: true,
onChanged: (newValue) async {
if (newValue == true) {
// 设置为全选
deviceShareListController.model.all =
1;
deviceShareListController
.selectedShareInfo.value =
deviceShareListController
.shareInfoList
.map((e) => e['id'] as String)
.toList();
} else {
// 取消全选
deviceShareListController.model.all =
0;
deviceShareListController
.selectedShareInfo
.clear();
}
deviceShareListController
.selectedShareInfo
.refresh();
deviceShareListController.updateAll();
},
side: BorderSide(
width: 1.5,
color: FlutterFlowTheme.of(context)
.secondaryText,
),
activeColor: stringToColor("#16C89F"),
checkColor:
FlutterFlowTheme.of(context).info,
),
)),
Text(
"全选".tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
].divide(SizedBox(
width: 10.rpx,
)),
),
ClickableContainer(
onTap: () async {
//todo 删除分享
// ApiResponse apiResponse =
// await deviceShareListController
// .deleteShareDevice();
// if (apiResponse.code == HttpStatusCodes.ok) {
// TopSlideNotification.show(context,
// text: apiResponse.msg!);
// } else {
// TopSlideNotification.show(context,
// text: apiResponse.msg!,
// textColor:
// themeController.currentColor.sc9);
// }
},
padding: EdgeInsets.symmetric(
horizontal: 20.rpx, vertical: 10.rpx),
borderRadius: 20.rpx,
backgroundColor: Colors.transparent,
highlightColor: themeController.currentColor.sc3
.withOpacity(0.1),
child: Text(
"删除".tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
),
],
),
),
Expanded(
child: deviceShareListController
.shareInfoList.value.isNotEmpty
? SingleChildScrollView(
child: Obx(() {
var selected = deviceShareListController
.selectedShareInfo.value;
return Column(
children: deviceShareListController
.shareInfoList.value
.map((item) =>
DeviceShareInfoWidget(data: item))
.toList()
.divide(SizedBox(height: 30.rpx))
.addToEnd(SizedBox(
height: 30.rpx,
)),
);
}),
)
: NullDataWidget(),
),
].divide(SizedBox(height: 30.rpx)),
),
),
),
),
),
),
);
}
}
BleDeviceData parseBleData(List<int> data) {
if (data.length < 18) {
throw Exception('BLE广播数据长度不足18字节');
}
int type = data[0];
int sn = data[1];
// 设备唯一ID (6字节),格式化为 MAC 地址样式
String deviceId =
List.generate(6, (i) => data[2 + i].toRadixString(16).padLeft(2, '0'))
.join(":")
.toUpperCase();
int bre = data[8];
int ht = data[9];
int active = data[10];
int flag = data[11];
// version 是4字节 uint大端字节序
int version =
(data[12] << 24) | (data[13] << 16) | (data[14] << 8) | data[15];
// qsn 是2字节 ushort大端字节序
int qsn = (data[16] << 8) | data[17];
return BleDeviceData(
type: type,
sn: sn,
deviceId: deviceId,
bre: bre,
ht: ht,
active: active,
flag: flag,
version: version,
qsn: qsn,
);
}

View File

@@ -276,7 +276,7 @@ class _DeviceSharePageState extends State<DeviceSharePage> {
children: [
TextSpan(
text:
'${deviceShareController.code == 1 ? "邀请成功".tr : "邀请失败".tr}',
'${deviceShareController.code.value == 1 ? "邀请成功".tr : "邀请失败".tr}',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
@@ -284,7 +284,7 @@ class _DeviceSharePageState extends State<DeviceSharePage> {
fontSize: 26.rpx,
letterSpacing: 0.0,
color: deviceShareController
.code ==
.code.value ==
1
? themeController
.currentColor.sc2

View File

@@ -35,8 +35,9 @@ class _EPageState extends State<DeviceTypePage> {
super.initState();
deviceTypeController.getDeviceType().then((response) {
if (response.code != HttpStatusCodes.ok) {
// 延迟到 widget 构建后再执行 show
TopSlideNotification.show(
Get.context!,
context, // 用当前页面 context 替代 Get.context!
text: response.msg ?? "服务器.失败".tr,
textColor: themeController.currentColor.sc9,
);
@@ -273,7 +274,7 @@ class _EPageState extends State<DeviceTypePage> {
),
alignment: Alignment.center, // 居中对齐
child: Text(
'绑定引导.跳过'.tr,
'确认'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
@@ -332,7 +333,7 @@ class _EPageState extends State<DeviceTypePage> {
children: [
/// 居中标题
Text(
'设备列表',
'设备列表'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
@@ -429,7 +430,7 @@ class _EPageState extends State<DeviceTypePage> {
title,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
color: const Color(0xFFC2CED7),
color: themeController.currentColor.sc3,
fontSize: 30.rpx,
letterSpacing: 0.0,
),

View File

@@ -30,11 +30,13 @@ class _DeviceTypeListPageState extends State<DeviceTypeListPage> {
super.initState();
deviceTypeController.getDeviceType().then((response) {
if (response.code != HttpStatusCodes.ok) {
TopSlideNotification.show(
Get.context!,
text: response.msg ?? "服务器.失败".tr,
textColor: themeController.currentColor.sc9,
);
WidgetsBinding.instance.addPostFrameCallback((_) {
TopSlideNotification.show(
context,
text: response.msg ?? "服务器.失败".tr,
textColor: themeController.currentColor.sc9,
);
});
}
});
}
@@ -68,7 +70,7 @@ class _DeviceTypeListPageState extends State<DeviceTypeListPage> {
children: [
/// 居中标题
Text(
'设备列表',
'设备列表'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
@@ -165,7 +167,7 @@ class _DeviceTypeListPageState extends State<DeviceTypeListPage> {
title,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
color: const Color(0xFFC2CED7),
color: themeController.currentColor.sc3,
fontSize: 30.rpx,
letterSpacing: 0.0,
),

View File

@@ -19,7 +19,6 @@ import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
class WifiPage extends StatefulWidget {
WifiPage({super.key});
// WifiPage({super.key});
@override
State<WifiPage> createState() => _WifiPageState();
@@ -32,8 +31,6 @@ class _WifiPageState extends State<WifiPage> {
PersonController personController = Get.find();
ThemeController themeController = Get.find();
var lisObj;
// List<String> _logBuffer = [];
// bool _isCollecting = false;
@override
void initState() {
@@ -106,7 +103,8 @@ class _WifiPageState extends State<WifiPage> {
textColor: themeController.currentColor.sc9,
);
}
Get.toNamed("/personPage");
Get.toNamed("/calibrationPage",arguments: 1);
// Get.toNamed("/personPage");
// Get.toNamed("/bindDeviceSuccess");
},
colors: [
@@ -686,7 +684,7 @@ class _WifiPageState extends State<WifiPage> {
),
),
Text(
'刷新',
'刷新'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
@@ -779,13 +777,13 @@ class _WifiPageState extends State<WifiPage> {
bool wifiStatus =
await getWifiStatus(blueteethBindController.currentDevice!);
blueteethBindController.wifiStatus.value = wifiStatus == true ? 1 : 0;
if (wifiStatus) {
Map connect_wifiInfo =
await getDeviceWifiStatus(blueteethBindController.currentDevice!);
if (connect_wifiInfo != null) {
blueteethBindController.connect_wifi.value = connect_wifiInfo;
}
}
// if (wifiStatus) {
// Map connect_wifiInfo =
// await getDeviceWifiStatus(blueteethBindController.currentDevice!);
// if (connect_wifiInfo != null) {
// blueteethBindController.connect_wifi.value = connect_wifiInfo;
// }
// }
List wifiList =
await getWifiList(blueteethBindController.currentDevice!);
if (wifiList.length > 0) {

View File

@@ -2,7 +2,10 @@ import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:fluwx/fluwx.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/CheckNetwork.dart';
import 'package:vbvs_app/common/util/CommonVariables.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';
@@ -26,6 +29,58 @@ class _EPageState extends State<LoginPage> {
LoginController loginController = Get.find();
ThemeController themeController = Get.find();
@override
void initState() {
super.initState();
LoginController loginController = Get.find();
Fluwx fluwx = loginController.fluwx;
if (isiOS) {
loginController.model.isIos = true;
fluwx.isWeChatInstalled.then((isWeChatInstalled) {
debugPrint('is wechat installed: $isWeChatInstalled');
if (!isWeChatInstalled) {
// TODO ios未安装微信 隐藏微信一键登录按钮
loginController.model.isWeChatNotInstalled = false;
} else {
loginController.model.isWeChatNotInstalled = true;
}
loginController.updateAll();
});
}
// 微信监听回调
loginController.fluwxCancelable = fluwx.addSubscriber((response) async {
if (response is WeChatAuthResponse) {
debugPrint('state :${response.state} \n code:${response.code}');
int errCode = response.errCode ?? -9999;
if (errCode == 0) {
// TODO 微信登录成功 传递code给后台 再操作逻辑
String code = response.code ?? "";
//把微信登录返回的code传给后台剩下的事就交给后台处理
//首次未注册的用户引导去手机号填写页面
//已注册的用户直接跳转首页
if (CommonVariables.isNetWorkOn == false) {
showToast("网络未连接,请开启设备网络后重试");
return;
}
String msg = await loginController.loginByWechatCode(code);
if (msg.isEmpty) {
// TODO 操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
loginController.fluwxCancelable?.cancel();
// 登录成功移出网络检查监听
Checknetwork.subscription?.cancel();
Get.offAndToNamed("/mianPageBottomChange");
}
// TODO 操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
// fluwxCancelable?.cancel();
} else if (errCode == -4) {
showToast("用户拒绝授权");
} else if (errCode == -2) {
showToast("用户取消授权");
}
}
});
}
@override
Widget build(BuildContext context) {
return LayoutBuilder(
@@ -186,9 +241,7 @@ class _EPageState extends State<LoginPage> {
], // 渐变色是同一个色,也可以根据需要调整
child: Container(
width:
// MediaQuery.sizeOf(context).width * 0.66,
bodysize.maxWidth,
width: bodysize.maxWidth,
height: MediaQuery.sizeOf(context).height *
0.055,
constraints: BoxConstraints(
@@ -200,19 +253,24 @@ class _EPageState extends State<LoginPage> {
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Text(
'登录页.本机号码一键登录/注册'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
//todo 颜色
color: themeController
.currentColor.sc3,
fontFamily: 'Inter',
fontSize: AppConstants()
.normal_text_fontSize,
letterSpacing: 0.0,
),
Expanded(
child: Text(
textAlign: TextAlign.center,
'登录页.本机号码一键登录/注册'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
//todo 颜色
color: themeController
.currentColor.sc3,
fontFamily: 'Inter',
fontSize: AppConstants()
.normal_text_fontSize,
letterSpacing: 0.0,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
].divide(SizedBox(
width: 17.rpx,
@@ -241,6 +299,8 @@ class _EPageState extends State<LoginPage> {
fontSize: 26.rpx,
color: themeController.currentColor.sc3,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
Padding(
@@ -433,43 +493,97 @@ class _EPageState extends State<LoginPage> {
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 91.rpx,
height: 91.rpx,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: Image.asset(
"assets/img/wechat.png",
width: 30.rpx,
height: 30.rpx,
ClickableContainer(
backgroundColor: Colors.white, // 背景色
highlightColor: Colors.grey, // 点击水波纹颜色
borderRadius: 999.rpx,
padding: EdgeInsets.zero,
// onTap: () {
// TopSlideNotification.show(context,
// text: "待开发功能".tr);
// },
onTap: () async {
if (loginController.model.isIos == true &&
loginController
.model.isWeChatNotInstalled !=
true) {
} else {
if (loginController
.model.register_agree ==
null ||
loginController
.model.register_agree !=
true) {
TopSlideNotification.show(
context,
text: "登录页.未同意协议".tr,
textColor:
themeController.currentColor.sc9,
);
return;
}
await loginController
.wxLoginSendAuth(context);
}
},
child: Container(
width: 91.rpx,
height: 91.rpx,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: Image.asset(
"assets/img/wechat.png",
width: 30.rpx,
height: 30.rpx,
),
),
),
Container(
width: 91.rpx,
height: 91.rpx,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: Image.asset(
"assets/img/tel.png",
width: 30.rpx,
height: 30.rpx,
ClickableContainer(
backgroundColor: Colors.white,
highlightColor: Colors.grey,
borderRadius: 999.rpx,
padding: EdgeInsets.zero,
onTap: () {
TopSlideNotification.show(context,
text: "待开发功能".tr);
},
child: Container(
width: 91.rpx,
height: 91.rpx,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: Image.asset(
"assets/img/tel.png",
width: 30.rpx,
height: 30.rpx,
),
),
),
Container(
width: 91.rpx,
height: 91.rpx,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: Image.asset(
"assets/img/google.png",
width: 30.rpx,
height: 30.rpx,
ClickableContainer(
backgroundColor: Colors.white,
highlightColor: Colors.grey,
borderRadius: 999.rpx,
padding: EdgeInsets.zero,
onTap: () {
TopSlideNotification.show(context,
text: "待开发功能".tr);
},
child: Container(
width: 91.rpx,
height: 91.rpx,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: Image.asset(
"assets/img/google.png",
width: 30.rpx,
height: 30.rpx,
),
),
),
].divide(SizedBox(width: 35.rpx)),

View File

@@ -1,11 +1,8 @@
import 'dart:io';
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:get_storage/get_storage.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
@@ -575,6 +572,10 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.currentColor.sc9,
);
} else {
CountdownController
countdownController = Get.find();
countdownController.countdown.value =
0;
// 登录成功,跳转到主页面
TopSlideNotification.show(
context,
@@ -821,43 +822,73 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 91.rpx,
height: 91.rpx,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: Image.asset(
"assets/img/wechat.png",
width: 30.rpx,
height: 30.rpx,
ClickableContainer(
backgroundColor: Colors.white, // 背景色
highlightColor: Colors.grey, // 点击水波纹颜色
borderRadius: 999.rpx,
padding: EdgeInsets.zero,
onTap: () {
TopSlideNotification.show(context,
text: "待开发功能".tr);
},
child: Container(
width: 91.rpx,
height: 91.rpx,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: Image.asset(
"assets/img/wechat.png",
width: 30.rpx,
height: 30.rpx,
),
),
),
Container(
width: 91.rpx,
height: 91.rpx,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: Image.asset(
"assets/img/tel.png",
width: 30.rpx,
height: 30.rpx,
ClickableContainer(
backgroundColor: Colors.white,
highlightColor: Colors.grey,
borderRadius: 999.rpx,
padding: EdgeInsets.zero,
onTap: () {
TopSlideNotification.show(context,
text: "待开发功能".tr);
},
child: Container(
width: 91.rpx,
height: 91.rpx,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: Image.asset(
"assets/img/tel.png",
width: 30.rpx,
height: 30.rpx,
),
),
),
Container(
width: 91.rpx,
height: 91.rpx,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: Image.asset(
"assets/img/google.png",
width: 30.rpx,
height: 30.rpx,
ClickableContainer(
backgroundColor: Colors.white,
highlightColor: Colors.grey,
borderRadius: 999.rpx,
padding: EdgeInsets.zero,
onTap: () {
TopSlideNotification.show(context,
text: "待开发功能".tr);
},
child: Container(
width: 91.rpx,
height: 91.rpx,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: Image.asset(
"assets/img/google.png",
width: 30.rpx,
height: 30.rpx,
),
),
),
].divide(SizedBox(width: 35.rpx)),

View File

@@ -2,13 +2,22 @@ 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/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/device/device_share_controller.dart';
import 'package:vbvs_app/controller/message/message_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/enum/MessageStatus.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
class MessageWidgetWidget extends StatefulWidget {
const MessageWidgetWidget({super.key});
final data;
const MessageWidgetWidget({super.key, required this.data});
@override
State<MessageWidgetWidget> createState() => _MessageWidgetWidgetState();
@@ -16,9 +25,12 @@ class MessageWidgetWidget extends StatefulWidget {
class _MessageWidgetWidgetState extends State<MessageWidgetWidget> {
ThemeController themeController = Get.find();
MessageController messageController = Get.find();
DeviceShareController deviceShareController = Get.find();
@override
Widget build(BuildContext context) {
var messageInfo = widget.data;
return Stack(
children: [
ClickableContainer(
@@ -39,7 +51,8 @@ class _MessageWidgetWidgetState extends State<MessageWidgetWidget> {
child: Align(
alignment: AlignmentDirectional(-1, 0),
child: Text(
'实时监测结果通知'.tr,
// '实时监测结果通知'.tr,
"${messageInfo['data']['title']}",
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
fontSize: 30.rpx,
@@ -55,18 +68,15 @@ class _MessageWidgetWidgetState extends State<MessageWidgetWidget> {
Container(
constraints: BoxConstraints(
minWidth: 30.rpx,
maxWidth: 120.rpx,
maxWidth: 140.rpx,
),
child: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildInfoItem(context, '设备ID'),
_buildInfoItem(context, '使用人员'),
_buildInfoItem(context, '消息类型'),
_buildInfoItem(context, '检测数值'),
_buildInfoItem(context, '发生时间'),
],
children: messageInfo['data']['val']
.map<Widget>((mapItem) =>
_buildInfoItem(context, mapItem['k'] ?? ''))
.toList(),
),
),
Container(
@@ -76,13 +86,10 @@ class _MessageWidgetWidgetState extends State<MessageWidgetWidget> {
child: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildValueItem(context, '设备ID'),
_buildValueItem(context, '使用人员'),
_buildValueItem(context, '消息类型'),
_buildValueItem(context, '检测数值'),
_buildValueItem(context, '发生时间'),
],
children: messageInfo['data']['val']
.map<Widget>((mapItem) =>
_buildValueItem(context, mapItem['v'] ?? ''))
.toList(),
),
),
].divide(SizedBox(width: 35.rpx)),
@@ -92,25 +99,49 @@ class _MessageWidgetWidgetState extends State<MessageWidgetWidget> {
),
Positioned(
bottom: 46.rpx,
right: 20.rpx,
right: 20.rpx,
child: Container(
width: 123.rpx,
height: 47.rpx,
child: CustomCard(
borderRadius: AppConstants().button_container_radius, // 直角
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2
], // 单色背景
colors: messageInfo['status'] == 1
? [
themeController.currentColor.sc1,
themeController.currentColor.sc2
]
: [themeController.currentColor.sc4], // 单色背景
enableAnimation: true, // 有点击缩放动画
enableGradient: false, // 不用渐变
onTap: () {
// 点击处理逻辑
print('处理按钮点击了');
if (messageInfo['status'] == 1) {
showConfirmDialog(context, Container(), "是否确认接受该设备".tr,
onConfirm: () async {
ApiResponse apiResponse = await deviceShareController
.confirmShare(messageInfo['data']['shareCode']);
if (apiResponse.code == HttpStatusCodes.ok) {
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor: themeController.currentColor.sc2,
);
messageController.getMessageList();
messageController.updateAll();
} else {
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor: themeController.currentColor.sc9,
);
messageController.getMessageList();
messageController.updateAll();
}
}, onCancel: () {});
}
},
child: Center(
child: Text(
'处理'.tr,
getMessageStatus(messageInfo['status']),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
@@ -134,6 +165,8 @@ class _MessageWidgetWidgetState extends State<MessageWidgetWidget> {
child: Align(
alignment: AlignmentDirectional(-1, 0),
child: Text(
overflow: TextOverflow.ellipsis,
maxLines: 1,
label.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
@@ -154,6 +187,8 @@ class _MessageWidgetWidgetState extends State<MessageWidgetWidget> {
child: Align(
alignment: AlignmentDirectional(-1, 0),
child: Text(
overflow: TextOverflow.ellipsis,
maxLines: 1,
value,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
@@ -165,4 +200,23 @@ class _MessageWidgetWidgetState extends State<MessageWidgetWidget> {
),
);
}
String getMessageStatus(int status) {
if (status == null) {
return '未知数据'.tr;
}
if (status == MessageStatus.noNeed.code) {
return '无需处理'.tr;
}
if (status == MessageStatus.pending.code) {
return "待处理".tr;
}
if (status == MessageStatus.completed.code) {
return "已处理".tr;
}
if (status == MessageStatus.timeout.code) {
return "已超时".tr;
}
return '未知数据'.tr;
}
}

View File

@@ -1,5 +1,6 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
@@ -19,10 +20,13 @@ class _EPageState extends State<EPage> {
builder: (context, boxConstraints) => GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Scaffold(
backgroundColor: Colors.transparent,
body: SafeArea(
top: true,
child: Text("小e"),
child: Text("小e",
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: Colors.white)),
),
),
),

View File

@@ -0,0 +1,101 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/WebViewWidget.dart';
class FollowPage extends StatefulWidget {
late MyWebView webView;
FollowPage({super.key});
@override
State<FollowPage> createState() => _FollowPageState();
}
class _FollowPageState extends State<FollowPage> {
@override
void initState() {
super.initState();
// widget.webView = MyWebView(
// // url: "assets/map/index.html",
// url: "https://mp.weixin.qq.com/s/LvDtjFSI1au4o0eNrxLHwg",
// onLoad: () {
// print('网页载入完毕');
// },
// );
}
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, bodySize) => GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Container(
// decoration: BoxDecoration(
// image: DecorationImage(
// image: AssetImage('assets/img/followus.png'), // 本地图片
// fit: BoxFit.contain, // 填满整个 Container
// ),
// ),
child: Scaffold(
backgroundColor: Colors.transparent, // 加上这一行
appBar: AppBar(
backgroundColor: themeController.currentColor.sc17,
// backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: themeController.currentColor.sc3),
titleSpacing: 0,
// leading: returnIconButtom,
title: Container(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
/// 居中标题
Text(
'关注我们'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx,
),
),
/// 左边返回按钮
Positioned(
left: 0,
child: returnIconButtom,
),
],
),
),
actions: [],
centerTitle: false,
),
body: SafeArea(
top: true,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 0.rpx),
child: Column(children: [
Expanded(
child: Container(
// child: widget.webView,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/img/followus.png'), // 本地图片
fit: BoxFit.cover, // 填满整个 Container
),
),
),
),
]),
),
),
),
),
),
);
}
}

View File

@@ -0,0 +1,129 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/WebViewWidget.dart';
import 'package:vbvs_app/controller/setting/pdf/PdfController.dart';
class HelpPage extends StatefulWidget {
late MyWebView webView;
HelpPage({super.key});
@override
State<HelpPage> createState() => _HelpPageState();
}
class _HelpPageState extends State<HelpPage> {
PdfController pdfController = Get.find();
@override
void initState() {
super.initState();
// pdfController.loadPdf();
widget.webView = MyWebView(
url: "https://mp.weixin.qq.com/s/hBo0FMYrpe04I2WV6wbcxQ",
onLoad: () {
print('网页载入完毕');
},
);
}
@override
Widget build(BuildContext context) {
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: themeController.currentColor.sc17,
// backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: themeController.currentColor.sc3),
titleSpacing: 0,
// leading: returnIconButtom,
title: Container(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
/// 居中标题
Text(
'操作说明'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx,
),
),
/// 左边返回按钮
Positioned(
left: 0,
child: returnIconButtom,
),
],
),
),
actions: [],
centerTitle: false,
),
// body: SafeArea(
// top: true,
// child: Padding(
// padding: EdgeInsets.symmetric(horizontal: 30.rpx),
// child: Column(
// children: [
// Expanded(
// child: Obx(() {
// if (pdfController.localPdfPath.value == null) {
// return Center(child: CircularProgressIndicator());
// } else {
// return PDFView(
// filePath: pdfController.localPdfPath.value!,
// autoSpacing: false,
// enableSwipe: true,
// swipeHorizontal: false,
// pageSnap: true,
// fitEachPage: true,
// defaultPage: 0,
// onRender: (pages) => print('PDF 渲染完成,共 $pages 页'),
// onError: (error) => print('PDF 加载错误: $error'),
// );
// }
// }),
// ),
// ],
// ),
// ),
// ),
body: SafeArea(
top: true,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 30.rpx),
child: Column(children: [
Expanded(
child: Container(
child: widget.webView,
),
),
]),
),
),
),
),
),
);
}
}

View File

@@ -44,7 +44,7 @@ class _HomePageState extends State<HomePage> {
final position = renderBox.localToGlobal(Offset.zero);
final size = renderBox.size;
double popupWidth = 190.rpx; // 弹窗宽度(可以改)
double popupWidth = 190.rpx;
_popupEntry?.remove(); // 清除旧弹窗
_popupEntry = OverlayEntry(
@@ -106,7 +106,7 @@ class _HomePageState extends State<HomePage> {
width: double.infinity,
child: Center(
child: Text(
'扫一扫'.tr,
'扫一扫.标题'.tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
@@ -131,7 +131,7 @@ class _HomePageState extends State<HomePage> {
width: double.infinity,
child: Center(
child: Text(
'蓝牙绑定'.tr,
'蓝牙绑定.标题'.tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
@@ -254,7 +254,7 @@ class _HomePageState extends State<HomePage> {
themeController.currentColor.sc2,
],
child: Container(
width: 100.rpx,
// width: 100.rpx,
height: 60.rpx,
alignment: Alignment.center,
padding: EdgeInsetsDirectional
@@ -314,13 +314,6 @@ class _HomePageState extends State<HomePage> {
),
);
}),
// SvgPicture.asset(
// 'assets/img/icon/add.svg',
// width: 39.rpx,
// height: 39.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
// //todo 颜色
// color: themeController.currentColor.sc16,
// ),
ClickableContainer(
key: addIconKey,
backgroundColor: Colors.transparent,
@@ -553,10 +546,41 @@ class _HomePageState extends State<HomePage> {
CustomCard(
borderRadius: AppConstants()
.button_container_radius, // 圆角半径
onTap: () {
onTap: () async {
if (userInfoController.model.login ==
LoginStatus.LOGIN.code) {
Get.toNamed("/deviceType");
await Get.toNamed("/deviceType");
homeController.getSleepReport();
deviceController
.getDeviceNum()
.then((apiResponse) {
if (apiResponse.code !=
HttpStatusCodes.ok) {
TopSlideNotification.show(
Get.context!,
text: apiResponse.msg!,
textColor: themeController
.currentColor.sc9,
);
}
});
deviceController
.getDeviceList()
.then((apiResponse) {
if (apiResponse.code !=
HttpStatusCodes.ok) {
TopSlideNotification.show(
Get.context!,
text: apiResponse.msg!,
textColor: themeController
.currentColor.sc9,
);
} else {
//请求睡眠报告
deviceController
.getSleepReport();
}
});
} else {
TopSlideNotification.show(
context,
@@ -681,7 +705,7 @@ class _HomePageState extends State<HomePage> {
.normal_text_fontSize,
letterSpacing: 0.0,
fontWeight:
FontWeight.w900,
FontWeight.w600,
color: stringToColor(
"#916D46"), //固定
),
@@ -763,19 +787,22 @@ class _HomePageState extends State<HomePage> {
backgroundColor:
themeController.currentColor.sc5,
highlightColor:
themeController.currentColor.sc3,
themeController.currentColor.sc21,
borderRadius: AppConstants()
.normal_container_radius,
padding: EdgeInsets
.zero, // 原始Container没有padding
onTap: () {
onTap: () async {
// BodyDeviceController
// bodyDeviceController = Get.find();
// bodyDeviceController.model.type = 1;
// Get.toNamed("/bodyDevice");
homeController.model.type = 1;
deviceController.model.type = 1;
deviceController.getDeviceList();
await deviceController
.getDeviceList();
await deviceController
.getSleepReport();
homeController.updateAll();
},
child: Container(
@@ -823,19 +850,17 @@ class _HomePageState extends State<HomePage> {
backgroundColor:
themeController.currentColor.sc5,
highlightColor:
themeController.currentColor.sc3,
themeController.currentColor.sc21,
borderRadius: AppConstants()
.normal_container_radius,
padding: EdgeInsets
.zero, // 原本的Container没有 padding这里设置为 zero
onTap: () {
// BodyDeviceController
// bodyDeviceController = Get.find();
// bodyDeviceController.model.type = 2;
// Get.toNamed("/bodyDevice");
padding: EdgeInsets.zero,
onTap: () async {
homeController.model.type = 2;
deviceController.model.type = 2;
deviceController.getDeviceList();
await deviceController
.getDeviceList();
await deviceController
.getSleepReport();
homeController.updateAll();
},
child: Container(
@@ -903,7 +928,6 @@ class _HomePageState extends State<HomePage> {
if (reportData.isEmpty) {
return Expanded(child: NullDataWidget());
}
List<String> macList = reportData.keys.toList();
macList = macList
.where(
@@ -911,8 +935,6 @@ class _HomePageState extends State<HomePage> {
.any((device) => device['mac'] == mac),
)
.toList();
// ⛔️防止 macList 长度和 deviceList.length 不对应导致崩溃
if (macList.length != deviceList.length) {
return Expanded(
child: Center(child: CircularProgressIndicator()),

View File

@@ -6,10 +6,10 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.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/TopSlideNotification.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/main_bottom/main_page_controller.dart';
import 'package:vbvs_app/controller/message/message_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/enum/LoginStatus.dart';
@@ -21,33 +21,48 @@ import 'package:vbvs_app/pages/main_bottom/mine_page.dart';
class MainPageBottomChange extends GetView<MainPageController> {
GlobalController globalController = Get.find();
ThemeController themeController = Get.find();
MessageController messageController = Get.find();
getBottomNavigationBarItem(String svgPath, String actSvgPath, String label,
{double size = 0, bool isEmpty = false}) {
{double size = 0, bool isEmpty = false, bool showBadge = false}) {
if (size == 0) {
size = 36.rpx;
}
Widget buildIcon(String path) {
return Padding(
padding: EdgeInsets.only(bottom: 6.rpx),
child: isEmpty
? Container()
: Stack(
clipBehavior: Clip.none,
children: [
SvgPicture.asset(
path,
width: size,
height: size,
),
if (showBadge)
Positioned(
right: -20.rpx,
top: -2.rpx,
child: Container(
width: 14.rpx,
height: 14.rpx,
decoration: BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
),
)
],
),
);
}
return BottomNavigationBarItem(
icon: Padding(
padding: EdgeInsets.only(bottom: 6.rpx),
child: isEmpty
? Container()
: SvgPicture.asset(
actSvgPath,
width: size,
height: size,
),
),
activeIcon: Padding(
padding: EdgeInsets.only(bottom: 6.rpx),
child: isEmpty
? Container()
: SvgPicture.asset(
svgPath,
width: size,
height: size,
),
),
label: label);
icon: buildIcon(actSvgPath),
activeIcon: buildIcon(svgPath),
label: label,
);
}
List arr = [
@@ -82,83 +97,98 @@ class MainPageBottomChange extends GetView<MainPageController> {
);
} else {
return Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/img/bgImage.png'), // 本地图片
fit: BoxFit.fill, // 填满整个 Container
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
body: arr[controller.model.currentIndex],
floatingActionButtonAnimator:
FloatingActionButtonAnimator.noAnimation,
floatingActionButtonLocation:
FloatingActionButtonLocation.centerDocked,
bottomNavigationBar: Theme(
data: ThemeData(
splashFactory: NoSplash.splashFactory,
highlightColor: Colors.transparent),
child: BottomNavigationBar(
unselectedItemColor: themeController.currentColor.sc4,
selectedItemColor: themeController.currentColor.sc1,
backgroundColor: themeController.currentColor.sc5,
selectedFontSize: 26.rpx,
unselectedFontSize: 26.rpx,
type: BottomNavigationBarType.fixed,
currentIndex: controller.model.currentIndex,
onTap: (index) {
Future.delayed(const Duration(milliseconds: 100), () {
UserInfoController userInfoController = Get.find();
bool isLoggedIn = userInfoController.model.login ==
LoginStatus.LOGIN.code;
// 需要登录的页面
if ((index == 1 || index == 2) && !isLoggedIn) {
TopSlideNotification.show(
context,
text: "必须登录提示".tr,
textColor: themeController.currentColor.sc9,
);
Future.delayed(Duration(milliseconds: 50), () {
if (Get.currentRoute == '/ePage' ||
Get.currentRoute == '/messagePage') {
Get.back();
}
Future.delayed(Duration(milliseconds: 100), () {
Get.toNamed("/loginPage");
});
});
return;
}
// 已登录 或 index 是不需要登录的页面,正常跳转
if (controller.model.currentIndex != index) {
globalController.model.hideBottomNavigationBar =
false;
globalController.updateAll();
}
controller.model.currentIndex = index;
controller.updateAll();
});
},
items: [
getBottomNavigationBarItem("assets/img/menu/home.svg",
"assets/img/menu/n_home.svg", "菜单.首页".tr),
// getBottomNavigationBarItem("assets/img/menu/report.svg",
// "assets/img/menu/n_report.svg", "菜单.报告".tr),
getBottomNavigationBarItem("assets/img/menu/e.svg",
"assets/img/menu/n_e.svg", "菜单.小e".tr),
getBottomNavigationBarItem("assets/img/menu/message.svg",
"assets/img/menu/n_message.svg", "菜单.消息".tr),
getBottomNavigationBarItem("assets/img/menu/mine.svg",
"assets/img/menu/n_mine.svg", "菜单.我的".tr),
],
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/img/bgImage.png'), // 本地图片
fit: BoxFit.fill, // 填满整个 Container
),
),
),
);
child: Scaffold(
backgroundColor: Colors.transparent,
body: arr[controller.model.currentIndex],
floatingActionButtonAnimator:
FloatingActionButtonAnimator.noAnimation,
floatingActionButtonLocation:
FloatingActionButtonLocation.centerDocked,
bottomNavigationBar: Theme(
data: Theme.of(context).copyWith(
splashFactory: NoSplash.splashFactory,
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
),
child: Container(
decoration: BoxDecoration(
border: Border(
top: BorderSide(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: 0.5,
),
),
),
child: BottomNavigationBar(
unselectedItemColor: themeController.currentColor.sc4,
selectedItemColor: themeController.currentColor.sc1,
backgroundColor: themeController.currentColor.sc5,
selectedFontSize: 26.rpx,
unselectedFontSize: 26.rpx,
type: BottomNavigationBarType.fixed,
currentIndex: controller.model.currentIndex,
onTap: (index) {
Future.delayed(const Duration(milliseconds: 100), () {
UserInfoController userInfoController = Get.find();
bool isLoggedIn = userInfoController.model.login ==
LoginStatus.LOGIN.code;
if ((index == 1 || index == 2) && !isLoggedIn) {
TopSlideNotification.show(
context,
text: "必须登录提示".tr,
textColor: themeController.currentColor.sc9,
);
Future.delayed(Duration(milliseconds: 50), () {
if (Get.currentRoute == '/ePage' ||
Get.currentRoute == '/messagePage') {
Get.back();
}
Future.delayed(Duration(milliseconds: 100), () {
Get.toNamed("/loginPage");
});
});
return;
}
if (controller.model.currentIndex != index) {
globalController.model.hideBottomNavigationBar =
false;
globalController.updateAll();
}
controller.model.currentIndex = index;
controller.updateAll();
});
},
items: [
getBottomNavigationBarItem("assets/img/menu/home.svg",
"assets/img/menu/n_home.svg", "菜单.首页".tr),
getBottomNavigationBarItem("assets/img/menu/e.svg",
"assets/img/menu/n_e.svg", "菜单.小e".tr),
getBottomNavigationBarItem(
"assets/img/menu/message.svg",
"assets/img/menu/n_message.svg",
"菜单.消息".tr,
showBadge: (messageController
.model.body_message_read ==
1 ||
messageController.model.system_message_read ==
1)),
getBottomNavigationBarItem("assets/img/menu/mine.svg",
"assets/img/menu/n_mine.svg", "菜单.我的".tr),
],
),
),
),
));
}
},
),
@@ -172,7 +202,8 @@ class MainPageBottomChange extends GetView<MainPageController> {
if (_lastBackPressedTime == null ||
currentTime.difference(_lastBackPressedTime!) > Duration(seconds: 2)) {
_lastBackPressedTime = currentTime;
showToast("再按一次退出程序", color: color_warning, closeTime: 2);
// showToast("再按一次退出程序", color: color_warning, closeTime: 2);
TopSlideNotification.show(context,text: "滑动退出提醒".tr);
return false; // 阻止退出程序
} else {
return true; // 允许退出程序

View File

@@ -5,6 +5,7 @@ import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/message/message_controller.dart';
@@ -21,9 +22,20 @@ class MessagePage extends StatefulWidget {
class _MessagePageState extends State<MessagePage> {
ThemeController themeController = Get.find();
MessageController messageController = Get.find();
late PageController _pageController;
@override
void initState() {
super.initState();
_pageController =
PageController(initialPage: messageController.model.type == 1 ? 0 : 1);
messageController.getMessageStatus();
_fetchMessageData();
}
void _fetchMessageData() {
String type = messageController.model.type == 1 ? "app_vsm" : "app_system";
messageController.updateMessageStatus(type: type);
messageController.getMessageList().then((response) {
if (response.code != HttpStatusCodes.ok) {
TopSlideNotification.show(
@@ -35,44 +47,61 @@ class _MessagePageState extends State<MessagePage> {
});
}
void _onTabChanged(int index) {
messageController.model.type = index == 0 ? 1 : 2;
messageController.updateAll();
_fetchMessageData();
_pageController.animateToPage(index,
duration: const Duration(milliseconds: 300), curve: Curves.easeInOut);
}
void _onPageChanged(int index) {
int newType = index == 0 ? 1 : 2;
if (messageController.model.type != newType) {
messageController.model.type = newType;
messageController.updateAll();
_fetchMessageData();
}
}
@override
void dispose() {
_pageController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.transparent, // 这里设置你希望的颜色
statusBarIconBrightness: Brightness.light, // 状态栏图标的亮度
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
statusBarIconBrightness: Brightness.light,
));
return LayoutBuilder(
builder: (context, boxConstraints) => GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Container(
decoration: BoxDecoration(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/img/bgNoImg.png'), // 本地图片
fit: BoxFit.fill, // 填满整个 Container
image: AssetImage('assets/img/bgNoImg.png'),
fit: BoxFit.fill,
),
),
child: Scaffold(
appBar: AppBar(
backgroundColor: themeController.currentColor.sc17,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(
color: themeController.currentColor.sc3,
),
iconTheme: IconThemeData(color: themeController.currentColor.sc3),
toolbarHeight: 140.rpx,
titleSpacing: 0,
title: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
40.rpx,
0.rpx,
0.rpx,
0.rpx,
),
padding: EdgeInsetsDirectional.fromSTEB(40.rpx, 0, 0, 0),
child: Container(
width: double.infinity,
height: 140.rpx, // 👈 明确告诉 Flutter 高度
height: 140.rpx,
child: Column(
children: [
SizedBox(height: 40.rpx), // 上边距
SizedBox(height: 40.rpx),
Expanded(
child: Stack(
alignment: Alignment.bottomLeft,
@@ -82,89 +111,129 @@ class _MessagePageState extends State<MessagePage> {
children: [
Obx(() {
return ClickableContainer(
padding: EdgeInsets.all(0),
backgroundColor: Colors.transparent,
highlightColor:
themeController.currentColor.sc3,
themeController.currentColor.sc21,
borderRadius: 8.rpx,
padding: EdgeInsets.all(0),
onTap: () async {
messageController.model.type = 1;
await messageController.getMessageList();
messageController.updateAll();
},
onTap: () => _onTabChanged(0),
child: Container(
width: 160.rpx,
alignment: Alignment.center,
child: Text(
'体征消息'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: AppConstants()
.title_text_fontSize,
letterSpacing: 0.0,
color:
messageController
.model.type ==
2
? themeController
.currentColor.sc3
: themeController
.currentColor.sc2,
),
child: Stack(
alignment: Alignment.center,
clipBehavior: Clip.none,
children: [
Text(
'体征消息'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: AppConstants()
.title_text_fontSize,
color:
messageController
.model.type ==
2
? themeController
.currentColor.sc3
: themeController
.currentColor.sc2,
),
),
Obx(() {
return messageController.model
.body_message_read ==
1
? Positioned(
top: -4,
right: -14,
child: Container(
width: 8,
height: 8,
decoration:
const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
),
)
: const SizedBox.shrink();
}),
],
),
),
);
}),
Obx(() {
return ClickableContainer(
padding: EdgeInsets.all(0),
backgroundColor: Colors.transparent,
highlightColor:
themeController.currentColor.sc3,
themeController.currentColor.sc21,
borderRadius: 8.rpx,
padding: EdgeInsets.all(0),
onTap: () async {
messageController.model.type = 2;
await messageController.getMessageList();
messageController.updateAll();
},
onTap: () => _onTabChanged(1),
child: Container(
width: 160.rpx,
alignment: Alignment.center,
child: Text(
'系统消息'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: AppConstants()
.title_text_fontSize,
letterSpacing: 0.0,
color:
messageController
.model.type ==
1
? themeController
.currentColor.sc3
: themeController
.currentColor.sc2,
),
child: Stack(
alignment: Alignment.center,
clipBehavior: Clip.none,
children: [
Text(
'系统消息'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: AppConstants()
.title_text_fontSize,
color:
messageController
.model.type ==
1
? themeController
.currentColor.sc3
: themeController
.currentColor.sc2,
),
),
Obx(() {
return messageController.model
.system_message_read ==
1
? Positioned(
top: -4,
right: -14,
child: Container(
width: 8,
height: 8,
decoration:
const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
),
)
: const SizedBox.shrink();
}),
],
),
),
);
}),
],
].divide(SizedBox(width: 10.rpx)),
),
Obx(() {
double lineWidth = 160.rpx;
double lineWidth = 170.rpx;
return AnimatedPositioned(
duration: Duration(milliseconds: 300),
duration: const Duration(milliseconds: 300),
curve: Curves.easeInOut,
bottom: 0, // 👈 现在 Stack 够大,线能放得下
bottom: 0,
left: messageController.model.type == 1
? 0
: 160.rpx,
: 170.rpx,
child: Container(
width: lineWidth,
height: 4.rpx,
@@ -178,47 +247,33 @@ class _MessagePageState extends State<MessagePage> {
],
),
),
SizedBox(height: 17.rpx), // 上边距
SizedBox(height: 17.rpx),
],
),
),
),
actions: [],
actions: const [],
centerTitle: false,
),
backgroundColor: Colors.transparent,
body: SafeArea(
top: true,
child: Column(
mainAxisSize: MainAxisSize.max,
child: PageView(
controller: _pageController,
onPageChanged: _onPageChanged,
children: [
Expanded(
child: Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx,
0.rpx,
30.rpx,
0.rpx,
),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
MessageWidgetWidget(),
MessageWidgetWidget(),
MessageWidgetWidget(),
]
.divide(SizedBox(height: 30.rpx))
.addToStart(SizedBox(height: 30.rpx))
.addToEnd(SizedBox(height: 30.rpx)),
),
),
),
),
),
Obx(() {
final list = messageController.messageList.value;
return list.isEmpty
? const NullDataWidget()
: _buildMessageListView(list);
}),
Obx(() {
final list = messageController.messageList.value;
return list.isEmpty
? const NullDataWidget()
: _buildMessageListView(list);
}),
],
),
),
@@ -227,4 +282,23 @@ class _MessagePageState extends State<MessagePage> {
),
);
}
Widget _buildMessageListView(List dataList) {
return Container(
width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 30.rpx),
child: SingleChildScrollView(
child: Column(
children: [
SizedBox(height: 30.rpx),
...dataList
.map((item) => MessageWidgetWidget(data: item))
.toList()
.divide(SizedBox(height: 30.rpx)),
SizedBox(height: 30.rpx),
],
),
),
);
}
}

View File

@@ -6,6 +6,7 @@ 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/base/SleepCalendarWidget.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
@@ -157,89 +158,99 @@ class _MinePageState extends State<MinePage> {
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 120.rpx,
height: 120.rpx,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
Obx(() {
var userInfo =
userInfoController.model.user;
return Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 120.rpx,
height: 120.rpx,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: login == 1
? (userInfoController.model.user!
.avatar ==
null ||
userInfoController.model
.user!.avatar!.isEmpty
? Image.asset(
"assets/img/avatar.png",
fit: BoxFit.cover,
)
: Image.network(
userInfoController
.model.user!.avatar!,
fit: BoxFit.cover,
))
: Image.asset(
"assets/img/avatar.png",
fit: BoxFit.cover,
),
),
child: login == 1
? (userInfoController.model.user!
.avatar ==
null ||
userInfoController.model
.user!.avatar!.isEmpty
? Image.asset(
"assets/img/avatar.png",
fit: BoxFit.cover,
)
: Image.network(
userInfoController
.model.user!.avatar!,
fit: BoxFit.cover,
))
: Image.asset(
"assets/img/avatar.png",
fit: BoxFit.cover,
),
),
Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
login == 1
? (userInfoController.model
.user!.nick_name ??
'未命名'.tr)
: "我的.未登录".tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color: themeController
.currentColor.sc3,
fontSize: AppConstants()
.title_text_fontSize,
letterSpacing: 0.0,
),
),
Text(
login == 1
? (userInfoController.model
.user!.email !=
null
? userInfoController
.model.user!.email!
: MyUtils.hidePhoneNumber(
userInfoController.model
.user!.phone!))
: "我的.未登录".tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color: themeController
.currentColor.sc3,
fontSize: AppConstants()
.normal_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(height: 20.rpx)),
),
].divide(SizedBox(width: 35.rpx)),
),
Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
login == 1
? (userInfoController.model
.user!.nick_name ??
'未命名'.tr)
: "我的.未登录".tr,
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color: themeController
.currentColor.sc3,
fontSize: AppConstants()
.title_text_fontSize,
letterSpacing: 0.0,
),
),
Text(
login == 1
? (userInfoController.model
.user!.email !=
null
? userInfoController
.model.user!.email!
: MyUtils.hidePhoneNumber(
userInfoController
.model
.user!
.phone!))
: "我的.未登录".tr,
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color: themeController
.currentColor.sc4,
fontSize: AppConstants()
.normal_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(height: 20.rpx)),
),
].divide(SizedBox(width: 35.rpx)),
);
}),
CustomCard(
borderRadius: 0,
onTap: () {
onTap: () async {
if (login == 1) {
Get.toNamed("/updateUserPage");
await Get.toNamed("/updateUserPage");
await userInfoController.getUserInfo();
userInfoController.updateAll();
} else {
Get.toNamed("/loginPage");
}
@@ -250,9 +261,7 @@ class _MinePageState extends State<MinePage> {
mainAxisSize: MainAxisSize.max,
children: [
Text(
login == 1
? '我的.个人信息'.tr
: '我的.去登录'.tr,
login == 1 ? '编辑'.tr : '我的.去登录'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
@@ -328,7 +337,7 @@ class _MinePageState extends State<MinePage> {
child: Container(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 20.rpx, 0.rpx, 20.rpx),
0.rpx, 30.rpx, 0.rpx, 30.rpx),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
@@ -392,18 +401,19 @@ class _MinePageState extends State<MinePage> {
);
Get.toNamed("/loginPage");
} else {
TopSlideNotification.show(
context,
text: "待开发.提示".tr,
textColor:
themeController.currentColor.sc2,
);
// TopSlideNotification.show(
// context,
// text: "待开发.提示".tr,
// textColor:
// themeController.currentColor.sc2,
// );
Get.toNamed("/applyRepairPage");
}
},
child: Container(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
40.rpx, 20.rpx, 40.rpx, 20.rpx),
40.rpx, 30.rpx, 40.rpx, 30.rpx),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
@@ -467,18 +477,19 @@ class _MinePageState extends State<MinePage> {
);
Get.toNamed("/loginPage");
} else {
TopSlideNotification.show(
context,
text: "待开发.提示".tr,
textColor:
themeController.currentColor.sc2,
);
// TopSlideNotification.show(
// context,
// text: "待开发.提示".tr,
// textColor:
// themeController.currentColor.sc2,
// );
Get.toNamed("/helpPage");
}
},
child: Container(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
40.rpx, 20.rpx, 40.rpx, 20.rpx),
40.rpx, 30.rpx, 40.rpx, 30.rpx),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
@@ -542,18 +553,19 @@ class _MinePageState extends State<MinePage> {
);
Get.toNamed("/loginPage");
} else {
TopSlideNotification.show(
context,
text: "待开发.提示".tr,
textColor:
themeController.currentColor.sc2,
);
// TopSlideNotification.show(
// context,
// text: "待开发.提示".tr,
// textColor:
// themeController.currentColor.sc2,
// );
Get.toNamed("/followPage");
}
},
child: Container(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 20.rpx, 0.rpx, 20.rpx),
0.rpx, 30.rpx, 0.rpx, 30.rpx),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
@@ -570,7 +582,7 @@ class _MinePageState extends State<MinePage> {
color: stringToColor("#00C1AA"),
),
Text(
'关注我们'.tr,
'我的.关注我们'.tr,
style:
FlutterFlowTheme.of(context)
.bodyMedium
@@ -617,18 +629,38 @@ class _MinePageState extends State<MinePage> {
);
Get.toNamed("/loginPage");
} else {
TopSlideNotification.show(
context,
text: "待开发.提示".tr,
textColor:
themeController.currentColor.sc2,
// TopSlideNotification.show(
// context,
// text: "待开发.提示".tr,
// textColor:
// themeController.currentColor.sc2,
// );
showModalBottomSheet(
context: context,
isScrollControlled: false, // 不需要滚动全屏
backgroundColor:
Colors.transparent, // 为了圆角和美观
builder: (context) {
return Container(
decoration: BoxDecoration(
color: const Color(
0xFF242835), // 你组件的底色
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.rpx),
topRight: Radius.circular(20.rpx),
),
),
child:
SleepCalendarWidget(), // 显示日历组件
);
},
);
}
},
child: Container(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 20.rpx, 0.rpx, 20.rpx),
0.rpx, 30.rpx, 0.rpx, 30.rpx),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:

View File

@@ -1,31 +1,30 @@
// import 'package:ef/ef.dart';
// import 'package:flutter/material.dart';
// import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
// import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
// class SleepReportPage extends StatefulWidget {
// const SleepReportPage({super.key});
class SleepReportPage extends StatefulWidget {
const SleepReportPage({super.key});
// @override
// State<SleepReportPage> createState() => _SleepReportPageState();
// }
@override
State<SleepReportPage> createState() => _SleepReportPageState();
}
// class _SleepReportPageState extends State<SleepReportPage> {
// GlobalController globalController = Get.find();
// UserInfoController userInfoController = Get.find();
// @override
// Widget build(BuildContext context) {
// return LayoutBuilder(
// builder: (context, boxConstraints) => GestureDetector(
// onTap: () => FocusScope.of(context).unfocus(),
// child: Scaffold(
// body: SafeArea(
// top: true,
// child: Text("睡眠报告"),
// ),
// ),
// ),
// );
// }
// }
class _SleepReportPageState extends State<SleepReportPage> {
GlobalController globalController = Get.find();
UserInfoController userInfoController = Get.find();
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, boxConstraints) => GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Scaffold(
body: SafeArea(
top: true,
child: Text("睡眠报告"),
),
),
),
);
}
}

View File

@@ -34,6 +34,17 @@ class _EPageState extends State<PersonPage> {
@override
void initState() {
super.initState();
personController.getDiseaseData().then((apiResponse) {
WidgetsBinding.instance.addPostFrameCallback((_) {
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor: apiResponse.code != HttpStatusCodes.ok
? themeController.currentColor.sc9
: themeController.currentColor.sc2,
);
});
});
personController.selectedDiseaseIds.value = [];
personController.name.value = '';
personController.gender.value = 1;

View File

@@ -3,7 +3,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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/controller/theme_controller/ThemeController.dart';
Future showDateSelectionDialog(BuildContext context,

View File

@@ -15,11 +15,13 @@ import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/person/person_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/enum/BindType.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/pages/person/select_time.dart';
class UpdatePersonPage extends StatefulWidget {
const UpdatePersonPage({super.key});
var status;
UpdatePersonPage({super.key, required this.status});
@override
State<UpdatePersonPage> createState() => _UpdatePageState();
@@ -38,7 +40,7 @@ class _UpdatePageState extends State<UpdatePersonPage> {
super.initState();
personController.getDiseaseData().then((apiResponse) {
TopSlideNotification.show(
Get.context!,
context,
text: apiResponse.msg!,
textColor: apiResponse.code != HttpStatusCodes.ok
? themeController.currentColor.sc9
@@ -49,6 +51,8 @@ class _UpdatePageState extends State<UpdatePersonPage> {
@override
Widget build(BuildContext context) {
print(widget.status);
print(widget.status);
return LayoutBuilder(
builder: (context, bodySize) => GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
@@ -85,7 +89,6 @@ class _UpdatePageState extends State<UpdatePersonPage> {
fontSize: 30.rpx,
),
),
/// 左边返回按钮
Positioned(
left: 0,
@@ -94,41 +97,44 @@ class _UpdatePageState extends State<UpdatePersonPage> {
bodyDeviceController.updateAll();
}),
),
Positioned(
right: 20.rpx,
child: CustomCard(
borderRadius: 20.rpx,
onTap: () async {
ApiResponse apiRespons =
await personController.savePersonData();
if (apiRespons.code == HttpStatusCodes.ok) {
TopSlideNotification.show(context,
text: apiRespons.msg!);
} else {
TopSlideNotification.show(context,
text: apiRespons.msg!,
textColor: themeController.currentColor.sc9);
}
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: 100.rpx,
height: 60.rpx,
alignment: Alignment.center,
padding: EdgeInsetsDirectional.fromSTEB(
16.rpx, 0, 16.rpx, 0),
child: Text(
'人员资料.保存'.tr,
style: FlutterFlowTheme.of(context)
.titleSmall
.override(
fontFamily: 'Inter Tight',
color: themeController.currentColor.sc3,
letterSpacing: 0.0,
),
Visibility(
visible: widget.status == BindType.active.code,
child: Positioned(
right: 20.rpx,
child: CustomCard(
borderRadius: 20.rpx,
onTap: () async {
ApiResponse apiRespons =
await personController.savePersonData();
if (apiRespons.code == HttpStatusCodes.ok) {
TopSlideNotification.show(context,
text: apiRespons.msg!);
} else {
TopSlideNotification.show(context,
text: apiRespons.msg!,
textColor: themeController.currentColor.sc9);
}
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: 100.rpx,
height: 60.rpx,
alignment: Alignment.center,
padding: EdgeInsetsDirectional.fromSTEB(
16.rpx, 0, 16.rpx, 0),
child: Text(
'人员资料.保存'.tr,
style: FlutterFlowTheme.of(context)
.titleSmall
.override(
fontFamily: 'Inter Tight',
color: themeController.currentColor.sc3,
letterSpacing: 0.0,
),
),
),
),
),
@@ -670,6 +676,7 @@ class _UpdatePageState extends State<UpdatePersonPage> {
),
);
}),
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 152.rpx, 0, 0),

View File

@@ -0,0 +1,538 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/ServiceConstant.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/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/device/body_device_controller.dart';
import 'package:vbvs_app/controller/device/device_type_controller.dart';
import 'package:vbvs_app/controller/repair/repair_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/pages/repair/component/RepairModelWidget.dart';
class ApplyRepairPage extends StatefulWidget {
const ApplyRepairPage({super.key});
@override
State<ApplyRepairPage> createState() => _ApplyRepairPageState();
}
class _ApplyRepairPageState extends State<ApplyRepairPage> {
final ThemeController themeController = Get.find();
DeviceTypeController deviceTypeController = Get.find();
RepairController repairController = Get.find();
BodyDeviceController bodyDeviceController = Get.find();
final List<GlobalKey> repairItemKeys = [];
final GlobalKey contactKey = GlobalKey();
final GlobalKey phoneKey = GlobalKey();
@override
void initState() {
super.initState();
_loadData();
repairItemKeys.addAll(List.generate(
repairController.repairList.length, (index) => GlobalKey()));
}
void _updateRepairItemKeys() {
try {
final int currentLength = repairController.repairList.length;
if (repairItemKeys.length != currentLength) {
repairItemKeys.clear();
repairItemKeys.addAll(
List.generate(currentLength, (index) => GlobalKey()),
);
}
} catch (e) {
print(e);
}
}
Future<void> _loadData() async {
repairController.repairList = [{}].obs;
repairController.name.value = "";
repairController.phone.value = "";
await deviceTypeController.getDeviceType(); // 等待数据加载
if (deviceTypeController.deviceTypeList.isNotEmpty) {
repairController.device_type.value =
deviceTypeController.deviceTypeList.first['_id'];
}
await bodyDeviceController.getDeviceList();
WidgetsBinding.instance.addPostFrameCallback((_) {
_updateRepairItemKeys();
});
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
if (deviceTypeController.deviceTypeList.isNotEmpty) {
repairController.device_type.value =
deviceTypeController.deviceTypeList.first['_id'];
}
if (bodyDeviceController.deviceList.isNotEmpty) {
repairController.deviceListId = bodyDeviceController.deviceList
.map((e) => e['_id'] as String)
.toList();
}
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: themeController.currentColor.sc17,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(
color: themeController.currentColor.sc3,
),
titleSpacing: 0,
title: Container(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
/// 居中标题
Text(
'设备报修'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx,
),
),
Positioned(
left: 0,
// child: returnIconButtom,
child: returnIconButtomAddCallback(() {}),
),
Positioned(
right: 20.rpx,
child: ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: themeController.currentColor.sc16,
padding: EdgeInsets.all(8.rpx),
onTap: () {
Get.toNamed("/repairListPage");
},
child: SvgPicture.asset(
'assets/img/icon/history.svg',
width: 39.rpx,
height: 39.rpx,
color: themeController.currentColor.sc16,
),
),
),
],
),
),
actions: [],
centerTitle: false,
),
body: SafeArea(
top: true,
child: Padding(
padding:
EdgeInsetsDirectional.fromSTEB(30.rpx, 29.rpx, 30.rpx, 0),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Obx(() {
return Row(
mainAxisSize: MainAxisSize.max,
children: deviceTypeController.deviceTypeList.value
.map(
(deviceType) => CustomCard(
borderRadius:
AppConstants().button_container_radius,
onTap: () async {
repairController.device_type.value =
deviceType['_id'];
repairController.repairList
.clear(); // 清空旧数据
repairController.repairList
.add({}); // 添加新数据
await bodyDeviceController
.getDeviceList(); // 等待数据加载
_updateRepairItemKeys(); // 清空后更新 keys
repairController
.updateAll(); // 手动触发更新(如果未自动更新)
},
colors: deviceType['_id'] ==
repairController.device_type.value
? [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
]
: [themeController.currentColor.sc5],
child: Container(
width: (MediaQuery.sizeOf(context).width *
0.284)
.rpx,
constraints: BoxConstraints(
minWidth: 213.rpx,
minHeight: 91.rpx,
),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(20.rpx),
),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: Text(
deviceType[
'name'], // 假设 deviceType 有 name 字段
style: TextStyle(
letterSpacing: 0.0,
color:
themeController.currentColor.sc3,
fontSize: AppConstants()
.normal_text_fontSize,
),
),
),
),
),
)
.toList()
.divide(SizedBox(width: 25.rpx)),
);
}),
Obx(() {
return Column(
children: repairController.repairList
.map((item) {
final int index =
repairController.repairList.indexOf(item);
return RepairModelWidget(
widgetKey:
repairItemKeys[index], // 确保 index 有效
model: item,
onTap: () {
repairController.repairList.remove(item);
_updateRepairItemKeys(); // 删除后更新 keys
},
length: repairController.repairList.length,
);
})
.toList()
.divide(SizedBox(
height: 25.rpx,
)),
);
}),
ClickableContainer(
backgroundColor: themeController.currentColor.sc5,
highlightColor: themeController.currentColor.sc21,
borderRadius: 20.rpx,
padding: EdgeInsets.zero,
onTap: () {
repairController.repairList.add({});
_updateRepairItemKeys(); // 初始化 keys
repairController.updateAll();
},
child: SizedBox(
width: double.infinity,
height: 90.rpx,
child: Center(
child: Image.asset(
"assets/img/addItem.png",
width: 39.rpx,
height: 39.rpx,
),
),
),
),
Container(
width: double.infinity,
decoration: BoxDecoration(
color: themeController.currentColor.sc5,
borderRadius: BorderRadius.circular(
AppConstants().normal_container_radius),
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 30.rpx, 30.rpx, 30.rpx),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
_buildParamRow(
context,
"联系人".tr,
"名称输入提示".tr,
(value) {
repairController.name.value = value;
},
key: contactKey,
),
_buildParamRow(
context,
"手机号".tr,
"手机号输入提示".tr,
(value) {
repairController.phone.value = value;
},
key: phoneKey,
),
].divide(SizedBox(height: 30.rpx)),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
100.rpx, 0.rpx, 100.rpx, 60.rpx),
child: CustomCard(
borderRadius:
AppConstants().button_container_radius, // 圆角半径
onTap: () async {
// TopSlideNotification.show(context,
// text: "提交成功",
// textColor: themeController.currentColor.sc1);
// Future.delayed(const Duration(seconds: 1), () {
// Get.offAllNamed("/mianPageBottomChange");
// });
String msg = checkRepairParam();
if (msg.isNotEmpty) {
TopSlideNotification.show(context,
text: msg,
textColor: themeController.currentColor.sc9);
} else {
String serviceAddress =
ServiceConstant.service_address;
String serviceName =
ServiceConstant.server_service;
String serviceApi = ServiceConstant.submit_repair;
String queryUrl =
"$serviceAddress$serviceName$serviceApi";
var data = {
"repairList": repairController.repairList,
"type": repairController.device_type.value,
};
ApiResponse apiResponse = await requestWithLog(
logTitle: "提交报修信息",
method: MyHttpMethod.post,
queryUrl: queryUrl,
data: data,
);
Get.back();
}
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
color: Colors.transparent,
width: MediaQuery.sizeOf(context).width * 0.66,
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,
)),
),
),
),
),
]
.divide(SizedBox(
height: 25.rpx,
))
.addToEnd(SizedBox(
height: 25.rpx,
)),
),
),
),
),
),
),
),
);
}
Widget _buildParamRow(BuildContext context, String text, String hinttext,
void Function(String) onChanged,
{Key? key} // 新增可选参数
) {
return Row(
key: key, // 使用传入的 key
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 110.rpx,
child: Text(
text,
style: TextStyle(
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
),
overflow: TextOverflow.ellipsis,
softWrap: false,
maxLines: 1,
),
),
Expanded(
child: Container(
width: 200.rpx,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.rpx),
color: Colors.transparent,
),
child: TextFormField(
autofocus: false,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelStyle: TextStyle(
letterSpacing: 0.0,
fontWeight:
FlutterFlowTheme.of(context).labelMedium.fontWeight,
fontStyle: FlutterFlowTheme.of(context).labelMedium.fontStyle,
),
hintText: hinttext,
hintStyle: TextStyle(
letterSpacing: 0.0,
fontSize: AppConstants().normal_text_fontSize,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius: BorderRadius.circular(
AppConstants().normal_container_radius),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.transparent,
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
filled: true,
fillColor: themeController.currentColor.sc15,
),
style: TextStyle(
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
fontSize: AppConstants().normal_text_fontSize,
),
cursorColor: themeController.currentColor.sc3,
onChanged: onChanged,
),
),
),
].divide(SizedBox(width: 24.rpx)),
);
}
String checkRepairParam() {
String errormsg = "";
// 检查报修项
for (var i = 0; i < repairController.repairList.length; i++) {
final item = repairController.repairList[i];
if (item["path"] == null || item["path"].toString().isEmpty) {
_scrollToKey(repairItemKeys[i]);
// return "第 ${i + 1} 项图片未上传";
return "图片未上传".tr;
}
if (item["id"] == null || item["id"].toString().isEmpty) {
_scrollToKey(repairItemKeys[i]);
// return "第 ${i + 1} 项设备未选择";
return "设备未选择".tr;
}
if (item["param"] == null || item["param"].toString().isEmpty) {
_scrollToKey(repairItemKeys[i]);
// return "第 ${i + 1} 项参数未填写";
return "参数未填写".tr;
}
if (item["issue"] == null || item["issue"].toString().isEmpty) {
_scrollToKey(repairItemKeys[i]);
// return "第 ${i + 1} 项问题描述未填写";
return "问题描述未填写".tr;
}
}
// 检查联系人
if (repairController.name.trim().isEmpty) {
_scrollToKey(contactKey);
return "联系人不能为空";
}
if (repairController.phone.trim().isEmpty) {
_scrollToKey(phoneKey);
return "联系电话不能为空";
}
return errormsg;
}
// 新增滚动方法
void _scrollToKey(GlobalKey key) {
WidgetsBinding.instance.addPostFrameCallback((_) {
Scrollable.ensureVisible(
key.currentContext!,
duration: Duration(milliseconds: 300),
curve: Curves.easeInOut,
);
});
}
}

View File

@@ -0,0 +1,250 @@
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/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/routers/routers.dart';
class RepairHistoryInfoWidget extends StatefulWidget {
const RepairHistoryInfoWidget({super.key});
@override
State<RepairHistoryInfoWidget> createState() =>
_RepairHistoryInfoWidgetState();
}
class _RepairHistoryInfoWidgetState extends State<RepairHistoryInfoWidget> {
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return CustomCard(
borderRadius: AppConstants().normal_container_radius,
onTap: () {
//跳转详情
},
colors: [
themeController.currentColor.sc5,
],
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: themeController.currentColor.sc5,
borderRadius:
BorderRadius.circular(AppConstants().normal_container_radius),
),
child: Padding(
padding:
EdgeInsetsDirectional.fromSTEB(30.rpx, 36.rpx, 0.rpx, 36.rpx),
child: Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: MediaQuery.sizeOf(context).width * 0.14,
constraints: BoxConstraints(
maxWidth: 130.rpx,
),
decoration: BoxDecoration(),
child: Text(
'设备类型'.tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 26.rpx,
letterSpacing: 0.0,
fontWeight: FlutterFlowTheme.of(context)
.bodyMedium
.fontWeight,
fontStyle: FlutterFlowTheme.of(context)
.bodyMedium
.fontStyle,
color: themeController.currentColor.sc4,
),
),
),
Text(
'智能床',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 26.rpx,
letterSpacing: 0.0,
fontWeight: FlutterFlowTheme.of(context)
.bodyMedium
.fontWeight,
fontStyle:
FlutterFlowTheme.of(context).bodyMedium.fontStyle,
color: themeController.currentColor.sc3,
),
),
].divide(SizedBox(width: 33.rpx)),
),
),
Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: MediaQuery.sizeOf(context).width * 0.14,
constraints: BoxConstraints(
maxWidth: 130.rpx,
),
decoration: BoxDecoration(),
child: Text(
'设备ID'.tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 26.rpx,
letterSpacing: 0.0,
fontWeight: FlutterFlowTheme.of(context)
.bodyMedium
.fontWeight,
fontStyle: FlutterFlowTheme.of(context)
.bodyMedium
.fontStyle,
color: themeController.currentColor.sc4,
),
),
),
Text(
'15561651',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 26.rpx,
letterSpacing: 0.0,
fontWeight: FlutterFlowTheme.of(context)
.bodyMedium
.fontWeight,
fontStyle:
FlutterFlowTheme.of(context).bodyMedium.fontStyle,
color: themeController.currentColor.sc3,
),
),
].divide(SizedBox(width: 33.rpx)),
),
),
Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: MediaQuery.sizeOf(context).width * 0.14,
constraints: BoxConstraints(
maxWidth: 130.rpx,
),
decoration: BoxDecoration(),
child: Text(
'联系人'.tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 26.rpx,
letterSpacing: 0.0,
fontWeight: FlutterFlowTheme.of(context)
.bodyMedium
.fontWeight,
fontStyle: FlutterFlowTheme.of(context)
.bodyMedium
.fontStyle,
color: themeController.currentColor.sc4,
),
),
),
Text(
'王明',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 26.rpx,
letterSpacing: 0.0,
fontWeight: FlutterFlowTheme.of(context)
.bodyMedium
.fontWeight,
fontStyle:
FlutterFlowTheme.of(context).bodyMedium.fontStyle,
color: themeController.currentColor.sc3,
),
),
].divide(SizedBox(width: 33.rpx)),
),
),
Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: MediaQuery.sizeOf(context).width * 0.14,
constraints: BoxConstraints(
maxWidth: 130.rpx,
),
decoration: BoxDecoration(),
child: Text(
'发生时间'.tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 26.rpx,
letterSpacing: 0.0,
fontWeight: FlutterFlowTheme.of(context)
.bodyMedium
.fontWeight,
fontStyle: FlutterFlowTheme.of(context)
.bodyMedium
.fontStyle,
color: themeController.currentColor.sc4,
),
),
),
Text(
'2022-08-01 15:05',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 26.rpx,
letterSpacing: 0.0,
fontWeight: FlutterFlowTheme.of(context)
.bodyMedium
.fontWeight,
fontStyle:
FlutterFlowTheme.of(context).bodyMedium.fontStyle,
color: themeController.currentColor.sc3,
),
),
].divide(SizedBox(width: 33.rpx)),
),
),
].divide(SizedBox(height: 34.rpx)),
),
),
),
),
);
}
}

View File

@@ -0,0 +1,435 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/component/base/THFlutterFlowDropDown.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/repair/repair_controller.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/routers/routers.dart';
class RepairModelWidget extends StatefulWidget {
var model;
final VoidCallback onTap; // 添加回调函数
int length;
final GlobalKey widgetKey; // 新增
RepairModelWidget({
super.key,
required this.model,
required this.onTap,
required this.length,
required this.widgetKey,
});
@override
State<RepairModelWidget> createState() => _RepairModelWidgetState();
}
class _RepairModelWidgetState extends State<RepairModelWidget> {
FormFieldController<String> _deviceController =
FormFieldController<String>(null);
RepairController repairController = Get.find();
UserInfoController userInfoController = Get.find();
@override
void setState(VoidCallback callback) {
super.setState(callback);
}
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
// _deviceController.value = "";
return Container(
key: widget.widgetKey, // 使用传入的 key
width: double.infinity,
decoration: BoxDecoration(
color: themeController.currentColor.sc5,
borderRadius:
BorderRadius.circular(AppConstants().normal_container_radius),
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 35.rpx, 30.rpx, 35.rpx),
child: Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 110.rpx,
decoration: BoxDecoration(),
child: Text(
'设备ID'.tr,
style: TextStyle(
fontSize: 26.rpx,
color: themeController.currentColor.sc3,
),
),
),
Expanded(
child: Container(
decoration: BoxDecoration(
color: themeController.currentColor.sc15,
borderRadius: BorderRadius.circular(
AppConstants().normal_container_radius),
),
height: AppConstants().dropdown_height,
child: THFlutterFlowDropDown<String>(
onChanged: (val) {
widget.model['id'] = val;
},
width: 200.rpx,
height: 40.rpx,
textStyle: TextStyle(
color: themeController.currentColor.sc3,
fontSize: AppConstants().normal_text_fontSize,
),
hintText: '选择设备'.tr,
hintTextStyle: TextStyle(
color: themeController.currentColor.sc4,
fontSize: AppConstants().normal_text_fontSize,
),
icon: Icon(
Icons.keyboard_arrow_down_rounded,
color: FlutterFlowTheme.of(context).secondaryText,
size: 24.rpx,
),
fillColor: themeController.currentColor.sc15,
elevation: 0,
borderColor: Colors.transparent,
borderWidth: 0,
borderRadius: 20.rpx,
margin: EdgeInsetsDirectional.fromSTEB(
20.rpx, 0, 20.rpx, 0),
hidesUnderline: true,
isOverButton: false,
isSearchable: false,
isMultiSelect: false,
controller: _deviceController,
options: repairController.deviceListId!,
optionLabels: repairController.deviceListId!,
),
),
),
].divide(SizedBox(width: 24.rpx)),
),
),
Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 110.rpx,
decoration: BoxDecoration(),
child: Text(
'设备参数'.tr,
style: TextStyle(
fontSize: 26.rpx,
color: themeController.currentColor.sc3,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
Expanded(
child: Container(
width: 200.rpx,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.rpx),
color: Colors.transparent,
),
child: TextFormField(
controller: repairController.onReDraw(
TextEditingController(
text: widget.model['param']),
(textEditingController) {
textEditingController.text = widget.model['param'];
}),
// initialValue: widget.model['param'],
autofocus: false,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelStyle: TextStyle(
letterSpacing: 0.0,
fontWeight: FlutterFlowTheme.of(context)
.labelMedium
.fontWeight,
fontStyle: FlutterFlowTheme.of(context)
.labelMedium
.fontStyle,
),
hintText: "设备参数提示".tr,
hintStyle: TextStyle(
letterSpacing: 0.0,
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc4,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius: BorderRadius.circular(
AppConstants().normal_container_radius),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.transparent,
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
filled: true,
fillColor: themeController.currentColor.sc15,
),
style: TextStyle(
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
fontSize: AppConstants().normal_text_fontSize,
),
cursorColor: themeController.currentColor.sc3,
onChanged: (value) {
widget.model['param'] = value;
},
),
),
),
].divide(SizedBox(width: 24.rpx)),
),
),
Container(
width: double.infinity,
height: 151.rpx,
decoration: BoxDecoration(
color: themeController.currentColor.sc15,
borderRadius: BorderRadius.circular(20.rpx),
),
child: Container(
width: 200.rpx,
child: TextFormField(
onChanged: (value) {
widget.model['issue'] = value;
},
maxLines: null, // 👈 支持无限行
controller: TextEditingController(),
autofocus: false,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelStyle: TextStyle(
letterSpacing: 0.0,
fontWeight:
FlutterFlowTheme.of(context).labelMedium.fontWeight,
fontStyle:
FlutterFlowTheme.of(context).labelMedium.fontStyle,
),
hintText: '问题描述'.tr,
hintStyle: TextStyle(
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1,
),
borderRadius: BorderRadius.circular(8.rpx),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1,
),
borderRadius: BorderRadius.circular(8.rpx),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 1,
),
borderRadius: BorderRadius.circular(8.rpx),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 1,
),
borderRadius: BorderRadius.circular(8.rpx),
),
filled: false,
contentPadding: EdgeInsets.symmetric(
vertical: 20.rpx, horizontal: 20.rpx),
),
style: TextStyle(
color: themeController.currentColor.sc3,
fontSize: AppConstants().normal_text_fontSize,
),
cursorColor: FlutterFlowTheme.of(context).primaryText,
),
),
),
ClickableContainer(
backgroundColor: themeController.currentColor.sc15,
highlightColor: themeController.currentColor.sc21,
borderRadius: 20.rpx,
padding: EdgeInsets.zero, // 原来没有额外 padding这里保持一致
onTap: () async {
ApiResponse apiResponse = await repairController.uploadImg();
print(apiResponse);
if (apiResponse.code == HttpStatusCodes.ok) {
print(widget.model);
// setState(() {
// widget.model['path'] = apiResponse.data['path'];
// });
widget.model['path'] = apiResponse.data['path'];
repairController.repairList
.refresh(); // 通知 Obx 更新(如果用了 GetX
print(widget.model);
} else {
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor: apiResponse.code == HttpStatusCodes.ok
? themeController.currentColor.sc2
: themeController.currentColor.sc9,
);
}
},
child: SizedBox(
width: double.infinity,
height: MediaQuery.sizeOf(context).height * 0.203,
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: 151.rpx,
),
child: Obx(() {
var list = repairController.repairList;
print(list);
if (widget.model['path'] == null ||
widget.model['path'] == "") {
return Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 60.rpx,
height: 53.rpx,
child: SvgPicture.asset(
'assets/img/icon/camera.svg',
width: 24.rpx,
height: 24.rpx,
color: themeController.currentColor.sc4,
),
),
Text(
'上传提示'.tr,
style: TextStyle(
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
),
].divide(SizedBox(height: 28.rpx)),
);
}
return Container(
// clipBehavior: Clip.antiAlias,
child: Image.network(
widget.model['path'],
fit: BoxFit.cover,
),
);
})),
),
),
if (widget.length > 1)
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
100.rpx, 0.rpx, 100.rpx, 0.rpx),
child: CustomCard(
borderRadius:
AppConstants().button_container_radius, // 圆角半径
onTap: widget.onTap,
colors: [
Colors.transparent,
],
child: Container(
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(
AppConstants().button_container_radius),
),
width: MediaQuery.sizeOf(context).width * 0.216,
height: MediaQuery.sizeOf(context).height * 0.038,
constraints: BoxConstraints(
minHeight: 62.rpx,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'删除'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
color: themeController.currentColor.sc9,
fontFamily: 'Inter',
fontSize: AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(
width: 17.rpx,
)),
),
),
),
),
].divide(SizedBox(height: 29.rpx)),
),
),
),
);
}
}

View File

@@ -0,0 +1,136 @@
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/controller/device/body_device_controller.dart';
import 'package:vbvs_app/controller/device/device_type_controller.dart';
import 'package:vbvs_app/controller/repair/repair_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/pages/repair/component/RepairHistoryInfoWidget.dart';
class RepairListPage extends StatefulWidget {
const RepairListPage({super.key});
@override
State<RepairListPage> createState() => _RepairListPageState();
}
class _RepairListPageState extends State<RepairListPage> {
@override
void initState() {
super.initState();
loadData();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
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: themeController.currentColor.sc17,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(
color: themeController.currentColor.sc3,
),
titleSpacing: 0,
title: Container(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
/// 居中标题
Text(
'申请记录'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx,
),
),
Positioned(
left: 0,
// child: returnIconButtom,
child: returnIconButtomAddCallback(() {}),
),
// Positioned(
// right: 20.rpx,
// child: ClickableContainer(
// backgroundColor: Colors.transparent,
// highlightColor: themeController.currentColor.sc16,
// padding: EdgeInsets.all(8.rpx),
// onTap: () {},
// child: SvgPicture.asset(
// 'assets/img/icon/history.svg',
// width: 39.rpx,
// height: 39.rpx,
// color: themeController.currentColor.sc16,
// ),
// ),
// ),
],
),
),
actions: [],
centerTitle: false,
),
body: SafeArea(
top: true,
child: Padding(
padding:
EdgeInsetsDirectional.fromSTEB(30.rpx, 29.rpx, 30.rpx, 0),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
RepairHistoryInfoWidget(),
RepairHistoryInfoWidget(),
RepairHistoryInfoWidget(),
RepairHistoryInfoWidget(),
RepairHistoryInfoWidget(),
RepairHistoryInfoWidget(),
RepairHistoryInfoWidget(),
]
.divide(SizedBox(
height: 25.rpx,
))
.addToEnd(SizedBox(
height: 25.rpx,
)),
),
),
),
),
),
),
),
);
}
Future<void> loadData() async {
// repairController.repairHistory.value = [{}];
// ApiResponse apiResponse = await requestWithLog(
// logTitle: "请求维修列表", method: MyHttpMethod.get, queryUrl: "");
// if (apiResponse.code == HttpStatusCodes.ok) {
// //请求维修列表
// }
}
}

View File

@@ -0,0 +1,272 @@
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/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/controller/setting/language/language_controller.dart';
import 'package:vbvs_app/language/AppLanguage.dart';
import 'package:vbvs_app/pages/device_bind/componnet/FancyCircleCheckbox.dart';
class LanguageSetting extends StatefulWidget {
const LanguageSetting({super.key});
@override
State<LanguageSetting> createState() => _LanguageSettingState();
}
class _LanguageSettingState extends State<LanguageSetting> {
LanguageController languageController = Get.find();
@override
void initState() {
// languageController.initLanuageList();
super.initState();
}
@override
Widget build(BuildContext context) {
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: themeController.currentColor.sc17,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(
color: themeController.currentColor.sc3,
),
titleSpacing: 0,
// leading: returnIconButtom,
title: Container(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
/// 居中标题
Text(
'选择语言'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
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: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 25.rpx, 30.rpx, 0),
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: Color(0xFF242835),
borderRadius: BorderRadius.circular(
AppConstants().normal_container_radius),
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0, 0.rpx, 0),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
40.rpx, 20.rpx, 40.rpx, 20.rpx),
child: Obx(() {
return Column(
children: languageController.languageList
.map<Widget>((language) {
return ClickableContainer(
backgroundColor:
Colors.transparent, // 背景透明
highlightColor: themeController
.currentColor.sc21, // 点击时的背景色
padding: EdgeInsets.symmetric(
vertical: 10.rpx,
horizontal: 16.rpx),
onTap: () async {
// 点击事件逻辑
print('点击了语言项');
for (var lang
in languageController
.languageList) {
lang.selected = (lang ==
language); // 根据选择更新状态
}
languageController
.selectLanguage
.value = language;
await AppLanguage()
.loadLanguage(language
.language_code); // 加载语言
languageController
.updateAll(); // 更新操作
},
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Expanded(
child: Text(
language.language_name ??
'语言名称', // 显示语言名称
style: FlutterFlowTheme
.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color:
themeController
.currentColor
.sc3,
fontSize: AppConstants()
.title_text_fontSize,
letterSpacing: 0.0,
),
maxLines: 1,
overflow: TextOverflow
.ellipsis, // 省略号处理
),
),
FancyCircleCheckbox(
borderColor: themeController
.currentColor.sc3,
fillColor: themeController
.currentColor.sc2,
value: language.selected ??
false, // 根据 selected 状态显示选中或未选中
onChanged: (value) async {
// 保持原有的状态更改逻辑
for (var lang
in languageController
.languageList) {
lang.selected = (lang ==
language); // 更新选中状态
}
languageController
.selectLanguage
.value = language;
await AppLanguage()
.loadLanguage(language
.language_code); // 加载语言
languageController
.updateAll(); // 更新操作
},
),
].divide(SizedBox(
width: 28.rpx)), // 为每个项添加间隔
),
);
})
.toList()
.divide(SizedBox(
height: 30.rpx,
)),
);
}),
),
// ClickableContainer(
// backgroundColor: Colors.transparent, // 容器背景色
// highlightColor: themeController
// .currentColor.sc21, // 点击时的背景色
// padding: EdgeInsetsDirectional.fromSTEB(
// 40.rpx, 0.rpx, 40.rpx, 0.rpx),
// onTap: () {},
// child: Container(),
// ),
]
.divide(SizedBox(height: 0.rpx))
.addToStart(SizedBox(height: 30.rpx))
.addToEnd(SizedBox(height: 30.rpx)),
),
),
),
),
],
),
),
),
),
),
),
),
);
}
Widget _buildDeviceCard(BuildContext context,
{required String title, required String imageUrl, required String type}) {
return CustomCard(
borderRadius: 20.rpx, // 圆角大小
onTap: () {
if (type != null) {
if (type == '1') {
Get.toNamed("/blueteethDevice");
}
}
},
colors: [themeController.currentColor.sc17], // 背景色
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,
),
),
],
),
),
);
}
}

View File

@@ -5,7 +5,6 @@ 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/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/component/tool/WebViewWidget.dart';
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
import 'package:vbvs_app/controller/device/device_type_controller.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
@@ -27,11 +26,21 @@ class _SleepReportPageState extends State<SleepReportPage> {
ThemeController themeController = Get.find();
DeviceTypeController deviceTypeController = Get.find();
// 使用 ValueNotifier 来管理加载状态
ValueNotifier<bool> isPageLoading = ValueNotifier<bool>(true);
@override
void initState() {
super.initState();
}
@override
void dispose() {
// 清理 ValueNotifier
isPageLoading.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return LayoutBuilder(
@@ -45,14 +54,12 @@ class _SleepReportPageState extends State<SleepReportPage> {
),
),
child: Scaffold(
backgroundColor: Colors.transparent, // 加上这一行
backgroundColor: Colors.transparent, // 背景透明
appBar: AppBar(
backgroundColor: themeController.currentColor.sc17,
// backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: themeController.currentColor.sc3),
titleSpacing: 0,
// leading: returnIconButtom,
title: Container(
width: double.infinity,
height: 180.rpx,
@@ -78,50 +85,35 @@ class _SleepReportPageState extends State<SleepReportPage> {
],
),
),
actions: [],
centerTitle: false,
),
body: SafeArea(
top: true,
child: InAppWebView(
key: UniqueKey(),
initialUrlRequest: URLRequest(url: WebUri(widget.sleepUri)),
child: Stack(
children: [
InAppWebView(
key: UniqueKey(),
initialUrlRequest: URLRequest(url: WebUri(widget.sleepUri)),
onLoadStart: (controller, url) {
// 页面开始加载时显示加载指示器
isPageLoading.value = true;
},
onLoadStop: (controller, url) {
// 页面加载完成后隐藏加载指示器
isPageLoading.value = false;
},
),
ValueListenableBuilder<bool>(
valueListenable: isPageLoading,
builder: (context, isLoading, child) {
return isLoading
? Center(
child: CircularProgressIndicator(), // 加载指示器
)
: SizedBox.shrink();
},
),
],
),
// child: WebViewWidget(url: "${widget.sleepUri}"),
// child: Padding(
// padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
// child: SingleChildScrollView(
// child: Column(
// mainAxisSize: MainAxisSize.max,
// children: [
// // 使用 Obx 来监听 deviceTypeList 的变化
// Obx(() {
// return Column(
// children: [
// SizedBox(height: 26.rpx), // 开始的间隔
// ...deviceTypeController.deviceTypeList.value
// .map((device) {
// return Padding(
// padding: EdgeInsets.only(
// bottom: 26.rpx), // 添加每个设备之间的间隔
// child: _buildDeviceCard(
// context,
// title: device['name'], // 这里假设 device 是一个 Map
// imageUrl: device['image'],
// type: device['type'],
// ),
// );
// }).toList(),
// SizedBox(height: 26.rpx), // 结束的间隔
// ],
// );
// }),
// ],
// ),
// ),
// ),
),
),
),
@@ -170,14 +162,8 @@ class _SleepReportPageState extends State<SleepReportPage> {
),
ClipRRect(
borderRadius: BorderRadius.circular(8.rpx),
// child: Image.asset(
// imageUrl,
// width: 212.rpx,
// height: 168.rpx,
// ),
child: Image.network(
imageUrl,
// fit: BoxFit.cover,
width: 212.rpx,
height: 168.rpx,
),

View File

@@ -11,6 +11,7 @@ import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.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/setting/language/language_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/model/api_response.dart';
@@ -27,9 +28,11 @@ class _SettingPageState extends State<SettingPage> {
UserInfoController userInfoController = Get.find();
BlueteethBindController blueteethBindController = Get.find();
ThemeController themeController = Get.find();
LanguageController languageController = Get.find();
@override
void initState() {
languageController.initLanuageList();
super.initState();
}
@@ -115,12 +118,13 @@ class _SettingPageState extends State<SettingPage> {
padding: EdgeInsetsDirectional.fromSTEB(
40.rpx, 0.rpx, 40.rpx, 0.rpx),
onTap: () {
print('点击了容器');
TopSlideNotification.show(context,
text: "待开发功能".tr);
},
child: Container(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 20.rpx, 0.rpx, 20.rpx),
0.rpx, 30.rpx, 0.rpx, 30.rpx),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
@@ -183,12 +187,14 @@ class _SettingPageState extends State<SettingPage> {
padding: EdgeInsetsDirectional.fromSTEB(
40.rpx, 0.rpx, 40.rpx, 0.rpx),
onTap: () {
print('点击了容器');
// TopSlideNotification.show(context,
// text: "待开发功能".tr);
Get.toNamed("/languageSetting");
},
child: Container(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 20.rpx, 0.rpx, 20.rpx),
0.rpx, 30.rpx, 0.rpx, 30.rpx),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
@@ -216,19 +222,24 @@ class _SettingPageState extends State<SettingPage> {
Row(
mainAxisSize: MainAxisSize.max,
children: [
Text(
'中文',
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color:
Color(0xFFD9E3EB),
fontSize: 26.rpx,
letterSpacing: 0.0,
),
),
Obx(() {
return Text(
languageController
.selectLanguage
.value!
.language_name!,
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily: 'Inter',
color:
Color(0xFFD9E3EB),
fontSize: 26.rpx,
letterSpacing: 0.0,
),
);
}),
SvgPicture.asset(
'assets/img/icon/arrow_right.svg',
width: 8.rpx,
@@ -257,7 +268,7 @@ class _SettingPageState extends State<SettingPage> {
child: Container(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
40.rpx, 20.rpx, 40.rpx, 20.rpx),
40.rpx, 30.rpx, 40.rpx, 30.rpx),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
@@ -302,12 +313,13 @@ class _SettingPageState extends State<SettingPage> {
padding: EdgeInsetsDirectional.fromSTEB(
40.rpx, 0.rpx, 40.rpx, 0.rpx),
onTap: () {
print('点击了容器');
TopSlideNotification.show(context,
text: "待开发功能".tr);
},
child: Container(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 20.rpx, 0.rpx, 20.rpx),
0.rpx, 30.rpx, 0.rpx, 30.rpx),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
@@ -352,12 +364,13 @@ class _SettingPageState extends State<SettingPage> {
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0.rpx, 0.rpx, 0.rpx),
onTap: () {
print('点击了容器');
TopSlideNotification.show(context,
text: "待开发功能".tr);
},
child: Container(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
40.rpx, 20.rpx, 40.rpx, 20.rpx),
40.rpx, 30.rpx, 40.rpx, 30.rpx),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:

View File

@@ -102,6 +102,7 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
userInfoController.model.user!.tmpHead = null;
userInfoController.model.user!.tmpNickName = null;
await userInfoController.getUserInfo();
userInfoController.updateAll();
Get.back();
}
},