mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-17 08:15:09 +00:00
Merge pull request #745 from krille-chan/krille/hide-add-subspace-button-if-not-admin
chore: Follow up add chat subspace button
This commit is contained in:
commit
709e8c61af
1 changed files with 19 additions and 9 deletions
|
@ -264,6 +264,11 @@ class _SpaceViewState extends State<SpaceView> {
|
|||
Widget build(BuildContext context) {
|
||||
final client = Matrix.of(context).client;
|
||||
final activeSpaceId = widget.controller.activeSpaceId;
|
||||
final activeSpace = activeSpaceId == null
|
||||
? null
|
||||
: client.getRoomById(
|
||||
activeSpaceId,
|
||||
);
|
||||
final allSpaces = client.rooms.where((room) => room.isSpace);
|
||||
if (activeSpaceId == null) {
|
||||
final rootSpaces = allSpaces
|
||||
|
@ -446,17 +451,22 @@ class _SpaceViewState extends State<SpaceView> {
|
|||
),
|
||||
onTap: () => _onJoinSpaceChild(spaceChild),
|
||||
),
|
||||
Material(
|
||||
child: ListTile(
|
||||
leading: const CircleAvatar(
|
||||
child: Icon(Icons.group_add_outlined),
|
||||
if (activeSpace?.canChangeStateEvent(
|
||||
EventTypes.spaceChild,
|
||||
) ==
|
||||
true)
|
||||
Material(
|
||||
child: ListTile(
|
||||
leading: const CircleAvatar(
|
||||
child: Icon(Icons.group_add_outlined),
|
||||
),
|
||||
title:
|
||||
Text(L10n.of(context)!.addChatOrSubSpace),
|
||||
trailing:
|
||||
const Icon(Icons.chevron_right_outlined),
|
||||
onTap: _addChatOrSubSpace,
|
||||
),
|
||||
title: Text(L10n.of(context)!.addChatOrSubSpace),
|
||||
trailing:
|
||||
const Icon(Icons.chevron_right_outlined),
|
||||
onTap: _addChatOrSubSpace,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue