mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-30 05:12:00 +02:00
fix(settings): remove extension row icons and correct online colors
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart' show CupertinoIcons, CupertinoTextField;
|
||||
import 'package:flutter/cupertino.dart'
|
||||
show CupertinoColors, CupertinoIcons, CupertinoTextField;
|
||||
import 'package:spotiflac_android/theme/mornye_theme.dart';
|
||||
import 'package:spotiflac_android/theme/mornye_icons.dart';
|
||||
import 'package:spotiflac_android/widgets/app_alert_dialog.dart';
|
||||
@@ -747,10 +748,13 @@ class _CapabilityItem extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
Color _healthStatusColor(ColorScheme colorScheme, String status) {
|
||||
Color _healthStatusColor(BuildContext context, String status) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
switch (status) {
|
||||
case 'online':
|
||||
return colorScheme.primary;
|
||||
return context.isMornye
|
||||
? CupertinoColors.systemGreen.resolveFrom(context)
|
||||
: colorScheme.primary;
|
||||
case 'degraded':
|
||||
return colorScheme.tertiary;
|
||||
case 'offline':
|
||||
@@ -811,7 +815,7 @@ class _HealthSummaryItem extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final statusValue = status?.status ?? 'unknown';
|
||||
final color = _healthStatusColor(colorScheme, statusValue);
|
||||
final color = _healthStatusColor(context, statusValue);
|
||||
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -885,7 +889,7 @@ class _HealthCheckItem extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final color = _healthStatusColor(colorScheme, check.status);
|
||||
final color = _healthStatusColor(context, check.status);
|
||||
final detailParts = <String>[
|
||||
_healthStatusLabel(context, check.status),
|
||||
if (check.httpStatus != null) 'HTTP ${check.httpStatus}',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart' show CupertinoColors;
|
||||
import 'package:spotiflac_android/widgets/app_snack_bar.dart';
|
||||
import 'package:spotiflac_android/widgets/app_switch.dart';
|
||||
import 'package:spotiflac_android/widgets/extension_row.dart';
|
||||
@@ -346,35 +347,46 @@ class _ExtensionItem extends StatelessWidget {
|
||||
: null;
|
||||
final serviceHealthColor = serviceHealthStatus == null
|
||||
? null
|
||||
: _extensionHealthColor(colorScheme, serviceHealthStatus);
|
||||
: _extensionHealthColor(context, serviceHealthStatus);
|
||||
|
||||
return ExtensionRow(
|
||||
showDivider: showDivider,
|
||||
onTap: onTap,
|
||||
avatar: ExtensionAvatar(
|
||||
filePath: extension.iconPath,
|
||||
fallbackIcon: hasError ? Icons.error_outline : Icons.extension,
|
||||
background: hasError
|
||||
? colorScheme.errorContainer
|
||||
: colorScheme.primaryContainer,
|
||||
foreground: hasError
|
||||
? colorScheme.error
|
||||
: colorScheme.onPrimaryContainer,
|
||||
),
|
||||
avatar: context.isMornye
|
||||
? null
|
||||
: ExtensionAvatar(
|
||||
filePath: extension.iconPath,
|
||||
fallbackIcon: hasError ? Icons.error_outline : Icons.extension,
|
||||
background: hasError
|
||||
? colorScheme.errorContainer
|
||||
: colorScheme.primaryContainer,
|
||||
foreground: hasError
|
||||
? colorScheme.error
|
||||
: colorScheme.onPrimaryContainer,
|
||||
),
|
||||
title: Text(extension.displayName),
|
||||
subtitle: Text(
|
||||
subtitle: Text.rich(
|
||||
hasError
|
||||
? context.friendlyError(
|
||||
extension.errorMessage,
|
||||
fallback: context.l10n.extensionsErrorLoading,
|
||||
? TextSpan(
|
||||
text: context.friendlyError(
|
||||
extension.errorMessage,
|
||||
fallback: context.l10n.extensionsErrorLoading,
|
||||
),
|
||||
)
|
||||
: serviceHealthStatus == null
|
||||
? 'v${extension.version}'
|
||||
: 'v${extension.version} · ${_extensionHealthLabel(context, serviceHealthStatus)}',
|
||||
: TextSpan(
|
||||
text: 'v${extension.version}',
|
||||
children: [
|
||||
if (serviceHealthStatus != null) ...[
|
||||
const TextSpan(text: ' · '),
|
||||
TextSpan(
|
||||
text: _extensionHealthLabel(context, serviceHealthStatus),
|
||||
style: TextStyle(color: serviceHealthColor),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: hasError
|
||||
? colorScheme.error
|
||||
: serviceHealthColor ?? colorScheme.onSurfaceVariant,
|
||||
color: hasError ? colorScheme.error : colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
trailing: AppSwitch(
|
||||
@@ -386,10 +398,13 @@ class _ExtensionItem extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
Color _extensionHealthColor(ColorScheme colorScheme, String status) {
|
||||
Color _extensionHealthColor(BuildContext context, String status) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
switch (status) {
|
||||
case 'online':
|
||||
return colorScheme.primary;
|
||||
return context.isMornye
|
||||
? CupertinoColors.systemGreen.resolveFrom(context)
|
||||
: colorScheme.primary;
|
||||
case 'degraded':
|
||||
return colorScheme.tertiary;
|
||||
case 'offline':
|
||||
|
||||
@@ -86,11 +86,11 @@ class ExtensionAvatar extends StatelessWidget {
|
||||
}
|
||||
|
||||
/// Row shell shared by the extension store and the installed-extensions list:
|
||||
/// avatar, title/subtitle column, trailing control, and the group divider.
|
||||
/// optional avatar, title/subtitle column, trailing control, and group divider.
|
||||
class ExtensionRow extends StatelessWidget {
|
||||
const ExtensionRow({
|
||||
super.key,
|
||||
required this.avatar,
|
||||
this.avatar,
|
||||
required this.title,
|
||||
required this.subtitle,
|
||||
required this.showDivider,
|
||||
@@ -98,7 +98,7 @@ class ExtensionRow extends StatelessWidget {
|
||||
this.onTap,
|
||||
});
|
||||
|
||||
final Widget avatar;
|
||||
final Widget? avatar;
|
||||
|
||||
/// A widget rather than a string: the store row appends a version pill.
|
||||
final Widget title;
|
||||
@@ -125,8 +125,7 @@ class ExtensionRow extends StatelessWidget {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
avatar,
|
||||
SizedBox(width: tokens.gapLg),
|
||||
if (avatar != null) ...[avatar!, SizedBox(width: tokens.gapLg)],
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -152,8 +151,9 @@ class ExtensionRow extends StatelessWidget {
|
||||
Divider(
|
||||
height: 1,
|
||||
thickness: 1,
|
||||
// Aligns with the text column: avatar width + its trailing gap.
|
||||
indent: ExtensionAvatar.size + tokens.gapLg * 2,
|
||||
indent: avatar == null
|
||||
? tokens.gapLg
|
||||
: ExtensionAvatar.size + tokens.gapLg * 2,
|
||||
endIndent: tokens.gapLg,
|
||||
color: colorScheme.outlineVariant.withValues(alpha: 0.3),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user