pda_scanner 0.2.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 73

PDA Scanner #

License Pub

A Flutter plugin 🛠 to scanning. Ready for PDA 🚀

github

pda_scanner.gif

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
 pda_scanner: ^0.2.2

Supported #

  • [x] SEUIC(小码哥)-PDA
  • [x] IData(盈达聚力)-PDA
  • [x] UROVO(优博讯)-PDA
  • [x] HONEYWELL(霍尼韦尔) PDA

Usage #

/// 导入依赖
import 'package:pda_scanner/pda_source.dart';
import 'package:pda_scanner/pda_listener.dart';

/// 程序启动时初始化 PdaSource.
PdaSource.init();

/// 退出应用程序时释放 PdaSource 相关资源.
PdaSource.uninstall();

class PageAlpha extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => PageAlphaState();
}

/// 继承 PdaListenerState<PageAlpha> 监听扫码事件
class PageAlphaState extends PdaListenerState<PageAlpha> {
  var _code;

  @override
  Widget build(BuildContext context) {
    return null;
  }

  /// 监听扫描事件
  @override
  void onEvent(Object code) {}
}

Contribute #

We would ❤️ to see your contribution!

License #

Distributed under the MIT license. See LICENSE for more information.

About #

Created by Shusheng.

[0.0.1] - 2019/04/12

  • 支持【小码哥】型号PDA

[0.0.2] - 2019/04/12

[0.0.3] - 2019/04/12

[0.1.0] - 2019/04/12

[0.1.1] - 2019/04/12

[0.1.2] - 2019/04/13

[0.1.3] - 2019/04/15

[0.1.4] - 2019/04/29

[0.1.5] - 2019/06/26

  • 支持【IDATA】型号PDA
  • 支持【优博讯】型号PDA

[0.2.0] - 2019/08/21

  • 添加抽象类 PdaListenerState<T extends StatefulWidget>

[0.2.1] - 2019/08/21

[0.2.2] - 2019/08/22

example/README.md

pda_scanner_example #

import 'package:flutter/material.dart';
import 'package:pda_scanner/pda_source.dart';
import 'package:pda_scanner/pda_listener.dart';

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    /// 程序启动时初始化 PdaSource.
    PdaSource.init();
  }

  @override
  void dispose() {
    super.dispose();
    /// 退出应用程序时释放 PdaSource 相关资源.
    PdaSource.uninstall();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: PageAlpha(),
    );
  }
}

class PageAlpha extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => PageAlphaState();
}

class PageAlphaState extends PdaListenerState<PageAlpha> {
  var _code;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('PageAlpha'),
      ),
      body: Column(
        children: <Widget>[
          Text('Scanning result: $_code\n'),
          RaisedButton(
            child: Text('Got to Beta'),
            onPressed: () => Navigator.of(context).push(MaterialPageRoute(builder: (context) => PageBeta())),
          ),
        ],
      ),
    );
  }

  /// 监听扫描事件
  @override
  void onEvent(Object event) {
    setState(() {
      _code = event;
      print("ChannelPage: $event");
    });
  }
}

class PageBeta extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => PageBetaState();
}

class PageBetaState extends PdaListenerState<PageBeta> {
  var _code;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('PageBeta'),
      ),
      body: Column(
        children: <Widget>[
          Text('Scanning result: $_code\n'),
          RaisedButton(child: Text('Back to Alhpa'), onPressed: () => Navigator.of(context).pop()),
        ],
      ),
    );
  }

  @override
  void onEvent(Object event) {
    setState(() {
      _code = event;
      print("ChannelPage: $event");
    });
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  pda_scanner: ^0.2.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:pda_scanner/pda_listener.dart';
import 'package:pda_scanner/pda_source.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
45
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

We analyzed this package on Oct 18, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/pda_source.dart.

Run flutter format to format lib/pda_source.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8