refactor: Move public room bottom sheet into dialog
Signed-off-by: Krille <c.kussowski@famedly.com>
This commit is contained in:
parent
5e7b0bf724
commit
c01e4ba797
8 changed files with 336 additions and 115 deletions
|
|
@ -3212,5 +3212,7 @@
|
||||||
"optionalMessage": "(Optional) message...",
|
"optionalMessage": "(Optional) message...",
|
||||||
"notSupportedOnThisDevice": "Not supported on this device",
|
"notSupportedOnThisDevice": "Not supported on this device",
|
||||||
"enterNewChat": "Enter new chat",
|
"enterNewChat": "Enter new chat",
|
||||||
"approve": "Approve"
|
"approve": "Approve",
|
||||||
|
"youHaveKnocked": "You have knocked",
|
||||||
|
"pleaseWaitUntilInvited": "Please wait now, until someone from the room invites you."
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,9 @@ import 'package:fluffychat/pages/chat_list/dummy_chat_list_item.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/search_title.dart';
|
import 'package:fluffychat/pages/chat_list/search_title.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/space_view.dart';
|
import 'package:fluffychat/pages/chat_list/space_view.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/status_msg_list.dart';
|
import 'package:fluffychat/pages/chat_list/status_msg_list.dart';
|
||||||
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
|
|
||||||
import 'package:fluffychat/utils/stream_extension.dart';
|
import 'package:fluffychat/utils/stream_extension.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/public_room_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/public_room_bottom_sheet.dart';
|
|
||||||
import '../../config/themes.dart';
|
import '../../config/themes.dart';
|
||||||
import '../../widgets/adaptive_dialogs/user_dialog.dart';
|
import '../../widgets/adaptive_dialogs/user_dialog.dart';
|
||||||
import '../../widgets/matrix.dart';
|
import '../../widgets/matrix.dart';
|
||||||
|
|
@ -302,12 +301,11 @@ class PublicRoomsHorizontalList extends StatelessWidget {
|
||||||
publicRooms[i].canonicalAlias?.localpart ??
|
publicRooms[i].canonicalAlias?.localpart ??
|
||||||
L10n.of(context).group,
|
L10n.of(context).group,
|
||||||
avatar: publicRooms[i].avatarUrl,
|
avatar: publicRooms[i].avatarUrl,
|
||||||
onPressed: () => showAdaptiveBottomSheet(
|
onPressed: () => showAdaptiveDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (c) => PublicRoomBottomSheet(
|
builder: (c) => PublicRoomDialog(
|
||||||
roomAlias:
|
roomAlias:
|
||||||
publicRooms[i].canonicalAlias ?? publicRooms[i].roomId,
|
publicRooms[i].canonicalAlias ?? publicRooms[i].roomId,
|
||||||
outerContext: context,
|
|
||||||
chunk: publicRooms[i],
|
chunk: publicRooms[i],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -10,16 +10,15 @@ import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/config/themes.dart';
|
import 'package:fluffychat/config/themes.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/chat_list_item.dart';
|
import 'package:fluffychat/pages/chat_list/chat_list_item.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/search_title.dart';
|
import 'package:fluffychat/pages/chat_list/search_title.dart';
|
||||||
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
|
|
||||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||||
import 'package:fluffychat/utils/stream_extension.dart';
|
import 'package:fluffychat/utils/stream_extension.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/public_room_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/adaptive_dialogs/show_modal_action_popup.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_modal_action_popup.dart';
|
||||||
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/adaptive_dialogs/show_text_input_dialog.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_text_input_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import 'package:fluffychat/widgets/public_room_bottom_sheet.dart';
|
|
||||||
|
|
||||||
enum AddRoomType { chat, subspace }
|
enum AddRoomType { chat, subspace }
|
||||||
|
|
||||||
|
|
@ -100,10 +99,9 @@ class _SpaceViewState extends State<SpaceView> {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
final space = client.getRoomById(widget.spaceId);
|
final space = client.getRoomById(widget.spaceId);
|
||||||
|
|
||||||
final joined = await showAdaptiveBottomSheet<bool>(
|
final joined = await showAdaptiveDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => PublicRoomBottomSheet(
|
builder: (_) => PublicRoomDialog(
|
||||||
outerContext: context,
|
|
||||||
chunk: item,
|
chunk: item,
|
||||||
via: space?.spaceChildren
|
via: space?.spaceChildren
|
||||||
.firstWhereOrNull(
|
.firstWhereOrNull(
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,11 @@ import 'package:punycode/punycode.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/config/app_config.dart';
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
|
|
||||||
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/adaptive_dialogs/user_dialog.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/user_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import 'package:fluffychat/widgets/public_room_bottom_sheet.dart';
|
import '../widgets/adaptive_dialogs/public_room_dialog.dart';
|
||||||
import 'platform_infos.dart';
|
import 'platform_infos.dart';
|
||||||
|
|
||||||
class UrlLauncher {
|
class UrlLauncher {
|
||||||
|
|
@ -179,11 +178,10 @@ class UrlLauncher {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
await showAdaptiveBottomSheet(
|
await showAdaptiveDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (c) => PublicRoomBottomSheet(
|
builder: (c) => PublicRoomDialog(
|
||||||
roomAlias: identityParts.primaryIdentifier,
|
roomAlias: identityParts.primaryIdentifier,
|
||||||
outerContext: context,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
228
lib/widgets/adaptive_dialogs/public_room_dialog.dart
Normal file
228
lib/widgets/adaptive_dialogs/public_room_dialog.dart
Normal file
|
|
@ -0,0 +1,228 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
import 'package:flutter_linkify/flutter_linkify.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
|
import '../../config/themes.dart';
|
||||||
|
import '../../utils/url_launcher.dart';
|
||||||
|
import '../avatar.dart';
|
||||||
|
import '../future_loading_dialog.dart';
|
||||||
|
import '../hover_builder.dart';
|
||||||
|
import '../matrix.dart';
|
||||||
|
import '../mxc_image_viewer.dart';
|
||||||
|
import 'adaptive_dialog_action.dart';
|
||||||
|
|
||||||
|
class PublicRoomDialog extends StatelessWidget {
|
||||||
|
final String? roomAlias;
|
||||||
|
final PublicRoomsChunk? chunk;
|
||||||
|
final List<String>? via;
|
||||||
|
|
||||||
|
const PublicRoomDialog({super.key, this.roomAlias, this.chunk, this.via});
|
||||||
|
|
||||||
|
void _joinRoom(BuildContext context) async {
|
||||||
|
final client = Matrix.of(context).client;
|
||||||
|
final chunk = this.chunk;
|
||||||
|
final knock = chunk?.joinRule == 'knock';
|
||||||
|
final result = await showFutureLoadingDialog<String>(
|
||||||
|
context: context,
|
||||||
|
future: () async {
|
||||||
|
if (chunk != null && client.getRoomById(chunk.roomId) != null) {
|
||||||
|
return chunk.roomId;
|
||||||
|
}
|
||||||
|
final roomId = chunk != null && knock
|
||||||
|
? await client.knockRoom(chunk.roomId, via: via)
|
||||||
|
: await client.joinRoom(
|
||||||
|
roomAlias ?? chunk!.roomId,
|
||||||
|
via: via,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!knock && client.getRoomById(roomId) == null) {
|
||||||
|
await client.waitForRoomInSync(roomId);
|
||||||
|
}
|
||||||
|
return roomId;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
final roomId = result.result;
|
||||||
|
if (roomId == null) return;
|
||||||
|
if (knock && client.getRoomById(roomId) == null) {
|
||||||
|
Navigator.of(context).pop<bool>(true);
|
||||||
|
await showOkAlertDialog(
|
||||||
|
context: context,
|
||||||
|
title: L10n.of(context).youHaveKnocked,
|
||||||
|
message: L10n.of(context).pleaseWaitUntilInvited,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (result.error != null) return;
|
||||||
|
if (!context.mounted) return;
|
||||||
|
Navigator.of(context).pop<bool>(true);
|
||||||
|
// don't open the room if the joined room is a space
|
||||||
|
if (chunk?.roomType != 'm.space' &&
|
||||||
|
!client.getRoomById(result.result!)!.isSpace) {
|
||||||
|
context.go('/rooms/$roomId');
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _testRoom(PublicRoomsChunk r) => r.canonicalAlias == roomAlias;
|
||||||
|
|
||||||
|
Future<PublicRoomsChunk> _search(BuildContext context) async {
|
||||||
|
final chunk = this.chunk;
|
||||||
|
if (chunk != null) return chunk;
|
||||||
|
final query = await Matrix.of(context).client.queryPublicRooms(
|
||||||
|
server: roomAlias!.domain,
|
||||||
|
filter: PublicRoomQueryFilter(
|
||||||
|
genericSearchTerm: roomAlias,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (!query.chunk.any(_testRoom)) {
|
||||||
|
throw (L10n.of(context).noRoomsFound);
|
||||||
|
}
|
||||||
|
return query.chunk.firstWhere(_testRoom);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final roomAlias = this.roomAlias ?? chunk?.canonicalAlias;
|
||||||
|
final roomLink = roomAlias ?? chunk?.roomId;
|
||||||
|
var copied = false;
|
||||||
|
return AlertDialog.adaptive(
|
||||||
|
title: ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(maxWidth: 256),
|
||||||
|
child: Text(
|
||||||
|
chunk?.name ?? roomAlias ?? chunk?.roomId ?? 'Unknown',
|
||||||
|
overflow: TextOverflow.fade,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
content: ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(maxWidth: 256, maxHeight: 256),
|
||||||
|
child: FutureBuilder<PublicRoomsChunk>(
|
||||||
|
future: _search(context),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
final theme = Theme.of(context);
|
||||||
|
|
||||||
|
final profile = snapshot.data;
|
||||||
|
final avatar = profile?.avatarUrl;
|
||||||
|
final topic = profile?.topic;
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
spacing: 8,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: [
|
||||||
|
if (roomLink != null)
|
||||||
|
HoverBuilder(
|
||||||
|
builder: (context, hovered) => StatefulBuilder(
|
||||||
|
builder: (context, setState) => MouseRegion(
|
||||||
|
cursor: SystemMouseCursors.click,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Clipboard.setData(
|
||||||
|
ClipboardData(text: roomLink),
|
||||||
|
);
|
||||||
|
setState(() {
|
||||||
|
copied = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
children: [
|
||||||
|
WidgetSpan(
|
||||||
|
child: Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(right: 4.0),
|
||||||
|
child: AnimatedScale(
|
||||||
|
duration:
|
||||||
|
FluffyThemes.animationDuration,
|
||||||
|
curve: FluffyThemes.animationCurve,
|
||||||
|
scale: hovered
|
||||||
|
? 1.33
|
||||||
|
: copied
|
||||||
|
? 1.25
|
||||||
|
: 1.0,
|
||||||
|
child: Icon(
|
||||||
|
copied
|
||||||
|
? Icons.check_circle
|
||||||
|
: Icons.copy,
|
||||||
|
size: 12,
|
||||||
|
color: copied ? Colors.green : null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextSpan(text: roomLink),
|
||||||
|
],
|
||||||
|
style: theme.textTheme.bodyMedium
|
||||||
|
?.copyWith(fontSize: 10),
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Center(
|
||||||
|
child: Avatar(
|
||||||
|
mxContent: avatar,
|
||||||
|
name: profile?.name ?? roomLink,
|
||||||
|
size: Avatar.defaultSize * 2,
|
||||||
|
onTap: avatar != null
|
||||||
|
? () => showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (_) => MxcImageViewer(avatar),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
L10n.of(context).countParticipants(
|
||||||
|
profile?.numJoinedMembers ?? 0,
|
||||||
|
),
|
||||||
|
style: const TextStyle(fontSize: 10),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
if (topic != null && topic.isNotEmpty)
|
||||||
|
SelectableLinkify(
|
||||||
|
text: topic,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
options: const LinkifyOptions(humanize: false),
|
||||||
|
linkStyle: TextStyle(
|
||||||
|
color: theme.colorScheme.primary,
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
decorationColor: theme.colorScheme.primary,
|
||||||
|
),
|
||||||
|
onOpen: (url) =>
|
||||||
|
UrlLauncher(context, url.url).launchUrl(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
AdaptiveDialogAction(
|
||||||
|
bigButtons: true,
|
||||||
|
onPressed: () => _joinRoom(context),
|
||||||
|
child: Text(
|
||||||
|
chunk?.joinRule == 'knock' &&
|
||||||
|
Matrix.of(context).client.getRoomById(chunk!.roomId) == null
|
||||||
|
? L10n.of(context).knock
|
||||||
|
: chunk?.roomType == 'm.space'
|
||||||
|
? L10n.of(context).joinSpace
|
||||||
|
: L10n.of(context).joinRoom,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
AdaptiveDialogAction(
|
||||||
|
bigButtons: true,
|
||||||
|
onPressed: Navigator.of(context).pop,
|
||||||
|
child: Text(L10n.of(context).close),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -54,114 +54,110 @@ class UserDialog extends StatelessWidget {
|
||||||
),
|
),
|
||||||
content: ConstrainedBox(
|
content: ConstrainedBox(
|
||||||
constraints: const BoxConstraints(maxWidth: 256, maxHeight: 256),
|
constraints: const BoxConstraints(maxWidth: 256, maxHeight: 256),
|
||||||
child: SelectionArea(
|
child: PresenceBuilder(
|
||||||
child: PresenceBuilder(
|
userId: profile.userId,
|
||||||
userId: profile.userId,
|
client: Matrix.of(context).client,
|
||||||
client: Matrix.of(context).client,
|
builder: (context, presence) {
|
||||||
builder: (context, presence) {
|
if (presence == null) return const SizedBox.shrink();
|
||||||
if (presence == null) return const SizedBox.shrink();
|
final statusMsg = presence.statusMsg;
|
||||||
final statusMsg = presence.statusMsg;
|
final lastActiveTimestamp = presence.lastActiveTimestamp;
|
||||||
final lastActiveTimestamp = presence.lastActiveTimestamp;
|
final presenceText = presence.currentlyActive == true
|
||||||
final presenceText = presence.currentlyActive == true
|
? L10n.of(context).currentlyActive
|
||||||
? L10n.of(context).currentlyActive
|
: lastActiveTimestamp != null
|
||||||
: lastActiveTimestamp != null
|
? L10n.of(context).lastActiveAgo(
|
||||||
? L10n.of(context).lastActiveAgo(
|
lastActiveTimestamp.localizedTimeShort(context),
|
||||||
lastActiveTimestamp.localizedTimeShort(context),
|
)
|
||||||
)
|
: null;
|
||||||
: null;
|
return SingleChildScrollView(
|
||||||
return SingleChildScrollView(
|
child: Column(
|
||||||
child: Column(
|
spacing: 8,
|
||||||
spacing: 8,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisSize: MainAxisSize.min,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
children: [
|
||||||
children: [
|
HoverBuilder(
|
||||||
HoverBuilder(
|
builder: (context, hovered) => StatefulBuilder(
|
||||||
builder: (context, hovered) => StatefulBuilder(
|
builder: (context, setState) => MouseRegion(
|
||||||
builder: (context, setState) => MouseRegion(
|
cursor: SystemMouseCursors.click,
|
||||||
cursor: SystemMouseCursors.click,
|
child: GestureDetector(
|
||||||
child: GestureDetector(
|
onTap: () {
|
||||||
onTap: () {
|
Clipboard.setData(
|
||||||
Clipboard.setData(
|
ClipboardData(text: profile.userId),
|
||||||
ClipboardData(text: profile.userId),
|
);
|
||||||
);
|
setState(() {
|
||||||
setState(() {
|
copied = true;
|
||||||
copied = true;
|
});
|
||||||
});
|
},
|
||||||
},
|
child: RichText(
|
||||||
child: RichText(
|
text: TextSpan(
|
||||||
text: TextSpan(
|
children: [
|
||||||
children: [
|
WidgetSpan(
|
||||||
WidgetSpan(
|
child: Padding(
|
||||||
child: Padding(
|
padding: const EdgeInsets.only(right: 4.0),
|
||||||
padding:
|
child: AnimatedScale(
|
||||||
const EdgeInsets.only(right: 4.0),
|
duration: FluffyThemes.animationDuration,
|
||||||
child: AnimatedScale(
|
curve: FluffyThemes.animationCurve,
|
||||||
duration:
|
scale: hovered
|
||||||
FluffyThemes.animationDuration,
|
? 1.33
|
||||||
curve: FluffyThemes.animationCurve,
|
: copied
|
||||||
scale: hovered
|
? 1.25
|
||||||
? 1.33
|
: 1.0,
|
||||||
: copied
|
child: Icon(
|
||||||
? 1.25
|
copied
|
||||||
: 1.0,
|
? Icons.check_circle
|
||||||
child: Icon(
|
: Icons.copy,
|
||||||
copied
|
size: 12,
|
||||||
? Icons.check_circle
|
color: copied ? Colors.green : null,
|
||||||
: Icons.copy,
|
|
||||||
size: 12,
|
|
||||||
color: copied ? Colors.green : null,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextSpan(text: profile.userId),
|
),
|
||||||
],
|
TextSpan(text: profile.userId),
|
||||||
style: theme.textTheme.bodyMedium
|
],
|
||||||
?.copyWith(fontSize: 10),
|
style: theme.textTheme.bodyMedium
|
||||||
),
|
?.copyWith(fontSize: 10),
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Center(
|
),
|
||||||
child: Avatar(
|
Center(
|
||||||
mxContent: avatar,
|
child: Avatar(
|
||||||
name: displayname,
|
mxContent: avatar,
|
||||||
size: Avatar.defaultSize * 2,
|
name: displayname,
|
||||||
onTap: avatar != null
|
size: Avatar.defaultSize * 2,
|
||||||
? () => showDialog(
|
onTap: avatar != null
|
||||||
context: context,
|
? () => showDialog(
|
||||||
builder: (_) => MxcImageViewer(avatar),
|
context: context,
|
||||||
)
|
builder: (_) => MxcImageViewer(avatar),
|
||||||
: null,
|
)
|
||||||
),
|
: null,
|
||||||
),
|
),
|
||||||
if (presenceText != null)
|
),
|
||||||
Text(
|
if (presenceText != null)
|
||||||
presenceText,
|
Text(
|
||||||
style: const TextStyle(fontSize: 10),
|
presenceText,
|
||||||
textAlign: TextAlign.center,
|
style: const TextStyle(fontSize: 10),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
if (statusMsg != null)
|
||||||
|
SelectableLinkify(
|
||||||
|
text: statusMsg,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
options: const LinkifyOptions(humanize: false),
|
||||||
|
linkStyle: TextStyle(
|
||||||
|
color: theme.colorScheme.primary,
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
decorationColor: theme.colorScheme.primary,
|
||||||
),
|
),
|
||||||
if (statusMsg != null)
|
onOpen: (url) =>
|
||||||
Linkify(
|
UrlLauncher(context, url.url).launchUrl(),
|
||||||
text: statusMsg,
|
),
|
||||||
textAlign: TextAlign.center,
|
],
|
||||||
options: const LinkifyOptions(humanize: false),
|
),
|
||||||
linkStyle: TextStyle(
|
);
|
||||||
color: theme.colorScheme.primary,
|
},
|
||||||
decoration: TextDecoration.underline,
|
|
||||||
decorationColor: theme.colorScheme.primary,
|
|
||||||
),
|
|
||||||
onOpen: (url) =>
|
|
||||||
UrlLauncher(context, url.url).launchUrl(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class Avatar extends StatelessWidget {
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: noPic
|
child: noPic
|
||||||
? Container(
|
? Container(
|
||||||
decoration: BoxDecoration(color: name!.lightColorAvatar),
|
decoration: BoxDecoration(color: name?.lightColorAvatar),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Text(
|
child: Text(
|
||||||
fallbackLetters,
|
fallbackLetters,
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import 'package:fluffychat/widgets/qr_code_viewer.dart';
|
import 'package:fluffychat/widgets/qr_code_viewer.dart';
|
||||||
|
|
||||||
|
@Deprecated('')
|
||||||
class PublicRoomBottomSheet extends StatelessWidget {
|
class PublicRoomBottomSheet extends StatelessWidget {
|
||||||
final String? roomAlias;
|
final String? roomAlias;
|
||||||
final BuildContext outerContext;
|
final BuildContext outerContext;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue