motrixi_flutter 0.0.1 motrixi_flutter: ^0.0.1 copied to clipboard
A new flutter plugin project.
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:motrixi_flutter/motrixi_flutter.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _logInformation = '';
@override
void initState() {
super.initState();
MotrixiFlutter.initSDK('5ad751a0-127e-11eb-a2b2-39b34bf62ab2');
MotrixiFlutter.setCallback(MotrixiCallback(
onLog: (String s) {
print('----Log-----' + s);
setState(() {
_logInformation = s;
});
}
));
}
Future<void> getInformation() async {
setState(() {
_logInformation = '';
});
await MotrixiFlutter.uploadSDKData;
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Flutter SDK Demo'),
actions: <Widget>[
FlatButton(onPressed: getInformation, child: Text("Upload", style: TextStyle(color: Colors.white),))
],
),
body: Center(
child: Container(
padding: EdgeInsets.all(30),
child: SingleChildScrollView(
child: Text(_logInformation),
),
)
),
),
);
}
}