Line data Source code
1 : part of '../main.dart'; 2 : 3 : class VWidgetBase extends VRouteElementBuilder { 4 : /// A list of routes which: 5 : /// - path NOT starting with '/' will be relative to [path] 6 : /// - widget or page will be stacked on top of [widget] 7 : final List<VRouteElement> stackedRoutes; 8 : 9 : /// The widget which will be displayed for this [VRouteElement] 10 : final Widget widget; 11 : 12 : /// A LocalKey that will be given to the page which contains the given [widget] 13 : /// 14 : /// This key mostly controls the page animation. If a page remains the same but the key is changes, 15 : /// the page gets animated 16 : /// The key is by default the value of the current [path] (or [aliases]) with 17 : /// the path parameters replaced 18 : /// 19 : /// Do provide a constant [key] if you don't want this page to animate even if [path] or 20 : /// [aliases] path parameters change 21 : final LocalKey? key; 22 : 23 : /// The duration of [VWidgetBase.buildTransition] 24 : final Duration? transitionDuration; 25 : 26 : /// The reverse duration of [VWidgetBase.buildTransition] 27 : final Duration? reverseTransitionDuration; 28 : 29 : /// Create a custom transition effect when coming to and 30 : /// going to this route 31 : /// This has the priority over [VRouter.buildTransition] 32 : /// 33 : /// Also see: 34 : /// * [VRouter.buildTransition] for default transitions for all routes 35 : final Widget Function( 36 : Animation<double> animation, Animation<double> secondaryAnimation, Widget child)? 37 : buildTransition; 38 : 39 13 : VWidgetBase({ 40 : required this.widget, 41 : this.stackedRoutes = const [], 42 : this.key, 43 : this.transitionDuration, 44 : this.reverseTransitionDuration, 45 : this.buildTransition, 46 : }); 47 : 48 13 : @override 49 13 : List<VRouteElement> buildRoutes() => [ 50 13 : VPageBase( 51 22 : pageBuilder: (key, child) => VBasePage.fromPlatform( 52 : key: key, 53 : child: child, 54 11 : buildTransition: buildTransition, 55 11 : transitionDuration: transitionDuration, 56 11 : reverseTransitionDuration: reverseTransitionDuration, 57 : ), 58 13 : widget: widget, 59 13 : key: key, 60 13 : stackedRoutes: stackedRoutes, 61 : ), 62 : ]; 63 : }