Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Support BoxFit #3

Open
tinyjin opened this issue Mar 14, 2024 · 0 comments
Open

Support BoxFit #3

tinyjin opened this issue Mar 14, 2024 · 0 comments
Labels
enhancement New feature or request widget Widget enhancements

Comments

@tinyjin
Copy link
Owner

tinyjin commented Mar 14, 2024

When the canvas size is bigger than animation has, image is resized like Boxfit.fill.
This issue causes different size from lottie-flutter.

Step 1. Must ensure the default rendering result is Boxfit.none.
Screenshot 2024-03-14 at 9 58 45 PM

Step 2. Should support 7 options on BoxFit enum:
https://api.flutter.dev/flutter/painting/BoxFit.html

  • fill
  • contain
  • cover
  • fitWidth
  • fitHeight
  • none
  • scaleDown

The parameter usage will be:

Lottie.asset(
    'assets/path/to/lottie.json',
    width: 300,
    height: 300,
    fit: BoxFit.cover
)

Artboard 1

@tinyjin tinyjin added the enhancement New feature or request label Mar 14, 2024
tinyjin added a commit that referenced this issue Mar 14, 2024
To render predictable animation, default BoxFit has changed to `none`.

Animation won't be longer stretched by canvas size. (retain original size, aligned to center)

Related: #3
@tinyjin tinyjin added the widget Widget enhancements label Mar 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request widget Widget enhancements
Projects
None yet
Development

No branches or pull requests

1 participant