Image Scale type center crop on flutter?
new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
new Expanded(child: new Image.network(
cover.img,fit: BoxFit.fitWidth,
),
),
Text(cover.name),
]
)
this works for me
Android ScaleType and BoxFit should match like this:
- CENTER = none
- CENTER_CROP = cover
- CENTER_INSIDE = scaleDown
- FIT_CENTER = contain (alignment.center)
- FIT_END = contain (alignment.bottomright)
- FIT_START = contain (alignment.topleft)
- FIT_XY = fill
Ex :-
Image.asset('assets/images/your_image.png',fit: BoxFit.fill)
So you should use Cover to achieve the CENTER_CROP result.
EDIT:
The problem should be crossAxisAlignment
of the Column widget.
Setting this property to crossAxisAlignment: CrossAxisAlignment.stretch
should fix your issue.