qrcode_forked 1.0.2 copy "qrcode_forked: ^1.0.2" to clipboard
qrcode_forked: ^1.0.2 copied to clipboard

A flutter plugin used to read qrCodes. I forked the qrCode plugin and migrated it to nullsafety. Currently running android and ios.

qrcode #

A flutter plugin for scanning QR codes. Use AVCaptureSession in iOS and zxing in Android.

Usage #

class _MyAppState extends State<MyApp> {
  QRCaptureController _captureController = QRCaptureController();

  bool _isTorchOn = false;

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

    _captureController.onCapture((data) {
      print('onCapture----$data');
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Stack(
          alignment: Alignment.center,
          children: <Widget>[
            QRCaptureView(controller: _captureController),
            Align(
              alignment: Alignment.bottomCenter,
              child: _buildToolBar(),
            )
          ],
        ),
      ),
    );
  }

  Widget _buildToolBar() {
    return Row(
          mainAxisSize: MainAxisSize.max,
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            FlatButton(
              onPressed: () {
                _captureController.pause();
              },
              child: Text('pause'),
            ),
            FlatButton(
              onPressed: () {
                if (_isTorchOn) {
                  _captureController.torchMode = CaptureTorchMode.off;
                } else {
                  _captureController.torchMode = CaptureTorchMode.on;
                }
                _isTorchOn = !_isTorchOn;
              },
              child: Text('torch'),
            ),
            FlatButton(
              onPressed: () {
                _captureController.resume();
              },
              child: Text('resume'),
            ),
          ],
        );
  }
}

Methods

Pause capture #

void pause() {
    _methodChannel.invokeMethod('pause');
  }

Resume capture #

void resume() {
    _methodChannel.invokeMethod('resume');
  }

Turn on the flashlight #

set torchMode(CaptureTorchMode mode) {
    var isOn = mode == CaptureTorchMode.on;
    _methodChannel.invokeMethod('setTorchMode', isOn);
  }

Capture Mode #

 QRCaptureController _captureController = QRCaptureController();
 _captureController.torchMode = CaptureTorchMode.off;

Integration #

iOS #

To use on iOS, you must add the following to your Info.plist

<key>NSCameraUsageDescription</key>
<string>Camera permission is required for qrcode scanning.</string>
<key>io.flutter.embedded_views_preview</key>
<true/>

"# qrcode_forked"

4
likes
140
points
45
downloads

Publisher

unverified uploader

Weekly Downloads

A flutter plugin used to read qrCodes. I forked the qrCode plugin and migrated it to nullsafety. Currently running android and ios.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on qrcode_forked