QR Code In Flutter

QR Code In Flutter :

This flutter tutorial post is QR Code In Flutter generate from String or images. It is a fast QR code generate.

Properties :

  • embeddedImage: AssetImage(‘assets/images/’),
  • gapless: true or false
  • size: integer
  • version: QrVersions.auto as well as supported 1 – 40.
  • data: Generate QR code from string.
  • embeddedImageStyle: QrEmbeddedImageStyle(size: Size(80, 80))

Advantage :

  • Supports QR code versions 1 – 40
  • Error correction / redundancy
  • Configurable output size, padding, background and foreground colors
  • Supports image overlays
  • Export to image data to save to file or use in memory
  • No internet connection required

Add the dependenci in pubspec.yaml.

  • dependencies:
  • qr_flutter:

Screenshot :

QR Code In Flutter

Program

import 'package:flutter/material.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'screen/page/ChipListPage.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Tutorial',
      debugShowCheckedModeBanner: false,
      home: MyHomePage(title: 'ChipList Flutter'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text('QR Code Flutter')),
        body: Center(
            child: Container(
                child: Stack(alignment: Alignment(0, 0), children: <Widget>[
                  // Gradient
                  Container(
                      width: 198,
                      height: 198,
                      decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(12),
                          gradient: LinearGradient(
                            begin: Alignment.bottomLeft,
                            end: Alignment.topRight,
                            stops: [0.0, 1],
                            colors: [Colors.blue, Colors.blue],
                          ))),
                  // overlay
                  Container(
                    width: 189,
                    height: 189,
                    decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(8),
                        color: Colors.white),
                  ),
                  // QR Code
                  QrImage(
                    data: '123',
                    size: 198,
                    errorCorrectionLevel: QrErrorCorrectLevel.Q,
                    gapless: false,
                    version: 9,
                  ),
                  // Logo background
                  Container(
                    width: 64,
                    height: 64,
                    decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(16),
                        color: Colors.white),
                  ),
                  // Logo
                  Container(
                    width: 53,
                    height: 53,
                    decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(12),
                        gradient: LinearGradient(
                          begin: Alignment.bottomLeft,
                          end: Alignment.topRight,
                          stops: [0.0, 1],
                          colors: [Color(0xFFF7941F), Colors.blue],
                        )),
                    child: Icon(Icons.home, color: Colors.white, size: 33),
                  )
                ]))));
  }
}

The flutter tutorial  is a website that bring you the latest and amazing resources of code. All the languages codes are included in this website. The languages like flutter, android, java,kotlin etc.with the help of this languages any user can develop the beautiful application

For more information about Flutter. visit www.fluttertutorial.in