Last active
November 17, 2021 12:08
-
-
Save Frankdroid7/90ad3f3c19893eaff6bf6c2238730d8d to your computer and use it in GitHub Desktop.
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
import 'package:flutter/material.dart'; | |
import 'package:qr_flutter/qr_flutter.dart'; | |
import 'package:screenshot/screenshot.dart'; | |
class QRCodePlayground extends StatefulWidget { | |
@override | |
_QRCodePlaygroundState createState() => _QRCodePlaygroundState(); | |
} | |
class _QRCodePlaygroundState extends State<QRCodePlayground> { | |
ScreenshotController screenshotController = ScreenshotController(); | |
final TextEditingController tfController = TextEditingController(); | |
@override | |
Widget build(BuildContext context) { | |
return Padding( | |
padding: const EdgeInsets.symmetric(horizontal: 16.0), | |
child: ListView( | |
children: [ | |
tfController.text.isEmpty | |
? SizedBox.shrink() | |
: Screenshot( | |
controller: screenshotController, | |
child: QrImage(data: tfController.text)), | |
SizedBox(height: 20), | |
TextField( | |
controller: tfController, | |
decoration: InputDecoration( | |
border: OutlineInputBorder( | |
borderSide: BorderSide(color: Colors.blue))), | |
), | |
SizedBox(height: 20), | |
RaisedButton( | |
color: Colors.blue, | |
textColor: Colors.white, | |
child: Text('Generate QR Code'), | |
onPressed: () => setState(() {}), | |
padding: EdgeInsets.symmetric(vertical: 12), | |
), | |
RaisedButton( | |
onPressed: () {}, | |
color: Colors.blue, | |
textColor: Colors.white, | |
child: Text('Share QR code'), | |
padding: EdgeInsets.symmetric(vertical: 12), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment