flutter - 颤振方向变化口吃
问题描述
当设备方向发生变化时,我遇到了口吃,请参阅下面的视频。
https://www.youtube.com/watch?v=Psmoi4NJ-aA
正如您所看到的,当将方向从纵向更改为横向时,几乎一半的屏幕显示黑色区域,而居中文本下方的绿色区域消失了一小段时间。
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: '',
home: Scaffold(
body: OrientationBuilder(builder: (context, orientation) {
return Container(
color: orientation == Orientation.portrait
? Colors.green
: Colors.blue,
child: Center(
child: Text(
"${orientation.toString()}",
style: Theme.of(context)
.textTheme
.headline6
.copyWith(color: Colors.white),
),
),
);
}),
),
);
}
}
知道什么可能导致问题吗?这可能是与设备相关的问题吗?我的设备规格: