mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: update recentViews list to only keep the first 20 items (#4512)
This commit is contained in:
parent
ed78cb4efc
commit
72a23bfe82
@ -25,9 +25,12 @@ class _MobileRecentFolderState extends State<MobileRecentFolder> {
|
|||||||
child: BlocBuilder<RecentViewsBloc, RecentViewsState>(
|
child: BlocBuilder<RecentViewsBloc, RecentViewsState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final ids = <String>{};
|
final ids = <String>{};
|
||||||
final List<ViewPB> recentViews = state.views.reversed.toList();
|
|
||||||
|
List<ViewPB> recentViews = state.views.reversed.toList();
|
||||||
recentViews.retainWhere((element) => ids.add(element.id));
|
recentViews.retainWhere((element) => ids.add(element.id));
|
||||||
// only keep the first 10 items.
|
|
||||||
|
// only keep the first 20 items.
|
||||||
|
recentViews = recentViews.take(20).toList();
|
||||||
|
|
||||||
if (recentViews.isEmpty) {
|
if (recentViews.isEmpty) {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user