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. 14
      packages/neon/neon_notes/lib/dialogs/select_category.dart
  4. 24
      packages/neon/neon_notes/lib/widgets/notes_view.dart

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

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

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

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

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

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

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

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

Loading…
Cancel
Save