【问题标题】:AnnotatedRegion doesn't work on real deviceAnnotatedRegion 在真实设备上不起作用
【发布时间】:2020-03-18 04:57:03
【问题描述】:

我使用AnnotatedRegion 小部件通过设置SystemUiOverlayStyle 来更改iOS 设备上的状态栏项目应位于darklight 的位置,这在我在iOS 模拟器上运行时有效。

这是预览(在 iOS 模拟器、iPhone 11 上):

但遗憾的是,我也尝试在真实设备上运行它,这是预览版 (iPhone XR)

我从新项目中制作了这个,这是我使用的代码:

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

这是错误还是什么?谢谢

【问题讨论】:

    标签: flutter


    【解决方案1】:

    在当前不稳定版本的颤振中修复(v1.16.2-pre.41)。 Github issuehttps://github.com/flutter/flutter/issues/53034

    【讨论】:

      猜你喜欢
      • 2013-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-04
      • 2020-07-03
      • 2012-07-06
      • 1970-01-01
      • 2011-05-23
      相关资源
      最近更新 更多