ecp_sync_plugin 2.0.1 copy "ecp_sync_plugin: ^2.0.1" to clipboard
ecp_sync_plugin: ^2.0.1 copied to clipboard

outdated

A new Flutter plugin. Added AES Encription for IOS & Android, Added QR Code Scanner, Added UI.

example/lib/main.dart

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

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

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

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

/*class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(home: new _MyAppState());
  }
}*/

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  EcpSyncPlugin _battery = EcpSyncPlugin();
  Map _batteryState;
  StreamSubscription<Map> _batteryStateSubscription;

  //BuildContext _context;
  // DatabaseHelper databaseHelper;

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

    // databaseHelper = DatabaseHelper.get();
    // databaseHelper.getCountLogin();

    _batteryStateSubscription =
        _battery.onBatteryStateChanged.listen((Map state) {
      setState(() {
        _batteryState = state;
        print(state);
      });
    });
    //initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      /*platformVersion = await EcpSyncPlugin()
          .encodeData("Vcs@1234", "B4V2A1C@S#S\$F", "0000000000000000");
      print("encode:$platformVersion");

      platformVersion = await EcpSyncPlugin()
          .decodeData(platformVersion, "B4V2A1C@S#S\$F", "0000000000000000");
      print("decode:$platformVersion");*/

      /*platformVersion =
          await EcpSyncPlugin().scanBarCodes("false", "true", "true");
      print("decode:$platformVersion");*/

      //platformVersion = await EcpSyncPlugin().getUniqueNumber();
      //print("UniqueNumber:$platformVersion");
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

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

  @override
  Widget build(BuildContext context) {
    //_context = context;
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('ECP Plugin Sync'),
        ),
        body: /*BarChartWithSecondaryAxis
                .withSampleData() */
            Center(
          child: Column(
            children: <Widget>[
              Text('Running on: $_platformVersion\n'),
              Text('Progress on: $_batteryState\n'),
              RaisedButton(
                padding: EdgeInsets.all(12.0),
                shape: StadiumBorder(),
                child: Text(
                  "SYNC",
                  style: TextStyle(color: Colors.white),
                ),
                color: Colors.blueGrey,
                onPressed: () {
                  //dismissProgressHUD();
                  pressDetails();
                },
              )
            ],
          ),
        ),
      ),
    );
  }

  pressDetails() {
    /*Navigator.push(
      _context,
      MaterialPageRoute(
          builder: (context) => BarChartWithSecondaryAxis.withSampleData()),
    );*/

    //DatabaseHelper dbAdapter = DatabaseHelper.get();
    //dbAdapter.getCountLogin();

    initPlatformState();
  }

  @override
  void dispose() {
    super.dispose();
    if (_batteryStateSubscription != null) {
      _batteryStateSubscription.cancel();
    }
  }
//{DeviceId=353490062185257, PersonId=3, Version=18.0.11, Date=2019-02-18 11:27:18, APIToken=25425FD4-D981-4574-B83A-AC2067AA2C8C, SubModuleName=BASF_HK_Device}
}
3
likes
0
pub points
61%
popularity

Publisher

unverified uploader

A new Flutter plugin. Added AES Encription for IOS & Android, Added QR Code Scanner, Added UI.

Homepage

License

unknown (license)

Dependencies

flutter, json_annotation, json_serializable

More

Packages that depend on ecp_sync_plugin