如何在应用栏中的图像文件下方放置文本?
How to Place a Text Below the Image file in the App-Bar?
我有一个 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
你可以,但是你想要开始的所有小部件都在同一列中对齐
并使用 MainAxisAlignment 属性 如:MainAxisAlignment.start
如果你也想要一些空格,你可以使用填充..
您可以将图像包装在一列中,并在此列中添加一个文本小部件。
child: Column(
children: <Widget>[
new Image.asset('assets/rewahub_icon.png'),
Text('I got my text here'),
],
)
我有一个 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
你可以,但是你想要开始的所有小部件都在同一列中对齐
并使用 MainAxisAlignment 属性 如:MainAxisAlignment.start
如果你也想要一些空格,你可以使用填充..
您可以将图像包装在一列中,并在此列中添加一个文本小部件。
child: Column(
children: <Widget>[
new Image.asset('assets/rewahub_icon.png'),
Text('I got my text here'),
],
)