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