Add local support to home tab

now user can select to display only local posts
This commit is contained in:
krawieck 2021-01-16 13:22:23 +01:00
parent 114a494d7e
commit 0602c2d7f7
1 changed files with 26 additions and 3 deletions

View File

@ -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}';