mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 14:59:29 +01:00
chore: Follow up add backbutton support
This commit is contained in:
parent
ed2eddd601
commit
dc0f067b0a
@ -2942,5 +2942,12 @@
|
||||
"enterRoom": "Enter room",
|
||||
"@enterRoom": {},
|
||||
"allSpaces": "All spaces",
|
||||
"@allSpaces": {}
|
||||
"@allSpaces": {},
|
||||
"numChats": "{number} chats",
|
||||
"@numChats": {
|
||||
"type": "number",
|
||||
"placeholders": {
|
||||
"number": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,8 +56,20 @@ class ChatListView extends StatelessWidget {
|
||||
return VWidgetGuard(
|
||||
onSystemPop: (redirector) async {
|
||||
final selMode = controller.selectMode;
|
||||
if (selMode != SelectMode.normal) controller.cancelAction();
|
||||
if (selMode == SelectMode.select) redirector.stopRedirection();
|
||||
if (selMode != SelectMode.normal) {
|
||||
controller.cancelAction();
|
||||
redirector.stopRedirection();
|
||||
return;
|
||||
}
|
||||
if (controller.activeFilter !=
|
||||
(AppConfig.separateChatTypes
|
||||
? ActiveFilter.messages
|
||||
: ActiveFilter.allChats)) {
|
||||
controller
|
||||
.onDestinationSelected(AppConfig.separateChatTypes ? 1 : 0);
|
||||
redirector.stopRedirection();
|
||||
return;
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
|
@ -148,7 +148,9 @@ class _SpaceViewState extends State<SpaceView> {
|
||||
return ListView.builder(
|
||||
itemCount: rootSpaces.length,
|
||||
controller: widget.scrollController,
|
||||
itemBuilder: (context, i) => ListTile(
|
||||
itemBuilder: (context, i) => Material(
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: ListTile(
|
||||
leading: Avatar(
|
||||
mxContent: rootSpaces[i].avatar,
|
||||
name: rootSpaces[i].displayname,
|
||||
@ -158,11 +160,13 @@ class _SpaceViewState extends State<SpaceView> {
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
subtitle: Text('${rootSpaces[i].spaceChildren.length} Chats'),
|
||||
subtitle: Text(L10n.of(context)!
|
||||
.numChats(rootSpaces[i].spaceChildren.length.toString())),
|
||||
onTap: () => widget.controller.setActiveSpace(rootSpaces[i].id),
|
||||
onLongPress: () => _onSpaceChildContextMenu(null, rootSpaces[i]),
|
||||
trailing: const Icon(Icons.chevron_right_outlined),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return FutureBuilder<GetSpaceHierarchyResponse>(
|
||||
@ -193,7 +197,15 @@ class _SpaceViewState extends State<SpaceView> {
|
||||
.any((child) => child.roomId == activeSpaceId));
|
||||
final spaceChildren = response.rooms;
|
||||
final canLoadMore = response.nextBatch != null;
|
||||
return ListView.builder(
|
||||
return VWidgetGuard(
|
||||
onSystemPop: (redirector) async {
|
||||
if (parentSpace != null) {
|
||||
widget.controller.setActiveSpace(parentSpace.id);
|
||||
redirector.stopRedirection();
|
||||
return;
|
||||
}
|
||||
},
|
||||
child: ListView.builder(
|
||||
itemCount: spaceChildren.length + 1 + (canLoadMore ? 1 : 0),
|
||||
controller: widget.scrollController,
|
||||
itemBuilder: (context, i) {
|
||||
@ -239,12 +251,14 @@ class _SpaceViewState extends State<SpaceView> {
|
||||
);
|
||||
}
|
||||
final isSpace = spaceChild.roomType == 'm.space';
|
||||
final topic =
|
||||
spaceChild.topic?.isEmpty ?? true ? null : spaceChild.topic;
|
||||
final topic = spaceChild.topic?.isEmpty ?? true
|
||||
? null
|
||||
: spaceChild.topic;
|
||||
if (spaceChild.roomId == activeSpaceId) {
|
||||
return SearchTitle(
|
||||
title:
|
||||
spaceChild.name ?? spaceChild.canonicalAlias ?? 'Space',
|
||||
title: spaceChild.name ??
|
||||
spaceChild.canonicalAlias ??
|
||||
'Space',
|
||||
icon: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Avatar(
|
||||
@ -295,7 +309,8 @@ class _SpaceViewState extends State<SpaceView> {
|
||||
],
|
||||
),
|
||||
onTap: () => _onJoinSpaceChild(spaceChild),
|
||||
onLongPress: () => _onSpaceChildContextMenu(spaceChild, room),
|
||||
onLongPress: () =>
|
||||
_onSpaceChildContextMenu(spaceChild, room),
|
||||
subtitle: Text(
|
||||
topic ??
|
||||
(isSpace
|
||||
@ -305,10 +320,12 @@ class _SpaceViewState extends State<SpaceView> {
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onBackground),
|
||||
),
|
||||
trailing:
|
||||
isSpace ? const Icon(Icons.chevron_right_outlined) : null,
|
||||
trailing: isSpace
|
||||
? const Icon(Icons.chevron_right_outlined)
|
||||
: null,
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user