Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

animation always restarts in Listview.builder #244

Open
hibbert-de opened this issue Mar 31, 2020 · 3 comments
Open

animation always restarts in Listview.builder #244

hibbert-de opened this issue Mar 31, 2020 · 3 comments

Comments

@hibbert-de
Copy link

hibbert-de commented Mar 31, 2020

Hi,
i want to to add a flutter animation at the first item of a listview. so i decided to take a Listview.builder. The page is a statefull widget because i have to update the listview sometimes if a new event arrives over a websocket.

so i tried this one here:

ListView.builder(
            itemCount: _events.length,
            padding: const EdgeInsets.all(15.0),
            itemBuilder: (context, position) {
              return position == 0 && _events[position].eventID >= 0
                  ? makeFirstCard(_events[position])
                  : makeCard(_events[position]);
            });
//...
makeFirstCard(GameEvent event) {
    return Card(
      elevation: 1.0,
      margin: new EdgeInsets.symmetric(horizontal: 5.0, vertical: 6.0),
      child: Container(
        width: double.infinity,
        child: Row(
          children: <Widget>[
            Expanded(
                flex: 0,
                child: Container(
                    width: 100,
                    height: 100,
                    child: FlareActor(
                      "assets/animations/dummy.flr",
                      animation: "dummy",
                    ))),
// some other text fields...
          ],
        ),
      ),
    );
  }

if i just scroll down a little bit the animation is starting from beginning.
is it possible to have a animation in a listview.builder or is there a better way to do this?
the length of items is dynamic and will change while the user is on this page.

[edit]
this only appears on touch down the listview. after touch down, holding and moving the list the animation works as expected.
[/edit]

thanks.
phil

Pubspec

flare_flutter: ^1.8.3

Flutter Doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v1.13.7-pre.8, on Mac OS X 10.15.3 19D76, locale de-DE)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.4)
[✓] Android Studio (version 3.6)
[!] IntelliJ IDEA Community Edition (version 2019.1.4)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] Connected device
! No devices available

@jeanmatthieud
Copy link

I have the same issue with a "SingleChildScrollView", and "physics" set to "AlwaysScrollableScrollPhysics()".
The FlareActor is rebuilt and the animation restarts. How to avoid this behavior ? Is it a bug or the normal behavior ?
I thought that the FlareActor will properly manage the animation state.

@devplanet-dp
Copy link

Any solution?

@p4-k4
Copy link

p4-k4 commented Jul 30, 2022

1 year later...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants