aeyrium_sensor 1.0.7 copy "aeyrium_sensor: ^1.0.7" to clipboard
aeyrium_sensor: ^1.0.7 copied to clipboard

A Flutter sensor plugin which provide easy access to the Pitch and Roll on Android and iOS devices.

example/lib/main.dart

import 'dart:async';

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

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

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

class _MyAppState extends State<MyApp> {
  String _data = "";

  StreamSubscription<dynamic> _streamSubscriptions;

  @override
  void initState() {
    _streamSubscriptions = AeyriumSensor.sensorEvents.listen((event) {
      setState(() {
        _data = "Pitch ${event.pitch} , Roll ${event.roll}";
      });
    });
    super.initState();
  }

  @override
  void dispose() {
    if (_streamSubscriptions != null) {
      _streamSubscriptions.cancel();
    }
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Padding(
          padding: const EdgeInsets.all(15.0),
          child: new Center(
            child: new Text('Device : $_data'),
          ),
        ),
      ),
    );
  }
}
copied to clipboard
15
likes
35
points
50
downloads

Publisher

verified publisheraeyrium.com

Weekly Downloads

2024.09.23 - 2025.04.07

A Flutter sensor plugin which provide easy access to the Pitch and Roll on Android and iOS devices.

Homepage
Repository (GitHub)

License

MIT (license)

Dependencies

flutter

More

Packages that depend on aeyrium_sensor