ff_orientation 0.0.2
ff_orientation: ^0.0.2 copied to clipboard
A flutter plugin project for listening device orientation.
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'),
),
),
);
}
}