Skip to content

Exit animations not working with PageRouteBuilder #14

@rlch

Description

@rlch

Hi,

I'm using PageRouteBuilder to push a widget with villain animations. The entrance animations work fine, however when i use Navigator.of(context).pop(), the exit animations don't appear.

Here's the push:

                  listenerContext,
                  PageRouteBuilder(
                      pageBuilder: (listenerContext, _, __) => RestScreen(
                            rest: state.rest,
                            workoutArea: widget.workoutArea,
                          ))).then((result) => result
                  ? _workoutBloc.dispatch(FinishWorkoutStep())
                  : print("closed"));```

and pop + villain animations (part of RestScreen):
```              Villain(
                villainAnimation: VillainAnimation.fade(
                    from: Duration(milliseconds: 0),
                    to: Duration(milliseconds: 1000),
                    fadeFrom: 0,
                    fadeTo: 1,
                    curve: Curves.linear),
                animateExit: true,
                animateEntrance: true,
                child: AppBar(
                  elevation: 0.0,
                  centerTitle: true,
                  title: Text(
                    widget.rest.title,
                    style: AppTheme.heading,
                  ),
                  leading: Padding(
                    padding: const EdgeInsets.only(left: 16),
                    child: IconButton(
                      iconSize: 40,
                      icon: Icon(Icons.close),
                      color: Colors.white.withOpacity(0.9),
                      onPressed: () {
                        Navigator.of(context).pop(false);
                      },
                    ),
                  ),
                  backgroundColor: Colors.transparent,
                ),
              ),```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions