Skip to content

Commit

Permalink
feat: show qr code
Browse files Browse the repository at this point in the history
  • Loading branch information
dnielopez committed Oct 8, 2023
1 parent b6557bc commit 3357f4c
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lib/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class _HomeScreenState extends State<HomeScreen> {
const MiniGamesScreen(),
RankingScreen(),
const MydinogrowScreen(),
WalletScreen(address: _publicKey, balance: _balance),
WalletScreen(address: _publicKey ?? '', balance: _balance),
],
),
),
Expand Down
58 changes: 40 additions & 18 deletions lib/pages/wallet/wallet.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:qr_flutter/qr_flutter.dart';

import '../../ui/widgets/widgets.dart';

class WalletScreen extends StatelessWidget {
final String? address;
final String address;
final String? balance;

const WalletScreen({super.key, this.address, this.balance});
const WalletScreen({super.key, required this.address, this.balance});

@override
Widget build(BuildContext context) {
Expand All @@ -23,23 +24,44 @@ class WalletScreen extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(children: [
Expanded(
child: TextBoxWidget(text: 'Your address: $address')),
const SizedBox(width: 12),
IntroButtonWidget(
text: 'Copy',
onPressed: () {
Clipboard.setData(ClipboardData(text: address ?? ''));
const snackBar = SnackBar(
content: Text('Copied!'),
);
Container(
color: Colors.white,
child: Padding(
padding: const EdgeInsets.all(6),
child: QrImageView(
data: address,
version: QrVersions.auto,
size: 200.0,
),
),
),
const SizedBox(height: 6),
Container(
color: Colors.black,
child: Padding(
padding: const EdgeInsets.all(3),
child: Text(
"Your address: $address",
textAlign: TextAlign.center,
style: const TextStyle(
color: Colors.white,
fontSize: 12,
),
),
),
),
const SizedBox(height: 30),
IntroButtonWidget(
text: 'Copy',
onPressed: () {
Clipboard.setData(ClipboardData(text: address));
const snackBar = SnackBar(
content: Text('Copied!'),
);

ScaffoldMessenger.of(context).showSnackBar(snackBar);
},
size: 'fit',
)
]),
ScaffoldMessenger.of(context).showSnackBar(snackBar);
},
),
const SizedBox(height: 30),
Row(children: [
Expanded(
Expand Down
6 changes: 6 additions & 0 deletions macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@ PODS:
- flutter_secure_storage_macos (6.1.1):
- FlutterMacOS
- FlutterMacOS (1.0.0)
- url_launcher_macos (0.0.1):
- FlutterMacOS

DEPENDENCIES:
- flutter_secure_storage_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_secure_storage_macos/macos`)
- FlutterMacOS (from `Flutter/ephemeral`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)

EXTERNAL SOURCES:
flutter_secure_storage_macos:
:path: Flutter/ephemeral/.symlinks/plugins/flutter_secure_storage_macos/macos
FlutterMacOS:
:path: Flutter/ephemeral
url_launcher_macos:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos

SPEC CHECKSUMS:
flutter_secure_storage_macos: d56e2d218c1130b262bef8b4a7d64f88d7f9c9ea
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95

PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367

Expand Down
16 changes: 16 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.7.3"
qr:
dependency: transitive
description:
name: qr
sha256: "64957a3930367bf97cc211a5af99551d630f2f4625e38af10edd6b19131b64b3"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
qr_flutter:
dependency: "direct main"
description:
name: qr_flutter
sha256: "5095f0fc6e3f71d08adef8feccc8cea4f12eec18a2e31c2e8d82cb6019f4b097"
url: "https://pub.dev"
source: hosted
version: "4.1.0"
rational:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies:
flame_forge2d: ^0.14.1+1
flutter_joystick: ^0.0.3
url_launcher: ^6.1.14
qr_flutter: ^4.1.0

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 3357f4c

Please sign in to comment.