rw_barcode_scanner 1.0.3 copy "rw_barcode_scanner: ^1.0.3" to clipboard
rw_barcode_scanner: ^1.0.3 copied to clipboard

PlatformAndroid

Barcode Scanner Plugin for RealWear Devices

example/lib/main.dart

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

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _barcodeContents;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('RealWear HMT-1/500 barcode scanner example app'),
        ),
        body: Builder(builder: (BuildContext context) {
          if (_barcodeContents != null) {
            WidgetsBinding.instance.addPostFrameCallback((_) {
              showDialog(
                context: context,
                builder: (BuildContext context) {
                  return AlertDialog(
                    title: const Text('Bar Code Contents'),
                    content: Text(_barcodeContents),
                    actions: <Widget>[
                      new ElevatedButton(
                        child: const Text('OK'),
                        onPressed: () {
                          Navigator.of(context).pop();
                        },
                      ),
                    ],
                  );
                },
              );
            });
          }

          return Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                ElevatedButton(
                  child: const Text('Scan QR'),
                  onPressed: () async {
                    final contents = await RwBarcodeScanner.scan("qr");

                    setState(() {
                      _barcodeContents = contents;
                    });
                  },
                ),
                ElevatedButton(
                  child: const Text('Scan UPC'),
                  onPressed: () async {
                    final contents = await RwBarcodeScanner.scan("upc");

                    setState(() {
                      _barcodeContents = contents;
                    });
                  },
                ),
                ElevatedButton(
                  child: const Text('Scan Barcode'),
                  onPressed: () async {
                    final contents = await RwBarcodeScanner.scan("barcode");

                    setState(() {
                      _barcodeContents = contents;
                    });
                  },
                ),
              ],
            ),
          );
        }),
      ),
    );
  }
}
1
likes
130
pub points
33%
popularity

Publisher

verified publishervieaura.com

Barcode Scanner Plugin for RealWear Devices

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on rw_barcode_scanner