2026.3.13 修改通知
parent
f4f2b3c566
commit
18ec2a746b
|
|
@ -14,6 +14,8 @@ import 'package:qhd_prevention/pages/notif/notif_detail_page.dart';
|
||||||
import 'package:qhd_prevention/tools/tools.dart';
|
import 'package:qhd_prevention/tools/tools.dart';
|
||||||
import '../../http/ApiService.dart';
|
import '../../http/ApiService.dart';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class NotifPage extends StatefulWidget {
|
class NotifPage extends StatefulWidget {
|
||||||
const NotifPage({Key? key}) : super(key: key);
|
const NotifPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
|
@ -69,7 +71,7 @@ class NotifPageState extends RouteAwareState<NotifPage>
|
||||||
void _initializeTabControllers() {
|
void _initializeTabControllers() {
|
||||||
final visibleTabsCount =
|
final visibleTabsCount =
|
||||||
(_showPlatformAnnouncement ? 1 : 0) +
|
(_showPlatformAnnouncement ? 1 : 0) +
|
||||||
(_showEnterpriseAnnouncement ? 1 : 0);
|
(_showEnterpriseAnnouncement ? 1 : 0);
|
||||||
|
|
||||||
_tabController = TabController(length: visibleTabsCount, vsync: this);
|
_tabController = TabController(length: visibleTabsCount, vsync: this);
|
||||||
_tabController.addListener(() {
|
_tabController.addListener(() {
|
||||||
|
|
@ -98,9 +100,9 @@ class NotifPageState extends RouteAwareState<NotifPage>
|
||||||
void _updateNotifVisibility() {
|
void _updateNotifVisibility() {
|
||||||
final routeService = RouteService();
|
final routeService = RouteService();
|
||||||
final notifRoutes =
|
final notifRoutes =
|
||||||
routeService.mainTabs.isNotEmpty
|
routeService.mainTabs.isNotEmpty
|
||||||
? routeService.getRoutesForTab(routeService.mainTabs[2])
|
? routeService.getRoutesForTab(routeService.mainTabs[2])
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
bool newPlatformAnnouncement = false;
|
bool newPlatformAnnouncement = false;
|
||||||
bool newEnterpriseAnnouncement = false;
|
bool newEnterpriseAnnouncement = false;
|
||||||
|
|
@ -110,10 +112,10 @@ class NotifPageState extends RouteAwareState<NotifPage>
|
||||||
final routeTitle = route.title;
|
final routeTitle = route.title;
|
||||||
|
|
||||||
switch (routeTitle) {
|
switch (routeTitle) {
|
||||||
case '公告':
|
case '公告通知':
|
||||||
newPlatformAnnouncement = route.hasMenu;
|
newPlatformAnnouncement = route.hasMenu;
|
||||||
break;
|
break;
|
||||||
case '通知':
|
case '平台提醒':
|
||||||
newEnterpriseAnnouncement = route.hasMenu;
|
newEnterpriseAnnouncement = route.hasMenu;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -240,16 +242,16 @@ class NotifPageState extends RouteAwareState<NotifPage>
|
||||||
// 构建可见的Tab列表
|
// 构建可见的Tab列表
|
||||||
final List<Widget> visibleTabs = [];
|
final List<Widget> visibleTabs = [];
|
||||||
if (_showPlatformAnnouncement) {
|
if (_showPlatformAnnouncement) {
|
||||||
visibleTabs.add(const Tab(text: '公告'));
|
visibleTabs.add(const Tab(text: '公告通知'));
|
||||||
}
|
}
|
||||||
if (_showEnterpriseAnnouncement) {
|
if (_showEnterpriseAnnouncement) {
|
||||||
visibleTabs.add(const Tab(text: '通知'));
|
visibleTabs.add(const Tab(text: '平台提醒'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果没有可见的Tab,显示空页面
|
// 如果没有可见的Tab,显示空页面
|
||||||
if (visibleTabs.isEmpty) {
|
if (visibleTabs.isEmpty) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: MyAppbar(title: '通知', isBack: false),
|
appBar: MyAppbar(title: '通知公告', isBack: false),
|
||||||
body: Center(
|
body: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'暂无通知权限',
|
'暂无通知权限',
|
||||||
|
|
@ -260,7 +262,7 @@ class NotifPageState extends RouteAwareState<NotifPage>
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: MyAppbar(title: '通知', isBack: false),
|
appBar: MyAppbar(title: '通知公告', isBack: false),
|
||||||
body: GestureDetector(
|
body: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
|
|
@ -281,7 +283,7 @@ class NotifPageState extends RouteAwareState<NotifPage>
|
||||||
width: 4.0,
|
width: 4.0,
|
||||||
color: const Color(0xFF1C61FF),
|
color: const Color(0xFF1C61FF),
|
||||||
),
|
),
|
||||||
insets: EdgeInsets.symmetric(horizontal: 35.0),
|
insets: EdgeInsets.symmetric(horizontal: 6.0),
|
||||||
),
|
),
|
||||||
labelColor: const Color(0xFF1C61FF),
|
labelColor: const Color(0xFF1C61FF),
|
||||||
unselectedLabelColor: Colors.grey,
|
unselectedLabelColor: Colors.grey,
|
||||||
|
|
@ -420,13 +422,13 @@ class NotifPageState extends RouteAwareState<NotifPage>
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder:
|
builder:
|
||||||
(context) => NotifDetailPage(
|
(context) => NotifDetailPage(
|
||||||
item,
|
item,
|
||||||
_selectedTab,
|
_selectedTab,
|
||||||
onClose: (result) {
|
onClose: (result) {
|
||||||
print('详情页面已关闭,返回结果: $result');
|
print('详情页面已关闭,返回结果: $result');
|
||||||
reRefreshData();
|
reRefreshData();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue