-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from martinloesethjensen/feature/qr
feature/qr
- Loading branch information
Showing
6 changed files
with
186 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import 'package:clipboard/clipboard.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_algo_wallet/theme/theme.dart'; | ||
|
||
class TextClip extends StatelessWidget { | ||
const TextClip({ | ||
Key? key, | ||
required this.textToCopy, | ||
this.snackBarText, | ||
}) : super(key: key); | ||
|
||
final String textToCopy; | ||
final String? snackBarText; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return GestureDetector( | ||
onTap: () async { | ||
await FlutterClipboard.copy(textToCopy); | ||
|
||
if (snackBarText != null) { | ||
final snackBar = SnackBar( | ||
behavior: SnackBarBehavior.floating, | ||
content: Text(snackBarText!), | ||
); | ||
|
||
ScaffoldMessenger.of(context).showSnackBar(snackBar); | ||
} | ||
}, | ||
child: RichText( | ||
text: TextSpan( | ||
children: [ | ||
TextSpan( | ||
text: textToCopy, | ||
style: regularTextStyle.copyWith(fontSize: fontSizeSmall), | ||
), | ||
WidgetSpan( | ||
child: Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 8.0), | ||
child: Icon( | ||
Icons.copy, | ||
size: 20, | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import 'package:algorand_dart/algorand_dart.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_algo_wallet/screens/components/text_clip.dart'; | ||
import 'package:flutter_algo_wallet/theme/dimens.dart'; | ||
import 'package:flutter_algo_wallet/widgets/spacing.dart'; | ||
import 'package:qr_flutter/qr_flutter.dart'; | ||
|
||
class RecieveWidget extends StatelessWidget { | ||
const RecieveWidget({ | ||
Key? key, | ||
required this.account, | ||
}) : super(key: key); | ||
|
||
final Account account; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ElevatedButton( | ||
child: Text('Recieve'), | ||
onPressed: () { | ||
showModalBottomSheet<void>( | ||
shape: RoundedRectangleBorder( | ||
borderRadius: BorderRadius.vertical( | ||
top: Radius.circular(20), | ||
), | ||
), | ||
context: context, | ||
builder: (BuildContext context) { | ||
return SafeArea( | ||
child: Padding( | ||
padding: const EdgeInsets.all(paddingSizeDefault), | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: <Widget>[ | ||
QrImage( | ||
data: | ||
'https://testnet.algoexplorer.io/address/${account.publicAddress}', | ||
version: QrVersions.auto, | ||
size: 250, | ||
gapless: false, | ||
embeddedImage: AssetImage('assets/images/algo_icon.png'), | ||
embeddedImageStyle: QrEmbeddedImageStyle( | ||
size: Size(80, 80), | ||
), | ||
), | ||
const VerticalSpacing(of: marginSizeDefault), | ||
TextClip(textToCopy: account.publicAddress), | ||
const VerticalSpacing(of: marginSizeDefault), | ||
ElevatedButton( | ||
child: const Text('Close'), | ||
onPressed: () => Navigator.pop(context), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
}, | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters