Browse Source

perf(neon_notes): do not use the spread operator for building lists

Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
pull/1094/head
Nikolas Rimikis 1 year ago
parent
commit
9b460d4b3a
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 3
      packages/neon/neon_news/lib/widgets/feeds_view.dart
  2. 8
      packages/neon/neon_notes/lib/dialogs/create_note.dart
  3. 4
      packages/neon/neon_notes/lib/dialogs/select_category.dart
  4. 18
      packages/neon/neon_notes/lib/widgets/notes_view.dart

3
packages/neon/neon_news/lib/widgets/feeds_view.dart

@ -57,13 +57,12 @@ class NewsFeedsView extends StatelessWidget {
value: NewsFeedAction.rename, value: NewsFeedAction.rename,
child: Text(NewsLocalizations.of(context).actionRename), child: Text(NewsLocalizations.of(context).actionRename),
), ),
if (folders.isNotEmpty) ...[ if (folders.isNotEmpty)
PopupMenuItem( PopupMenuItem(
value: NewsFeedAction.move, value: NewsFeedAction.move,
child: Text(NewsLocalizations.of(context).actionMove), child: Text(NewsLocalizations.of(context).actionMove),
), ),
], ],
],
onSelected: (final action) async { onSelected: (final action) async {
switch (action) { switch (action) {
case NewsFeedAction.showURL: case NewsFeedAction.showURL:

8
packages/neon/neon_notes/lib/dialogs/create_note.dart

@ -60,9 +60,11 @@ class _NotesCreateNoteDialogState extends State<NotesCreateNoteDialog> {
onRetry: widget.bloc.refresh, onRetry: widget.bloc.refresh,
), ),
), ),
if (widget.category == null && notes.isLoading) if (widget.category == null)
const Center( Center(
child: NeonLinearProgressIndicator(), child: NeonLinearProgressIndicator(
visible: notes.isLoading,
),
), ),
if (widget.category == null && notes.hasData) if (widget.category == null && notes.hasData)
NotesCategorySelect( NotesCategorySelect(

4
packages/neon/neon_notes/lib/dialogs/select_category.dart

@ -36,6 +36,7 @@ class _NotesSelectCategoryDialogState extends State<NotesSelectCategoryDialog> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
if (notes.hasError)
Center( Center(
child: NeonError( child: NeonError(
notes.error, notes.error,
@ -47,7 +48,7 @@ class _NotesSelectCategoryDialogState extends State<NotesSelectCategoryDialog> {
visible: notes.isLoading, visible: notes.isLoading,
), ),
), ),
if (notes.hasData) ...[ if (notes.hasData)
NotesCategorySelect( NotesCategorySelect(
categories: notes.requireData.map((final note) => note.category).toSet().toList(), categories: notes.requireData.map((final note) => note.category).toSet().toList(),
initialValue: widget.initialCategory, initialValue: widget.initialCategory,
@ -56,7 +57,6 @@ class _NotesSelectCategoryDialogState extends State<NotesSelectCategoryDialog> {
}, },
onSubmitted: submit, onSubmitted: submit,
), ),
],
ElevatedButton( ElevatedButton(
onPressed: submit, onPressed: submit,
child: Text(NotesLocalizations.of(context).noteSetCategory), child: Text(NotesLocalizations.of(context).noteSetCategory),

18
packages/neon/neon_notes/lib/widgets/notes_view.dart

@ -45,20 +45,20 @@ class NotesView extends StatelessWidget {
RelativeTime( RelativeTime(
date: DateTime.fromMillisecondsSinceEpoch(note.modified * 1000), date: DateTime.fromMillisecondsSinceEpoch(note.modified * 1000),
), ),
if (note.category.isNotEmpty) ...[ if (note.category.isNotEmpty)
const SizedBox( Padding(
width: 8, padding: const EdgeInsets.only(top: 8),
), child: Icon(
Icon(
MdiIcons.tag, MdiIcons.tag,
size: smallIconSize, size: smallIconSize,
color: NotesCategoryColor.compute(note.category), color: NotesCategoryColor.compute(note.category),
), ),
const SizedBox(
width: 2,
), ),
Text(note.category), if (note.category.isNotEmpty)
], Padding(
padding: const EdgeInsets.only(top: 2),
child: Text(note.category),
),
], ],
), ),
trailing: IconButton( trailing: IconButton(

Loading…
Cancel
Save