Flutter 将对象置于图像之上
Flutter place object on top of image
我尝试在 Flutter web 中重新创建以下图像,我了解几乎所有操作,除了图像上方的配置文件框,
如何将对象放在图像之上?
使用Stack
to put widgets on each other ,if you want to put widget on specific position use Positioned
我建议你阅读this article
这是将对象放置在图像的顶部的示例:
Stack(
children: [
// Background image placed in the center of Stack
Center(
child: Image.network(
'https://interactive-examples.mdn.mozilla.net/media/cc0-images/grapefruit-slice-332-332.jpg'),
),
// Blue container 50x50 placed on the top of an image
Center(
child: Container(
width: 50,
height: 50,
color: Colors.blue
),
),
],
)
我尝试在 Flutter web 中重新创建以下图像,我了解几乎所有操作,除了图像上方的配置文件框,
如何将对象放在图像之上?
使用Stack
to put widgets on each other ,if you want to put widget on specific position use Positioned
我建议你阅读this article
这是将对象放置在图像的顶部的示例:
Stack(
children: [
// Background image placed in the center of Stack
Center(
child: Image.network(
'https://interactive-examples.mdn.mozilla.net/media/cc0-images/grapefruit-slice-332-332.jpg'),
),
// Blue container 50x50 placed on the top of an image
Center(
child: Container(
width: 50,
height: 50,
color: Colors.blue
),
),
],
)