Merge remote-tracking branch 'origin/master'

master
hs 2026-03-13 15:19:13 +08:00
commit 6fa38a51be
1 changed files with 20 additions and 18 deletions

View File

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