[英]AnnotatedRegion doesn't work on real device
I use AnnotatedRegion
widget to change where status bar items on iOS device should be dark
or light
by setting SystemUiOverlayStyle
and this works when I run it on iOS Simulator.我使用AnnotatedRegion
小部件通过设置SystemUiOverlayStyle
来更改 iOS 设备上的状态栏项目应该在哪里dark
或light
SystemUiOverlayStyle
,这在我在 iOS 模拟器上运行时有效。
Here's the preview (on iOS Simulator, iPhone 11):这是预览(在 iOS 模拟器上,iPhone 11):
But sadly I also tried to run it on real device, and here's the preview (iPhone XR)但遗憾的是我也尝试在真实设备上运行它,这是预览(iPhone XR)
I made this from fresh project and here's the code I use:我从新项目中制作了这个,这是我使用的代码:
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
bool _toggled = false;
@override
Widget build(BuildContext context) {
return AnnotatedRegion<SystemUiOverlayStyle>(
value: _toggled ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark,
child: Container(
color: Colors.blueAccent,
child: FlatButton(
child: Text('Toggle SystemUiOverlayStyle'),
onPressed: () {
setState(() => _toggled = !_toggled);
},
),
),
);
}
}
• Flutter version 1.12.13+hotfix.8 at /Users/mochamadluckypradana/Documents/flutter
• Framework revision 0b8abb4724 (5 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
Is this bug or something?这是bug还是什么? Thank you谢谢
Fixed in current unstable version of flutter (v1.16.2-pre.41).在当前不稳定的 flutter 版本 (v1.16.2-pre.41) 中修复。 Github issue https://github.com/flutter/flutter/issues/53034 Github 问题https://github.com/flutter/flutter/issues/53034
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.