Add subscription qr code share

This commit is contained in:
problematicconsumer
2023-11-13 17:55:47 +03:30
parent 2592325923
commit beec48c8b4
8 changed files with 100 additions and 4 deletions

View File

@@ -0,0 +1,61 @@
import 'package:flutter/material.dart';
import 'package:qr_flutter/qr_flutter.dart';
class QrCodeDialog extends StatelessWidget {
const QrCodeDialog(
this.data, {
super.key,
this.message,
this.width = 268,
this.backgroundColor = Colors.white,
});
final String data;
final String? message;
final double width;
final Color backgroundColor;
Future<void> show(BuildContext context) async {
await showDialog(context: context, builder: (context) => this);
}
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: width,
child: QrImageView(
data: data,
backgroundColor: backgroundColor,
),
),
if (message != null)
SizedBox(
width: width,
child: Material(
color: theme.colorScheme.background,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(
child: Text(
message!,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: theme.colorScheme.onBackground),
),
),
],
),
),
),
],
),
);
}
}