mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-18 02:42:34 +01:00
feat: Beautify qr code scanner
This commit is contained in:
parent
8029a366f7
commit
0728a30565
@ -79,9 +79,10 @@ class NewPrivateChatController extends State<NewPrivateChat> {
|
|||||||
void openScannerAction() async {
|
void openScannerAction() async {
|
||||||
final status = await Permission.camera.request();
|
final status = await Permission.camera.request();
|
||||||
if (!status.isGranted) return;
|
if (!status.isGranted) return;
|
||||||
await showDialog(
|
await showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
|
//useSafeArea: false,
|
||||||
builder: (_) => QrScannerModal(),
|
builder: (_) => QrScannerModal(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:fluffychat/utils/url_launcher.dart';
|
import 'package:fluffychat/utils/url_launcher.dart';
|
||||||
@ -33,19 +34,32 @@ class _QrScannerModalState extends State<QrScannerModal> {
|
|||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: Icon(Icons.close_outlined),
|
icon: Icon(Icons.close_outlined),
|
||||||
onPressed: Navigator.of(context).pop,
|
onPressed: Navigator.of(context).pop,
|
||||||
|
tooltip: L10n.of(context).close,
|
||||||
),
|
),
|
||||||
title: Text(L10n.of(context).scanQrCode),
|
title: Text(L10n.of(context).scanQrCode),
|
||||||
),
|
),
|
||||||
body: QRView(
|
body: Stack(
|
||||||
key: qrKey,
|
children: [
|
||||||
onQRViewCreated: _onQRViewCreated,
|
QRView(
|
||||||
|
key: qrKey,
|
||||||
|
onQRViewCreated: _onQRViewCreated,
|
||||||
|
overlay: QrScannerOverlayShape(
|
||||||
|
borderColor: Theme.of(context).primaryColor,
|
||||||
|
borderRadius: 10,
|
||||||
|
borderLength: 30,
|
||||||
|
borderWidth: 8,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onQRViewCreated(QRViewController controller) {
|
void _onQRViewCreated(QRViewController controller) {
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
controller.scannedDataStream.listen((scanData) {
|
StreamSubscription sub;
|
||||||
|
sub = controller.scannedDataStream.listen((scanData) {
|
||||||
|
sub.cancel();
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
UrlLauncher(context, scanData.code).openMatrixToUrl();
|
UrlLauncher(context, scanData.code).openMatrixToUrl();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user