基础组件库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

40 lines
837 B

  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. }