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

outdated

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

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().syncronizeData(
          UserName: "",
          fk_EmpGlCode: "",
          urlUpload: "",
          imei: "",
          appVersion: "",
          uploadMethod: "",
          ClientName: "",
          databaseName: "",
          packageName: "");*/

      /*SharedPreferences prefs = await SharedPreferences.getInstance();
      prefs.clear();

      platformVersion = await EcpSyncPlugin().syncronizeData(
          UserName: "1783E250-D28C-4552-9664-B7E94B62476D",
          fk_EmpGlCode: "8",
          urlUpload: "http://172.16.8.112/BASF_HK_Webservice/Services.asmx/",
          imei: "357640060504711",
          appVersion: "18.0.11",
          uploadMethod: "SynchronizeDatabase",
          ClientName: "BASF_HK_Device",
          databaseName: "BASF-HK-Database.db",
          packageName: "ecp.vcs.com.ecpsyncpluginexample");

      print("encode:$platformVersion");*/

      /*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("true", "true", "true");
      print("decode:$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
64%
popularity

Publisher

unverified uploader

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

Homepage

License

unknown (LICENSE)

Dependencies

flutter, json_annotation, json_serializable

More

Packages that depend on ecp_sync_plugin