go to instance/community
This commit is contained in:
parent
d3f0dd3fd4
commit
e879a17948
|
@ -10,6 +10,7 @@ import '../hooks/delayed_loading.dart';
|
||||||
import '../hooks/memo_future.dart';
|
import '../hooks/memo_future.dart';
|
||||||
import '../hooks/stores.dart';
|
import '../hooks/stores.dart';
|
||||||
import '../util/extensions/iterators.dart';
|
import '../util/extensions/iterators.dart';
|
||||||
|
import '../util/goto.dart';
|
||||||
import '../util/text_color.dart';
|
import '../util/text_color.dart';
|
||||||
|
|
||||||
class CommunitiesTab extends HookWidget {
|
class CommunitiesTab extends HookWidget {
|
||||||
|
@ -26,6 +27,7 @@ class CommunitiesTab extends HookWidget {
|
||||||
useMemoized(() => accountsStore.loggedInInstances.length);
|
useMemoized(() => accountsStore.loggedInInstances.length);
|
||||||
final isCollapsed = useState(List.filled(amountOfDisplayInstances, false));
|
final isCollapsed = useState(List.filled(amountOfDisplayInstances, false));
|
||||||
|
|
||||||
|
// TODO: rebuild when instances/accounts change
|
||||||
final instancesSnap = useMemoFuture(() {
|
final instancesSnap = useMemoFuture(() {
|
||||||
final futures = accountsStore.loggedInInstances
|
final futures = accountsStore.loggedInInstances
|
||||||
.map(
|
.map(
|
||||||
|
@ -112,7 +114,6 @@ class CommunitiesTab extends HookWidget {
|
||||||
toggleCollapse(int i) => isCollapsed.value =
|
toggleCollapse(int i) => isCollapsed.value =
|
||||||
isCollapsed.value.mapWithIndex((e, j) => j == i ? !e : e).toList();
|
isCollapsed.value.mapWithIndex((e, j) => j == i ? !e : e).toList();
|
||||||
|
|
||||||
// TODO: add observer
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
actions: [
|
actions: [
|
||||||
|
@ -138,7 +139,8 @@ class CommunitiesTab extends HookWidget {
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () {}, // TODO: open instance
|
onTap: () => goToInstance(
|
||||||
|
context, accountsStore.loggedInInstances.elementAt(i)),
|
||||||
onLongPress: () => toggleCollapse(i),
|
onLongPress: () => toggleCollapse(i),
|
||||||
leading: instances[i].icon != null
|
leading: instances[i].icon != null
|
||||||
? CachedNetworkImage(
|
? CachedNetworkImage(
|
||||||
|
@ -171,7 +173,10 @@ class CommunitiesTab extends HookWidget {
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 17),
|
padding: const EdgeInsets.only(left: 17),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
onTap: () {}, // TODO: open community
|
onTap: () => goToCommunity.byId(
|
||||||
|
context,
|
||||||
|
accountsStore.loggedInInstances.elementAt(i),
|
||||||
|
comm.communityId),
|
||||||
dense: true,
|
dense: true,
|
||||||
leading: VerticalDivider(
|
leading: VerticalDivider(
|
||||||
color: theme.hintColor,
|
color: theme.hintColor,
|
||||||
|
|
Loading…
Reference in New Issue