在颤动中隐藏后退按钮

ios*_*per 2 android ios dart flutter

我正在为颤振中的某些屏幕使用有状态和无状态小部件。

我想隐藏后退按钮是某个屏幕,想要显示后退按钮是某个屏幕我该怎么做。我没有为后退按钮编写任何代码,它只是默认出现。

我正在使用下面的代码推送到另一个带有参数的屏幕

Navigator.push(
          context,
          MaterialPageRoute(
            builder: (context) => Nextscreen('parameter1','Parameter2'),
          ));
Run Code Online (Sandbox Code Playgroud)

当没有参数时或下面的代码: Navigator.of(context).pushNamed(NEXT_SCREEN);

小智 9

如果要隐藏 Scaffold 页面的 AppBar 中的后退按钮,请传递 AppBarautomaticallyImplyLeading值为的属性false

  appBar: AppBar(
    automaticallyImplyLeading: false,
    ...
  )
Run Code Online (Sandbox Code Playgroud)