toughpad 0.0.1 copy "toughpad: ^0.0.1" to clipboard
toughpad: ^0.0.1 copied to clipboard

outdated

Panasonic Toughpad plugin.

example/lib/main.dart

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

import 'package:toughpad/toughpad.dart';

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

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

class _MyAppState extends State<MyApp> {
  String _barcode = 'Unknown';

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

  Future<void> initPlatformState() async {
    String platformVersion;
    if (!mounted) return;


    Toughpad.init();

    setState(() {
      _barcode = platformVersion;
    });

    Toughpad.readBarcodes.stream.listen((message)=>{
      setState(() {
        _barcode = message;
      })
    });
  }


  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(

            child: new Row(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: <Widget>[
                new RaisedButton(
                  padding: const EdgeInsets.all(8.0),
                  textColor: Colors.white,
                  color: Colors.blue,
                  onPressed:  ()=> Toughpad.startBarcodeScan(),
                  child: new Text("Start"),
                ),

                Text('Barcode: $_barcode\n'),
                new RaisedButton(
                  onPressed:  ()=> Toughpad.stopBarcodeScan(),
                  textColor: Colors.white,
                  color: Colors.red,
                  padding: const EdgeInsets.all(8.0),
                  child: new Text("Stop"),
                ),
              ],
            )//,
        ),
      ),
    );
  }
}
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Panasonic Toughpad plugin.

Homepage

License

unknown (LICENSE)

Dependencies

flutter, rxdart

More

Packages that depend on toughpad