Integrate defaultListingType
This commit is contained in:
parent
270702192e
commit
fa7effcb4b
|
@ -25,10 +25,13 @@ class HomeTab extends HookWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final accStore = useAccountsStore();
|
||||
final defaultListingType =
|
||||
useConfigStoreSelect((configStore) => configStore.defaultListingType);
|
||||
final selectedList = useState(_SelectedList(
|
||||
listingType: accStore.hasNoAccount
|
||||
listingType: accStore.hasNoAccount &&
|
||||
defaultListingType == PostListingType.subscribed
|
||||
? PostListingType.all
|
||||
: PostListingType.subscribed));
|
||||
: defaultListingType));
|
||||
final isc = useInfiniteScrollController();
|
||||
final theme = Theme.of(context);
|
||||
final instancesIcons = useMemoFuture(() async {
|
||||
|
@ -54,9 +57,10 @@ class HomeTab extends HookWidget {
|
|||
selectedList.value.listingType == PostListingType.subscribed ||
|
||||
!accStore.instances.contains(selectedList.value.instanceHost)) {
|
||||
selectedList.value = _SelectedList(
|
||||
listingType: accStore.hasNoAccount
|
||||
listingType: accStore.hasNoAccount &&
|
||||
defaultListingType == PostListingType.subscribed
|
||||
? PostListingType.all
|
||||
: PostListingType.subscribed,
|
||||
: defaultListingType,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -144,6 +144,5 @@ class ConfigStore extends ChangeNotifier {
|
|||
|
||||
SortType _sortTypeFromJson(String? json) =>
|
||||
json != null ? SortType.fromJson(json) : SortType.hot;
|
||||
// String _sortType
|
||||
PostListingType _postListingTypeFromJson(String? json) =>
|
||||
json != null ? PostListingType.fromJson(json) : PostListingType.all;
|
||||
|
|
Loading…
Reference in New Issue