Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
orzogc committed Dec 23, 2022
1 parent 32fdaba commit 0c2311b
Show file tree
Hide file tree
Showing 12 changed files with 170 additions and 77 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 更新记录
## v0.2.1(未发布)
- 默认开启底边栏以取代侧边栏,如要恢复侧边栏可在界面设置->界面基本设置里取消显示侧边栏
- 可以设置向下滑动时是否自动隐藏标题栏(界面基本设置)
- 可以设置缓存图片数量(高级设置)
- 历史记录添加搜索功能,在历史记录页面点击右上角菜单里的搜索可以搜索串内容
Expand Down
7 changes: 7 additions & 0 deletions lib/app/data/models/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ abstract class Settings {

static const String showBackdropGuide = 'showBackdropGuide';

static const String showGuideWithoutBottomBar = 'showGuideWithoutBottomBar';

static const String showBackdropGuideWithoutBottomBar =
'showBackdropGuideWithoutBottomBar';

static const String showBottomBarGuide = 'showBottomBarGuide';

static const String showBottomBar = 'showBottomBar';

static const String autoHideBottomBar = 'autoHideBottomBar';
Expand Down
7 changes: 7 additions & 0 deletions lib/app/data/services/persistent.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class PersistentDataService extends GetxService {

static late final bool clearImageCache;

static bool isNavigatorReady = false;

late final Box _dataBox;

final RxBool _isKeyboardVisible = false.obs;
Expand Down Expand Up @@ -137,6 +139,11 @@ class PersistentDataService extends GetxService {
}

if (notice?.isNotEmpty ?? false) {
// 需要Navigator显示公告
while (!isNavigatorReady) {
debugPrint('正在等待Navigator');
await Future.delayed(const Duration(milliseconds: 500));
}
await showNoticeDialog(showCheckbox: true);
}
}
Expand Down
48 changes: 39 additions & 9 deletions lib/app/data/services/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class SettingsService extends GetxService {

static late final bool isFixMissingFont;

static bool shouldShowGuide = false;

static late final bool isShowGuide;

late final Box _settingsBox;
Expand Down Expand Up @@ -191,29 +193,56 @@ class SettingsService extends GetxService {
set fixMissingFont(bool fixMissingFont) =>
_settingsBox.put(Settings.fixMissingFont, fixMissingFont);

bool get showGuide =>
!isBackdropUI && _settingsBox.get(Settings.showGuide, defaultValue: true);

bool get rawShowGuide =>
_settingsBox.get(Settings.showGuide, defaultValue: true);

bool get showGuide =>
!backdropUI &&
(rawShowGuide || showBottomBarGuide || showGuideWithoutBottomBar);

bool get showGuideWithoutBottomBar =>
!backdropUI &&
!showBottomBar &&
_settingsBox.get(Settings.showGuideWithoutBottomBar, defaultValue: true);

set showGuideWithoutBottomBar(bool showGuideWithoutBottomBar) => _settingsBox
.put(Settings.showGuideWithoutBottomBar, showGuideWithoutBottomBar);

set showGuide(bool showGuide) =>
_settingsBox.put(Settings.showGuide, showGuide);

bool get showBackdropGuide =>
isBackdropUI &&
_settingsBox.get(Settings.showBackdropGuide, defaultValue: true);

bool get rawShowBackdropGuide =>
_settingsBox.get(Settings.showBackdropGuide, defaultValue: true);

bool get showBackdropGuide =>
backdropUI &&
(rawShowBackdropGuide ||
showBottomBarGuide ||
showBackdropGuideWithoutBottomBar);

bool get showBackdropGuideWithoutBottomBar =>
backdropUI &&
!showBottomBar &&
_settingsBox.get(Settings.showBackdropGuideWithoutBottomBar,
defaultValue: true);

set showBackdropGuideWithoutBottomBar(
bool showBackdropGuideWithoutBottomBar) =>
_settingsBox.put(Settings.showBackdropGuideWithoutBottomBar,
showBackdropGuideWithoutBottomBar);

set showBackdropGuide(bool showBackdropGuide) =>
_settingsBox.put(Settings.showBackdropGuide, showBackdropGuide);

bool get shouldShowGuide => showBackdropGuide || showGuide;
bool get showBottomBarGuide =>
showBottomBar &&
_settingsBox.get(Settings.showBottomBarGuide, defaultValue: true);

set showBottomBarGuide(bool showBottomBarGuide) =>
_settingsBox.put(Settings.showBottomBarGuide, showBottomBarGuide);

bool get showBottomBar =>
_settingsBox.get(Settings.showBottomBar, defaultValue: GetPlatform.isIOS);
_settingsBox.get(Settings.showBottomBar, defaultValue: true);

set showBottomBar(bool showBottomBar) {
_settingsBox.put(Settings.showBottomBar, showBottomBar);
Expand Down Expand Up @@ -581,6 +610,7 @@ class SettingsService extends GetxService {
_isAutoHideAppBar = autoHideAppBar.obs;
_drawerDragRatio = drawerEdgeDragWidthRatio.obs;
_isCompactTabAndForumList = compactTabAndForumList.obs;
shouldShowGuide = showGuide || showBackdropGuide;
isShowGuide = shouldShowGuide;

await PersistentDataService.clearCacheImage();
Expand Down
8 changes: 8 additions & 0 deletions lib/app/data/services/stack.dart
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ class ControllerStacksService extends GetxService {
return list;
}

void resetAppBarHeight() {
for (final stack in _stacks) {
for (final controller in stack.controllers) {
controller.controller.appBarHeight = PostListAppBar.height;
}
}
}

Future<void> _buildStacks() async {
final settings = SettingsService.to;

Expand Down
Loading

0 comments on commit 0c2311b

Please sign in to comment.