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

@@ -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("睡眠报告"),
),
),
),
);
}
}