native_device_orientation 0.1.0 copy "native_device_orientation: ^0.1.0" to clipboard
native_device_orientation: ^0.1.0 copied to clipboard

outdated

A Flutter plugin for reading device's native orientation

example/lib/main.dart

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

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

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

class _MyAppState extends State<MyApp> {
  bool useSensor = false;

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Native Orientation example app'),
          actions: <Widget>[Switch(value: useSensor, onChanged: (val) => setState(() => useSensor = val))],
        ),
        body: NativeDeviceOrientationReader(
          builder: (context) {
            NativeDeviceOrientation orientation = NativeDeviceOrientationReader.orientation(context);
            return Center(child: Text('Native Orientation: ${orientation.toString()}\n'));
          },
          useSensor: useSensor,
        ),
      ),
    );
  }
}
124
likes
0
pub points
98%
popularity

Publisher

unverified uploader

A Flutter plugin for reading device's native orientation

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on native_device_orientation