【发布时间】:2020-12-24 05:01:43
【问题描述】:
我的应用程序只是显示首页。
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark.copyWith(
statusBarColor: Colors.transparent
));
return MaterialApp(
theme: ThemeData(
),
home: TopPage(title: 'flutter'),
);
}
}
class TopPage extends StatefulWidget {
TopPage({Key key, this.title}) : super(key: key);
final String title;
@override
_TopPageState createState() => _TopPageState();
}
class _TopPageState extends State<TopPage> {
@override
void initState() {
super.initState();
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);
}
}
我以此来限制方向
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);
它修复了 Android /Android 平板电脑 / iPhone 上的仅纵向显示。
但仅适用于 iPad。
它旋转到横向。
如何在 iPad 上停止旋转??
在我的 Xcode 中 Deployment Info. -> 1Device Orientation`
Portlait
Lanscape Left
Landscape Right
已检查。
因为我需要在TopPage以外的页面上旋转
【问题讨论】:
标签: ios iphone xcode flutter ipad