Hello, Custom widget to render QR Code. I try to integrate as many parameters as i can with the FF options type available.
Parameters Settings:[image.png]Dependencies:
qr_flutter[image.png]
Code :
import 'package:qr_flutter/qr_flutter.dart';
class Qr extends StatefulWidget {
const Qr({
Key key,
this.width,
this.height,
this.data,
this.size,
this.backgroundColor,
this.foregroundColor,
this.semanticsLabel,
}) : super(key: key);
final double width;
final double height;
final String data;
final double size;
final Color backgroundColor;
final Color foregroundColor;
final String semanticsLabel;
@override
_QrState createState() => _QrState();
}
class _QrState extends State {
@override
Widget build(BuildContext context) {
return Container(
width: widget.width,
height: widget.height,
child : QrImage(
version: QrVersions.auto,
data: widget.data.toString(),
size: widget.size,
backgroundColor: widget.backgroundColor,
foregroundColor: widget.foregroundColor,
gapless: true,
semanticsLabel: widget.semanticsLabel.toString()
),
);
}
}Final Result:[image.png]
The data String can be from a variable > combine Text > Specific or Variable Widget State. Technically with some smart workaround and tweaking of the code you can generate a QR from an entire Firestore Document. 😏 ( sharing record beetween companion app )