Expand The App bar in Flutter to Allow Multi-Line Title?

前端 未结 6 950
名媛妹妹
名媛妹妹 2021-02-04 02:28

Does anyone know how I can create an app bar with a multi-line title, as per the material guidelines show here?

https://material.io/design/components/app-bars-top.html#

6条回答
  •  鱼传尺愫
    2021-02-04 03:18

    Try below code. This will give multi-line where you can also control the text styling. Use Text instead of RichText if you do not want different style for all the lines.

                 AppBar(
                    title: RichText(
                      textAlign: TextAlign.center,
                      text: TextSpan(
                          text: "Developer Developer",
                          style: TextStyle(fontSize: 20),
                          children: [
                            TextSpan(
                              text: '\nTrip List',
                              style: TextStyle(
                                fontSize: 16,
                              ),
                            ),
                          ]
                      ),
                    ),
                    backgroundColor: MissionGPSTheme.themeBlueColor
                ),
    

提交回复
热议问题