chore: nicer bottom sheets

This commit is contained in:
krille-chan 2024-07-26 17:32:36 +02:00
commit d71d633cce
No known key found for this signature in database
4 changed files with 33 additions and 32 deletions

View file

@ -234,7 +234,7 @@ class UserBottomSheetController extends State<UserBottomSheet> {
void sendAction([_]) async {
final userId = widget.user?.id ?? widget.profile?.userId;
final client = Matrix.of(context).client;
final client = Matrix.of(widget.outerContext).client;
if (userId == null) throw ('user or profile must not be null!');
final input = sendController.text.trim();

View file

@ -207,6 +207,29 @@ class UserBottomSheetView extends StatelessWidget {
),
],
),
PresenceBuilder(
userId: userId,
client: client,
builder: (context, presence) {
final status = presence?.statusMsg;
if (status == null || status.isEmpty) {
return const SizedBox.shrink();
}
return ListTile(
title: SelectableLinkify(
text: status,
style: const TextStyle(fontSize: 16),
options: const LinkifyOptions(humanize: false),
linkStyle: const TextStyle(
color: Colors.blueAccent,
decorationColor: Colors.blueAccent,
),
onOpen: (url) =>
UrlLauncher(context, url.url).launchUrl(),
),
);
},
),
if (userId != client.userID)
Padding(
padding: const EdgeInsets.symmetric(
@ -250,29 +273,6 @@ class UserBottomSheetView extends StatelessWidget {
),
),
),
PresenceBuilder(
userId: userId,
client: client,
builder: (context, presence) {
final status = presence?.statusMsg;
if (status == null || status.isEmpty) {
return const SizedBox.shrink();
}
return ListTile(
title: SelectableLinkify(
text: status,
style: const TextStyle(fontSize: 16),
options: const LinkifyOptions(humanize: false),
linkStyle: const TextStyle(
color: Colors.blueAccent,
decorationColor: Colors.blueAccent,
),
onOpen: (url) =>
UrlLauncher(context, url.url).launchUrl(),
),
);
},
),
if (controller.widget.onMention != null)
ListTile(
leading: const Icon(Icons.alternate_email_outlined),