0

我有一个 App-Bar ,我需要在 App-Bar 的图像下方放置一个文本。文本应直接在下方对齐。我尝试了很多方法,但我找不到方法来做到这一点。[我现在得到的输出图像][1]

      appBar:
      new PreferredSize(
       preferredSize: const Size.fromHeight(240.0), 
        child: new AppBar(
        centerTitle: true,
        title: Row(),
            flexibleSpace: Container(
              decoration: BoxDecoration(
                gradient: LinearGradient(
                  colors: [reddish, blushish],
                ),
              ),
            ),

      bottom: new PreferredSize(
          child: new Container(
            child: new Image.asset('assets/rewahub_icon.png'),
            padding: const EdgeInsets.all(80.0),
           ),
          preferredSize: const Size.fromHeight(100.0)),
      ),
      ),

I am not able to place a text below the Png file that is image file. I would like to place a text below the Image file. Please do help me with this.

[1]: https://i.stack.imgur.com/P45ya.jpg


4

2 回答 2

0

you can but all widgets you want to start at the same align in a column and use MainAxisAlignment property like: MainAxisAlignment.start

you can use padding if you want some spaces around too ..

于 2019-10-02T15:19:14.670 回答
0

您可以将图像包装在一个列中,并在该列中添加一个文本小部件。

                    child: Column(
                  children: <Widget>[
                    new Image.asset('assets/rewahub_icon.png'),
                    Text('I got my text here'),
                  ],
                )
于 2019-10-02T15:51:39.860 回答