orientation_provider 0.0.2 copy "orientation_provider: ^0.0.2" to clipboard
orientation_provider: ^0.0.2 copied to clipboard

Flutter plugin providing native orientation

example/lib/main.dart

import 'dart:async';

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

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

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

class _MyAppState extends State<MyApp> {
  ExactDeviceOrientation _deviceOrientation;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return OrientationBuilder(builder: (context, orientation) {
      OrientationProvider.orientation.then((value) {
        if (_deviceOrientation != value) {
          setState(() {
            _deviceOrientation = value;
          });
        }
      });
      return MaterialApp(
        home: Scaffold(
          appBar: AppBar(
            title: const Text('OrientationProviderPlugin example app'),
          ),
          body: Center(
            child: Text('Current device orientation: $_deviceOrientation\n'),
          ),
        ),
      );
    });
  }
}
1
likes
30
pub points
0%
popularity

Publisher

unverified uploader

Flutter plugin providing native orientation

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on orientation_provider