カードに画像を追加すると、カード上部の半径が隠れてしまいます。どうすれば解決できますか?
カードに画像を追加すると、カード上部の半径が隠れてしまいます。どうすれば解決できますか?
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(primarySwatch: Colors.yellow),
home: Scaffold(
backgroundColor: Colors.grey[200],
appBar: AppBar(title: Text('Demo'),),
body: SizedBox(
height: 310.0,
child: Card(
elevation: 3.0,
color: Colors.white,
margin: EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(height: 0.0,),
Image.network('https://img.zcool.cn/community/012157578c405f0000012e7e69e7cd.jpg@1280w_1l_2o_100sh.jpg'),
SizedBox(height: 16.0,),
Row(
children: <Widget>[
SizedBox(width: 16.0,),
Text('素雪', style: Theme.of(context).textTheme.headline,),
SizedBox(width: 16.0,),
Text('吉时已到', style: Theme.of(context).textTheme.subhead,),
],
),
SizedBox(height: 16.0,),
],
),
))),
);
}
}
これはレンダリングです
ベストアンサー1
clipBehavior
カードに設定できる内容:
Card(
clipBehavior: Clip.antiAliasWithSaveLayer, ...
または、画像をClipRRect
ClipRRect(
borderRadius: BorderRadius.vertical(top: Radius.circular(4.0)),
child: Image.network(...),
)