spotube/lib/components/Shared/SortTracksDropdown.dart
Kingkor Roy Tirtho 9eee573ce9 feat: initial platform_ui integration
What's changed:
- Sidebar
- Settings
- UserLibrary (root)
- Search (search field)
2022-10-29 14:23:17 +06:00

54 lines
1.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:platform_ui/platform_ui.dart';
import 'package:spotube/components/Library/UserLocalTracks.dart';
class SortTracksDropdown extends StatelessWidget {
final SortBy? value;
final void Function(SortBy)? onChanged;
const SortTracksDropdown({
this.onChanged,
this.value,
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return PlatformPopupMenuButton<SortBy>(
items: [
PlatformPopupMenuItem(
value: SortBy.none,
enabled: value != SortBy.none,
child: const Text("None"),
),
PlatformPopupMenuItem(
value: SortBy.ascending,
enabled: value != SortBy.ascending,
child: const Text("Sort by A-Z"),
),
PlatformPopupMenuItem(
value: SortBy.descending,
enabled: value != SortBy.descending,
child: const Text("Sort by Z-A"),
),
PlatformPopupMenuItem(
value: SortBy.dateAdded,
enabled: value != SortBy.dateAdded,
child: const Text("Sort by Date"),
),
PlatformPopupMenuItem(
value: SortBy.artist,
enabled: value != SortBy.artist,
child: const Text("Sort by Artist"),
),
PlatformPopupMenuItem(
value: SortBy.album,
enabled: value != SortBy.album,
child: const Text("Sort by Album"),
),
],
onSelected: onChanged,
child: const Icon(Icons.sort_rounded),
);
}
}