Flutter中有后退按钮时如何对齐应用栏

How to align app bar when there is back button in Flutter

在我的应用栏中,我有一个文本和图像,但每次我转到第二页时,文本和图像不再居中对齐,因为左下角有后退按钮。

我只是想知道如何使它居中对齐,以便它在每个屏幕上看起来都一样。

     appBar: AppBar(
        title: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              "Maxis",
              style:
                  TextStyle(fontFamily: "Raleway", fontWeight: FontWeight.w300),
            ),
            Image.asset(
              "assets/images/Image.png",
              width: 30,
            ),
            Text(
              "Mobile",
              style:
                  TextStyle(fontFamily: "Raleway", fontWeight: FontWeight.w300),
            ),
          ],
        ),
        centerTitle: true,
      ),


在 AppBar 上使用 MainAxisAlignment.center 和 MainAxisSize.min 以及 centerTitle: true 的行

 return Scaffold(
  appBar: AppBar(
    title: Row(
      mainAxisAlignment: MainAxisAlignment.center,
      mainAxisSize: MainAxisSize.min,
      children: [
        const Text('title 1'),
        const SizedBox(width: 16),
        const Icon(Icons.ac_unit),
        const SizedBox(width: 16),
        const Text('title 2'),
      ],
    ),
    centerTitle: true,
    elevation: 6,
  ),