image - 如何在容器中心添加圆形图像
问题描述
我正在创建个人资料页面,我想要这样的顶部
这是我的代码
Widget build(BuildContext context) {
return Scaffold(
appBar: new MyAppBar(title: Text("My Profile")
),
drawer:drawer(),
body:
SingleChildScrollView(
child:Stack(children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: 150,
color: Colors.blue[500],
child: Align(
alignment:Alignment(-1.4,4.0),
child:Container(
//margin: EdgeInsets.all(20),
width: 400,
height: 125,
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
image: NetworkImage('https://patientcaremedical.com/wp-content/uploads/2018/04/male-catheters.jpg'),
),
),
))),
])));
}
}
这是它的输出
它从底部开始是圆形的,你能帮我解决我做错的地方吗?
解决方案
你的意思是你的圆圈底部看起来很平?这与您的代码无关。这是因为您使用的图像底部有白色。看看你自己。如果你改变backgroundColor:
你的Scaffold
toColors.red
或白色以外的东西,你会明白我在说什么。您需要做的就是使用底部没有白色的不同图像,或者裁剪您当前的图像。
推荐阅读
- excel - excel - 软件功能而不是excel公式
- eclipse - 无论如何要恢复 ECLIPSE 中意外关闭的 SQL 控制台选项卡吗?
- firebase - 在 Firestore 规则中,您如何检查请求文档的 ID?
- php - 使用自定义挂钩时删除了 WooCommerce 自定义订单项键
- python - 如何在熊猫数据框中获取单元格的内容
- java - 我尝试将 ro setSize() 设置为 JButton,这发生了
- android - RecyclerView 在底部工作表片段内不起作用
- python - 我如何实现存在_of(x)=>缺席_of(y)
- python - 在 Python 中绘制 BST
- azure-devops - Azure Devops REST API 203 返回