Skip to content

Commit bd7b2ba

Browse files
committed
Fix notes ordering after unpinned note modification
1 parent 532ba44 commit bd7b2ba

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

note_app/lib/model/NotesList.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class NotesList extends ChangeNotifier {
5959
for (int i = 0; i < notes.length; i++) {
6060
if (notes[i].id == modifiedNote.id) {
6161
notes.removeAt(i);
62-
notes.insert(0, modifiedNote);
62+
notes.insert(nbPinned, modifiedNote);
6363
if (!modifiedNote.pinned) {
6464
ordering.moveTo(modifiedNote.id, nbPinned);
6565
}
@@ -88,9 +88,9 @@ class NotesList extends ChangeNotifier {
8888
for (int i = 0; i < notes.length; i++) {
8989
if (notes[i].id == unpinnedNote.id) {
9090
notes.removeAt(i);
91+
nbPinned--;
9192
notes.insert(nbPinned, unpinnedNote);
9293
ordering.moveTo(unpinnedNote.id, nbPinned);
93-
nbPinned--;
9494
DatabaseHelper.writeNote(unpinnedNote, ordering);
9595
notifyListeners();
9696
return;

note_app/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1515
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
1616
# Read more about iOS versioning at
1717
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18-
version: 2.0.3+7
18+
version: 2.1.0+8
1919

2020
environment:
2121
sdk: ">=2.12.0 <3.0.0"

0 commit comments

Comments
 (0)