我试图禁用手机用户在颤振网站上的景观模式。我用这段代码来禁用它,好吧,当我把这个项目作为一个应用程序运行时,它可以工作,但是它不适用于网络项目。
Widget build(BuildContext context) => ResponsiveSizer(
builder: (context, orientation, screenType) {
if (screenType == ScreenType.mobile) {
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
}
return MaterialApp(
title: 'App Title',
debugShowCheckedModeBanner: false,
theme: AppTheme.lightTheme,
home: const HomePage(),
);
},
);知道如何做到这一点吗?
https://stackoverflow.com/questions/71636620
复制相似问题