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

A flutter plugin project for listening device orientation.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:ff_orientation/ff_orientation.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> {
  DeviceOrientation _deviceOrientation = DeviceOrientation.portraitUp;

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

    FfOrientation().handlerOpenUrl = (orientation) {
      setState(() {
        _deviceOrientation = orientation;
      });
      return Future.value();
    };
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('DeviceOrientation: $_deviceOrientation'),
        ),
      ),
    );
  }
}
0
likes
140
pub points
0%
popularity

Publisher

unverified uploader

A flutter plugin project for listening device orientation.

Homepage

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on ff_orientation