Merge branch 'main' into fix-jagged-avatar-edges
commit
c5b61aba64
@ -0,0 +1,26 @@
|
|||||||
|
name: Matrix Notification
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [ opened ]
|
||||||
|
issue_comment:
|
||||||
|
types: [ created ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
notify:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Send Matrix Notification
|
||||||
|
env:
|
||||||
|
MATRIX_URL: https://matrix.janian.de/_matrix/client/v3/rooms/${{ secrets.MATRIX_MANAGEMENT_ROOM }}/send/m.room.message
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.event.action }}" == "opened" ]; then
|
||||||
|
PAYLOAD="{\"msgtype\": \"m.notice\", \"body\": \"New Issue from ${{ github.event.issue.user.login }}\\n${{ github.event.issue.title }}\\n\\n${{ github.event.issue.body }}\\n\\nURL: ${{ github.event.issue.html_url }}\"}"
|
||||||
|
elif [ "${{ github.event.action }}" == "created" ]; then
|
||||||
|
PAYLOAD="{\"msgtype\": \"m.notice\", \"body\": \"New Comment from ${{ github.event.comment.user.login }}\\n\\n${{ github.event.comment.body }}\\n\\nURL: ${{ github.event.comment.html_url }}\"}"
|
||||||
|
fi
|
||||||
|
curl -X POST -H "Authorization: Bearer ${{ secrets.MATRIX_BOT_TOKEN }}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "$PAYLOAD" \
|
||||||
|
$MATRIX_URL
|
@ -1,2 +1,2 @@
|
|||||||
FLUTTER_VERSION=3.29.2
|
FLUTTER_VERSION=3.29.3
|
||||||
JAVA_VERSION=17
|
JAVA_VERSION=17
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,72 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
||||||
import 'package:matrix/matrix.dart';
|
|
||||||
|
|
||||||
import '../../../config/app_config.dart';
|
|
||||||
|
|
||||||
class VerificationRequestContent extends StatelessWidget {
|
|
||||||
final Event event;
|
|
||||||
final Timeline timeline;
|
|
||||||
|
|
||||||
const VerificationRequestContent({
|
|
||||||
required this.event,
|
|
||||||
required this.timeline,
|
|
||||||
super.key,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final theme = Theme.of(context);
|
|
||||||
|
|
||||||
final events = event.aggregatedEvents(timeline, 'm.reference');
|
|
||||||
final done = events.where((e) => e.type == EventTypes.KeyVerificationDone);
|
|
||||||
final start =
|
|
||||||
events.where((e) => e.type == EventTypes.KeyVerificationStart);
|
|
||||||
final cancel =
|
|
||||||
events.where((e) => e.type == EventTypes.KeyVerificationCancel);
|
|
||||||
final fullyDone = done.length >= 2;
|
|
||||||
final started = start.isNotEmpty;
|
|
||||||
final canceled = cancel.isNotEmpty;
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 8.0,
|
|
||||||
vertical: 4.0,
|
|
||||||
),
|
|
||||||
child: Center(
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.all(8),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(
|
|
||||||
color: theme.dividerColor,
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
|
||||||
color: theme.colorScheme.surface,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
Icon(
|
|
||||||
Icons.lock_outlined,
|
|
||||||
color: canceled
|
|
||||||
? Colors.red
|
|
||||||
: (fullyDone ? Colors.green : Colors.grey),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
Text(
|
|
||||||
canceled
|
|
||||||
? 'Error ${cancel.first.content.tryGet<String>('code')}: ${cancel.first.content.tryGet<String>('reason')}'
|
|
||||||
: (fullyDone
|
|
||||||
? L10n.of(context).verifySuccess
|
|
||||||
: (started
|
|
||||||
? L10n.of(context).loadingPleaseWait
|
|
||||||
: L10n.of(context).newVerificationRequest)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,231 @@
|
|||||||
|
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?.localpart ?? chunk?.roomId ?? 'Unknown',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (profile?.numJoinedMembers != 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,
|
||||||
|
textScaleFactor:
|
||||||
|
MediaQuery.textScalerOf(context).scale(1),
|
||||||
|
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),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
|
||||||
|
import 'mxc_image.dart';
|
||||||
|
|
||||||
|
class MxcImageViewer extends StatelessWidget {
|
||||||
|
final Uri mxContent;
|
||||||
|
|
||||||
|
const MxcImageViewer(this.mxContent, {super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final iconButtonStyle = IconButton.styleFrom(
|
||||||
|
backgroundColor: Colors.black.withAlpha(200),
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
);
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () => Navigator.of(context).pop(),
|
||||||
|
child: Scaffold(
|
||||||
|
backgroundColor: Colors.black.withAlpha(128),
|
||||||
|
extendBodyBehindAppBar: true,
|
||||||
|
appBar: AppBar(
|
||||||
|
elevation: 0,
|
||||||
|
leading: IconButton(
|
||||||
|
style: iconButtonStyle,
|
||||||
|
icon: const Icon(Icons.close),
|
||||||
|
onPressed: Navigator.of(context).pop,
|
||||||
|
color: Colors.white,
|
||||||
|
tooltip: L10n.of(context).close,
|
||||||
|
),
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
),
|
||||||
|
body: InteractiveViewer(
|
||||||
|
minScale: 1.0,
|
||||||
|
maxScale: 10.0,
|
||||||
|
onInteractionEnd: (endDetails) {
|
||||||
|
if (endDetails.velocity.pixelsPerSecond.dy >
|
||||||
|
MediaQuery.of(context).size.height * 1.5) {
|
||||||
|
Navigator.of(context, rootNavigator: false).pop();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Center(
|
||||||
|
child: GestureDetector(
|
||||||
|
// Ignore taps to not go back here:
|
||||||
|
onTap: () {},
|
||||||
|
child: MxcImage(
|
||||||
|
key: ValueKey(mxContent.toString()),
|
||||||
|
uri: mxContent,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
isThumbnail: false,
|
||||||
|
animated: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,233 +0,0 @@
|
|||||||
import 'package:flutter/material.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/utils/fluffy_share.dart';
|
|
||||||
import 'package:fluffychat/utils/url_launcher.dart';
|
|
||||||
import 'package:fluffychat/widgets/avatar.dart';
|
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
|
||||||
import 'package:fluffychat/widgets/qr_code_viewer.dart';
|
|
||||||
|
|
||||||
class PublicRoomBottomSheet extends StatelessWidget {
|
|
||||||
final String? roomAlias;
|
|
||||||
final BuildContext outerContext;
|
|
||||||
final PublicRoomsChunk? chunk;
|
|
||||||
final List<String>? via;
|
|
||||||
|
|
||||||
PublicRoomBottomSheet({
|
|
||||||
this.roomAlias,
|
|
||||||
required this.outerContext,
|
|
||||||
this.chunk,
|
|
||||||
this.via,
|
|
||||||
super.key,
|
|
||||||
}) {
|
|
||||||
assert(roomAlias != null || chunk != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _joinRoom(BuildContext context) async {
|
|
||||||
final client = Matrix.of(outerContext).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;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (knock) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (result.error == null) {
|
|
||||||
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) {
|
|
||||||
outerContext.go('/rooms/${result.result!}');
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool _testRoom(PublicRoomsChunk r) => r.canonicalAlias == roomAlias;
|
|
||||||
|
|
||||||
Future<PublicRoomsChunk> _search() async {
|
|
||||||
final chunk = this.chunk;
|
|
||||||
if (chunk != null) return chunk;
|
|
||||||
final query = await Matrix.of(outerContext).client.queryPublicRooms(
|
|
||||||
server: roomAlias!.domain,
|
|
||||||
filter: PublicRoomQueryFilter(
|
|
||||||
genericSearchTerm: roomAlias,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
if (!query.chunk.any(_testRoom)) {
|
|
||||||
throw (L10n.of(outerContext).noRoomsFound);
|
|
||||||
}
|
|
||||||
return query.chunk.firstWhere(_testRoom);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final roomAlias = this.roomAlias ?? chunk?.canonicalAlias;
|
|
||||||
final roomLink = roomAlias ?? chunk?.roomId;
|
|
||||||
return SafeArea(
|
|
||||||
child: Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
title: Text(
|
|
||||||
chunk?.name ?? roomAlias ?? chunk?.roomId ?? 'Unknown',
|
|
||||||
overflow: TextOverflow.fade,
|
|
||||||
),
|
|
||||||
leading: Center(
|
|
||||||
child: CloseButton(
|
|
||||||
onPressed: Navigator.of(context, rootNavigator: false).pop,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
actions: roomAlias == null
|
|
||||||
? null
|
|
||||||
: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
||||||
child: IconButton(
|
|
||||||
icon: const Icon(Icons.qr_code_rounded),
|
|
||||||
onPressed: () => showQrCodeViewer(
|
|
||||||
context,
|
|
||||||
roomAlias,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
body: FutureBuilder<PublicRoomsChunk>(
|
|
||||||
future: _search(),
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
final theme = Theme.of(context);
|
|
||||||
|
|
||||||
final profile = snapshot.data;
|
|
||||||
return ListView(
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: profile == null
|
|
||||||
? const Center(
|
|
||||||
child: CircularProgressIndicator.adaptive(),
|
|
||||||
)
|
|
||||||
: Avatar(
|
|
||||||
client: Matrix.of(outerContext).client,
|
|
||||||
mxContent: profile.avatarUrl,
|
|
||||||
name: profile.name ?? roomAlias,
|
|
||||||
size: Avatar.defaultSize * 3,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
TextButton.icon(
|
|
||||||
onPressed: roomLink != null
|
|
||||||
? () => FluffyShare.share(
|
|
||||||
roomLink,
|
|
||||||
context,
|
|
||||||
copyOnly: true,
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.copy_outlined,
|
|
||||||
size: 14,
|
|
||||||
),
|
|
||||||
style: TextButton.styleFrom(
|
|
||||||
foregroundColor: theme.colorScheme.onSurface,
|
|
||||||
iconColor: theme.colorScheme.onSurface,
|
|
||||||
),
|
|
||||||
label: Text(
|
|
||||||
roomLink ?? '...',
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextButton.icon(
|
|
||||||
onPressed: () {},
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.groups_3_outlined,
|
|
||||||
size: 14,
|
|
||||||
),
|
|
||||||
style: TextButton.styleFrom(
|
|
||||||
foregroundColor: theme.colorScheme.onSurface,
|
|
||||||
iconColor: theme.colorScheme.onSurface,
|
|
||||||
),
|
|
||||||
label: Text(
|
|
||||||
L10n.of(context).countParticipants(
|
|
||||||
profile?.numJoinedMembers ?? 0,
|
|
||||||
),
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
||||||
child: ElevatedButton.icon(
|
|
||||||
onPressed: () => _joinRoom(context),
|
|
||||||
label: Text(
|
|
||||||
chunk?.joinRule == 'knock' &&
|
|
||||||
Matrix.of(outerContext)
|
|
||||||
.client
|
|
||||||
.getRoomById(chunk!.roomId) ==
|
|
||||||
null
|
|
||||||
? L10n.of(context).knock
|
|
||||||
: chunk?.roomType == 'm.space'
|
|
||||||
? L10n.of(context).joinSpace
|
|
||||||
: L10n.of(context).joinRoom,
|
|
||||||
),
|
|
||||||
icon: const Icon(Icons.navigate_next),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
if (profile?.topic?.isNotEmpty ?? false)
|
|
||||||
ListTile(
|
|
||||||
subtitle: SelectableLinkify(
|
|
||||||
text: profile!.topic!,
|
|
||||||
linkStyle: TextStyle(
|
|
||||||
color: theme.colorScheme.primary,
|
|
||||||
decorationColor: theme.colorScheme.primary,
|
|
||||||
),
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
color: theme.textTheme.bodyMedium!.color,
|
|
||||||
),
|
|
||||||
options: const LinkifyOptions(humanize: false),
|
|
||||||
onOpen: (url) =>
|
|
||||||
UrlLauncher(context, url.url).launchUrl(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue