device_real_orientation 0.0.1 copy "device_real_orientation: ^0.0.1" to clipboard
device_real_orientation: ^0.0.1 copied to clipboard

outdated

Plugin for check deviceorientation from sensors

example/lib/main.dart

import 'package:device_real_orientation/device_orientation.dart';
import 'package:flutter/material.dart';
import 'package:device_real_orientation/device_orientation_provider.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  var orientation = DeviceOrientation.portrait;

  @override
  void initState() {
    super.initState();
    DeviceOrientationProvider.orientations.listen((orientation) {
      setState(() {
        this.orientation = orientation;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Orientation: $orientation'),
        ),
      ),
    );
  }
}
1
likes
0
points
19
downloads

Publisher

unverified uploader

Weekly Downloads

Plugin for check deviceorientation from sensors

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on device_real_orientation

Packages that implement device_real_orientation