barcode_bill_scanner 1.1.1 copy "barcode_bill_scanner: ^1.1.1" to clipboard
barcode_bill_scanner: ^1.1.1 copied to clipboard

Barcode Bill Scanner aims to be used by brazilian apps willing to get a readable code from a horizontal barcode, mainly from bills.

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'BarcodeBillScanner Demo',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String? barcode;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        alignment: Alignment.center,
        children: [
          BarcodeBillScanner(
            onActionLabel: "You can set a message to cancel an action",
            onSuccess: (String value) async {
              setState(() => barcode = value);
            },
            onCancel: () {
              setState(() => barcode = null);
            },
          ),
          if (barcode != null)
            Center(
              child: RotatedBox(
                quarterTurns: 1,
                child: Text(
                  barcode!,
                  textAlign: TextAlign.center,
                  style: const TextStyle(
                    fontSize: 20.0,
                    color: Colors.amber,
                  ),
                ),
              ),
            ),
        ],
      ),
    );
  }
}
4
likes
150
pub points
54%
popularity

Publisher

unverified uploader

Barcode Bill Scanner aims to be used by brazilian apps willing to get a readable code from a horizontal barcode, mainly from bills.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

camera, flutter, google_mlkit_barcode_scanning, rxdart

More

Packages that depend on barcode_bill_scanner