Image Scale type center crop on flutter?

后端 未结 4 1052
南方客
南方客 2021-02-05 05:31

I\'m trying to do something similar to centerCrop property from android ImageView. Setting the height of the imageview, and making it crop and align to center, just as centerCro

4条回答
  •  时光说笑
    2021-02-05 05:53

    Android ScaleType and BoxFit should match like this:

    1. CENTER = none
    2. CENTER_CROP = Cover
    3. CENTER_INSIDE = scaleDown
    4. FIT_CENTER = contain (alignment.center)
    5. FIT_END = contain (alignment.bottomright)
    6. FIT_START = contain (alignment.topleft)
    7. FIT_XY = 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.

提交回复
热议问题