栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

动画路线出去/被替换

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

动画路线出去/被替换

从Flutter源代码注释中:

/// Signature for the [PageRouteBuilder] function that builds the route's/// transitions.////// See [ModalRoute.buildTransitions] for complete definition of the parameters.typedef Widget RouteTransitionsBuilder(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child);

并进一步:

  /// We've used [PageRouteBuilder] to demonstrate the [buildTransitions] method  /// here. The body of an override of the [buildTransitions] method would be  /// defined in the same way.  ///  /// When the [Navigator] pushes a route on the top of its stack, the  /// [secondaryAnimation] can be used to define how the route that was on  /// the top of the stack leaves the screen. Similarly when the topmost route  /// is popped, the secondaryAnimation can be used to define how the route  /// below it reappears on the screen. When the Navigator pushes a new route  /// on the top of its stack, the old topmost route's secondaryAnimation  /// runs from 0.0 to 1.0.  When the Navigator pops the topmost route, the  /// secondaryAnimation for the route below it runs from 1.0 to 0.0.  ///  /// The example below adds a transition that's driven by the  /// [secondaryAnimation]. When this route disappears because a new route has  /// been pushed on top of it, it translates in the opposite direction of  /// the new route. Likewise when the route is exposed because the topmost  /// route has been popped off.  ///  /// ```dart  ///   transitionsBuilder: (  ///       BuildContext context,  ///       Animation<double> animation,  ///       Animation<double> secondaryAnimation,  ///       Widget child,  ///   ) {  ///     return new SlideTransition(  ///       position: new AlignmentTween(  ///         begin: const Offset(0.0, 1.0),  ///         end: Offset.zero,  ///       ).animate(animation),  ///       child: new SlideTransition(  ///         position: new TweenOffset(  ///begin: Offset.zero,  ///end: const Offset(0.0, 1.0),  ///         ).animate(secondaryAnimation),  ///         child: child,  ///       ),  ///     );  ///   }  /// ```  ///  /// In practice the `secondaryAnimation` is used pretty rarely.  ///  /// The arguments to this method are as follows:  ///  ///  * `context`: The context in which the route is being built.  ///  * [animation]: When the [Navigator] pushes a route on the top of its stack,  ///    the new route's primary [animation] runs from 0.0 to 1.0. When the [Navigator]  ///    pops the topmost route this animation runs from 1.0 to 0.0.  ///  * [secondaryAnimation]: When the Navigator pushes a new route  ///    on the top of its stack, the old topmost route's [secondaryAnimation]  ///    runs from 0.0 to 1.0.  When the [Navigator] pops the topmost route, the  ///    [secondaryAnimation] for the route below it runs from 1.0 to 0.0.  ///  * `child`, the page contents.  ///  /// See also:  ///  ///  * [buildPage], which is used to describe the actual contents of the page,  ///    and whose result is passed to the `child` argument of this method.

我个人的建议是文档模糊不清或缺少代码;)

最好



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/430794.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号