opt: login/logout

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-08 13:23:11 +08:00
parent c77ceea262
commit e06a3d8f22
17 changed files with 174 additions and 237 deletions

View File

@@ -14,7 +14,7 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
late TabController tabController;
late List tabsCtrList;
late List<Widget> tabsPageList;
RxBool userLogin = false.obs;
RxBool isLogin = false.obs;
RxString userFace = ''.obs;
dynamic userInfo;
late final StreamController<bool> searchBarStream =
@@ -32,7 +32,7 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
void onInit() {
super.onInit();
userInfo = GStorage.userInfo.get('userInfoCache');
userLogin.value = userInfo != null;
isLogin.value = userInfo != null;
userFace.value = userInfo != null ? userInfo.face : '';
hideSearchBar =
GStorage.setting.get(SettingBoxKey.hideSearchBar, defaultValue: true);
@@ -64,14 +64,6 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
} catch (_) {}
}
// 更新登录状态
Future updateLoginStatus(val) async {
userInfo = await GStorage.userInfo.get('userInfoCache');
userLogin.value = val ?? false;
if (val) return;
userFace.value = userInfo != null ? userInfo.face : '';
}
void setTabConfig() async {
defaultTabs = [...tabsConfig];
tabbarSort = GStorage.setting

View File

@@ -89,7 +89,7 @@ class _HomePageState extends State<HomePage>
searchBar,
const SizedBox(width: 4),
Obx(
() => _homeController.userLogin.value
() => _homeController.isLogin.value
? Stack(
clipBehavior: Clip.none,
alignment: Alignment.center,
@@ -134,7 +134,7 @@ class _HomePageState extends State<HomePage>
Semantics(
label: "我的",
child: Obx(
() => _homeController.userLogin.value
() => _homeController.isLogin.value
? Stack(
clipBehavior: Clip.none,
children: [