app bar positioning

This commit is contained in:
Fabian Freund
2025-12-22 21:00:02 +01:00
parent a90f18d9c8
commit 5a46751834
11 changed files with 540 additions and 290 deletions
@@ -38,6 +38,8 @@ enum TabBarSwipeAction { switchLastOpened, navigateOrderedTabs }
enum TabIntentOpenSetting { regular, private, ask }
enum TabBarPosition { top, bottom }
enum DeleteBrowsingDataType {
tabs('Open tabs'),
history('Browsing history'),
@@ -74,6 +76,7 @@ class GeneralSettings with FastEquatable {
final bool tabBarReaderView;
final bool tabBarShowContextualBar;
final bool tabBarShowQuickTabSwitcherBar;
final TabBarPosition tabBarPosition;
GeneralSettings({
required this.themeMode,
@@ -94,6 +97,7 @@ class GeneralSettings with FastEquatable {
required this.tabBarReaderView,
required this.tabBarShowContextualBar,
required this.tabBarShowQuickTabSwitcherBar,
required this.tabBarPosition,
});
GeneralSettings.withDefaults({
@@ -115,6 +119,7 @@ class GeneralSettings with FastEquatable {
bool? tabBarReaderView,
bool? tabBarShowContextualBar,
bool? tabBarShowQuickTabSwitcherBar,
TabBarPosition? tabBarPosition,
}) : themeMode = themeMode ?? ThemeMode.dark,
enableReadability = enableReadability ?? true,
enforceReadability = enforceReadability ?? false,
@@ -134,7 +139,8 @@ class GeneralSettings with FastEquatable {
tabViewBottomSheet = tabViewBottomSheet ?? false,
tabBarReaderView = tabBarReaderView ?? false,
tabBarShowContextualBar = tabBarShowContextualBar ?? true,
tabBarShowQuickTabSwitcherBar = tabBarShowQuickTabSwitcherBar ?? true;
tabBarShowQuickTabSwitcherBar = tabBarShowQuickTabSwitcherBar ?? true,
tabBarPosition = tabBarPosition ?? TabBarPosition.bottom;
factory GeneralSettings.fromJson(Map<String, dynamic> json) =>
_$GeneralSettingsFromJson(json);
@@ -161,5 +167,6 @@ class GeneralSettings with FastEquatable {
tabBarReaderView,
tabBarShowContextualBar,
tabBarShowQuickTabSwitcherBar,
tabBarPosition,
];
}
@@ -51,6 +51,8 @@ abstract class _$GeneralSettingsCWProxy {
bool tabBarShowQuickTabSwitcherBar,
);
GeneralSettings tabBarPosition(TabBarPosition tabBarPosition);
/// 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)`.
///
@@ -77,6 +79,7 @@ abstract class _$GeneralSettingsCWProxy {
bool tabBarReaderView,
bool tabBarShowContextualBar,
bool tabBarShowQuickTabSwitcherBar,
TabBarPosition tabBarPosition,
});
}
@@ -162,6 +165,10 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
bool tabBarShowQuickTabSwitcherBar,
) => call(tabBarShowQuickTabSwitcherBar: tabBarShowQuickTabSwitcherBar);
@override
GeneralSettings tabBarPosition(TabBarPosition tabBarPosition) =>
call(tabBarPosition: tabBarPosition);
@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)`.
@@ -189,6 +196,7 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
Object? tabBarReaderView = const $CopyWithPlaceholder(),
Object? tabBarShowContextualBar = const $CopyWithPlaceholder(),
Object? tabBarShowQuickTabSwitcherBar = const $CopyWithPlaceholder(),
Object? tabBarPosition = const $CopyWithPlaceholder(),
}) {
return GeneralSettings(
themeMode: themeMode == const $CopyWithPlaceholder() || themeMode == null
@@ -295,6 +303,12 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
? _value.tabBarShowQuickTabSwitcherBar
// ignore: cast_nullable_to_non_nullable
: tabBarShowQuickTabSwitcherBar as bool,
tabBarPosition:
tabBarPosition == const $CopyWithPlaceholder() ||
tabBarPosition == null
? _value.tabBarPosition
// ignore: cast_nullable_to_non_nullable
: tabBarPosition as TabBarPosition,
);
}
}
@@ -351,6 +365,10 @@ GeneralSettings _$GeneralSettingsFromJson(
tabBarReaderView: json['tabBarReaderView'] as bool?,
tabBarShowContextualBar: json['tabBarShowContextualBar'] as bool?,
tabBarShowQuickTabSwitcherBar: json['tabBarShowQuickTabSwitcherBar'] as bool?,
tabBarPosition: $enumDecodeNullable(
_$TabBarPositionEnumMap,
json['tabBarPosition'],
),
);
Map<String, dynamic> _$GeneralSettingsToJson(
@@ -381,6 +399,7 @@ Map<String, dynamic> _$GeneralSettingsToJson(
'tabBarReaderView': instance.tabBarReaderView,
'tabBarShowContextualBar': instance.tabBarShowContextualBar,
'tabBarShowQuickTabSwitcherBar': instance.tabBarShowQuickTabSwitcherBar,
'tabBarPosition': _$TabBarPositionEnumMap[instance.tabBarPosition]!,
};
const _$ThemeModeEnumMap = {
@@ -422,3 +441,8 @@ const _$TabBarSwipeActionEnumMap = {
TabBarSwipeAction.switchLastOpened: 'switchLastOpened',
TabBarSwipeAction.navigateOrderedTabs: 'navigateOrderedTabs',
};
const _$TabBarPositionEnumMap = {
TabBarPosition.top: 'top',
TabBarPosition.bottom: 'bottom',
};
@@ -114,6 +114,10 @@ class GeneralSettingsRepository extends _$GeneralSettingsRepository {
),
'tabBarShowQuickTabSwitcherBar': settings['tabBarShowQuickTabSwitcherBar']
?.readAs(DriftSqlType.bool, db.typeMapping),
'tabBarPosition': settings['tabBarPosition']?.readAs(
DriftSqlType.string,
db.typeMapping,
),
});
}
@@ -35,7 +35,7 @@ final class GeneralSettingsRepositoryProvider
}
String _$generalSettingsRepositoryHash() =>
r'4014986c9510d6d7210c5c16d814f6b018a1f93c';
r'09542387844db25334384af115c538348b0ad33f';
abstract class _$GeneralSettingsRepository
extends $StreamNotifier<GeneralSettings> {