GgRouter constructor
GgRouter(
- Map<
String, Widget Function(BuildContext)> children, { - required Key key,
- Map<
String, String> semanticLabels = const {}, - String? defaultRoute,
- GgAnimationBuilder? inAnimation,
- GgAnimationBuilder? outAnimation,
- Duration animationDuration = const Duration(milliseconds: 500),
Constructor, which takes a map of child routes. Depending on the currently selected routed one of the child routes is shown.
To animate widgets when switching a route, specify an inAnimation
and
an outAnimation
. The first is applied to the widget appearing on
the screen. The second is applied to the one disappearing.
GgRouter({
'_INDEX_': (context) => Text('The index screen'),
'green': (context) => Container(color: Colors.green),
'yellow': (context) => Container(color: Colors.red),
'red': (context) => Container(color: Colors.red),
})
Implementation
GgRouter(
this.children, {
required Key key,
this.semanticLabels = const {},
this.defaultRoute,
this.inAnimation,
this.outAnimation,
this.animationDuration = const Duration(milliseconds: 500),
}) : _rootChild = null,
_rootNode = null,
super(key: key) {
_checkChildren();
_checkAnimations();
_checkSemanticLabels();
}