ecp_sync_plugin 3.1.9 ecp_sync_plugin: ^3.1.9 copied to clipboard
A new Flutter plugin. Added AES Encription, Added QR Code Scanner, File & DB Sync for Android & IOS, Internet Connectivity check for both Android & IOS.
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:ecp_sync_plugin/ecp_sync_plugin.dart';
//import 'package:ecp_sync_plugin_example/DatabaseHelper.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.removeLogs();
//databaseHelper.closeDatabase();
//databaseHelper.close();
_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(int type) async {
String platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
// 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(1);
},
),
RaisedButton(
padding: EdgeInsets.all(12.0),
shape: StadiumBorder(),
child: Text(
"File Sync",
style: TextStyle(color: Colors.white),
),
color: Colors.blueGrey,
onPressed: () {
//dismissProgressHUD();
pressDetails(2);
},
),
RaisedButton(
padding: EdgeInsets.all(12.0),
shape: StadiumBorder(),
child: Text(
"Scan",
style: TextStyle(color: Colors.white),
),
color: Colors.blueGrey,
onPressed: () {
//dismissProgressHUD();
pressDetails(3);
},
),
RaisedButton(
padding: EdgeInsets.all(12.0),
shape: StadiumBorder(),
child: Text(
"Internet",
style: TextStyle(color: Colors.white),
),
color: Colors.blueGrey,
onPressed: () {
//dismissProgressHUD();
pressDetails(4);
},
)
],
),
),
),
);
}
pressDetails(int type) {
/*Navigator.push(
_context,
MaterialPageRoute(
builder: (context) => BarChartWithSecondaryAxis.withSampleData()),
);*/
initPlatformState(type);
}
@override
void dispose() {
super.dispose();
print("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}
}