createRoute method

  1. @override
Route<T> createRoute(
  1. BuildContext context
)
override

Creates the Route that corresponds to this page.

The created Route must have its Route.settings property set to this Page.

Implementation

@override
Route<T> createRoute(BuildContext context) {
  final motion = NeumorphicMotion.of(context);
  return _NeumorphicPageRoute<T>(
    settings: this,
    // The look's page change, as a MaterialPageRoute the app pushes under the theme takes it.
    transitionDuration: motion.travel,
    reverseTransitionDuration: motion.leave,
    pageBuilder: (context, _, _) {
      final settings = ModalRoute.of(context)?.settings;
      return ColoredBox(
        color: NeumorphicTheme.of(context).colors.ground,
        child: settings is NeumorphicPage<T> ? settings.child : child,
      );
    },
    // On iOS the swipe back from the screen's edge stands round it.
    transitions: neumorphicPageMotionHere(motion),
  );
}