|
|
@ -15,30 +15,20 @@ class NotesView extends StatelessWidget { |
|
|
|
stream: bloc.notes, |
|
|
|
stream: bloc.notes, |
|
|
|
builder: (final context, final notes) => SortBoxBuilder<NotesSortProperty, NotesNote>( |
|
|
|
builder: (final context, final notes) => SortBoxBuilder<NotesSortProperty, NotesNote>( |
|
|
|
sortBox: notesSortBox, |
|
|
|
sortBox: notesSortBox, |
|
|
|
|
|
|
|
presort: const { |
|
|
|
|
|
|
|
(NotesSortProperty.favorite, SortBoxOrder.ascending), |
|
|
|
|
|
|
|
}, |
|
|
|
sortPropertyOption: bloc.options.notesSortPropertyOption, |
|
|
|
sortPropertyOption: bloc.options.notesSortPropertyOption, |
|
|
|
sortBoxOrderOption: bloc.options.notesSortBoxOrderOption, |
|
|
|
sortBoxOrderOption: bloc.options.notesSortBoxOrderOption, |
|
|
|
input: category != null |
|
|
|
input: category != null ? notes.data?.where((final note) => note.category == category).toList() : notes.data, |
|
|
|
? notes.data?.where((final note) => note.favorite && note.category == category).toList() |
|
|
|
builder: (final context, final sorted) => NeonListView<NotesNote>( |
|
|
|
: notes.data?.where((final note) => note.favorite).toList(), |
|
|
|
scrollKey: 'notes-notes', |
|
|
|
builder: (final context, final sortedFavorites) => SortBoxBuilder<NotesSortProperty, NotesNote>( |
|
|
|
withFloatingActionButton: true, |
|
|
|
sortBox: notesSortBox, |
|
|
|
items: sorted, |
|
|
|
sortPropertyOption: bloc.options.notesSortPropertyOption, |
|
|
|
isLoading: notes.isLoading, |
|
|
|
sortBoxOrderOption: bloc.options.notesSortBoxOrderOption, |
|
|
|
error: notes.error, |
|
|
|
input: category != null |
|
|
|
onRefresh: bloc.refresh, |
|
|
|
? notes.data?.where((final note) => !note.favorite && note.category == category).toList() |
|
|
|
builder: _buildNote, |
|
|
|
: notes.data?.where((final note) => !note.favorite).toList(), |
|
|
|
|
|
|
|
builder: (final context, final sortedNonFavorites) => NeonListView<NotesNote>( |
|
|
|
|
|
|
|
scrollKey: 'notes-notes', |
|
|
|
|
|
|
|
withFloatingActionButton: true, |
|
|
|
|
|
|
|
items: [ |
|
|
|
|
|
|
|
...sortedFavorites, |
|
|
|
|
|
|
|
...sortedNonFavorites, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
isLoading: notes.isLoading, |
|
|
|
|
|
|
|
error: notes.error, |
|
|
|
|
|
|
|
onRefresh: bloc.refresh, |
|
|
|
|
|
|
|
builder: _buildNote, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|