rw_barcode_reader 1.0.0 copy "rw_barcode_reader: ^1.0.0" to clipboard
rw_barcode_reader: ^1.0.0 copied to clipboard

Bar Code Reader Plugin for RealWear HMT-1

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:rw_barcode_reader/rw_barcode_reader.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 barcode reader 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 FlatButton(
                        child: const Text('OK'),
                        onPressed: () {
                          Navigator.of(context).pop();
                        },
                      ),
                    ],
                  );
                },
              );
            });
          }

          return Center(
            child: RaisedButton(
              child: const Text('Scan Bar Code'),
              onPressed: () async {
                final contents = await RwBarcodeReader.scanBarcode();

                setState(() {
                  _barcodeContents = contents;
                });
              },
            ),
          );
        }),
      ),
    );
  }
}
0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

Bar Code Reader Plugin for RealWear HMT-1

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on rw_barcode_reader