我在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 Widget。这看起来像这样:
Stack(
children: <Widget>[
Image.network('www.somesite.com/some_image_url.png'),
Container(
color: Colors.black12
alignment: Alignment.bottomCenter,
child: Text('ImageText'),
),
]
)