-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #411 from EgidioCaprino/search-filters
More search filters and channel videos sorting options
- Loading branch information
Showing
19 changed files
with
632 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
|
||
enum ChannelSortBy { | ||
newest, | ||
oldest, | ||
popular; | ||
|
||
String getLabel(AppLocalizations locals) { | ||
return switch (this) { | ||
(ChannelSortBy.newest) => locals.channelSortByNewest, | ||
(ChannelSortBy.oldest) => locals.channelSortByOldest, | ||
(ChannelSortBy.popular) => locals.channelSortByPopular, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
import 'package:invidious/channels/models/channel_sort_by.dart'; | ||
|
||
class SortDropdownButton extends StatelessWidget { | ||
final ChannelSortBy selectedSortingOption; | ||
final Function(ChannelSortBy) onChanged; | ||
|
||
const SortDropdownButton({ | ||
super.key, | ||
required this.selectedSortingOption, | ||
required this.onChanged, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final locals = AppLocalizations.of(context)!; | ||
return DropdownButton<ChannelSortBy>( | ||
value: selectedSortingOption, | ||
items: ChannelSortBy.values | ||
.map((value) => DropdownMenuItem<ChannelSortBy>( | ||
value: value, | ||
child: Text(value.getLabel(locals)), | ||
)) | ||
.toList(), | ||
onChanged: (ChannelSortBy? newValue) { | ||
onChanged(newValue ?? ChannelSortBy.newest); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
|
||
enum SearchDate { | ||
any, | ||
hour, | ||
today, | ||
week, | ||
month, | ||
year; | ||
|
||
String getLabel(AppLocalizations locals) { | ||
return switch (this) { | ||
(SearchDate.any) => locals.searchUploadDateAny, | ||
(SearchDate.hour) => locals.searchUploadDateHour, | ||
(SearchDate.today) => locals.searchUploadDateToday, | ||
(SearchDate.week) => locals.searchUploadDateWeek, | ||
(SearchDate.month) => locals.searchUploadDateMonth, | ||
(SearchDate.year) => locals.searchUploadDateYear, | ||
}; | ||
} | ||
} |
Oops, something went wrong.