mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
105 lines
3.1 KiB
Dart
105 lines
3.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:spotube/collections/spotube_icons.dart';
|
|
import 'package:spotube/components/library/user_local_tracks.dart';
|
|
import 'package:spotube/components/shared/adaptive/adaptive_pop_sheet_list.dart';
|
|
import 'package:spotube/extensions/context.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) {
|
|
var theme = Theme.of(context);
|
|
return ListTileTheme(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: AdaptivePopSheetList<SortBy>(
|
|
children: [
|
|
PopSheetEntry(
|
|
value: SortBy.none,
|
|
enabled: value != SortBy.none,
|
|
child: ListTile(
|
|
enabled: value != SortBy.none,
|
|
title: Text(context.l10n.none),
|
|
),
|
|
),
|
|
PopSheetEntry(
|
|
value: SortBy.ascending,
|
|
enabled: value != SortBy.ascending,
|
|
child: ListTile(
|
|
enabled: value != SortBy.ascending,
|
|
title: Text(context.l10n.sort_a_z),
|
|
),
|
|
),
|
|
PopSheetEntry(
|
|
value: SortBy.descending,
|
|
enabled: value != SortBy.descending,
|
|
child: ListTile(
|
|
enabled: value != SortBy.descending,
|
|
title: Text(context.l10n.sort_z_a),
|
|
),
|
|
),
|
|
PopSheetEntry(
|
|
value: SortBy.newest,
|
|
enabled: value != SortBy.newest,
|
|
child: ListTile(
|
|
enabled: value != SortBy.newest,
|
|
title: Text(context.l10n.sort_newest),
|
|
),
|
|
),
|
|
PopSheetEntry(
|
|
value: SortBy.oldest,
|
|
enabled: value != SortBy.oldest,
|
|
child: ListTile(
|
|
enabled: value != SortBy.oldest,
|
|
title: Text(context.l10n.sort_oldest),
|
|
),
|
|
),
|
|
PopSheetEntry(
|
|
value: SortBy.artist,
|
|
enabled: value != SortBy.artist,
|
|
child: ListTile(
|
|
enabled: value != SortBy.artist,
|
|
title: Text(context.l10n.sort_artist),
|
|
),
|
|
),
|
|
PopSheetEntry(
|
|
value: SortBy.album,
|
|
enabled: value != SortBy.album,
|
|
child: ListTile(
|
|
enabled: value != SortBy.album,
|
|
title: Text(context.l10n.sort_album),
|
|
),
|
|
),
|
|
],
|
|
headings: [
|
|
Text(context.l10n.sort_tracks),
|
|
],
|
|
onSelected: onChanged,
|
|
tooltip: context.l10n.sort_tracks,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
|
|
child: DefaultTextStyle(
|
|
style: theme.textTheme.titleSmall!,
|
|
child: Row(
|
|
children: [
|
|
const Icon(SpotubeIcons.sort),
|
|
const SizedBox(width: 8),
|
|
Text(context.l10n.sort_tracks),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|