From 95df2fb6ab3dd8f6a59ee511b98fd992c36b8b29 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sat, 19 Oct 2024 13:31:11 +0800 Subject: [PATCH] opt: set&get sheetHeight --- lib/pages/main/view.dart | 2 ++ lib/utils/global_data_cache.dart | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pages/main/view.dart b/lib/pages/main/view.dart index f829b0c1..6d194960 100644 --- a/lib/pages/main/view.dart +++ b/lib/pages/main/view.dart @@ -10,6 +10,7 @@ import 'package:pilipala/pages/media/index.dart'; import 'package:pilipala/pages/rank/index.dart'; import 'package:pilipala/utils/event_bus.dart'; import 'package:pilipala/utils/feed_back.dart'; +import 'package:pilipala/utils/global_data_cache.dart'; import 'package:pilipala/utils/storage.dart'; import './controller.dart'; @@ -125,6 +126,7 @@ class _MainAppState extends State with SingleTickerProviderStateMixin { double sheetHeight = MediaQuery.sizeOf(context).height - MediaQuery.of(context).padding.top - MediaQuery.sizeOf(context).width * 9 / 16; + GlobalDataCache().sheetHeight = sheetHeight; localCache.put('sheetHeight', sheetHeight); localCache.put('statusBarHeight', statusBarHeight); return PopScope( diff --git a/lib/utils/global_data_cache.dart b/lib/utils/global_data_cache.dart index 7a36f3ce..8117de81 100644 --- a/lib/utils/global_data_cache.dart +++ b/lib/utils/global_data_cache.dart @@ -106,7 +106,7 @@ class GlobalDataCache { speedsList.addAll(playSpeedSystem); userInfo = userInfoCache.get('userInfoCache'); - sheetHeight = localCache.get('sheetHeight'); + sheetHeight = localCache.get('sheetHeight', defaultValue: 0.0); historyCacheList = localCache.get('cacheList', defaultValue: []); } }