Skip to content

Commit 0d5dec1

Browse files
committed
🚧 Update Tweet list.
1. Newest Tweet will show first in list.. 2.Newest Tweet will show first in list.
1 parent 1216630 commit 0d5dec1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/state/feedState.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ class FeedState extends AppState {
125125
_feedlist.add(model);
126126
}
127127
});
128+
/// Sort Tweet by time
129+
/// It helps to display newest Tweet first.
130+
_feedlist.sort((x,y) => DateTime.parse(x.createdAt).compareTo(DateTime.parse(y.createdAt)));
128131
}
129132
} else {
130133
_feedlist = null;
@@ -192,6 +195,9 @@ class FeedState extends AppState {
192195
}
193196
} else {}
194197
if (x == _tweetDetail.replyTweetKeyList.last) {
198+
/// Sort comment by time
199+
/// It helps to display newest Tweet first.
200+
_commentlist.sort((x,y) => DateTime.parse(y.createdAt).compareTo(DateTime.parse(x.createdAt)));
195201
tweetReplyMap.putIfAbsent(postID, () => _commentlist);
196202
notifyListeners();
197203
}

0 commit comments

Comments
 (0)