我有一个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
答案 0 :(得分:0)
您可以,但所有要从同一列开始的小部件都应对齐
并使用MainAxisAlignment属性,例如:MainAxisAlignment.start
如果您也想在周围留一些空格,可以使用填充。
答案 1 :(得分:0)
您可以将图像包装在列中,并在此列中添加文本小部件。
child: Column(
children: <Widget>[
new Image.asset('assets/rewahub_icon.png'),
Text('I got my text here'),
],
)