feat: QR Code viewer for mxid sharing

Signed-off-by: Krille <c.kussowski@famedly.com>
This commit is contained in:
Krille 2024-12-14 12:01:42 +01:00 committed by krille-chan
commit dbf3eccc93
No known key found for this signature in database
7 changed files with 492 additions and 339 deletions

View file

@ -14,6 +14,7 @@ import 'package:fluffychat/utils/url_launcher.dart';
import 'package:fluffychat/widgets/avatar.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
import 'package:fluffychat/widgets/matrix.dart';
import '../../widgets/qr_code_viewer.dart';
class NewPrivateChatView extends StatelessWidget {
final NewPrivateChatController controller;
@ -25,6 +26,7 @@ class NewPrivateChatView extends StatelessWidget {
final theme = Theme.of(context);
final searchResponse = controller.searchResponse;
final userId = Matrix.of(context).client.userID!;
return Scaffold(
appBar: AppBar(
scrolledUnderElevation: 0,
@ -157,26 +159,35 @@ class NewPrivateChatView extends StatelessWidget {
),
Center(
child: Padding(
padding: const EdgeInsets.all(64.0),
child: ConstrainedBox(
constraints: const BoxConstraints(maxHeight: 256),
child: Material(
borderRadius: BorderRadius.circular(12),
elevation: 10,
color: Colors.white,
shadowColor: theme.appBarTheme.shadowColor,
clipBehavior: Clip.hardEdge,
padding: const EdgeInsets.symmetric(
horizontal: 64.0,
vertical: 24.0,
),
child: Material(
borderRadius:
BorderRadius.circular(AppConfig.borderRadius),
color: theme.colorScheme.primaryContainer,
clipBehavior: Clip.hardEdge,
child: InkWell(
borderRadius:
BorderRadius.circular(AppConfig.borderRadius),
onTap: () => showQrCodeViewer(
context,
userId,
),
child: Padding(
padding: const EdgeInsets.all(8),
child: PrettyQrView.data(
data:
'https://matrix.to/#/${Matrix.of(context).client.userID}',
decoration: PrettyQrDecoration(
shape: PrettyQrSmoothSymbol(
roundFactor: 1,
color: theme.brightness == Brightness.light
? theme.colorScheme.primary
: theme.colorScheme.onPrimary,
padding: const EdgeInsets.all(32.0),
child: ConstrainedBox(
constraints:
const BoxConstraints(maxWidth: 256),
child: PrettyQrView.data(
data: 'https://matrix.to/#/$userId',
decoration: PrettyQrDecoration(
shape: PrettyQrSmoothSymbol(
roundFactor: 1,
color:
theme.colorScheme.onPrimaryContainer,
),
),
),
),