258 lines
18 KiB
HTML
258 lines
18 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
|
<meta name="description" content="API docs for the buildTransitions method from the NoAnimationMaterialPageRoute class, for the Dart programming language.">
|
||
|
<title>buildTransitions method - NoAnimationMaterialPageRoute class - noAnimationMaterialPageRoute library - Dart API</title>
|
||
|
<!-- required because all the links are pseudo-absolute -->
|
||
|
<base href="../..">
|
||
|
|
||
|
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500,400i,400,300|Source+Sans+Pro:400,300,700" rel="stylesheet">
|
||
|
<link rel="stylesheet" href="static-assets/github.css">
|
||
|
<link rel="stylesheet" href="static-assets/styles.css">
|
||
|
<link rel="icon" href="static-assets/favicon.png">
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
|
||
|
<div id="overlay-under-drawer"></div>
|
||
|
|
||
|
<header id="title">
|
||
|
<button id="sidenav-left-toggle" type="button"> </button>
|
||
|
<ol class="breadcrumbs gt-separated dark hidden-xs">
|
||
|
<li><a href="index.html">touch_demonstrator</a></li>
|
||
|
<li><a href="ui_noAnimationMaterialPageRoute/ui_noAnimationMaterialPageRoute-library.html">noAnimationMaterialPageRoute</a></li>
|
||
|
<li><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute-class.html">NoAnimationMaterialPageRoute<span class="signature"><<wbr><span class="type-parameter">T</span>></span></a></li>
|
||
|
<li class="self-crumb">buildTransitions method</li>
|
||
|
</ol>
|
||
|
<div class="self-name">buildTransitions</div>
|
||
|
<form class="search navbar-right" role="search">
|
||
|
<input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
|
||
|
</form>
|
||
|
</header>
|
||
|
|
||
|
<main>
|
||
|
|
||
|
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
|
||
|
<h5>NoAnimationMaterialPageRoute class</h5>
|
||
|
<ol>
|
||
|
<li class="section-title"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute-class.html#constructors">Constructors</a></li>
|
||
|
<li><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/NoAnimationMaterialPageRoute.html">NoAnimationMaterialPageRoute</a></li>
|
||
|
|
||
|
<li class="section-title inherited">
|
||
|
<a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute-class.html#instance-properties">Properties</a>
|
||
|
</li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/animation.html">animation</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/barrierColor.html">barrierColor</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/barrierDismissible.html">barrierDismissible</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/barrierLabel.html">barrierLabel</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/builder.html">builder</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/canPop.html">canPop</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/completed.html">completed</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/controller.html">controller</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/currentResult.html">currentResult</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/debugLabel.html">debugLabel</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/finishedWhenPopped.html">finishedWhenPopped</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/focusScopeNode.html">focusScopeNode</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/fullscreenDialog.html">fullscreenDialog</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/hashCode.html">hashCode</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/hasScopedWillPopCallback.html">hasScopedWillPopCallback</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/isActive.html">isActive</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/isCurrent.html">isCurrent</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/isFirst.html">isFirst</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/maintainState.html">maintainState</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/navigator.html">navigator</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/offstage.html">offstage</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/opaque.html">opaque</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/overlayEntries.html">overlayEntries</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/popped.html">popped</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/runtimeType.html">runtimeType</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/secondaryAnimation.html">secondaryAnimation</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/semanticsDismissible.html">semanticsDismissible</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/settings.html">settings</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/subtreeContext.html">subtreeContext</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/transitionDuration.html">transitionDuration</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/willHandlePopInternally.html">willHandlePopInternally</a></li>
|
||
|
|
||
|
<li class="section-title"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute-class.html#instance-methods">Methods</a></li>
|
||
|
<li><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/buildTransitions.html">buildTransitions</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/addLocalHistoryEntry.html">addLocalHistoryEntry</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/addScopedWillPopCallback.html">addScopedWillPopCallback</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/buildPage.html">buildPage</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/canTransitionFrom.html">canTransitionFrom</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/canTransitionTo.html">canTransitionTo</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/changedExternalState.html">changedExternalState</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/changedInternalState.html">changedInternalState</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/createAnimation.html">createAnimation</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/createAnimationController.html">createAnimationController</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/createOverlayEntries.html">createOverlayEntries</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/didChangeNext.html">didChangeNext</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/didChangePrevious.html">didChangePrevious</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/didComplete.html">didComplete</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/didPop.html">didPop</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/didPopNext.html">didPopNext</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/didPush.html">didPush</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/didReplace.html">didReplace</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/dispose.html">dispose</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/install.html">install</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/noSuchMethod.html">noSuchMethod</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/removeLocalHistoryEntry.html">removeLocalHistoryEntry</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/removeScopedWillPopCallback.html">removeScopedWillPopCallback</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/setState.html">setState</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/toString.html">toString</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/willPop.html">willPop</a></li>
|
||
|
|
||
|
<li class="section-title inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute-class.html#operators">Operators</a></li>
|
||
|
<li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/operator_equals.html">operator ==</a></li>
|
||
|
|
||
|
|
||
|
|
||
|
</ol>
|
||
|
</div><!--/.sidebar-offcanvas-->
|
||
|
|
||
|
<div class="col-xs-12 col-sm-9 col-md-8 main-content">
|
||
|
<h1>buildTransitions method</h1>
|
||
|
|
||
|
<section class="multi-line-signature">
|
||
|
<div>
|
||
|
<ol class="annotation-list">
|
||
|
<li>@override</li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<span class="returntype">Widget</span>
|
||
|
<span class="name ">buildTransitions</span>
|
||
|
(<wbr><span class="parameter" id="buildTransitions-param-context"><span class="type-annotation">BuildContext</span> <span class="parameter-name">context</span>, </span> <span class="parameter" id="buildTransitions-param-animation"><span class="type-annotation">Animation<span class="signature"><<wbr><span class="type-parameter">double</span>></span></span> <span class="parameter-name">animation</span>, </span> <span class="parameter" id="buildTransitions-param-secondaryAnimation"><span class="type-annotation">Animation<span class="signature"><<wbr><span class="type-parameter">double</span>></span></span> <span class="parameter-name">secondaryAnimation</span>, </span> <span class="parameter" id="buildTransitions-param-child"><span class="type-annotation">Widget</span> <span class="parameter-name">child</span></span>)
|
||
|
|
||
|
</section>
|
||
|
<section class="desc markdown">
|
||
|
<p>Override this method to wrap the <code>child</code> with one or more transition
|
||
|
widgets that define how the route arrives on and leaves the screen.</p>
|
||
|
<p>By default, the child (which contains the widget returned by <a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/buildPage.html">buildPage</a>)
|
||
|
is not wrapped in any transition widgets.</p>
|
||
|
<p>The <a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/buildTransitions.html">buildTransitions</a> method, in contrast to <a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/buildPage.html">buildPage</a>, is called each
|
||
|
time the <code>Route</code>'s state changes (e.g. the value of <a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/canPop.html">canPop</a>).</p>
|
||
|
<p>The <a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/buildTransitions.html">buildTransitions</a> method is typically used to define transitions
|
||
|
that animate the new topmost route's comings and goings. When the
|
||
|
<code>Navigator</code> pushes a route on the top of its stack, the new route's
|
||
|
primary <code>animation</code> runs from 0.0 to 1.0. When the Navigator pops the
|
||
|
topmost route, e.g. because the use pressed the back button, the
|
||
|
primary animation runs from 1.0 to 0.0.</p>
|
||
|
<p>The following example uses the primary animation to drive a
|
||
|
<code>SlideTransition</code> that translates the top of the new route vertically
|
||
|
from the bottom of the screen when it is pushed on the Navigator's
|
||
|
stack. When the route is popped the SlideTransition translates the
|
||
|
route from the top of the screen back to the bottom.</p>
|
||
|
<pre class="language-dart"><code class="language-dart">PageRouteBuilder(
|
||
|
pageBuilder: (BuildContext context,
|
||
|
Animation<double> animation,
|
||
|
Animation<double> secondaryAnimation,
|
||
|
Widget child,
|
||
|
) {
|
||
|
return Scaffold(
|
||
|
appBar: AppBar(title: Text('Hello')),
|
||
|
body: Center(
|
||
|
child: Text('Hello World'),
|
||
|
),
|
||
|
);
|
||
|
},
|
||
|
transitionsBuilder: (
|
||
|
BuildContext context,
|
||
|
Animation<double> animation,
|
||
|
Animation<double> secondaryAnimation,
|
||
|
Widget child,
|
||
|
) {
|
||
|
return SlideTransition(
|
||
|
position: Tween<Offset>(
|
||
|
begin: const Offset(0.0, 1.0),
|
||
|
end: Offset.zero,
|
||
|
).animate(animation),
|
||
|
child: child, // child is the value returned by pageBuilder
|
||
|
);
|
||
|
},
|
||
|
);
|
||
|
</code></pre>
|
||
|
<p>We've used <code>PageRouteBuilder</code> to demonstrate the <a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/buildTransitions.html">buildTransitions</a> method
|
||
|
here. The body of an override of the <a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/buildTransitions.html">buildTransitions</a> method would be
|
||
|
defined in the same way.</p>
|
||
|
<p>When the <code>Navigator</code> pushes a route on the top of its stack, the
|
||
|
<code>secondaryAnimation</code> 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.</p>
|
||
|
<p>The example below adds a transition that's driven by the
|
||
|
<code>secondaryAnimation</code>. 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.</p>
|
||
|
<pre class="language-dart"><code class="language-dart"> transitionsBuilder: (
|
||
|
BuildContext context,
|
||
|
Animation<double> animation,
|
||
|
Animation<double> secondaryAnimation,
|
||
|
Widget child,
|
||
|
) {
|
||
|
return SlideTransition(
|
||
|
position: AlignmentTween(
|
||
|
begin: const Offset(0.0, 1.0),
|
||
|
end: Offset.zero,
|
||
|
).animate(animation),
|
||
|
child: SlideTransition(
|
||
|
position: TweenOffset(
|
||
|
begin: Offset.zero,
|
||
|
end: const Offset(0.0, 1.0),
|
||
|
).animate(secondaryAnimation),
|
||
|
child: child,
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
</code></pre>
|
||
|
<p>In practice the <code>secondaryAnimation</code> is used pretty rarely.</p>
|
||
|
<p>The arguments to this method are as follows:</p><ul><li><code>context</code>: The context in which the route is being built.</li><li><code>animation</code>: When the <code>Navigator</code> pushes a route on the top of its stack,
|
||
|
the new route's primary <code>animation</code> runs from 0.0 to 1.0. When the <code>Navigator</code>
|
||
|
pops the topmost route this animation runs from 1.0 to 0.0.</li><li><code>secondaryAnimation</code>: When the Navigator pushes a new route
|
||
|
on the top of its stack, the old topmost route's <code>secondaryAnimation</code>
|
||
|
runs from 0.0 to 1.0. When the <code>Navigator</code> pops the topmost route, the
|
||
|
<code>secondaryAnimation</code> for the route below it runs from 1.0 to 0.0.</li><li><code>child</code>, the page contents, as returned by <a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/buildPage.html">buildPage</a>.</li></ul>
|
||
|
<p>See also:</p><ul><li><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/buildPage.html">buildPage</a>, which is used to describe the actual contents of the page,
|
||
|
and whose result is passed to the <code>child</code> argument of this method.</li></ul>
|
||
|
</section>
|
||
|
|
||
|
<section class="summary source-code" id="source">
|
||
|
<h2><span>Implementation</span> </h2>
|
||
|
<pre class="language-dart"><code class="language-dart">@override
|
||
|
Widget buildTransitions(BuildContext context, Animation<double> animation,
|
||
|
Animation<double> secondaryAnimation, Widget child) {
|
||
|
return child;
|
||
|
}</code></pre>
|
||
|
</section>
|
||
|
|
||
|
</div> <!-- /.main-content -->
|
||
|
|
||
|
<div class="col-xs-6 col-sm-6 col-md-2 sidebar sidebar-offcanvas-right">
|
||
|
</div><!--/.sidebar-offcanvas-->
|
||
|
|
||
|
</main>
|
||
|
|
||
|
<footer>
|
||
|
<span class="no-break">
|
||
|
touch_demonstrator 1.0.0+1
|
||
|
</span>
|
||
|
|
||
|
</footer>
|
||
|
|
||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||
|
<script src="static-assets/typeahead.bundle.min.js"></script>
|
||
|
<script src="static-assets/highlight.pack.js"></script>
|
||
|
<script src="static-assets/URI.js"></script>
|
||
|
<script src="static-assets/script.js"></script>
|
||
|
|
||
|
|
||
|
</body>
|
||
|
|
||
|
</html>
|