返回后隐藏顶部状态栏

the*_*yer 7 flutter

问题是在隐藏它之后,当我通过顶部滑动将它带回来然后保持......

我该如何解决这个问题?也许某种监听器触摸顶部状态栏?

在此输入图像描述

我的代码

class _MyProfileState extends State<MyProfile> {
  @override
  void initState() {
    SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]);
    super.initState();
  }

  @override
  void dispose() {
    SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('My Profile'),
        elevation: 0,
      ),
      body: Container(),
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

小智 -2

尝试这个:

 class _MyProfileState extends State<MyProfile> {
      @override
      void initState() {
        super.initState();
      }
    
      @override
      void dispose() {
        SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
        super.dispose();
      }
    
      @override
      Widget build(BuildContext context) {
       SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]);
        return Scaffold(
          appBar: AppBar(
            title: Text('My Profile'),
            elevation: 0,
          ),
          body: Container(),
        );
      }
    }
Run Code Online (Sandbox Code Playgroud)