Flutter 图像';颤振中的s角
我正在使用这个应用程序,我遇到了一个问题,首先图片没有采用ClipRect的所有尺寸,然后我使用了Ink.Image和BoxFit.fitHeight,没问题,但现在图片没有采用ClipRect的半径。。 对不起,我英语不好,这是应用程序的代码和截图。 请查看链接中的图片。 非常感谢Flutter 图像';颤振中的s角,flutter,dart,Flutter,Dart,我正在使用这个应用程序,我遇到了一个问题,首先图片没有采用ClipRect的所有尺寸,然后我使用了Ink.Image和BoxFit.fitHeight,没问题,但现在图片没有采用ClipRect的半径。。 对不起,我英语不好,这是应用程序的代码和截图。 请查看链接中的图片。 非常感谢 Widget foodCard() { return Padding( padding: EdgeInsets.all(10.0), child: Container( child: Fitte
Widget foodCard() {
return Padding(
padding: EdgeInsets.all(10.0),
child: Container(
child: FittedBox(
child: Material(
color: Colors.white,
elevation:8.0 ,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.0),
),
child: Row(children: [
Container(
width: 250, height: 250,
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.0)),
child: Ink.image(
height: 200,
fit: BoxFit.fitHeight,
alignment: Alignment.topLeft,
image: NetworkImage(
"https://images-gmi-pmc.edge-generalmills.com/087d17eb-500e-4b26-abd1-4f9ffa96a2c6.jpg"
)),)
),
Container(
child: Padding(padding: const EdgeInsets.all(8.0),
child: Column(children: [
Text("Recipe 1",
style: TextStyle(color: Colors.black),),
Text("Some data"),
ButtonBar(children: <Widget>[
FlatButton(
child: Text('Like'),
color: Colors.deepPurple,
onPressed: () {},
),
FlatButton(
child: Text('Dislike'),
color: Colors.deepPurple,
onPressed: () {},
),
],)
]),)
)
],)
)
),
));
Widget foodCard(){
返回填充(
填充:所有边缘设置(10.0),
子:容器(
孩子:FittedBox(
儿童:材料(
颜色:颜色,白色,
标高:8.0,
borderRadius:仅限borderRadius(
左上:半径。圆形(20.0),
),
子对象:行(子对象:[
容器(
宽度:250,高度:250,
孩子:ClipRRect(
borderRadius:仅限borderRadius(
左上:半径。圆形(20.0)),
孩子:墨水(
身高:200,
适合度:BoxFit.fit高度,
对齐:alignment.topLeft,
图片:NetworkImage(
"https://images-gmi-pmc.edge-generalmills.com/087d17eb-500e-4b26-abd1-4f9ffa96a2c6.jpg"
)),)
),
容器(
子项:填充(填充:常量边集。全部(8.0),
子项:列(子项:[
文本(“配方1”,
样式:TextStyle(颜色:Colors.black),
文本(“某些数据”),
巴顿巴(儿童:[
扁平按钮(
child:Text('Like'),
颜色:颜色。深紫色,
按下:(){},
),
扁平按钮(
child:Text('不喜欢'),
颜色:颜色。深紫色,
按下:(){},
),
],)
]),)
)
],)
)
),
));
}
复制并粘贴此小部件
Padding(
padding: const EdgeInsets.all(16.0),
child: Material(
color: Colors.white,
elevation: 8.0,
shadowColor: Colors.blueGrey,
borderRadius: BorderRadius.all(Radius.circular(20.0)),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(20.0)),
child: FittedBox(
child: Material(
color: Colors.white,
elevation: 8.0,
shadowColor: Colors.blueGrey,
child: Row(
children: [
Container(
width: 250,
height: 250,
child: Ink.image(
height: 200,
fit: BoxFit.fitHeight,
alignment: Alignment.topLeft,
image: NetworkImage(
"https://images-gmi-pmc.edge-generalmills.com/087d17eb-500e-4b26-abd1-4f9ffa96a2c6.jpg"))),
Container(
padding: const EdgeInsets.all(8.0),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(children: [
Text(
"Recipe 1",
style: TextStyle(color: Colors.black),
),
Text("Some data"),
ButtonBar(
children: <Widget>[
FlatButton(
child: Text('Like'),
color: Colors.deepPurple,
onPressed: () {},
),
FlatButton(
child: Text('Dislike'),
color: Colors.deepPurple,
onPressed: () {},
),
],
)
]),
))
],
)))),
),
)
填充(
填充:常数边集全部(16.0),
儿童:材料(
颜色:颜色,白色,
标高:8.0,
阴影颜色:颜色。蓝灰色,
borderRadius:borderRadius.all(半径圆形(20.0)),
孩子:ClipRRect(
borderRadius:borderRadius.all(半径圆形(20.0)),
孩子:FittedBox(
儿童:材料(
颜色:颜色,白色,
标高:8.0,
阴影颜色:颜色。蓝灰色,
孩子:排(
儿童:[
容器(
宽度:250,
身高:250,
孩子:墨水(
身高:200,
适合度:BoxFit.fit高度,
对齐:alignment.topLeft,
图片:NetworkImage(
"https://images-gmi-pmc.edge-generalmills.com/087d17eb-500e-4b26-abd1-4f9ffa96a2c6.jpg"))),
容器(
填充:常数边集全部(8.0),
孩子:填充(
填充:常数边集全部(8.0),
子项:列(子项:[
正文(
“配方1”,
样式:TextStyle(颜色:Colors.black),
),
文本(“某些数据”),
钮扣杆(
儿童:[
扁平按钮(
child:Text('Like'),
颜色:颜色。深紫色,
按下:(){},
),
扁平按钮(
child:Text('不喜欢'),
颜色:颜色。深紫色,
按下:(){},
),
],
)
]),
))
],
)))),
),
)
您可以发布一张图片,说明您希望图像的外观吗?如果您希望图像完全填充左边一行,请尝试fit:BoxFit.fill
我希望这样,但我希望半径应用于它。我的意思是半径应用于容器,我也想在图片上应用它。我尝试使用boxfit.fill及其隐藏左上半径循环很多次,它就像我想要的一样工作!你能告诉我我在代码中犯了什么错误,这样就不会给我相同的结果吗?