97 lines
3.0 KiB
Dart
97 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:qr_flutter/qr_flutter.dart';
|
|
|
|
import 'package:pweb/utils/dimensions.dart';
|
|
|
|
import 'package:pweb/generated/i18n/app_localizations.dart';
|
|
|
|
|
|
class WalletTopUpAddressBlock extends StatelessWidget {
|
|
final String address;
|
|
final AppDimensions dimensions;
|
|
|
|
const WalletTopUpAddressBlock({
|
|
super.key,
|
|
required this.address,
|
|
required this.dimensions,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final loc = AppLocalizations.of(context)!;
|
|
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
loc.walletTopUpAddressLabel,
|
|
style: theme.textTheme.titleSmall,
|
|
),
|
|
TextButton.icon(
|
|
icon: const Icon(Icons.copy, size: 16),
|
|
label: Text(loc.copyAddress),
|
|
onPressed: () {
|
|
Clipboard.setData(ClipboardData(text: address));
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
SnackBar(content: Text(loc.addressCopied)),
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 6),
|
|
Container(
|
|
width: double.infinity,
|
|
padding: EdgeInsets.all(dimensions.paddingMedium),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(dimensions.borderRadiusSmall),
|
|
border: Border.all(color: theme.colorScheme.outlineVariant),
|
|
color: theme.colorScheme.surfaceContainerHighest.withValues(alpha: 0.4),
|
|
),
|
|
child: SelectableText(
|
|
address,
|
|
style: theme.textTheme.bodyLarge?.copyWith(
|
|
fontFeatures: const [FontFeature.tabularFigures()],
|
|
),
|
|
),
|
|
),
|
|
SizedBox(height: dimensions.paddingLarge),
|
|
Text(
|
|
loc.walletTopUpQrLabel,
|
|
style: theme.textTheme.titleSmall,
|
|
),
|
|
const SizedBox(height: 8),
|
|
Container(
|
|
padding: EdgeInsets.all(dimensions.paddingMedium),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(dimensions.borderRadiusSmall),
|
|
border: Border.all(color: theme.colorScheme.outlineVariant),
|
|
color: theme.colorScheme.surfaceContainerHighest.withValues(alpha: 0.4),
|
|
),
|
|
child: Center(
|
|
child: QrImageView(
|
|
data: address,
|
|
backgroundColor: theme.colorScheme.onSecondary,
|
|
eyeStyle: QrEyeStyle(
|
|
eyeShape: QrEyeShape.square,
|
|
color: theme.colorScheme.onSurface,
|
|
),
|
|
dataModuleStyle: QrDataModuleStyle(
|
|
dataModuleShape: QrDataModuleShape.square,
|
|
color: theme.colorScheme.onSurface,
|
|
),
|
|
size: 220,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|