awareframework_activityrecognition 0.0.2 awareframework_activityrecognition: ^0.0.2 copied to clipboard
A new flutter plugin project.
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:awareframework_activityrecognition/awareframework_activityrecognition.dart';
import 'package:awareframework_core/awareframework_core.dart';
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
ActivityRecognitionSensor sensor;
ActivityrecognitionSensorConfig config;
@override
void initState() {
super.initState();
config = ActivityrecognitionSensorConfig()
..debug = true;
sensor = new ActivityRecognitionSensor(config);
sensor.start();
}
void _updateSensor(){
sensor.stop();
sensor.start();
}
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new Scaffold(
appBar: new AppBar(
title: const Text('Plugin Example App'),
),
body: new ActivityRecognitionCard(sensor: sensor,),
floatingActionButton: new FloatingActionButton(
onPressed: _updateSensor,
tooltip: 'Refresh',
child: new Icon(Icons.sync),
), // This trailing comma makes auto-formatting nicer for build methods.
),
);
}
}