mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-28 20:32:15 +02:00
fix(settings): restore distinct category icons on the main page
This commit is contained in:
@@ -32,6 +32,7 @@ import 'package:spotiflac_android/widgets/profile_avatar.dart';
|
||||
class _Destination {
|
||||
const _Destination({
|
||||
required this.icon,
|
||||
required this.iconColor,
|
||||
required this.title,
|
||||
required this.subtitle,
|
||||
required this.pageBuilder,
|
||||
@@ -40,6 +41,7 @@ class _Destination {
|
||||
});
|
||||
|
||||
final IconData icon;
|
||||
final MaterialColor iconColor;
|
||||
final String title;
|
||||
final String subtitle;
|
||||
final Widget Function() pageBuilder;
|
||||
@@ -105,6 +107,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
destinations: [
|
||||
_Destination(
|
||||
icon: Icons.extension_outlined,
|
||||
iconColor: Colors.teal,
|
||||
title: l10n.settingsExtensions,
|
||||
subtitle: l10n.settingsExtensionsSubtitle,
|
||||
keywords: const ['plugin', 'provider', 'priority', 'store'],
|
||||
@@ -113,6 +116,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
),
|
||||
_Destination(
|
||||
icon: Icons.palette_outlined,
|
||||
iconColor: Colors.purple,
|
||||
title: l10n.settingsAppearance,
|
||||
subtitle: l10n.settingsAppearanceSubtitle,
|
||||
keywords: const [
|
||||
@@ -135,6 +139,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
destinations: [
|
||||
_Destination(
|
||||
icon: Icons.library_music_outlined,
|
||||
iconColor: Colors.blue,
|
||||
title: l10n.settingsLocalLibrary,
|
||||
subtitle: l10n.settingsLocalLibrarySubtitle,
|
||||
keywords: const [
|
||||
@@ -149,6 +154,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
),
|
||||
_Destination(
|
||||
icon: Icons.sell_outlined,
|
||||
iconColor: Colors.amber,
|
||||
title: l10n.settingsMetadata,
|
||||
subtitle: l10n.settingsMetadataSubtitle,
|
||||
keywords: const ['tag', 'cover', 'artwork', 'isrc', 'provider'],
|
||||
@@ -157,6 +163,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
),
|
||||
_Destination(
|
||||
icon: Icons.lyrics_outlined,
|
||||
iconColor: Colors.cyan,
|
||||
title: l10n.settingsLyrics,
|
||||
subtitle: l10n.settingsLyricsSubtitle,
|
||||
keywords: const ['lrc', 'synced', 'provider'],
|
||||
@@ -169,6 +176,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
destinations: [
|
||||
_Destination(
|
||||
icon: Icons.download_outlined,
|
||||
iconColor: Colors.green,
|
||||
title: l10n.settingsDownload,
|
||||
subtitle: l10n.settingsDownloadSubtitle,
|
||||
keywords: const [
|
||||
@@ -185,6 +193,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
),
|
||||
_Destination(
|
||||
icon: Icons.folder_outlined,
|
||||
iconColor: Colors.orange,
|
||||
title: l10n.settingsFiles,
|
||||
subtitle: l10n.settingsFilesSubtitle,
|
||||
keywords: const [
|
||||
@@ -204,6 +213,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
destinations: [
|
||||
_Destination(
|
||||
icon: Icons.tune_outlined,
|
||||
iconColor: Colors.blueGrey,
|
||||
title: l10n.settingsApp,
|
||||
subtitle: l10n.settingsAppSubtitle,
|
||||
keywords: const ['update', 'channel', 'debug', 'logging'],
|
||||
@@ -212,6 +222,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
),
|
||||
_Destination(
|
||||
icon: Icons.storage_outlined,
|
||||
iconColor: Colors.indigo,
|
||||
title: l10n.settingsCache,
|
||||
subtitle: l10n.settingsCacheSubtitle,
|
||||
keywords: const ['clear', 'space', 'image', 'temp'],
|
||||
@@ -220,6 +231,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
),
|
||||
_Destination(
|
||||
icon: Icons.settings_backup_restore,
|
||||
iconColor: Colors.teal,
|
||||
title: l10n.settingsBackup,
|
||||
subtitle: l10n.settingsBackupSubtitle,
|
||||
keywords: const ['export', 'import', 'restore', 'json'],
|
||||
@@ -228,6 +240,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
),
|
||||
_Destination(
|
||||
icon: Icons.article_outlined,
|
||||
iconColor: Colors.brown,
|
||||
title: l10n.logTitle,
|
||||
subtitle: l10n.settingsLogsSubtitle,
|
||||
keywords: const ['debug', 'error', 'report'],
|
||||
@@ -240,6 +253,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
destinations: [
|
||||
_Destination(
|
||||
icon: Icons.favorite_outline,
|
||||
iconColor: Colors.pink,
|
||||
title: l10n.settingsDonate,
|
||||
subtitle: l10n.settingsDonateSubtitle,
|
||||
keywords: const ['support', 'ko-fi', 'sponsor'],
|
||||
@@ -247,6 +261,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
),
|
||||
_Destination(
|
||||
icon: Icons.info_outline,
|
||||
iconColor: Colors.grey,
|
||||
title: l10n.settingsAbout,
|
||||
subtitle: '${l10n.aboutVersion} ${AppInfo.displayVersion}',
|
||||
keywords: const ['version', 'license', 'contributor'],
|
||||
@@ -288,9 +303,16 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
});
|
||||
}
|
||||
|
||||
Color _iconColorFor(_Destination destination) =>
|
||||
destination.iconColor[Theme.of(context).brightness == Brightness.dark
|
||||
? 300
|
||||
: 800]!;
|
||||
|
||||
Widget _itemFor(_Destination destination, {required bool showDivider}) {
|
||||
return SettingsItem(
|
||||
icon: destination.icon,
|
||||
iconColor: _iconColorFor(destination),
|
||||
showIconInMornye: true,
|
||||
title: destination.title,
|
||||
subtitle: context.isMornye ? null : destination.subtitle,
|
||||
showDivider: showDivider,
|
||||
@@ -309,6 +331,8 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
'settings-search:${result.destination.title}:${entry.title}',
|
||||
),
|
||||
icon: entry.icon,
|
||||
iconColor: _iconColorFor(result.destination),
|
||||
showIconInMornye: true,
|
||||
title: entry.title,
|
||||
subtitle: result.destination.title,
|
||||
showDivider: showDivider,
|
||||
|
||||
@@ -267,6 +267,10 @@ class SettingsGroup extends StatelessWidget {
|
||||
|
||||
class SettingsItem extends StatelessWidget {
|
||||
final IconData? icon;
|
||||
final Color? iconColor;
|
||||
|
||||
/// Show category icons in Mornye's top-level settings and search results.
|
||||
final bool showIconInMornye;
|
||||
final String title;
|
||||
final Widget? titleTrailing;
|
||||
final String? subtitle;
|
||||
@@ -277,6 +281,8 @@ class SettingsItem extends StatelessWidget {
|
||||
const SettingsItem({
|
||||
super.key,
|
||||
this.icon,
|
||||
this.iconColor,
|
||||
this.showIconInMornye = false,
|
||||
required this.title,
|
||||
this.titleTrailing,
|
||||
this.subtitle,
|
||||
@@ -288,7 +294,7 @@ class SettingsItem extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final showIcon = icon != null && !context.isMornye;
|
||||
final showIcon = icon != null && (!context.isMornye || showIconInMornye);
|
||||
|
||||
final content = Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -309,7 +315,11 @@ class SettingsItem extends StatelessWidget {
|
||||
child: Row(
|
||||
children: [
|
||||
if (showIcon) ...[
|
||||
Icon(icon, color: colorScheme.onSurfaceVariant, size: 24),
|
||||
Icon(
|
||||
context.adaptiveIcon(icon!),
|
||||
color: iconColor ?? colorScheme.onSurfaceVariant,
|
||||
size: 24,
|
||||
),
|
||||
SizedBox(width: context.tokens.rowIconGap),
|
||||
],
|
||||
Expanded(
|
||||
|
||||
Reference in New Issue
Block a user