【发布时间】:2019-04-01 08:56:09
【问题描述】:
我在flutter小部件中搜索了一个和这个相同的小部件,但我没有找到我该怎么做?image with text in bottom
【问题讨论】:
我在flutter小部件中搜索了一个和这个相同的小部件,但我没有找到我该怎么做?image with text in bottom
【问题讨论】:
Center(
child: Stack(children: <Widget>[
Image.network(
'https://images.pexels.com/photos/433539/pexels-photo-433539.jpeg?cs=srgb&dl=bali-beautiful-beauty-433539.jpg&fm=jpg'),
Positioned(
right: 0,
left: 0,
bottom: 0,
child: Container(
alignment: Alignment.center,
child: Text(
'ImageText',
style: TextStyle(color: Colors.white),
),
color: Colors.black54,
height: 60,
),
),
]),
)
【讨论】:
您可以使用堆栈小部件。这看起来像这样:
Stack(
children: <Widget>[
Image.network('www.somesite.com/some_image_url.png'),
Container(
color: Colors.black12
alignment: Alignment.bottomCenter,
child: Text('ImageText'),
),
]
)
【讨论】: