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),
)
Customizing Card As it doesn't provide option to adjust width or height, the easiest way to set the size is by wrapping it inside a Container or a SizedBox widget. Then, specify the desired width and height of the Container or SizedBox .
To set specific height for Image widget in Flutter Application, set height property of Image object with required double value.
The font size can be set by manipulating the fontSize property of the TextStyle class. The line-height can be adjusted by using the height property of the TextStyle class. When height is non-null, the line-height of the span of text will be a multiple of fontSize and be exactly fontSize * height logical pixels tall.
To modify the width or height of a card you can wrap it in a Container Widget and provide height and/or width properties to it.
Please see below your code wrapped with a container set with height at 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),
),
),
Time is moving, prefer you that: 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),
),
),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With