ShaderTransitionBuilders class

Factory + PageTransitionsBuilder for using a ShaderTransition with any router.

  • Flutter Navigator: prefer ShaderPageRoute.
  • go_router: CustomTransitionPage(transitionsBuilder: ...).
  • auto_route: CustomRoute(transitionsBuilder: ...).
  • App-wide default: ShaderPageTransitionsBuilder in ThemeData.pageTransitionsTheme.

go_router

GoRoute(
  path: '/next',
  pageBuilder: (context, state) => CustomTransitionPage(
    key: state.pageKey,
    child: const NextPage(),
    opaque: false, // ← required for the outgoing page to show through
    transitionDuration: const Duration(milliseconds: 800),
    reverseTransitionDuration: const Duration(milliseconds: 800),
    transitionsBuilder: ShaderTransitionBuilders.create(
      const DiamondTransition(),
    ),
  ),
)

auto_route

AutoRoute(
  page: NextRoute.page,
  customRouteBuilder: <T>(context, child, page) => PageRouteBuilder<T>(
    settings: page,
    opaque: false,
    pageBuilder: (_, __, ___) => child,
    transitionsBuilder: ShaderTransitionBuilders.create(
      const CircleTransition(),
    ),
  ),
)

go_router / auto_route users: set opaque: false on the page/route. Without it Flutter stops rendering the outgoing route, causing a black flash at the start of the transition.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

create(ShaderTransition transition, {VoidCallback? onStart, VoidCallback? onComplete, ValueChanged<double>? onProgress}) → RouteTransitionsBuilder
Creates a RouteTransitionsBuilder for the given transition.