基础组件库
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

qr_code.dart 837 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import 'dart:typed_data';
  2. import 'package:flutter/material.dart';
  3. import 'dart:convert' as convert;
  4. class QrCode extends StatefulWidget {
  5. final String qrcode;
  6. const QrCode(this.qrcode, {Key key}) : super(key: key);
  7. @override
  8. _QrCodeState createState() => _QrCodeState();
  9. }
  10. class _QrCodeState extends State<QrCode> with AutomaticKeepAliveClientMixin {
  11. Uint8List src;
  12. @override
  13. void initState() {
  14. // TODO: implement initState
  15. src = convert.base64Decode(widget.qrcode);
  16. super.initState();
  17. }
  18. @override
  19. Widget build(BuildContext context) {
  20. return Container(
  21. margin: EdgeInsets.only(bottom: 12),
  22. width: 124,
  23. height: 124,
  24. // color: Colors.redAccent,
  25. child: Image.memory(src),
  26. );
  27. }
  28. @override
  29. // TODO: implement wantKeepAlive
  30. bool get wantKeepAlive => true;
  31. }