barcode_bill_scanner 1.0.2 copy "barcode_bill_scanner: ^1.0.2" to clipboard
barcode_bill_scanner: ^1.0.2 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,
                  ),
                ),
              ),
            ),
        ],
      ),
    );
  }
}
3
likes
130
pub points
43%
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_barcode_kit, rxdart

More

Packages that depend on barcode_bill_scanner