easy_qr_scanner 0.0.2 copy "easy_qr_scanner: ^0.0.2" to clipboard
easy_qr_scanner: ^0.0.2 copied to clipboard

A Flutter package for scanning QR codes using camera or image gallery.

example/lib/main.dart

import 'package:easy_qr_scanner/easy_qr_scanner.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'QR Scanner Demo',
      home: const HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  String res = "";

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('QR Scanner')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            ElevatedButton(
                onPressed: () async {
                  final result =await easyScanQRCode(context,title: "Find a QR code and scan it",
                      scanWindowBorderColor: Colors.green,
                      titleStyle: Theme.of(context).textTheme.bodyLarge?.copyWith(
                        fontWeight: FontWeight.w700,
                        fontSize: 11,
                        color: Colors.amber,
                      ));
                  setState(() {
                    res = result.toString();
                  });
                  ScaffoldMessenger.of(context).showSnackBar(
                    SnackBar(content: Text('Scanned result: $result')),
                  );
                },
                child: const Text("Scan QR Code")),
            Text(res)
          ],
        ),
      ),
    );
  }
}
2
likes
130
points
47
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for scanning QR codes using camera or image gallery.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, image_picker, mobile_scanner

More

Packages that depend on easy_qr_scanner