Add alphabetical sort toggle to puzzle openings screen#3045
Conversation
a80f135 to
5c64be3
Compare
|
Can you see why tests are failing @adharshio ? thanks! |
bb256b7 to
12c57f9
Compare
|
Hi @veloce, the test failures were due to stale generated files (tv_controller.freezed.dart). Running dart run build_runner build --delete-conflicting-outputs fixed it — all 814 tests pass locally now.i have pushed it now. |
|
hi @veloce . what do you think of this ? would love to have any suggestion ... |
|
@adharshio can we have a screen recording showing how this new feature works? Thanks. |
Veloce he included one here #3019 He just reopened as a new pr to clean up the commit history |
| final puzzleOpeningsProvider = FutureProvider.autoDispose<IList<PuzzleOpeningFamily>>((Ref ref) { | ||
| final puzzleOpeningsProvider = FutureProvider.autoDispose.family<IList<PuzzleOpeningFamily>, bool>(( | ||
| Ref ref, | ||
| bool alphabetical, |
There was a problem hiding this comment.
Instead of the boolean, I'd rather see an enum. It is a stronger type and clearer at the same time.
enum PuzzleOpeningSort { popular, alphabetical }| title: Text(context.l10n.puzzlePuzzlesByOpenings), | ||
| actions: [ | ||
| IconButton( | ||
| icon: Icon(isAlphabetical ? Icons.sort_by_alpha : Icons.trending_up), |
There was a problem hiding this comment.
The trending_up icon is not ideal here.
Instead of having 2 icons to represent which sorting is chosen, prefer having a unique Icons.sort_outlined that opens a context menu that allows you to choose between both sorting options.
See study_list_screen.dart for an example.
|
I am so sorry for the delay...will start this as soon as I can. |
Fixes lichess-org#2981 - Add sort toggle button in app bar (popular ↔ alphabetical) - Sort is done client-side as the server endpoint does not support order param - puzzleOpeningsProvider is now a family provider keyed by sort order - Both orders are cached separately for 1 day
0316a9f to
aea8f0e
Compare
|
replaced bool with enum PuzzleOpeningSort { popular, alphabetical and replaced with ContextMenuIconButton using Icons.sort_outlined that opens a context menu with both options. sorted_opening.mp4 |
Fixes #2981