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 : /// A name for the route which will allow you to easily navigate to it 24 : /// using [VRouter.of(context).pushNamed] 25 : /// 26 : /// Note that [name] should be unique w.r.t every [VRouteElement] 27 : final String? name; 28 : 29 : /// The duration of [VWidgetBase.buildTransition] 30 : final Duration? transitionDuration; 31 : 32 : /// The reverse duration of [VWidgetBase.buildTransition] 33 : final Duration? reverseTransitionDuration; 34 : 35 : /// Create a custom transition effect when coming to and 36 : /// going to this route 37 : /// This has the priority over [VRouter.buildTransition] 38 : /// 39 : /// Also see: 40 : /// * [VRouter.buildTransition] for default transitions for all routes 41 : final Widget Function(Animation<double> animation, 42 : Animation<double> secondaryAnimation, Widget child)? buildTransition; 43 : 44 13 : VWidgetBase({ 45 : required this.widget, 46 : this.stackedRoutes = const [], 47 : this.key, 48 : this.name, 49 : this.transitionDuration, 50 : this.reverseTransitionDuration, 51 : this.buildTransition, 52 : }); 53 : 54 13 : @override 55 13 : List<VRouteElement> buildRoutes() => [ 56 13 : VPageBase( 57 22 : pageBuilder: (key, child, name) => VBasePage.fromPlatform( 58 : key: key, 59 : child: child, 60 : name: name, 61 11 : buildTransition: buildTransition, 62 11 : transitionDuration: transitionDuration, 63 11 : reverseTransitionDuration: reverseTransitionDuration, 64 : ), 65 13 : widget: widget, 66 13 : key: key, 67 13 : name: name, 68 13 : stackedRoutes: stackedRoutes, 69 : ), 70 : ]; 71 : }