diff --git a/lib/pages/home.dart b/lib/pages/home.dart index c49f1c5..7657c8f 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -116,7 +116,7 @@ class _HomeScreenState extends State { const MiniGamesScreen(), RankingScreen(), const MydinogrowScreen(), - WalletScreen(address: _publicKey, balance: _balance), + WalletScreen(address: _publicKey ?? '', balance: _balance), ], ), ), diff --git a/lib/pages/wallet/wallet.dart b/lib/pages/wallet/wallet.dart index 44faef3..46434f1 100644 --- a/lib/pages/wallet/wallet.dart +++ b/lib/pages/wallet/wallet.dart @@ -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) { @@ -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( diff --git a/macos/Podfile.lock b/macos/Podfile.lock index fca764b..c30ff3d 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -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 diff --git a/pubspec.lock b/pubspec.lock index 03a6aa8..8a1dcaa 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -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: diff --git a/pubspec.yaml b/pubspec.yaml index 4157b9b..a90ade4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: