mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-29 21:02:09 +02:00
style(settings): simplify grouped rows and use green switches
This commit is contained in:
@@ -7,7 +7,6 @@ import 'package:spotiflac_android/providers/settings_provider.dart';
|
||||
import 'package:spotiflac_android/providers/theme_provider.dart';
|
||||
import 'package:spotiflac_android/models/theme_settings.dart';
|
||||
import 'package:spotiflac_android/theme/mornye_theme.dart';
|
||||
import 'package:spotiflac_android/theme/mornye_icons.dart';
|
||||
import 'package:spotiflac_android/widgets/mornye_chrome.dart';
|
||||
import 'package:spotiflac_android/utils/adaptive_layout.dart';
|
||||
import 'package:spotiflac_android/widgets/settings_group.dart';
|
||||
@@ -68,17 +67,13 @@ class AppearanceSettingsPage extends ConsumerWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
leading: Icon(
|
||||
context.isMornye
|
||||
? mornyeIconFor(
|
||||
style == AppThemeStyle.mornye
|
||||
? Icons.music_note_outlined
|
||||
: Icons.palette_outlined,
|
||||
)
|
||||
: style == AppThemeStyle.mornye
|
||||
? Icons.music_note_outlined
|
||||
: Icons.palette_outlined,
|
||||
),
|
||||
leading: context.isMornye
|
||||
? null
|
||||
: Icon(
|
||||
style == AppThemeStyle.mornye
|
||||
? Icons.music_note_outlined
|
||||
: Icons.palette_outlined,
|
||||
),
|
||||
trailing: themeSettings.style == style
|
||||
? Icon(
|
||||
Icons.check_circle,
|
||||
@@ -708,12 +703,9 @@ class _LanguageSelector extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final content = ListTile(
|
||||
leading: Icon(
|
||||
context.adaptiveIcon(Icons.language),
|
||||
color: context.isMornye
|
||||
? colorScheme.primary
|
||||
: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
leading: context.isMornye
|
||||
? null
|
||||
: Icon(Icons.language, color: colorScheme.onSurfaceVariant),
|
||||
title: Text(context.l10n.appearanceLanguage),
|
||||
subtitle: Text(_getLanguageName(currentLocale)),
|
||||
trailing: Icon(Icons.chevron_right, color: colorScheme.onSurfaceVariant),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart' show CupertinoColors;
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:liquid_glass_easy/liquid_glass_easy.dart';
|
||||
import 'package:spotiflac_android/providers/runtime_profile_provider.dart';
|
||||
@@ -31,6 +32,7 @@ class AppSwitch extends StatelessWidget {
|
||||
return Consumer(
|
||||
builder: (context, ref, _) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final active = CupertinoColors.systemGreen.resolveFrom(context);
|
||||
final enabled = onChanged != null;
|
||||
final useGlass =
|
||||
enabled &&
|
||||
@@ -49,7 +51,7 @@ class AppSwitch extends StatelessWidget {
|
||||
child: LiquidGlassSwitch(
|
||||
value: value,
|
||||
onChanged: onChanged!,
|
||||
activeColor: scheme.primary,
|
||||
activeColor: active,
|
||||
inactiveColor: inactive,
|
||||
),
|
||||
);
|
||||
@@ -59,7 +61,7 @@ class AppSwitch extends StatelessWidget {
|
||||
height: 28,
|
||||
padding: const EdgeInsets.all(2),
|
||||
decoration: BoxDecoration(
|
||||
color: value ? scheme.primary : inactive,
|
||||
color: value ? active : inactive,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
child: Align(
|
||||
|
||||
@@ -204,7 +204,9 @@ class SettingsGroup extends StatelessWidget {
|
||||
|
||||
final decoration = BoxDecoration(
|
||||
color: cardColor,
|
||||
borderRadius: BorderRadius.circular(context.tokens.radiusCard),
|
||||
borderRadius: BorderRadius.circular(
|
||||
context.isMornye ? 28 : context.tokens.radiusCard,
|
||||
),
|
||||
border: context.isMornye
|
||||
? null
|
||||
: Border.all(
|
||||
@@ -286,6 +288,7 @@ class SettingsItem extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final showIcon = icon != null && !context.isMornye;
|
||||
|
||||
final content = Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -305,14 +308,8 @@ class SettingsItem extends StatelessWidget {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
if (icon != null) ...[
|
||||
Icon(
|
||||
context.adaptiveIcon(icon!),
|
||||
color: context.isMornye
|
||||
? colorScheme.primary
|
||||
: colorScheme.onSurfaceVariant,
|
||||
size: 24,
|
||||
),
|
||||
if (showIcon) ...[
|
||||
Icon(icon, color: colorScheme.onSurfaceVariant, size: 24),
|
||||
SizedBox(width: context.tokens.rowIconGap),
|
||||
],
|
||||
Expanded(
|
||||
@@ -373,7 +370,7 @@ class SettingsItem extends StatelessWidget {
|
||||
if (showDivider)
|
||||
Divider(
|
||||
height: 1,
|
||||
indent: icon != null
|
||||
indent: showIcon
|
||||
? context.tokens.rowIconDividerIndent
|
||||
: context.tokens.rowPaddingH,
|
||||
endIndent: context.tokens.rowPaddingH,
|
||||
@@ -413,6 +410,7 @@ class SettingsSwitchItem extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final isDisabled = !enabled || onChanged == null;
|
||||
final showIcon = icon != null && !context.isMornye;
|
||||
|
||||
final content = Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -430,13 +428,11 @@ class SettingsSwitchItem extends StatelessWidget {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
if (icon != null) ...[
|
||||
if (showIcon) ...[
|
||||
Icon(
|
||||
context.adaptiveIcon(icon!),
|
||||
icon,
|
||||
color: isDisabled
|
||||
? colorScheme.outline
|
||||
: context.isMornye
|
||||
? colorScheme.primary
|
||||
: colorScheme.onSurfaceVariant,
|
||||
size: 24,
|
||||
),
|
||||
@@ -495,7 +491,7 @@ class SettingsSwitchItem extends StatelessWidget {
|
||||
if (showDivider)
|
||||
Divider(
|
||||
height: 1,
|
||||
indent: icon != null
|
||||
indent: showIcon
|
||||
? context.tokens.rowIconDividerIndent
|
||||
: context.tokens.rowPaddingH,
|
||||
endIndent: context.tokens.rowPaddingH,
|
||||
@@ -519,18 +515,16 @@ class SettingsSectionHeader extends StatelessWidget {
|
||||
final content = Padding(
|
||||
padding: const EdgeInsets.fromLTRB(32, 24, 32, 8),
|
||||
child: Text(
|
||||
context.isMornye ? title.toUpperCase() : title,
|
||||
title,
|
||||
style:
|
||||
(context.isMornye
|
||||
? Theme.of(context).textTheme.bodySmall
|
||||
? Theme.of(context).textTheme.bodyLarge
|
||||
: Theme.of(context).textTheme.titleSmall)
|
||||
?.copyWith(
|
||||
color: context.isMornye
|
||||
? Theme.of(context).colorScheme.onSurfaceVariant
|
||||
: Theme.of(context).colorScheme.primary,
|
||||
fontWeight: context.isMornye
|
||||
? FontWeight.normal
|
||||
: FontWeight.w600,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user