fix: 动态未读标记
This commit is contained in:
@ -40,10 +40,10 @@ class MainController extends GetxController {
|
|||||||
dynamicBadgeType.value = DynamicBadgeMode.values[setting.get(
|
dynamicBadgeType.value = DynamicBadgeMode.values[setting.get(
|
||||||
SettingBoxKey.dynamicBadgeMode,
|
SettingBoxKey.dynamicBadgeMode,
|
||||||
defaultValue: DynamicBadgeMode.number.code)];
|
defaultValue: DynamicBadgeMode.number.code)];
|
||||||
|
setNavBarConfig();
|
||||||
if (dynamicBadgeType.value != DynamicBadgeMode.hidden) {
|
if (dynamicBadgeType.value != DynamicBadgeMode.hidden) {
|
||||||
getUnreadDynamic();
|
getUnreadDynamic();
|
||||||
}
|
}
|
||||||
setNavBarConfig();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onBackPressed(BuildContext context) {
|
void onBackPressed(BuildContext context) {
|
||||||
|
|||||||
@ -138,14 +138,14 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
|||||||
duration: const Duration(milliseconds: 500),
|
duration: const Duration(milliseconds: 500),
|
||||||
offset: Offset(0, snapshot.data ? 0 : 1),
|
offset: Offset(0, snapshot.data ? 0 : 1),
|
||||||
child: GlobalData().enableMYBar
|
child: GlobalData().enableMYBar
|
||||||
? NavigationBar(
|
? Obx(
|
||||||
onDestinationSelected: (value) => setIndex(value),
|
() => NavigationBar(
|
||||||
selectedIndex: _mainController.selectedIndex,
|
onDestinationSelected: (value) => setIndex(value),
|
||||||
destinations: <Widget>[
|
selectedIndex: _mainController.selectedIndex,
|
||||||
..._mainController.navigationBars.map((e) {
|
destinations: <Widget>[
|
||||||
return NavigationDestination(
|
..._mainController.navigationBars.map((e) {
|
||||||
icon: Obx(
|
return NavigationDestination(
|
||||||
() => Badge(
|
icon: Badge(
|
||||||
label: _mainController
|
label: _mainController
|
||||||
.dynamicBadgeType.value ==
|
.dynamicBadgeType.value ==
|
||||||
DynamicBadgeMode.number
|
DynamicBadgeMode.number
|
||||||
@ -159,25 +159,25 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
|||||||
e['count'] > 0,
|
e['count'] > 0,
|
||||||
child: e['icon'],
|
child: e['icon'],
|
||||||
),
|
),
|
||||||
),
|
selectedIcon: e['selectIcon'],
|
||||||
selectedIcon: e['selectIcon'],
|
label: e['label'],
|
||||||
label: e['label'],
|
);
|
||||||
);
|
}).toList(),
|
||||||
}).toList(),
|
],
|
||||||
],
|
),
|
||||||
)
|
)
|
||||||
: BottomNavigationBar(
|
: Obx(
|
||||||
currentIndex: _mainController.selectedIndex,
|
() => BottomNavigationBar(
|
||||||
type: BottomNavigationBarType.fixed,
|
currentIndex: _mainController.selectedIndex,
|
||||||
onTap: (value) => setIndex(value),
|
type: BottomNavigationBarType.fixed,
|
||||||
iconSize: 16,
|
onTap: (value) => setIndex(value),
|
||||||
selectedFontSize: 12,
|
iconSize: 16,
|
||||||
unselectedFontSize: 12,
|
selectedFontSize: 12,
|
||||||
items: [
|
unselectedFontSize: 12,
|
||||||
..._mainController.navigationBars.map((e) {
|
items: [
|
||||||
return BottomNavigationBarItem(
|
..._mainController.navigationBars.map((e) {
|
||||||
icon: Obx(
|
return BottomNavigationBarItem(
|
||||||
() => Badge(
|
icon: Badge(
|
||||||
label: _mainController
|
label: _mainController
|
||||||
.dynamicBadgeType.value ==
|
.dynamicBadgeType.value ==
|
||||||
DynamicBadgeMode.number
|
DynamicBadgeMode.number
|
||||||
@ -191,12 +191,12 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
|||||||
e['count'] > 0,
|
e['count'] > 0,
|
||||||
child: e['icon'],
|
child: e['icon'],
|
||||||
),
|
),
|
||||||
),
|
activeIcon: e['selectIcon'],
|
||||||
activeIcon: e['selectIcon'],
|
label: e['label'],
|
||||||
label: e['label'],
|
);
|
||||||
);
|
}).toList(),
|
||||||
}).toList(),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user