StatefulShellModularRoute class

Modular wrapper for StatefulShellRoute.

Troca entre branches:

Sobrescritas explícitas: transition, transitionDuration, reverseTransitionDuration. navigatorContainerBuilder, quando informado, substitui toda a lógica acima.

As transições de ChildRoute/ModuleRoute (go_transitions) continuam válidas dentro da pilha de cada branch.

Example:

class AppModule extends Module {
  @override
  List<ModularRoute> get routes => [
    StatefulShellModularRoute(
      transition: GoTransitions.slide.toTop.withFade,
      transitionDuration: Duration(milliseconds: 300),
      builder: (context, state, navigationShell) => ScaffoldWithNavBar(
        navigationShell: navigationShell,
      ),
      branches: [
        ModularBranch(
          routes: [
            ChildRoute('/home', child: (_, __) => HomePage()),
          ],
        ),
        ModuleBranch(
          '/settings',
          module: SettingsModule(),
        ),
      ],
    ),
  ];
}
Inheritance

Constructors

StatefulShellModularRoute({required List<ModularBranch> branches, Widget builder(BuildContext context, GoRouterState state, StatefulNavigationShell navigationShell)?, Page pageBuilder(BuildContext context, GoRouterState state, StatefulNavigationShell navigationShell)?, GoTransition? transition, Duration? transitionDuration, Duration? reverseTransitionDuration, ShellNavigationContainerBuilder? navigatorContainerBuilder, bool notifyRootObserver = true, List<RouteGuard> guards = const [], @Deprecated(guardsRedirectDeprecation) FutureOr<String?> redirect(BuildContext context, GoRouterState state)?, GlobalKey<NavigatorState>? parentNavigatorKey, String? restorationScopeId, GlobalKey<StatefulNavigationShellState>? shellKey})

Properties

branches List<ModularBranch>
final
builder Widget Function(BuildContext context, GoRouterState state, StatefulNavigationShell navigationShell)?
final
guards List<RouteGuard>
Guards que protegem o shell, avaliados antes da seleção de branch e em curto-circuito ("primeiro que barrar vence"). Veja RouteGuard.
final
hashCode int
The hash code for this object.
no setterinherited
Container das branches.
final
notifyRootObserver bool
Encaminhado para StatefulShellRoute: notificar o observer raiz da troca de páginas.
final
pageBuilder Page Function(BuildContext context, GoRouterState state, StatefulNavigationShell navigationShell)?
final
parentNavigatorKey GlobalKey<NavigatorState>?
final
redirect FutureOr<String?> Function(BuildContext context, GoRouterState state)?
final
restorationScopeId String?
final
reverseTransitionDuration Duration?
Duração reversa opcional. Omitido usa GoTransition.defaultReverseDuration ou a duração efetiva.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shellKey GlobalKey<StatefulNavigationShellState>?
final
transition → GoTransition?
Transição entre branches (GoTransitions.*). Omitido usa Modular.getDefaultTransition quando houver animação (ver documentação da classe).
final
transitionDuration Duration?
Duração da transição ao trocar de branch. Omitido usa GoTransition.defaultDuration.
final

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