From 3aece9316c1f2546b5ef447edc06d6b0a77e3145 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Thu, 4 Sep 2025 00:25:44 +0800 Subject: [PATCH] :sparkles: Able to temporary disable background image --- assets/i18n/en-US.json | 7 +- assets/i18n/zh-CN.json | 1 + assets/i18n/zh-TW.json | 3 +- lib/pods/config.dart | 9 +++ lib/pods/config.freezed.dart | 39 ++++----- lib/pods/config.g.dart | 2 +- lib/pods/translate.g.dart | 2 +- lib/screens/settings.dart | 147 +++++++--------------------------- lib/widgets/app_scaffold.dart | 3 +- 9 files changed, 71 insertions(+), 142 deletions(-) diff --git a/assets/i18n/en-US.json b/assets/i18n/en-US.json index b7613ee2..f8c73559 100644 --- a/assets/i18n/en-US.json +++ b/assets/i18n/en-US.json @@ -338,6 +338,7 @@ "notifications": "Notifications", "posts": "Posts", "settingsBackgroundImage": "Background Image", + "settingsBackgroundImageEnable": "Show Background Image", "settingsBackgroundImageClear": "Clear Background Image", "settingsBackgroundGenerateColor": "Generate color scheme from Bacground Image", "messageNone": "No content to display", @@ -634,8 +635,8 @@ "chatJoin": "Join the Chat", "realmJoin": "Join the Realm", "realmJoinSuccess": "Successfully joined the realm.", - "discoverRealms": "Discover realms", - "discoverPublishers": "Discover publishers", + "discoverRealms": "Realms", + "discoverPublishers": "Publishers", "search": "Search", "publisherMembers": "Collaborators", "developerHub": "Developer Hub", @@ -693,7 +694,7 @@ "publisherFeatureDevelopDescription": "Unlock development abilities for your publisher, including custom apps, API keys, and more.", "publisherFeatureDevelopHint": "Currently, this feature is under active development, you need send a request to unlock this feature.", "learnMore": "Learn More", - "discoverWebArticles": "Articles from external sites", + "discoverWebArticles": "Web Feed Articles", "webArticlesStand": "Article Stand", "about": "About", "membershipCancel": "Cancel Membership", diff --git a/assets/i18n/zh-CN.json b/assets/i18n/zh-CN.json index 683752ba..8c44fac6 100644 --- a/assets/i18n/zh-CN.json +++ b/assets/i18n/zh-CN.json @@ -304,6 +304,7 @@ "notifications": "通知", "posts": "帖子", "settingsBackgroundImage": "背景图片", + "settingsBackgroundImageEnable": "显示背景图片", "settingsBackgroundImageClear": "清除背景图片", "settingsBackgroundGenerateColor": "从背景图像生成主题色", "messageNone": "没有内容可显示", diff --git a/assets/i18n/zh-TW.json b/assets/i18n/zh-TW.json index d26d46b6..50cc5c0d 100644 --- a/assets/i18n/zh-TW.json +++ b/assets/i18n/zh-TW.json @@ -303,7 +303,8 @@ "notifications": "通知", "posts": "帖子", "settingsBackgroundImage": "背景圖片", - "settingsBackgroundImageClear": "清除背景圖片", + "settingsBackgroundImageEnable": "顯示背景圖片", + "settingsBackgroundImageClear": "清除背景圖片", "settingsBackgroundGenerateColor": "從背景圖像生成主題色", "messageNone": "沒有內容可顯示", "unreadMessages": { diff --git a/lib/pods/config.dart b/lib/pods/config.dart index 59491e98..b109b84b 100644 --- a/lib/pods/config.dart +++ b/lib/pods/config.dart @@ -15,6 +15,7 @@ const kNetworkServerStoreKey = 'app_server_url'; const kAppbarTransparentStoreKey = 'app_bar_transparent'; const kAppBackgroundStoreKey = 'app_has_background'; +const kAppShowBackgroundImage = 'app_show_background_image'; const kAppColorSchemeStoreKey = 'app_color_scheme'; const kAppNotifyWithHaptic = 'app_notify_with_haptic'; const kAppCustomFonts = 'app_custom_fonts'; @@ -58,6 +59,7 @@ sealed class AppSettings with _$AppSettings { required bool aprilFoolFeatures, required bool enterToSend, required bool appBarTransparent, + required bool showBackgroundImage, required String? customFonts, required int? appColorScheme, // The color stored via the int type required Size? windowSize, // The window size for desktop platforms @@ -75,6 +77,7 @@ class AppSettingsNotifier extends _$AppSettingsNotifier { aprilFoolFeatures: prefs.getBool(kAppAprilFoolFeatures) ?? true, enterToSend: prefs.getBool(kAppEnterToSend) ?? true, appBarTransparent: prefs.getBool(kAppbarTransparentStoreKey) ?? false, + showBackgroundImage: prefs.getBool(kAppShowBackgroundImage) ?? true, customFonts: prefs.getString(kAppCustomFonts), appColorScheme: prefs.getInt(kAppColorSchemeStoreKey), windowSize: _getWindowSizeFromPrefs(prefs), @@ -129,6 +132,12 @@ class AppSettingsNotifier extends _$AppSettingsNotifier { ref.read(themeProvider.notifier).reloadTheme(); } + void setShowBackgroundImage(bool value) { + final prefs = ref.read(sharedPreferencesProvider); + prefs.setBool(kAppShowBackgroundImage, value); + state = state.copyWith(showBackgroundImage: value); + } + void setCustomFonts(String? value) { final prefs = ref.read(sharedPreferencesProvider); prefs.setString(kAppCustomFonts, value ?? ''); diff --git a/lib/pods/config.freezed.dart b/lib/pods/config.freezed.dart index 2d166283..500f586a 100644 --- a/lib/pods/config.freezed.dart +++ b/lib/pods/config.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$AppSettings { - bool get autoTranslate; bool get soundEffects; bool get aprilFoolFeatures; bool get enterToSend; bool get appBarTransparent; String? get customFonts; int? get appColorScheme;// The color stored via the int type + bool get autoTranslate; bool get soundEffects; bool get aprilFoolFeatures; bool get enterToSend; bool get appBarTransparent; bool get showBackgroundImage; String? get customFonts; int? get appColorScheme;// The color stored via the int type Size? get windowSize; /// Create a copy of AppSettings /// with the given fields replaced by the non-null parameter values. @@ -26,16 +26,16 @@ $AppSettingsCopyWith get copyWith => _$AppSettingsCopyWithImpl Object.hash(runtimeType,autoTranslate,soundEffects,aprilFoolFeatures,enterToSend,appBarTransparent,customFonts,appColorScheme,windowSize); +int get hashCode => Object.hash(runtimeType,autoTranslate,soundEffects,aprilFoolFeatures,enterToSend,appBarTransparent,showBackgroundImage,customFonts,appColorScheme,windowSize); @override String toString() { - return 'AppSettings(autoTranslate: $autoTranslate, soundEffects: $soundEffects, aprilFoolFeatures: $aprilFoolFeatures, enterToSend: $enterToSend, appBarTransparent: $appBarTransparent, customFonts: $customFonts, appColorScheme: $appColorScheme, windowSize: $windowSize)'; + return 'AppSettings(autoTranslate: $autoTranslate, soundEffects: $soundEffects, aprilFoolFeatures: $aprilFoolFeatures, enterToSend: $enterToSend, appBarTransparent: $appBarTransparent, showBackgroundImage: $showBackgroundImage, customFonts: $customFonts, appColorScheme: $appColorScheme, windowSize: $windowSize)'; } @@ -46,7 +46,7 @@ abstract mixin class $AppSettingsCopyWith<$Res> { factory $AppSettingsCopyWith(AppSettings value, $Res Function(AppSettings) _then) = _$AppSettingsCopyWithImpl; @useResult $Res call({ - bool autoTranslate, bool soundEffects, bool aprilFoolFeatures, bool enterToSend, bool appBarTransparent, String? customFonts, int? appColorScheme, Size? windowSize + bool autoTranslate, bool soundEffects, bool aprilFoolFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, String? customFonts, int? appColorScheme, Size? windowSize }); @@ -63,13 +63,14 @@ class _$AppSettingsCopyWithImpl<$Res> /// Create a copy of AppSettings /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? autoTranslate = null,Object? soundEffects = null,Object? aprilFoolFeatures = null,Object? enterToSend = null,Object? appBarTransparent = null,Object? customFonts = freezed,Object? appColorScheme = freezed,Object? windowSize = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? autoTranslate = null,Object? soundEffects = null,Object? aprilFoolFeatures = null,Object? enterToSend = null,Object? appBarTransparent = null,Object? showBackgroundImage = null,Object? customFonts = freezed,Object? appColorScheme = freezed,Object? windowSize = freezed,}) { return _then(_self.copyWith( autoTranslate: null == autoTranslate ? _self.autoTranslate : autoTranslate // ignore: cast_nullable_to_non_nullable as bool,soundEffects: null == soundEffects ? _self.soundEffects : soundEffects // ignore: cast_nullable_to_non_nullable as bool,aprilFoolFeatures: null == aprilFoolFeatures ? _self.aprilFoolFeatures : aprilFoolFeatures // ignore: cast_nullable_to_non_nullable as bool,enterToSend: null == enterToSend ? _self.enterToSend : enterToSend // ignore: cast_nullable_to_non_nullable as bool,appBarTransparent: null == appBarTransparent ? _self.appBarTransparent : appBarTransparent // ignore: cast_nullable_to_non_nullable +as bool,showBackgroundImage: null == showBackgroundImage ? _self.showBackgroundImage : showBackgroundImage // ignore: cast_nullable_to_non_nullable as bool,customFonts: freezed == customFonts ? _self.customFonts : customFonts // ignore: cast_nullable_to_non_nullable as String?,appColorScheme: freezed == appColorScheme ? _self.appColorScheme : appColorScheme // ignore: cast_nullable_to_non_nullable as int?,windowSize: freezed == windowSize ? _self.windowSize : windowSize // ignore: cast_nullable_to_non_nullable @@ -155,10 +156,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( bool autoTranslate, bool soundEffects, bool aprilFoolFeatures, bool enterToSend, bool appBarTransparent, String? customFonts, int? appColorScheme, Size? windowSize)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( bool autoTranslate, bool soundEffects, bool aprilFoolFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, String? customFonts, int? appColorScheme, Size? windowSize)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _AppSettings() when $default != null: -return $default(_that.autoTranslate,_that.soundEffects,_that.aprilFoolFeatures,_that.enterToSend,_that.appBarTransparent,_that.customFonts,_that.appColorScheme,_that.windowSize);case _: +return $default(_that.autoTranslate,_that.soundEffects,_that.aprilFoolFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.customFonts,_that.appColorScheme,_that.windowSize);case _: return orElse(); } @@ -176,10 +177,10 @@ return $default(_that.autoTranslate,_that.soundEffects,_that.aprilFoolFeatures,_ /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( bool autoTranslate, bool soundEffects, bool aprilFoolFeatures, bool enterToSend, bool appBarTransparent, String? customFonts, int? appColorScheme, Size? windowSize) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( bool autoTranslate, bool soundEffects, bool aprilFoolFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, String? customFonts, int? appColorScheme, Size? windowSize) $default,) {final _that = this; switch (_that) { case _AppSettings(): -return $default(_that.autoTranslate,_that.soundEffects,_that.aprilFoolFeatures,_that.enterToSend,_that.appBarTransparent,_that.customFonts,_that.appColorScheme,_that.windowSize);} +return $default(_that.autoTranslate,_that.soundEffects,_that.aprilFoolFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.customFonts,_that.appColorScheme,_that.windowSize);} } /// A variant of `when` that fallback to returning `null` /// @@ -193,10 +194,10 @@ return $default(_that.autoTranslate,_that.soundEffects,_that.aprilFoolFeatures,_ /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool autoTranslate, bool soundEffects, bool aprilFoolFeatures, bool enterToSend, bool appBarTransparent, String? customFonts, int? appColorScheme, Size? windowSize)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool autoTranslate, bool soundEffects, bool aprilFoolFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, String? customFonts, int? appColorScheme, Size? windowSize)? $default,) {final _that = this; switch (_that) { case _AppSettings() when $default != null: -return $default(_that.autoTranslate,_that.soundEffects,_that.aprilFoolFeatures,_that.enterToSend,_that.appBarTransparent,_that.customFonts,_that.appColorScheme,_that.windowSize);case _: +return $default(_that.autoTranslate,_that.soundEffects,_that.aprilFoolFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.customFonts,_that.appColorScheme,_that.windowSize);case _: return null; } @@ -208,7 +209,7 @@ return $default(_that.autoTranslate,_that.soundEffects,_that.aprilFoolFeatures,_ class _AppSettings implements AppSettings { - const _AppSettings({required this.autoTranslate, required this.soundEffects, required this.aprilFoolFeatures, required this.enterToSend, required this.appBarTransparent, required this.customFonts, required this.appColorScheme, required this.windowSize}); + const _AppSettings({required this.autoTranslate, required this.soundEffects, required this.aprilFoolFeatures, required this.enterToSend, required this.appBarTransparent, required this.showBackgroundImage, required this.customFonts, required this.appColorScheme, required this.windowSize}); @override final bool autoTranslate; @@ -216,6 +217,7 @@ class _AppSettings implements AppSettings { @override final bool aprilFoolFeatures; @override final bool enterToSend; @override final bool appBarTransparent; +@override final bool showBackgroundImage; @override final String? customFonts; @override final int? appColorScheme; // The color stored via the int type @@ -231,16 +233,16 @@ _$AppSettingsCopyWith<_AppSettings> get copyWith => __$AppSettingsCopyWithImpl<_ @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppSettings&&(identical(other.autoTranslate, autoTranslate) || other.autoTranslate == autoTranslate)&&(identical(other.soundEffects, soundEffects) || other.soundEffects == soundEffects)&&(identical(other.aprilFoolFeatures, aprilFoolFeatures) || other.aprilFoolFeatures == aprilFoolFeatures)&&(identical(other.enterToSend, enterToSend) || other.enterToSend == enterToSend)&&(identical(other.appBarTransparent, appBarTransparent) || other.appBarTransparent == appBarTransparent)&&(identical(other.customFonts, customFonts) || other.customFonts == customFonts)&&(identical(other.appColorScheme, appColorScheme) || other.appColorScheme == appColorScheme)&&(identical(other.windowSize, windowSize) || other.windowSize == windowSize)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppSettings&&(identical(other.autoTranslate, autoTranslate) || other.autoTranslate == autoTranslate)&&(identical(other.soundEffects, soundEffects) || other.soundEffects == soundEffects)&&(identical(other.aprilFoolFeatures, aprilFoolFeatures) || other.aprilFoolFeatures == aprilFoolFeatures)&&(identical(other.enterToSend, enterToSend) || other.enterToSend == enterToSend)&&(identical(other.appBarTransparent, appBarTransparent) || other.appBarTransparent == appBarTransparent)&&(identical(other.showBackgroundImage, showBackgroundImage) || other.showBackgroundImage == showBackgroundImage)&&(identical(other.customFonts, customFonts) || other.customFonts == customFonts)&&(identical(other.appColorScheme, appColorScheme) || other.appColorScheme == appColorScheme)&&(identical(other.windowSize, windowSize) || other.windowSize == windowSize)); } @override -int get hashCode => Object.hash(runtimeType,autoTranslate,soundEffects,aprilFoolFeatures,enterToSend,appBarTransparent,customFonts,appColorScheme,windowSize); +int get hashCode => Object.hash(runtimeType,autoTranslate,soundEffects,aprilFoolFeatures,enterToSend,appBarTransparent,showBackgroundImage,customFonts,appColorScheme,windowSize); @override String toString() { - return 'AppSettings(autoTranslate: $autoTranslate, soundEffects: $soundEffects, aprilFoolFeatures: $aprilFoolFeatures, enterToSend: $enterToSend, appBarTransparent: $appBarTransparent, customFonts: $customFonts, appColorScheme: $appColorScheme, windowSize: $windowSize)'; + return 'AppSettings(autoTranslate: $autoTranslate, soundEffects: $soundEffects, aprilFoolFeatures: $aprilFoolFeatures, enterToSend: $enterToSend, appBarTransparent: $appBarTransparent, showBackgroundImage: $showBackgroundImage, customFonts: $customFonts, appColorScheme: $appColorScheme, windowSize: $windowSize)'; } @@ -251,7 +253,7 @@ abstract mixin class _$AppSettingsCopyWith<$Res> implements $AppSettingsCopyWith factory _$AppSettingsCopyWith(_AppSettings value, $Res Function(_AppSettings) _then) = __$AppSettingsCopyWithImpl; @override @useResult $Res call({ - bool autoTranslate, bool soundEffects, bool aprilFoolFeatures, bool enterToSend, bool appBarTransparent, String? customFonts, int? appColorScheme, Size? windowSize + bool autoTranslate, bool soundEffects, bool aprilFoolFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, String? customFonts, int? appColorScheme, Size? windowSize }); @@ -268,13 +270,14 @@ class __$AppSettingsCopyWithImpl<$Res> /// Create a copy of AppSettings /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? autoTranslate = null,Object? soundEffects = null,Object? aprilFoolFeatures = null,Object? enterToSend = null,Object? appBarTransparent = null,Object? customFonts = freezed,Object? appColorScheme = freezed,Object? windowSize = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? autoTranslate = null,Object? soundEffects = null,Object? aprilFoolFeatures = null,Object? enterToSend = null,Object? appBarTransparent = null,Object? showBackgroundImage = null,Object? customFonts = freezed,Object? appColorScheme = freezed,Object? windowSize = freezed,}) { return _then(_AppSettings( autoTranslate: null == autoTranslate ? _self.autoTranslate : autoTranslate // ignore: cast_nullable_to_non_nullable as bool,soundEffects: null == soundEffects ? _self.soundEffects : soundEffects // ignore: cast_nullable_to_non_nullable as bool,aprilFoolFeatures: null == aprilFoolFeatures ? _self.aprilFoolFeatures : aprilFoolFeatures // ignore: cast_nullable_to_non_nullable as bool,enterToSend: null == enterToSend ? _self.enterToSend : enterToSend // ignore: cast_nullable_to_non_nullable as bool,appBarTransparent: null == appBarTransparent ? _self.appBarTransparent : appBarTransparent // ignore: cast_nullable_to_non_nullable +as bool,showBackgroundImage: null == showBackgroundImage ? _self.showBackgroundImage : showBackgroundImage // ignore: cast_nullable_to_non_nullable as bool,customFonts: freezed == customFonts ? _self.customFonts : customFonts // ignore: cast_nullable_to_non_nullable as String?,appColorScheme: freezed == appColorScheme ? _self.appColorScheme : appColorScheme // ignore: cast_nullable_to_non_nullable as int?,windowSize: freezed == windowSize ? _self.windowSize : windowSize // ignore: cast_nullable_to_non_nullable diff --git a/lib/pods/config.g.dart b/lib/pods/config.g.dart index b8affd2b..fe139735 100644 --- a/lib/pods/config.g.dart +++ b/lib/pods/config.g.dart @@ -7,7 +7,7 @@ part of 'config.dart'; // ************************************************************************** String _$appSettingsNotifierHash() => - r'c4f40a3bc4311c6360c2b5e44f8df5e5d7c1bd75'; + r'e3c13307eabb0201487b85ab67b1ab493e588e71'; /// See also [AppSettingsNotifier]. @ProviderFor(AppSettingsNotifier) diff --git a/lib/pods/translate.g.dart b/lib/pods/translate.g.dart index 7d0fc584..5b9ee4fa 100644 --- a/lib/pods/translate.g.dart +++ b/lib/pods/translate.g.dart @@ -149,7 +149,7 @@ class _TranslateStringProviderElement } String _$detectStringLanguageHash() => - r'697b68464b3d00927cc43ccc1ba8ba93f2a470ed'; + r'24fbf52edbbffcc8dc4f09f7206f82d69728e703'; /// See also [detectStringLanguage]. @ProviderFor(detectStringLanguage) diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index b862556e..ff81437c 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -219,6 +219,33 @@ class SettingsScreen extends HookConsumerWidget { }, ), + // Background image enabled + if (!kIsWeb && docBasepath.value != null) + FutureBuilder( + future: + File('${docBasepath.value}/$kAppBackgroundImagePath').exists(), + builder: (context, snapshot) { + if (!snapshot.hasData || !snapshot.data!) { + return const SizedBox.shrink(); + } + + return ListTile( + minLeadingWidth: 48, + title: Text('settingsBackgroundImageEnable').tr(), + contentPadding: const EdgeInsets.only(left: 24, right: 17), + leading: const Icon(Symbols.image), + trailing: Switch( + value: settings.showBackgroundImage, + onChanged: (value) { + ref + .read(appSettingsNotifierProvider.notifier) + .setShowBackgroundImage(value); + }, + ), + ); + }, + ), + // Clear background image option if (!kIsWeb && docBasepath.value != null) FutureBuilder( @@ -426,63 +453,8 @@ class SettingsScreen extends HookConsumerWidget { ]; // Desktop-specific settings - final desktopSettings = - !isDesktop - ? [] - : [ - ListTile( - minLeadingWidth: 48, - title: Text('settingsKeyboardShortcuts').tr(), - contentPadding: const EdgeInsets.only(left: 24, right: 17), - leading: const Icon(Symbols.keyboard), - onTap: () { - showDialog( - context: context, - builder: - (context) => AlertDialog( - title: Text('settingsKeyboardShortcuts').tr(), - content: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _ShortcutRow( - shortcut: 'Ctrl+F', - description: - 'settingsKeyboardShortcutSearch'.tr(), - ), - _ShortcutRow( - shortcut: 'Ctrl+,', - description: - 'settingsKeyboardShortcutSettings'.tr(), - ), - _ShortcutRow( - shortcut: 'Ctrl+N', - description: - 'settingsKeyboardShortcutNewMessage'.tr(), - ), - _ShortcutRow( - shortcut: 'Esc', - description: - 'settingsKeyboardShortcutCloseDialog' - .tr(), - ), - // Add more shortcuts as needed - ], - ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.of(context).pop(), - child: Text('close').tr(), - ), - ], - ), - ); - }, - trailing: const Icon(Symbols.chevron_right), - ), - ]; + // But nothing for now + final desktopSettings = !isDesktop ? [] : []; // Create a responsive layout based on screen width Widget buildSettingsList() { @@ -553,34 +525,7 @@ class SettingsScreen extends HookConsumerWidget { return AppScaffold( isNoBackground: false, - appBar: AppBar( - title: Text('settings').tr(), - actions: - isDesktop - ? [ - IconButton( - icon: const Icon(Symbols.help_outline), - onPressed: () { - // Show help dialog - showDialog( - context: context, - builder: - (context) => AlertDialog( - title: Text('settingsHelp').tr(), - content: Text('settingsHelpContent').tr(), - actions: [ - TextButton( - onPressed: () => Navigator.of(context).pop(), - child: Text('close').tr(), - ), - ], - ), - ); - }, - ), - ] - : null, - ), + appBar: AppBar(title: Text('settings').tr()), body: Focus( autofocus: true, onKeyEvent: (node, event) { @@ -630,35 +575,3 @@ class _SettingsSection extends StatelessWidget { ); } } - -// Helper widget for displaying keyboard shortcuts -class _ShortcutRow extends StatelessWidget { - final String shortcut; - final String description; - - const _ShortcutRow({required this.shortcut, required this.description}); - - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.symmetric(vertical: 8.0), - child: Row( - children: [ - Container( - padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4), - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.surfaceVariant, - borderRadius: BorderRadius.circular(4), - border: Border.all( - color: Theme.of(context).colorScheme.outline.withOpacity(0.5), - ), - ), - child: Text(shortcut, style: TextStyle(fontFamily: 'monospace')), - ), - SizedBox(width: 16), - Text(description), - ], - ), - ); - } -} diff --git a/lib/widgets/app_scaffold.dart b/lib/widgets/app_scaffold.dart index f3b6af17..d6811ee4 100644 --- a/lib/widgets/app_scaffold.dart +++ b/lib/widgets/app_scaffold.dart @@ -271,11 +271,12 @@ class AppBackground extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final imageFileAsync = ref.watch(backgroundImageFileProvider); + final settings = ref.watch(appSettingsNotifierProvider); if (isRoot || !isWideScreen(context)) { return imageFileAsync.when( data: (file) { - if (file != null) { + if (file != null && settings.showBackgroundImage) { return Container( color: Theme.of(context).colorScheme.surface, child: Container(