From 0602c2d7f72938063683073727833d328f982ea4 Mon Sep 17 00:00:00 2001 From: krawieck Date: Sat, 16 Jan 2021 13:22:23 +0100 Subject: [PATCH] Add local support to home tab now user can select to display only local posts --- lib/pages/home_tab.dart | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/pages/home_tab.dart b/lib/pages/home_tab.dart index 3c8902d..7a12fb3 100644 --- a/lib/pages/home_tab.dart +++ b/lib/pages/home_tab.dart @@ -67,6 +67,12 @@ class HomeTab extends HookWidget { onTap: () => pop(const _SelectedList( listingType: PostListingType.subscribed)), ), + ListTile( + title: const Text('Local'), + leading: const SizedBox(width: 20, height: 20), + onTap: () => pop( + const _SelectedList(listingType: PostListingType.local)), + ), ListTile( title: const Text('All'), leading: const SizedBox(width: 20, height: 20), @@ -125,6 +131,14 @@ class HomeTab extends HookWidget { )), leading: const SizedBox(width: 20), ), + ListTile( + title: const Text('Local'), + onTap: () => pop(_SelectedList( + listingType: PostListingType.local, + instanceHost: instance, + )), + leading: const SizedBox(width: 20), + ), ListTile( title: const Text('All'), onTap: () => pop(_SelectedList( @@ -146,9 +160,18 @@ class HomeTab extends HookWidget { } final title = () { - final first = selectedList.value.listingType == PostListingType.subscribed - ? 'Subscribed' - : 'All'; + final first = () { + switch (selectedList.value.listingType) { + case PostListingType.all: + return 'All'; + case PostListingType.local: + return 'Local'; + case PostListingType.subscribed: + return 'Subscribed'; + default: + throw 'ERROR'; + } + }(); final last = selectedList.value.instanceHost == null ? '' : '@${selectedList.value.instanceHost}';