mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-30 05:12:00 +02:00
feat(material): unify search filters and extension actions
This commit is contained in:
@@ -6,6 +6,9 @@ import 'package:spotiflac_android/screens/track_history_snapshot.dart';
|
||||
import 'package:spotiflac_android/theme/app_tokens.dart';
|
||||
import 'package:spotiflac_android/theme/mornye_theme.dart';
|
||||
import 'package:spotiflac_android/widgets/app_switch.dart';
|
||||
import 'package:spotiflac_android/widgets/app_choice_chip.dart';
|
||||
import 'package:spotiflac_android/widgets/app_loading_indicator.dart';
|
||||
import 'package:spotiflac_android/widgets/expressive_button.dart';
|
||||
import 'package:spotiflac_android/theme/mornye_icons.dart';
|
||||
import 'package:spotiflac_android/widgets/mornye_chrome.dart';
|
||||
import 'package:spotiflac_android/widgets/mornye_artist_header.dart';
|
||||
|
||||
@@ -29,7 +29,7 @@ extension _HomeTabCsvImport on _HomeTabState {
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const CircularProgressIndicator(),
|
||||
const AppLoadingIndicator(),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
totalTracks > 0
|
||||
|
||||
@@ -226,10 +226,10 @@ extension _HomeTabSearchResultsUI on _HomeTabState {
|
||||
onTap: () => setSheetState(() => tempSort = option),
|
||||
);
|
||||
}
|
||||
return FilterChip(
|
||||
return AppChoiceChip(
|
||||
label: Text(_sortOptionLabel(option)),
|
||||
selected: tempSort == option,
|
||||
showCheckmark: false,
|
||||
singleChoice: true,
|
||||
onSelected: (_) =>
|
||||
setSheetState(() => tempSort = option),
|
||||
);
|
||||
@@ -238,7 +238,7 @@ extension _HomeTabSearchResultsUI on _HomeTabState {
|
||||
const SizedBox(height: 24),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: FilledButton(
|
||||
child: ExpressiveButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(ctx);
|
||||
if (_searchSortOption != tempSort) {
|
||||
@@ -731,12 +731,12 @@ extension _HomeTabSearchResultsUI on _HomeTabState {
|
||||
onTap: select,
|
||||
),
|
||||
)
|
||||
: FilterChip(
|
||||
: AppChoiceChip(
|
||||
label: Text(label),
|
||||
selected: selectedFilter == id,
|
||||
onSelected: (_) => select(),
|
||||
showCheckmark: false,
|
||||
avatar: icon == null ? null : Icon(icon, size: 18),
|
||||
singleChoice: true,
|
||||
icon: icon == null ? null : Icon(icon, size: 18),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,14 +34,7 @@ class _SearchProviderDropdown extends ConsumerWidget {
|
||||
height: 28,
|
||||
child: Center(
|
||||
child: isProviderLoading
|
||||
? SizedBox(
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: colorScheme.primary,
|
||||
),
|
||||
)
|
||||
? AppLoadingIndicator(size: 18, color: colorScheme.primary)
|
||||
: Icon(
|
||||
Icons.search_off,
|
||||
size: 20,
|
||||
|
||||
@@ -24,7 +24,6 @@ import 'package:spotiflac_android/l10n/l10n.dart';
|
||||
import 'package:spotiflac_android/utils/adaptive_layout.dart';
|
||||
import 'package:spotiflac_android/utils/audio_quality_badge_policy.dart';
|
||||
import 'package:spotiflac_android/utils/nav_bar_inset.dart';
|
||||
import 'package:spotiflac_android/widgets/settings_group.dart';
|
||||
import 'package:spotiflac_android/utils/file_access.dart';
|
||||
import 'package:spotiflac_android/utils/ordered_range_selection.dart';
|
||||
import 'package:spotiflac_android/models/download_item.dart';
|
||||
|
||||
@@ -137,15 +137,12 @@ class _FilterChip extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
return FilterChip(
|
||||
label: content,
|
||||
return AppChoiceChip(
|
||||
label: Text(label),
|
||||
count: count,
|
||||
singleChoice: true,
|
||||
selected: isSelected,
|
||||
onSelected: (_) => onTap(),
|
||||
showCheckmark: false,
|
||||
backgroundColor: settingsGroupColor(context),
|
||||
side: BorderSide(
|
||||
color: colorScheme.outlineVariant.withValues(alpha: 0.6),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+30
-13
@@ -20,6 +20,9 @@ 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/widgets/extension_repo_card.dart';
|
||||
import 'package:spotiflac_android/widgets/app_choice_chip.dart';
|
||||
import 'package:spotiflac_android/widgets/expressive_button.dart';
|
||||
import 'package:spotiflac_android/widgets/app_loading_indicator.dart';
|
||||
|
||||
class RepoTab extends ConsumerStatefulWidget {
|
||||
const RepoTab({super.key});
|
||||
@@ -703,18 +706,12 @@ class _CategoryChip extends ConsumerWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
return FilterChip(
|
||||
label: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [Icon(icon, size: 16), const SizedBox(width: 6), Text(label)],
|
||||
),
|
||||
return AppChoiceChip(
|
||||
label: Text(label),
|
||||
icon: Icon(icon, size: 18),
|
||||
singleChoice: true,
|
||||
selected: isSelected,
|
||||
onSelected: (_) => onTap(),
|
||||
showCheckmark: false,
|
||||
backgroundColor: settingsGroupColor(context),
|
||||
side: BorderSide(
|
||||
color: colorScheme.outlineVariant.withValues(alpha: 0.6),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -830,9 +827,29 @@ class _ExtensionItem extends StatelessWidget {
|
||||
trailing: Padding(
|
||||
padding: EdgeInsets.only(left: tokens.gapMd),
|
||||
child: isDownloading
|
||||
? const SizedBox.square(
|
||||
dimension: 24,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
? const AppLoadingIndicator(size: 24)
|
||||
: !context.isMornye
|
||||
? ExpressiveButton(
|
||||
onPressed: extension.hasUpdate
|
||||
? onUpdate
|
||||
: extension.isInstalled
|
||||
? null
|
||||
: onInstall,
|
||||
outlined: extension.isInstalled && !extension.hasUpdate,
|
||||
tonal: extension.hasUpdate,
|
||||
icon: extension.isInstalled && !extension.hasUpdate
|
||||
? const Icon(Icons.check, size: 16)
|
||||
: null,
|
||||
style: FilledButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
),
|
||||
child: Text(
|
||||
extension.hasUpdate
|
||||
? context.l10n.storeUpdate
|
||||
: extension.isInstalled
|
||||
? context.l10n.storeInstalled
|
||||
: context.l10n.storeInstall,
|
||||
),
|
||||
)
|
||||
: extension.hasUpdate
|
||||
? FilledButton.tonal(
|
||||
|
||||
@@ -2462,7 +2462,7 @@ class _EditMetadataSheetState extends State<_EditMetadataSheet> {
|
||||
}),
|
||||
);
|
||||
}
|
||||
return FilterChip(
|
||||
return AppChoiceChip(
|
||||
label: Text(_fieldLabel(key)),
|
||||
selected: selected,
|
||||
onSelected: _fetching
|
||||
@@ -2477,12 +2477,6 @@ class _EditMetadataSheetState extends State<_EditMetadataSheet> {
|
||||
}
|
||||
});
|
||||
},
|
||||
backgroundColor: cs.surfaceContainerHigh,
|
||||
selectedColor: cs.primaryContainer,
|
||||
checkmarkColor: cs.onPrimaryContainer,
|
||||
labelStyle: Theme.of(context).textTheme.labelMedium?.copyWith(
|
||||
color: selected ? cs.onPrimaryContainer : cs.onSurfaceVariant,
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:flutter/cupertino.dart'
|
||||
CupertinoTextField,
|
||||
CupertinoActivityIndicator;
|
||||
import 'package:spotiflac_android/widgets/app_action_button.dart';
|
||||
import 'package:spotiflac_android/widgets/app_choice_chip.dart';
|
||||
import 'package:spotiflac_android/widgets/app_switch.dart';
|
||||
import 'package:spotiflac_android/widgets/app_bottom_sheet.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
Reference in New Issue
Block a user