A Flutter plugin that switches device orientation.
Chat: Join WeChat group
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';
In AppDelegate
import LXFProtocolTool
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return UIApplication.shared.lxf.currentVcOrientationMask
}
Nothing to do.
SwitchOrientation.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]);
- Flutter: Failed to change device orientation on Ipad
- How to enable upside down orientation on flutter for iOS?
- GitHub: https://github.com/LinXunFeng
- Email: linxunfeng@yeah.net
- Blogs:
- å…¨æ ˆè¡ŒåŠ¨: https://fullstackaction.com
- 掘金: https://juejin.cn/user/1820446984512392