如何在颤动中改变卡片的高度
How to change height of a card in flutter
Card(
semanticContainer: true,
clipBehavior: Clip.antiAliasWithSaveLayer,
child: Image.network( 'https://placeimg.com/640/480/any',fit: BoxFit.fill),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
elevation: 5,
margin: EdgeInsets.all(10),
)
要修改卡片的宽度或高度,您可以将其包装在容器小部件中并为其提供高度 and/or 宽度属性。
请查看下面用高度设置为 500 的容器包裹的代码:
Container(
height: 500,
child: Card(
semanticContainer: true,
clipBehavior: Clip.antiAliasWithSaveLayer,
child: Image.network(
'https://placeimg.com/640/480/any', fit: BoxFit.fill,),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
elevation: 5,
margin: EdgeInsets.all(10),
),
),
时间在流逝,喜欢你:
https://api.flutter.dev/flutter/widgets/SizedBox-class.html
SizedBox(
height: double.infinity,
child: Card(
semanticContainer: true,
clipBehavior: Clip.antiAliasWithSaveLayer,
child: Image.network(
'https://placeimg.com/640/480/any',
fit: BoxFit.fill,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
elevation: 5,
margin: EdgeInsets.all(10),
),
),
Card(
semanticContainer: true,
clipBehavior: Clip.antiAliasWithSaveLayer,
child: Image.network( 'https://placeimg.com/640/480/any',fit: BoxFit.fill),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
elevation: 5,
margin: EdgeInsets.all(10),
)
要修改卡片的宽度或高度,您可以将其包装在容器小部件中并为其提供高度 and/or 宽度属性。
请查看下面用高度设置为 500 的容器包裹的代码:
Container(
height: 500,
child: Card(
semanticContainer: true,
clipBehavior: Clip.antiAliasWithSaveLayer,
child: Image.network(
'https://placeimg.com/640/480/any', fit: BoxFit.fill,),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
elevation: 5,
margin: EdgeInsets.all(10),
),
),
时间在流逝,喜欢你: https://api.flutter.dev/flutter/widgets/SizedBox-class.html
SizedBox(
height: double.infinity,
child: Card(
semanticContainer: true,
clipBehavior: Clip.antiAliasWithSaveLayer,
child: Image.network(
'https://placeimg.com/640/480/any',
fit: BoxFit.fill,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
elevation: 5,
margin: EdgeInsets.all(10),
),
),