toggleOrientation static method
切换屏幕方向(自动在横屏和竖屏之间切换)
Implementation
static Future<void> toggleOrientation() async {
final orientation = await getCurrentOrientation();
if (orientation == Orientation.landscape) {
await switchToPortrait();
} else {
await switchToLandscape();
}
}