reorganize tab bar menus; readerview button visibility via setting;

This commit is contained in:
Fabian Freund
2025-11-05 07:57:52 +01:00
parent 55305c3dd1
commit 2bfb3fdf87
10 changed files with 418 additions and 306 deletions
@@ -71,6 +71,7 @@ class GeneralSettings with FastEquatable {
final TabBarSwipeAction tabBarSwipeAction;
final Duration historyAutoCleanInterval;
final bool tabViewBottomSheet;
final bool tabBarReaderView;
GeneralSettings({
required this.themeMode,
@@ -88,6 +89,7 @@ class GeneralSettings with FastEquatable {
required this.tabBarSwipeAction,
required this.historyAutoCleanInterval,
required this.tabViewBottomSheet,
required this.tabBarReaderView,
});
GeneralSettings.withDefaults({
@@ -106,6 +108,7 @@ class GeneralSettings with FastEquatable {
TabBarSwipeAction? tabBarSwipeAction,
Duration? historyAutoCleanInterval,
bool? tabViewBottomSheet,
bool? tabBarReaderView,
}) : themeMode = themeMode ?? ThemeMode.dark,
enableReadability = enableReadability ?? true,
enforceReadability = enforceReadability ?? false,
@@ -122,7 +125,8 @@ class GeneralSettings with FastEquatable {
tabBarSwipeAction ?? TabBarSwipeAction.switchLastOpened,
historyAutoCleanInterval =
historyAutoCleanInterval ?? const Duration(days: 90),
tabViewBottomSheet = tabViewBottomSheet ?? false;
tabViewBottomSheet = tabViewBottomSheet ?? false,
tabBarReaderView = tabBarReaderView ?? false;
factory GeneralSettings.fromJson(Map<String, dynamic> json) =>
_$GeneralSettingsFromJson(json);
@@ -146,5 +150,6 @@ class GeneralSettings with FastEquatable {
tabBarSwipeAction,
historyAutoCleanInterval,
tabViewBottomSheet,
tabBarReaderView,
];
}
@@ -43,6 +43,8 @@ abstract class _$GeneralSettingsCWProxy {
GeneralSettings tabViewBottomSheet(bool tabViewBottomSheet);
GeneralSettings tabBarReaderView(bool tabBarReaderView);
/// Creates a new instance with the provided field values.
/// Passing `null` to a nullable field nullifies it, while `null` for a non-nullable field is ignored. To update a single field use `GeneralSettings(...).copyWith.fieldName(value)`.
///
@@ -66,6 +68,7 @@ abstract class _$GeneralSettingsCWProxy {
TabBarSwipeAction tabBarSwipeAction,
Duration historyAutoCleanInterval,
bool tabViewBottomSheet,
bool tabBarReaderView,
});
}
@@ -138,6 +141,10 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
GeneralSettings tabViewBottomSheet(bool tabViewBottomSheet) =>
call(tabViewBottomSheet: tabViewBottomSheet);
@override
GeneralSettings tabBarReaderView(bool tabBarReaderView) =>
call(tabBarReaderView: tabBarReaderView);
@override
/// Creates a new instance with the provided field values.
/// Passing `null` to a nullable field nullifies it, while `null` for a non-nullable field is ignored. To update a single field use `GeneralSettings(...).copyWith.fieldName(value)`.
@@ -162,6 +169,7 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
Object? tabBarSwipeAction = const $CopyWithPlaceholder(),
Object? historyAutoCleanInterval = const $CopyWithPlaceholder(),
Object? tabViewBottomSheet = const $CopyWithPlaceholder(),
Object? tabBarReaderView = const $CopyWithPlaceholder(),
}) {
return GeneralSettings(
themeMode: themeMode == const $CopyWithPlaceholder() || themeMode == null
@@ -250,6 +258,12 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
? _value.tabViewBottomSheet
// ignore: cast_nullable_to_non_nullable
: tabViewBottomSheet as bool,
tabBarReaderView:
tabBarReaderView == const $CopyWithPlaceholder() ||
tabBarReaderView == null
? _value.tabBarReaderView
// ignore: cast_nullable_to_non_nullable
: tabBarReaderView as bool,
);
}
}
@@ -303,6 +317,7 @@ GeneralSettings _$GeneralSettingsFromJson(Map<String, dynamic> json) =>
microseconds: (json['historyAutoCleanInterval'] as num).toInt(),
),
tabViewBottomSheet: json['tabViewBottomSheet'] as bool?,
tabBarReaderView: json['tabBarReaderView'] as bool?,
);
Map<String, dynamic> _$GeneralSettingsToJson(
@@ -330,6 +345,7 @@ Map<String, dynamic> _$GeneralSettingsToJson(
'tabBarSwipeAction': _$TabBarSwipeActionEnumMap[instance.tabBarSwipeAction]!,
'historyAutoCleanInterval': instance.historyAutoCleanInterval.inMicroseconds,
'tabViewBottomSheet': instance.tabViewBottomSheet,
'tabBarReaderView': instance.tabBarReaderView,
};
const _$ThemeModeEnumMap = {