mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: pages
Closes #644 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -18,8 +18,7 @@ class MainController extends GetxController {
|
||||
List<Widget> pages = <Widget>[];
|
||||
RxList navigationBars = [].obs;
|
||||
|
||||
final StreamController<bool> bottomBarStream =
|
||||
StreamController<bool>.broadcast();
|
||||
StreamController<bool>? bottomBarStream;
|
||||
late bool hideTabBar;
|
||||
late dynamic controller;
|
||||
RxInt selectedIndex = 0.obs;
|
||||
@@ -48,6 +47,9 @@ class MainController extends GetxController {
|
||||
}
|
||||
hideTabBar =
|
||||
GStorage.setting.get(SettingBoxKey.hideTabBar, defaultValue: true);
|
||||
if (hideTabBar) {
|
||||
bottomBarStream = StreamController<bool>.broadcast();
|
||||
}
|
||||
isLogin.value = Accounts.main.isLogin;
|
||||
dynamicBadgeMode = DynamicBadgeMode.values[GStorage.setting.get(
|
||||
SettingBoxKey.dynamicBadgeMode,
|
||||
@@ -217,7 +219,7 @@ class MainController extends GetxController {
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
bottomBarStream.close();
|
||||
bottomBarStream?.close();
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +178,8 @@ class _MainAppState extends State<MainApp>
|
||||
onPopInvokedWithResult: (bool didPop, Object? result) async {
|
||||
if (_mainController.selectedIndex.value != 0) {
|
||||
setIndex(0);
|
||||
_mainController.bottomBarStream.add(true);
|
||||
_mainController.bottomBarStream?.add(true);
|
||||
_homeController.searchBarStream?.add(true);
|
||||
} else {
|
||||
if (Platform.isAndroid) {
|
||||
Utils.channel.invokeMethod('back');
|
||||
@@ -265,9 +266,9 @@ class _MainAppState extends State<MainApp>
|
||||
: StreamBuilder(
|
||||
stream: _mainController.hideTabBar
|
||||
? _mainController.navSearchStreamDebounce
|
||||
? _mainController.bottomBarStream.stream
|
||||
? _mainController.bottomBarStream?.stream
|
||||
.throttle(const Duration(milliseconds: 500))
|
||||
: _mainController.bottomBarStream.stream
|
||||
: _mainController.bottomBarStream?.stream
|
||||
: null,
|
||||
initialData: true,
|
||||
builder: (context, AsyncSnapshot snapshot) {
|
||||
|
||||
Reference in New Issue
Block a user