flutter_coast icon indicating copy to clipboard operation
flutter_coast copied to clipboard

Flicker when using two Crabs in one Beach

Open xBugzilla opened this issue 4 years ago • 0 comments

Hello. First, thank you so much for this amazing package.

Second, I want to animate two Crabs in the same Beach and they do animate but there is a flicker in between animations that does not happen with a single Crab.

https://user-images.githubusercontent.com/35877309/143782452-ccadc251-5959-431e-8a5a-662539f9aaf2.mp4

I'm animation the text in all the transitions. And only between two pages, I animate the "operators and arrows" box too. There is visual flicker on the transition with the "operators and arrows".

Also, how can I use flightShuttleBuilder to make the "operators and arrows" stick to the page if there is no room for it in the next or previous page? I'm using the flightShuttleBuilder from another issue related to Text that I modified so text changes instantly.

Widget textFlightShuttleBuilder(
  BuildContext flightContext,
  Animation<double> animation,
  BeachTransitionDirection direction,
  BuildContext fromCrabContext,
  BuildContext? toCrabContext,
) {
  final curvedAnimation = CurvedAnimation(parent: animation, curve: Curves.linear);
  return Stack(
    clipBehavior: Clip.none,
    children: [
      Positioned(
        top: 0,
        left: 0,
        child: FadeTransition(
          opacity: Tween<double>(begin: 0, end: 0).animate(curvedAnimation), // begin == end
          child: (fromCrabContext.widget as Crab).child,
        ),
      ),
      if (toCrabContext != null)
        Positioned(
          top: 0,
          left: 0,
          child: FadeTransition(
            opacity: Tween<double>(begin: 1, end: 1).animate(curvedAnimation),  // begin == end
            child: (toCrabContext.widget as Crab).child,
          ),
        ),
    ],
  );
}

xBugzilla avatar Nov 28 '21 19:11 xBugzilla