feat: Show/hide third column in chat view

This commit is contained in:
krille-chan 2024-04-07 10:30:21 +02:00
commit 02ceddf9e8
No known key found for this signature in database
5 changed files with 93 additions and 52 deletions

View file

@ -22,10 +22,12 @@ enum AliasActions { copy, delete, setCanonical }
class ChatDetails extends StatefulWidget {
final String roomId;
final Widget? embeddedCloseButton;
const ChatDetails({
super.key,
required this.roomId,
this.embeddedCloseButton,
});
@override

View file

@ -35,8 +35,6 @@ class ChatDetailsView extends StatelessWidget {
);
}
final isEmbedded = GoRouterState.of(context).fullPath == '/rooms/:roomid';
return StreamBuilder(
stream: room.onUpdate.stream,
builder: (context, snapshot) {
@ -51,29 +49,28 @@ class ChatDetailsView extends StatelessWidget {
MatrixLocals(L10n.of(context)!),
);
return Scaffold(
appBar: isEmbedded
? null
: AppBar(
leading: const Center(child: BackButton()),
elevation: Theme.of(context).appBarTheme.elevation,
actions: <Widget>[
if (room.canonicalAlias.isNotEmpty)
IconButton(
tooltip: L10n.of(context)!.share,
icon: Icon(Icons.adaptive.share_outlined),
onPressed: () => FluffyShare.share(
L10n.of(context)!.youInvitedToBy(
AppConfig.inviteLinkPrefix + room.canonicalAlias,
),
context,
),
),
ChatSettingsPopupMenu(room, false),
],
title: Text(L10n.of(context)!.chatDetails),
backgroundColor:
Theme.of(context).appBarTheme.backgroundColor,
appBar: AppBar(
leading: controller.widget.embeddedCloseButton ??
const Center(child: BackButton()),
elevation: Theme.of(context).appBarTheme.elevation,
actions: <Widget>[
if (room.canonicalAlias.isNotEmpty)
IconButton(
tooltip: L10n.of(context)!.share,
icon: Icon(Icons.adaptive.share_outlined),
onPressed: () => FluffyShare.share(
L10n.of(context)!.youInvitedToBy(
AppConfig.inviteLinkPrefix + room.canonicalAlias,
),
context,
),
),
if (controller.widget.embeddedCloseButton == null)
ChatSettingsPopupMenu(room, false),
],
title: Text(L10n.of(context)!.chatDetails),
backgroundColor: Theme.of(context).appBarTheme.backgroundColor,
),
body: MaxWidthBody(
child: ListView.builder(
physics: const NeverScrollableScrollPhysics(),
@ -106,7 +103,9 @@ class ChatDetailsView extends StatelessWidget {
),
),
child: Hero(
tag: isEmbedded
tag: controller
.widget.embeddedCloseButton !=
null
? 'embedded_content_banner'
: 'content_banner',
child: Avatar(