opt: pages

Closes #644

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-09 00:22:33 +08:00
parent 850e5a199e
commit 03830533eb
12 changed files with 203 additions and 348 deletions

View File

@@ -19,8 +19,7 @@ class HomeController extends GetxController
RxBool isLogin = false.obs;
RxString userFace = ''.obs;
dynamic userInfo;
late final StreamController<bool> searchBarStream =
StreamController<bool>.broadcast();
StreamController<bool>? searchBarStream;
late bool hideSearchBar;
late List defaultTabs;
late List<String> tabbarSort;
@@ -51,6 +50,9 @@ class HomeController extends GetxController
userFace.value = userInfo != null ? userInfo.face : '';
hideSearchBar =
GStorage.setting.get(SettingBoxKey.hideSearchBar, defaultValue: true);
if (hideSearchBar) {
searchBarStream = StreamController<bool>.broadcast();
}
enableSearchWord = GStorage.setting
.get(SettingBoxKey.enableSearchWord, defaultValue: true);
if (enableSearchWord) {
@@ -117,7 +119,7 @@ class HomeController extends GetxController
@override
void onClose() {
searchBarStream.close();
searchBarStream?.close();
super.onClose();
}
}

View File

@@ -155,9 +155,9 @@ class _HomePageState extends State<HomePage>
return StreamBuilder(
stream: _homeController.hideSearchBar
? _mainController.navSearchStreamDebounce
? _homeController.searchBarStream.stream
? _homeController.searchBarStream?.stream
.throttle(const Duration(milliseconds: 500))
: _homeController.searchBarStream.stream
: _homeController.searchBarStream?.stream
: null,
initialData: true,
builder: (BuildContext context, AsyncSnapshot snapshot) {