LinXunFeng / flutter_switch_orientation

A Flutter plugin that switches device orientation.

Home Page:https://pub.dev/packages/switch_orientation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

switch_orientation

A Flutter plugin that switches device orientation.

β˜• Support me

ko-fi wechat

Chat: Join WeChat group

πŸ“¦ Installing

Add switch_orientation to your pubspec.yaml file:

dependencies:
  switch_orientation: latest_version

Import switch_orientation in files that it will be used:

import 'package:switch_orientation/switch_orientation.dart';

πŸ“š Usage

iOS

In AppDelegate

import LXFProtocolTool

func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
    return UIApplication.shared.lxf.currentVcOrientationMask
}

Android

Nothing to do.

Dart

SwitchOrientation.setPreferredOrientations([
  DeviceOrientation.portraitUp,
  DeviceOrientation.portraitDown,
  DeviceOrientation.landscapeLeft,
  DeviceOrientation.landscapeRight,
]);

FAQ

πŸ–¨ About Me

About

A Flutter plugin that switches device orientation.

https://pub.dev/packages/switch_orientation

License:MIT License


Languages

Language:Dart 48.5%Language:Swift 40.7%Language:Ruby 10.1%Language:Kotlin 0.5%Language:Objective-C 0.2%