【问题标题】:how to add rounded image in the center of the container如何在容器中心添加圆形图像
【发布时间】:2021-09-29 12:01:21
【问题描述】:

我正在创建个人资料页面,我想要这样的顶部

这是我的代码

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'),
              
            ),
          ),
        ))),
        

      ])));
  }
}

这是它的输出

它是从底部开始的,你能帮我解决我做错的地方吗?

【问题讨论】:

    标签: image flutter containers rounding profile


    【解决方案1】:

    你的意思是你的圆圈底部看起来是平的?这与您的代码无关。这是因为您使用的图像底部有白色。 Take a look 为你自己。如果您将ScaffoldbackgroundColor: 更改为Colors.red 或白色以外的其他内容,您将看到我在说什么。您需要做的就是使用底部没有白色的其他图像,或者裁剪当前的图像。

    【讨论】:

      猜你喜欢
      • 2021-12-10
      • 1970-01-01
      • 2021-04-05
      • 1970-01-01
      • 2014-05-15
      • 2015-04-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多