简体   繁体   English

为什么flutter AppBar的automaticImplyLeading属性没有效果?

[英]Why flutter AppBar's automaticallyImplyLeading attribute has no effect?

In main.dart file, I set appBar Theme as follows.在 main.dart 文件中,我将 appBar Theme 设置如下。

AppBarTheme(
  color: AppColors.colorWhite,
  elevation: 0,
  iconTheme: IconThemeData(
    color: AppColors.colorBlack
  ),
  centerTitle: false,
),

And then, the result of this appBarTheme is shown as following image.然后,这个 appBarTheme 的结果如下图所示。 在此处输入图像描述

But, some pages show a back button and some pages do not.但是,有些页面显示后退按钮,有些页面没有。

Showing a back button page's code is this.显示后退按钮页面的代码是这样的。

return AppBar(
  title: KoreanText(
  TextValues.myPageAppBarText,
    style: TextStyle().pageTitle,
  ),
);

And, not showing page's code is this.而且,不显示页面的代码就是这样。

return AppBar(
  title: KoreanText(
    controller.formatCurrentDate(),
    style: TextStyle().pageTitle,
  ),
  actions: [
    _buildAppBarActions(),
  ],
);

In addition, the automaticallyImplyLeading attribute in all Screen's AppBar did not work at all.另外,所有Screen 的AppBar 中的automaticImplyLeading 属性根本不起作用。

Could you tell me which part of code is wrong in mine...?你能告诉我我的哪一部分代码是错误的......?


Edit 1编辑 1

I am using GetX Library for state management.我正在使用 GetX 库进行 state 管理。

And, only bottom navigation's child screen does not have a back button.而且,只有底部导航的子屏幕没有后退按钮。

A parent page with bottom navigation bar is a main page, child one is a home page.带有底部导航栏的父页面是主页,子页面是主页。

The main page and home page is not a relation of child routing, but the main page has a home page inside it.主页面和主页不是子路由的关系,但是主页面里面有一个主页。

In upper case, the home page's back button is not showing.在大写的情况下,主页的后退按钮不显示。

Back button is not showing when navigating using bottom navigation bar because it doesn't push new screens on your navigation stack contrary to when using Get.to() or Get.toNamed() or Navigator.push() .使用底部导航栏导航时不显示后退按钮,因为与使用Get.to()Get.toNamed()Navigator.push()时相反,它不会在导航堆栈上推送新屏幕。 The back icon/button is only implied when there's more than on item on your navigation stack.仅当导航堆栈上的项目不止一个时,才会隐含返回图标/按钮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM