GithubHelp home page GithubHelp logo

rayhanyulanda / barcode_platform_view Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rodrigowerberich/barcode_platform_view

0.0 0.0 0.0 138 KB

License: Other

Kotlin 24.51% Swift 1.71% Objective-C 42.60% Dart 18.74% Ruby 12.43%

barcode_platform_view's Introduction

barcode_platform_view

A plugin to access native barcode plugins as view for flutter. This allows you to read 2d barcodes and QR codes!

Getting Started

Right now only available for android, ios is comming soon. Usage can be seen in the example folder:

Requires androidx and kotlin

import 'package:barcode_platform_view/barcode_scanner_view.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(new MyApp());
}

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

class _MyAppState extends State<MyApp> {
  String barcode = "Nothing scanned yet";

  BarcodeScannerController scannerController;

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

  @override
  Widget build(BuildContext context) {

    BarcodeScannerView scannerView = new BarcodeScannerView(
      onScannerCreated: onScannerCreated,
    );

    return new MaterialApp(
      home: new Scaffold(
          appBar: new AppBar(
            title: new Text('Barcode Scanner View Example'),
          ),
          body: new Center(
            child: new Column(
              children: <Widget>[
                new Container(
                  child: scannerView,
                  height: 300,
                  padding: const EdgeInsets.all(8.0),
                ),
                new Text(barcode),
              ],
            ),
          )),
    );
  }

  void codeRead(String code){
    barcode = code;
    setState(() { });
    scannerController.startCamera();
  }

  void onScannerCreated(scannerController){
    this.scannerController = scannerController;
    this.scannerController.startCamera();
    this.scannerController.addBarcodeScannerReadCallback(codeRead);
  }

}

barcode_platform_view's People

Contributors

rodrigowerberich avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.