1

What I am currently doing

Navigator.push(context,
            RouteAnimationFadeIn(NewWidget(someValue), true));

RouteAnimationFadeIn:

class RouteAnimationFadeIn extends PageRouteBuilder {
final Widget widget;
final bool shouldMaintainState;

RouteAnimationFadeIn(this.widget, this.shouldMaintainState)
  : super(pageBuilder: (BuildContext context, Animation<double> animation,
        Animation<double> secondaryAnimation) {
      return widget;
    }, transitionsBuilder: (BuildContext context,
        Animation<double> animation,
        Animation<double> secondaryAnimation,
        Widget child) {
      return FadeTransition(
        opacity: animation,
        child: child,
      );
    });

@override
bool get maintainState {
  return shouldMaintainState;
}
}

This disposes of the previous widget, which consequently disposes of data of all the form fields in it. What I want is a fragment add like the functionality of Android, so that the new widget opens on tap of the old widget so that, when I use Navigator.pop(context); I see the old data in it.

I tried this, but it doesn't work.

Siddharth Mehra
  • 1,691
  • 1
  • 9
  • 32
RoyalGriffin
  • 1,987
  • 1
  • 12
  • 25
  • The AutomaticKeepAliveClientMixin is the way to go. How did you implement it? –  Jun 14 '19 at 22:52

0 Answers0