更新绑定消息跳转
This commit is contained in:
@@ -546,5 +546,6 @@
|
||||
"选择主题": "Select Theme",
|
||||
"有一条新的设备分享消息": "You have a new device sharing message",
|
||||
"去查看": "View now",
|
||||
"设备已被用户解绑,将取消当前分享!": "The device has been unbound by the user, and the current sharing will be cancelled."
|
||||
"设备已被用户解绑,将取消当前分享!": "The device has been unbound by the user, and the current sharing will be cancelled.",
|
||||
"消息列表": "message list"
|
||||
}
|
||||
@@ -549,5 +549,6 @@
|
||||
"浅色": "浅色",
|
||||
"有一条新的设备分享消息": "有一条新的设备分享消息",
|
||||
"去查看": "去查看",
|
||||
"设备已被用户解绑,将取消当前分享!": "设备已被用户解绑,将取消当前分享!"
|
||||
"设备已被用户解绑,将取消当前分享!": "设备已被用户解绑,将取消当前分享!",
|
||||
"消息列表": "消息列表"
|
||||
}
|
||||
@@ -543,5 +543,6 @@
|
||||
"浅色": "淺色",
|
||||
"有一条新的设备分享消息": "有一條新的設備分享消息",
|
||||
"去查看": "去查看",
|
||||
"设备已被用户解绑,将取消当前分享!": "設備已被用戶解綁,將取消當前分享!"
|
||||
"设备已被用户解绑,将取消当前分享!": "設備已被用戶解綁,將取消當前分享!",
|
||||
"消息列表": "消息列表"
|
||||
}
|
||||
@@ -16,6 +16,8 @@ class CustomCard extends StatefulWidget {
|
||||
final bool enableGradient; // 是否启用渐变
|
||||
final GradientDirection gradientDirection; // 渐变方向
|
||||
final EdgeInsetsGeometry? margin; // 外部间距
|
||||
final bool enableBorder; // 是否显示边框
|
||||
final Color borderColor; // 边框颜色
|
||||
|
||||
const CustomCard({
|
||||
Key? key,
|
||||
@@ -27,6 +29,8 @@ class CustomCard extends StatefulWidget {
|
||||
this.enableGradient = true,
|
||||
this.gradientDirection = GradientDirection.horizontal,
|
||||
this.margin,
|
||||
this.enableBorder = false,
|
||||
this.borderColor = Colors.transparent,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@@ -97,6 +101,9 @@ class _CustomCardState extends State<CustomCard>
|
||||
)
|
||||
: null,
|
||||
borderRadius: BorderRadius.circular(widget.borderRadius),
|
||||
border: widget.enableBorder
|
||||
? Border.all(color: widget.borderColor)
|
||||
: null,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(0.rpx, 0.rpx, 0.rpx, 0.rpx),
|
||||
|
||||
@@ -191,8 +191,8 @@ Future<void> initWX() async {
|
||||
// appId: "wx929c548fea6af9c7", //眠花糖
|
||||
doOnAndroid: true,
|
||||
doOnIOS: true,
|
||||
universalLink: "https://app.he-info.com/theh/",
|
||||
// universalLink: "https://zhmht.swes.com.cn/app/",
|
||||
// universalLink: "https://app.he-info.com/theh/",
|
||||
universalLink: "https://zhmht.swes.com.cn/app/",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -375,8 +375,12 @@ Future<void> startMessagePolling(int ent_type) async {
|
||||
textColor: themeController.currentColor.sc3);
|
||||
|
||||
if (result == 'confirm') {
|
||||
// messageController.model.type = 2;
|
||||
// Get.toNamed('/messagePage');
|
||||
messageController.model.type = 2;
|
||||
Get.toNamed('/messagePage');
|
||||
Get.toNamed(
|
||||
'/messagePageReturn',
|
||||
);
|
||||
}
|
||||
} else {
|
||||
dialogTitle = '设备解绑提醒'.tr;
|
||||
@@ -496,7 +500,7 @@ Future<void> startMessagePolling(int ent_type) async {
|
||||
}
|
||||
} else {
|
||||
if (Get.isRegistered<MessageController>()) {
|
||||
Get.find<MessageController>().getMessageStatus();
|
||||
await Get.find<MessageController>().getMessageStatus();
|
||||
if (messageController.model.system_message_read == 1) {
|
||||
await messageController.getMessageList(
|
||||
key: "app_system", page: 1, limit: 100, append: false);
|
||||
@@ -521,7 +525,7 @@ Future<void> startMessagePolling(int ent_type) async {
|
||||
// 新增:如果当前页面是消息页,则跳过弹窗
|
||||
if (Get.currentRoute == '/messagePage') {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
final data = message['data'] as Map<String, dynamic>;
|
||||
final valList = data['val'] as List<dynamic>;
|
||||
@@ -557,8 +561,9 @@ Future<void> startMessagePolling(int ent_type) async {
|
||||
textColor: themeController.currentColor.sc3);
|
||||
|
||||
if (result == 'confirm') {
|
||||
messageController.model.type = 2;
|
||||
Get.toNamed(
|
||||
'/messagePage',
|
||||
'/messagePageReturn',
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:loading_indicator/loading_indicator.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/component/tool/FrostedDialog.dart';
|
||||
@@ -1506,8 +1507,7 @@ Future<String?> showMessageConfirmDialog({
|
||||
children: [
|
||||
TextSpan(
|
||||
text: '有一条新的设备分享消息'.tr,
|
||||
style:
|
||||
TextStyle(color: textColor, fontSize: 26.rpx)),
|
||||
style: TextStyle(color: textColor, fontSize: 26.rpx)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -1516,12 +1516,14 @@ Future<String?> showMessageConfirmDialog({
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
CustomCard(
|
||||
enableBorder: true,
|
||||
borderColor: themeController.currentColor.sc4,
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
borderRadius: 16.rpx,
|
||||
onTap: () {
|
||||
Get.back(result: 'cancel');
|
||||
},
|
||||
colors: colorsList,
|
||||
colors: [Colors.transparent],
|
||||
child: Container(
|
||||
width: 200.rpx,
|
||||
height: 90.rpx,
|
||||
|
||||
@@ -89,7 +89,8 @@ class _MessagePageState extends State<MessagePage> {
|
||||
),
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: themeController.currentColor.sc17,
|
||||
// backgroundColor: themeController.currentColor.sc17,
|
||||
backgroundColor: Colors.transparent,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme: IconThemeData(color: themeController.currentColor.sc3),
|
||||
// toolbarHeight: 140.rpx,
|
||||
|
||||
363
lib/pages/main_bottom/message_page_return.dart
Normal file
363
lib/pages/main_bottom/message_page_return.dart
Normal file
@@ -0,0 +1,363 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.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/common/util/MyUtils.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';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/pages/main_bottom/component/MessageWidgetWidget.dart';
|
||||
|
||||
class MessageReturnPage extends StatefulWidget {
|
||||
const MessageReturnPage({super.key});
|
||||
|
||||
@override
|
||||
State<MessageReturnPage> createState() => _MessageReturnPageState();
|
||||
}
|
||||
|
||||
class _MessageReturnPageState extends State<MessageReturnPage> {
|
||||
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(
|
||||
Get.context!,
|
||||
text: response.msg ?? "失败".tr,
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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(const SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent,
|
||||
statusBarIconBrightness: Brightness.light,
|
||||
));
|
||||
|
||||
return LayoutBuilder(
|
||||
builder: (context, boxConstraints) => GestureDetector(
|
||||
// onTap: () => FocusScope.of(context).unfocus(),,
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
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,
|
||||
),
|
||||
titleSpacing: 0,
|
||||
// leading: returnIconButtom,
|
||||
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: returnIconButtomNew(),
|
||||
),
|
||||
// Positioned(
|
||||
// left: 40.rpx,
|
||||
// child: ClickableContainer(
|
||||
// onTap: () {
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// backgroundColor: Colors.transparent,
|
||||
// highlightColor: Colors.grey,
|
||||
// borderRadius: 8.rpx,
|
||||
// padding: EdgeInsets.all(8.rpx),
|
||||
// child: Icon(
|
||||
// Icons.close,
|
||||
// size: 25.rpx,
|
||||
// color: themeController.currentColor.sc3,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [],
|
||||
centerTitle: false,
|
||||
),
|
||||
backgroundColor: Colors.transparent,
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Column(
|
||||
children: [
|
||||
// 将原来的AppBar内容放在这里
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 140.rpx,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0.rpx, 0, 0.rpx, 0),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 40.rpx),
|
||||
Expanded(
|
||||
child: Stack(
|
||||
alignment: Alignment.bottomLeft,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
// 第一个容器,宽度占屏幕一半
|
||||
Obx(() {
|
||||
return Expanded(
|
||||
child: ClickableContainer(
|
||||
padding: EdgeInsets.all(0),
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor:
|
||||
themeController.currentColor.sc21,
|
||||
borderRadius: 8.rpx,
|
||||
onTap: () => _onTabChanged(0),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Text(
|
||||
'体征消息'.tr,
|
||||
style: TextStyle(
|
||||
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();
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
SizedBox(width: 10.rpx),
|
||||
// 第二个容器,宽度占屏幕一半
|
||||
Obx(() {
|
||||
return Expanded(
|
||||
child: ClickableContainer(
|
||||
padding: EdgeInsets.all(0),
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor:
|
||||
themeController.currentColor.sc21,
|
||||
borderRadius: 8.rpx,
|
||||
onTap: () => _onTabChanged(1),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Text(
|
||||
'系统消息'.tr,
|
||||
style: TextStyle(
|
||||
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();
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
// 动画线
|
||||
Obx(() {
|
||||
double lineWidth =
|
||||
MediaQuery.sizeOf(context).width * 0.5 -
|
||||
20.rpx; // 每个容器占宽度的一半
|
||||
return AnimatedPositioned(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
bottom: 0,
|
||||
left: messageController.model.type == 1
|
||||
? 0
|
||||
: MediaQuery.sizeOf(context).width * 0.5 +
|
||||
10.rpx, // 动态设置左侧位置
|
||||
child: Container(
|
||||
width: lineWidth,
|
||||
height: 4.rpx,
|
||||
decoration: BoxDecoration(
|
||||
color: themeController.currentColor.sc2,
|
||||
borderRadius: BorderRadius.circular(2.rpx),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 17.rpx),
|
||||
],
|
||||
),
|
||||
),
|
||||
// 页面内容
|
||||
Expanded(
|
||||
child: PageView(
|
||||
controller: _pageController,
|
||||
onPageChanged: _onPageChanged,
|
||||
children: [
|
||||
Obx(() {
|
||||
final list = messageController.messageList.value;
|
||||
return list.isEmpty
|
||||
? const NullDataWidget()
|
||||
: _buildMessageListView(list, "app_vsm");
|
||||
}),
|
||||
Obx(() {
|
||||
final list = messageController.messageList.value;
|
||||
return list.isEmpty
|
||||
? const NullDataWidget()
|
||||
: _buildMessageListView(list, "app_system");
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMessageListView(List dataList, String type) {
|
||||
return NotificationListener<ScrollNotification>(
|
||||
onNotification: (scrollInfo) {
|
||||
if (scrollInfo.metrics.pixels == scrollInfo.metrics.maxScrollExtent) {
|
||||
// 滑到底部,加载下一页
|
||||
messageController.loadMore(type);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.symmetric(horizontal: 30.rpx, vertical: 30.rpx),
|
||||
itemCount: dataList.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: 30.rpx),
|
||||
child: MessageWidgetWidget(data: dataList[index]),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import 'package:vbvs_app/pages/main_bottom/help_page.dart';
|
||||
import 'package:vbvs_app/pages/main_bottom/home_page.dart';
|
||||
import 'package:vbvs_app/pages/main_bottom/main_page_bottom_change.dart';
|
||||
import 'package:vbvs_app/pages/main_bottom/message_page.dart';
|
||||
import 'package:vbvs_app/pages/main_bottom/message_page_return.dart';
|
||||
import 'package:vbvs_app/pages/main_bottom/mine_page.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/user/page/bind_tel_page.dart';
|
||||
import 'package:vbvs_app/pages/person/person_page.dart';
|
||||
@@ -59,6 +60,7 @@ var routes = {
|
||||
// "/ePage": (contxt) => EPage(),
|
||||
"/ePage": (contxt, {arguments}) => EPage(sleepUri: arguments),
|
||||
"/messagePage": (contxt) => MessagePage(),
|
||||
"/messagePageReturn": (contxt) => MessageReturnPage(),
|
||||
"/minePage": (contxt) => MinePage(),
|
||||
"/mianPageBottomChange": (contxt) => MainPageBottomChange(),
|
||||
// "/loginPage": (contxt) => LoginPage(),
|
||||
|
||||
Reference in New Issue
Block a user