oin_pos_plugin 0.0.2 copy "oin_pos_plugin: ^0.0.2" to clipboard
oin_pos_plugin: ^0.0.2 copied to clipboard

outdated

oin pos flutter plugin for iOS and Android

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:oin_pos_plugin/oin_pos_plugin.dart';

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

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

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

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

  connectBlueTooth() {
    OinPosPlugin.connectBluetooth();
  }

  searchPort() {
    OinPosPlugin.searchPort();
  }

  openCashDrawer() {
    OinPosPlugin.openCashDrawer();
  }

  testPrint() {
    OinPosPlugin.printTestReceipt();
  }

  getPortname() async {
    String portName;
    // OinPosPlugin.openCashDrawer();
    try {
      portName = await OinPosPlugin.portName;
    } on PlatformException {
      portName = 'Failed to get platform version.';
    }
  }

  printReceipts() async {
    try {
      await OinPosPlugin.printReceipts;
    } on PlatformException {
      
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            children: <Widget>[
              RaisedButton(
                onPressed: connectBlueTooth,
                child: Text("藍芽連線"),
                color: Colors.red,
                textColor: Colors.white,
                splashColor: Colors.black,
              ),
              RaisedButton(
                onPressed: getPortname,
                child: Text("CurrentPort"),
                color: Colors.red,
                textColor: Colors.white,
                splashColor: Colors.black,
              ),
              RaisedButton(
                onPressed: searchPort,
                child: Text("SearchPort"),
                color: Colors.red,
                textColor: Colors.white,
                splashColor: Colors.black,
              ),
              RaisedButton(
                onPressed: openCashDrawer,
                child: Text("打開錢櫃"),
                color: Colors.red,
                textColor: Colors.white,
                splashColor: Colors.black,
              ),
              RaisedButton(
                onPressed: testPrint,
                child: Text("列印測試"),
                color: Colors.red,
                textColor: Colors.white,
                splashColor: Colors.black,
              ),
              RaisedButton(
                onPressed: printReceipts,
                child: Text("列印收據"),
                color: Colors.red,
                textColor: Colors.white,
                splashColor: Colors.black,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
0
pub points
6%
popularity

Publisher

unverified uploader

oin pos flutter plugin for iOS and Android

Repository (GitLab)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on oin_pos_plugin