Skip to content

LinXunFeng/flutter_switch_orientation

Repository files navigation

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.

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published