buildAnimatedPage method

  1. @override
Page buildAnimatedPage(
  1. BuildContext context
)
override

Built-in page types wrap their content so a root page keeps system back (Android predictive back). Custom subclasses that override this, including types returned from ReplaceAnimationTypeCustom.handler, do not get that wrap, and on Android 16 back on such a root closes the app.

Implementation

@override
Page<dynamic> buildAnimatedPage(BuildContext context) {
  return MaterialPage<dynamic>(
    key: key,
    name: screenName,
    fullscreenDialog: true,
    child: RootPopScope(child: builder(context)),
  );
}