setting to show/hide quick tab titles
This commit is contained in:
+14
-4
@@ -482,6 +482,11 @@ class QuickTabSwitcher extends HookConsumerWidget {
|
|||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final appColors = AppColors.of(context);
|
final appColors = AppColors.of(context);
|
||||||
final selectedTabId = ref.watch(selectedTabProvider);
|
final selectedTabId = ref.watch(selectedTabProvider);
|
||||||
|
final showTitles = ref.watch(
|
||||||
|
generalSettingsWithDefaultsProvider.select(
|
||||||
|
(s) => s.quickTabSwitcherShowTitles,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
final tabStates = (switch (quickTabSwitcherMode) {
|
final tabStates = (switch (quickTabSwitcherMode) {
|
||||||
QuickTabSwitcherMode.lastUsedTabs => ref.watch(fifoTabStatesProvider),
|
QuickTabSwitcherMode.lastUsedTabs => ref.watch(fifoTabStatesProvider),
|
||||||
@@ -511,14 +516,19 @@ class QuickTabSwitcher extends HookConsumerWidget {
|
|||||||
enableDelete: false,
|
enableDelete: false,
|
||||||
scrollController: chipScrollController,
|
scrollController: chipScrollController,
|
||||||
itemId: (item) => item.id,
|
itemId: (item) => item.id,
|
||||||
|
labelPadding: (item) =>
|
||||||
|
(!showTitles && !item.isHistory && !item.isPrivate)
|
||||||
|
? EdgeInsets.zero
|
||||||
|
: null,
|
||||||
itemLabel: (item) {
|
itemLabel: (item) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
ConstrainedBox(
|
if (item.isHistory || showTitles)
|
||||||
constraints: const BoxConstraints(maxWidth: 64),
|
ConstrainedBox(
|
||||||
child: Text(item.title),
|
constraints: const BoxConstraints(maxWidth: 64),
|
||||||
),
|
child: Text(item.title),
|
||||||
|
),
|
||||||
if (item.isPrivate)
|
if (item.isPrivate)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
|||||||
@@ -82,11 +82,49 @@ class _TabBarLayoutSection extends StatelessWidget {
|
|||||||
_TabListShowFaviconsTile(),
|
_TabListShowFaviconsTile(),
|
||||||
_ShowQuickTabSwitcherBarTile(),
|
_ShowQuickTabSwitcherBarTile(),
|
||||||
_QuickTabSwitcherModeSection(),
|
_QuickTabSwitcherModeSection(),
|
||||||
|
_QuickTabSwitcherShowTitlesTile(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _QuickTabSwitcherShowTitlesTile extends HookConsumerWidget {
|
||||||
|
const _QuickTabSwitcherShowTitlesTile();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final quickTabSwitcherShowTitles = ref.watch(
|
||||||
|
generalSettingsWithDefaultsProvider.select(
|
||||||
|
(s) => s.quickTabSwitcherShowTitles,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
final tabBarShowQuickTabSwitcherBar = ref.watch(
|
||||||
|
generalSettingsWithDefaultsProvider.select(
|
||||||
|
(s) => s.tabBarShowQuickTabSwitcherBar,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return SwitchListTile.adaptive(
|
||||||
|
title: const Text('Show Titles in Quick Tab Switcher'),
|
||||||
|
subtitle: const Text(
|
||||||
|
'Display tab titles alongside icons in the quick tab switcher bar',
|
||||||
|
),
|
||||||
|
secondary: const Icon(MdiIcons.textRecognition),
|
||||||
|
value: quickTabSwitcherShowTitles,
|
||||||
|
onChanged: tabBarShowQuickTabSwitcherBar
|
||||||
|
? (value) async {
|
||||||
|
await ref
|
||||||
|
.read(saveGeneralSettingsControllerProvider.notifier)
|
||||||
|
.save(
|
||||||
|
(currentSettings) => currentSettings.copyWith
|
||||||
|
.quickTabSwitcherShowTitles(value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class _GesturesSection extends StatelessWidget {
|
class _GesturesSection extends StatelessWidget {
|
||||||
const _GesturesSection();
|
const _GesturesSection();
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ class GeneralSettings with FastEquatable {
|
|||||||
final int maxSearchHistoryEntries;
|
final int maxSearchHistoryEntries;
|
||||||
final bool allowClipboardAccess;
|
final bool allowClipboardAccess;
|
||||||
final bool tabListShowFavicons;
|
final bool tabListShowFavicons;
|
||||||
|
final bool quickTabSwitcherShowTitles;
|
||||||
|
|
||||||
GeneralSettings({
|
GeneralSettings({
|
||||||
required this.themeMode,
|
required this.themeMode,
|
||||||
@@ -116,6 +117,7 @@ class GeneralSettings with FastEquatable {
|
|||||||
required this.maxSearchHistoryEntries,
|
required this.maxSearchHistoryEntries,
|
||||||
required this.allowClipboardAccess,
|
required this.allowClipboardAccess,
|
||||||
required this.tabListShowFavicons,
|
required this.tabListShowFavicons,
|
||||||
|
required this.quickTabSwitcherShowTitles,
|
||||||
});
|
});
|
||||||
|
|
||||||
GeneralSettings.withDefaults({
|
GeneralSettings.withDefaults({
|
||||||
@@ -146,6 +148,7 @@ class GeneralSettings with FastEquatable {
|
|||||||
int? maxSearchHistoryEntries,
|
int? maxSearchHistoryEntries,
|
||||||
bool? allowClipboardAccess,
|
bool? allowClipboardAccess,
|
||||||
bool? tabListShowFavicons,
|
bool? tabListShowFavicons,
|
||||||
|
bool? quickTabSwitcherShowTitles,
|
||||||
}) : themeMode = themeMode ?? ThemeMode.dark,
|
}) : themeMode = themeMode ?? ThemeMode.dark,
|
||||||
enableReadability = enableReadability ?? true,
|
enableReadability = enableReadability ?? true,
|
||||||
enforceReadability = enforceReadability ?? false,
|
enforceReadability = enforceReadability ?? false,
|
||||||
@@ -176,7 +179,8 @@ class GeneralSettings with FastEquatable {
|
|||||||
unassignedTabsAutoCleanInterval ?? Duration.zero,
|
unassignedTabsAutoCleanInterval ?? Duration.zero,
|
||||||
maxSearchHistoryEntries = maxSearchHistoryEntries ?? 5,
|
maxSearchHistoryEntries = maxSearchHistoryEntries ?? 5,
|
||||||
allowClipboardAccess = allowClipboardAccess ?? true,
|
allowClipboardAccess = allowClipboardAccess ?? true,
|
||||||
tabListShowFavicons = tabListShowFavicons ?? false;
|
tabListShowFavicons = tabListShowFavicons ?? false,
|
||||||
|
quickTabSwitcherShowTitles = quickTabSwitcherShowTitles ?? true;
|
||||||
|
|
||||||
factory GeneralSettings.fromJson(Map<String, dynamic> json) =>
|
factory GeneralSettings.fromJson(Map<String, dynamic> json) =>
|
||||||
_$GeneralSettingsFromJson(json);
|
_$GeneralSettingsFromJson(json);
|
||||||
@@ -212,5 +216,6 @@ class GeneralSettings with FastEquatable {
|
|||||||
maxSearchHistoryEntries,
|
maxSearchHistoryEntries,
|
||||||
allowClipboardAccess,
|
allowClipboardAccess,
|
||||||
tabListShowFavicons,
|
tabListShowFavicons,
|
||||||
|
quickTabSwitcherShowTitles,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ abstract class _$GeneralSettingsCWProxy {
|
|||||||
|
|
||||||
GeneralSettings tabListShowFavicons(bool tabListShowFavicons);
|
GeneralSettings tabListShowFavicons(bool tabListShowFavicons);
|
||||||
|
|
||||||
|
GeneralSettings quickTabSwitcherShowTitles(bool quickTabSwitcherShowTitles);
|
||||||
|
|
||||||
/// Creates a new instance with the provided field values.
|
/// 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)`.
|
/// 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)`.
|
||||||
///
|
///
|
||||||
@@ -108,6 +110,7 @@ abstract class _$GeneralSettingsCWProxy {
|
|||||||
int maxSearchHistoryEntries,
|
int maxSearchHistoryEntries,
|
||||||
bool allowClipboardAccess,
|
bool allowClipboardAccess,
|
||||||
bool tabListShowFavicons,
|
bool tabListShowFavicons,
|
||||||
|
bool quickTabSwitcherShowTitles,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,6 +234,10 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
|||||||
GeneralSettings tabListShowFavicons(bool tabListShowFavicons) =>
|
GeneralSettings tabListShowFavicons(bool tabListShowFavicons) =>
|
||||||
call(tabListShowFavicons: tabListShowFavicons);
|
call(tabListShowFavicons: tabListShowFavicons);
|
||||||
|
|
||||||
|
@override
|
||||||
|
GeneralSettings quickTabSwitcherShowTitles(bool quickTabSwitcherShowTitles) =>
|
||||||
|
call(quickTabSwitcherShowTitles: quickTabSwitcherShowTitles);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
/// Creates a new instance with the provided field values.
|
/// 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)`.
|
/// 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)`.
|
||||||
@@ -267,6 +274,7 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
|||||||
Object? maxSearchHistoryEntries = const $CopyWithPlaceholder(),
|
Object? maxSearchHistoryEntries = const $CopyWithPlaceholder(),
|
||||||
Object? allowClipboardAccess = const $CopyWithPlaceholder(),
|
Object? allowClipboardAccess = const $CopyWithPlaceholder(),
|
||||||
Object? tabListShowFavicons = const $CopyWithPlaceholder(),
|
Object? tabListShowFavicons = const $CopyWithPlaceholder(),
|
||||||
|
Object? quickTabSwitcherShowTitles = const $CopyWithPlaceholder(),
|
||||||
}) {
|
}) {
|
||||||
return GeneralSettings(
|
return GeneralSettings(
|
||||||
themeMode: themeMode == const $CopyWithPlaceholder() || themeMode == null
|
themeMode: themeMode == const $CopyWithPlaceholder() || themeMode == null
|
||||||
@@ -427,6 +435,12 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
|||||||
? _value.tabListShowFavicons
|
? _value.tabListShowFavicons
|
||||||
// ignore: cast_nullable_to_non_nullable
|
// ignore: cast_nullable_to_non_nullable
|
||||||
: tabListShowFavicons as bool,
|
: tabListShowFavicons as bool,
|
||||||
|
quickTabSwitcherShowTitles:
|
||||||
|
quickTabSwitcherShowTitles == const $CopyWithPlaceholder() ||
|
||||||
|
quickTabSwitcherShowTitles == null
|
||||||
|
? _value.quickTabSwitcherShowTitles
|
||||||
|
// ignore: cast_nullable_to_non_nullable
|
||||||
|
: quickTabSwitcherShowTitles as bool,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -504,6 +518,7 @@ GeneralSettings _$GeneralSettingsFromJson(
|
|||||||
maxSearchHistoryEntries: (json['maxSearchHistoryEntries'] as num?)?.toInt(),
|
maxSearchHistoryEntries: (json['maxSearchHistoryEntries'] as num?)?.toInt(),
|
||||||
allowClipboardAccess: json['allowClipboardAccess'] as bool?,
|
allowClipboardAccess: json['allowClipboardAccess'] as bool?,
|
||||||
tabListShowFavicons: json['tabListShowFavicons'] as bool?,
|
tabListShowFavicons: json['tabListShowFavicons'] as bool?,
|
||||||
|
quickTabSwitcherShowTitles: json['quickTabSwitcherShowTitles'] as bool?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$GeneralSettingsToJson(
|
Map<String, dynamic> _$GeneralSettingsToJson(
|
||||||
@@ -545,6 +560,7 @@ Map<String, dynamic> _$GeneralSettingsToJson(
|
|||||||
'maxSearchHistoryEntries': instance.maxSearchHistoryEntries,
|
'maxSearchHistoryEntries': instance.maxSearchHistoryEntries,
|
||||||
'allowClipboardAccess': instance.allowClipboardAccess,
|
'allowClipboardAccess': instance.allowClipboardAccess,
|
||||||
'tabListShowFavicons': instance.tabListShowFavicons,
|
'tabListShowFavicons': instance.tabListShowFavicons,
|
||||||
|
'quickTabSwitcherShowTitles': instance.quickTabSwitcherShowTitles,
|
||||||
};
|
};
|
||||||
|
|
||||||
const _$ThemeModeEnumMap = {
|
const _$ThemeModeEnumMap = {
|
||||||
|
|||||||
@@ -149,6 +149,8 @@ class GeneralSettingsRepository extends _$GeneralSettingsRepository {
|
|||||||
DriftSqlType.bool,
|
DriftSqlType.bool,
|
||||||
db.typeMapping,
|
db.typeMapping,
|
||||||
),
|
),
|
||||||
|
'quickTabSwitcherShowTitles': settings['quickTabSwitcherShowTitles']
|
||||||
|
?.readAs(DriftSqlType.bool, db.typeMapping),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ final class GeneralSettingsRepositoryProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _$generalSettingsRepositoryHash() =>
|
String _$generalSettingsRepositoryHash() =>
|
||||||
r'a4e4fb6f4e5b40d32b4cc676532af3bacdbe54d2';
|
r'290fc9fb5dd79b94bb4a42a131184b385a1ecb4d';
|
||||||
|
|
||||||
abstract class _$GeneralSettingsRepository
|
abstract class _$GeneralSettingsRepository
|
||||||
extends $StreamNotifier<GeneralSettings> {
|
extends $StreamNotifier<GeneralSettings> {
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ class SelectableChips<T extends S, S, K> extends StatelessWidget {
|
|||||||
final int? Function(T item)? itemBadgeCount;
|
final int? Function(T item)? itemBadgeCount;
|
||||||
final Color? Function(T item)? itemBackgroundColor;
|
final Color? Function(T item)? itemBackgroundColor;
|
||||||
final Color? selectedBorderColor;
|
final Color? selectedBorderColor;
|
||||||
|
final EdgeInsetsGeometry? Function(T item)? labelPadding;
|
||||||
|
|
||||||
final Widget Function(Widget child, S item)? itemWrap;
|
final Widget Function(Widget child, S item)? itemWrap;
|
||||||
|
|
||||||
@@ -97,6 +98,7 @@ class SelectableChips<T extends S, S, K> extends StatelessWidget {
|
|||||||
this.onLongPress,
|
this.onLongPress,
|
||||||
this.sortSelectedFirst = true,
|
this.sortSelectedFirst = true,
|
||||||
this.scrollController,
|
this.scrollController,
|
||||||
|
this.labelPadding,
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -150,6 +152,7 @@ class SelectableChips<T extends S, S, K> extends StatelessWidget {
|
|||||||
child: FilterChip(
|
child: FilterChip(
|
||||||
selected: selectedBorderColor == null && isSelected,
|
selected: selectedBorderColor == null && isSelected,
|
||||||
showCheckmark: false,
|
showCheckmark: false,
|
||||||
|
labelPadding: labelPadding?.call(item),
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
onSelected?.call(item);
|
onSelected?.call(item);
|
||||||
|
|||||||
Reference in New Issue
Block a user