Masterarbeit Richard Stern. Flutter App, sich mit einem Bluetooth-Gerät verbindet und Berührungen auf einem Sensor visualisiert.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

buildTransitions.html 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <meta name="description" content="API docs for the buildTransitions method from the NoAnimationMaterialPageRoute class, for the Dart programming language.">
  8. <title>buildTransitions method - NoAnimationMaterialPageRoute class - noAnimationMaterialPageRoute library - Dart API</title>
  9. <!-- required because all the links are pseudo-absolute -->
  10. <base href="../..">
  11. <link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500,400i,400,300|Source+Sans+Pro:400,300,700" rel="stylesheet">
  12. <link rel="stylesheet" href="static-assets/github.css">
  13. <link rel="stylesheet" href="static-assets/styles.css">
  14. <link rel="icon" href="static-assets/favicon.png">
  15. </head>
  16. <body>
  17. <div id="overlay-under-drawer"></div>
  18. <header id="title">
  19. <button id="sidenav-left-toggle" type="button">&nbsp;</button>
  20. <ol class="breadcrumbs gt-separated dark hidden-xs">
  21. <li><a href="index.html">touch_demonstrator</a></li>
  22. <li><a href="ui_noAnimationMaterialPageRoute/ui_noAnimationMaterialPageRoute-library.html">noAnimationMaterialPageRoute</a></li>
  23. <li><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute-class.html">NoAnimationMaterialPageRoute<span class="signature">&lt;<wbr><span class="type-parameter">T</span>&gt;</span></a></li>
  24. <li class="self-crumb">buildTransitions method</li>
  25. </ol>
  26. <div class="self-name">buildTransitions</div>
  27. <form class="search navbar-right" role="search">
  28. <input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
  29. </form>
  30. </header>
  31. <main>
  32. <div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
  33. <h5>NoAnimationMaterialPageRoute class</h5>
  34. <ol>
  35. <li class="section-title"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute-class.html#constructors">Constructors</a></li>
  36. <li><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/NoAnimationMaterialPageRoute.html">NoAnimationMaterialPageRoute</a></li>
  37. <li class="section-title inherited">
  38. <a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute-class.html#instance-properties">Properties</a>
  39. </li>
  40. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/animation.html">animation</a></li>
  41. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/barrierColor.html">barrierColor</a></li>
  42. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/barrierDismissible.html">barrierDismissible</a></li>
  43. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/barrierLabel.html">barrierLabel</a></li>
  44. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/builder.html">builder</a></li>
  45. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/canPop.html">canPop</a></li>
  46. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/completed.html">completed</a></li>
  47. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/controller.html">controller</a></li>
  48. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/currentResult.html">currentResult</a></li>
  49. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/debugLabel.html">debugLabel</a></li>
  50. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/finishedWhenPopped.html">finishedWhenPopped</a></li>
  51. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/focusScopeNode.html">focusScopeNode</a></li>
  52. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/fullscreenDialog.html">fullscreenDialog</a></li>
  53. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/hashCode.html">hashCode</a></li>
  54. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/hasScopedWillPopCallback.html">hasScopedWillPopCallback</a></li>
  55. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/isActive.html">isActive</a></li>
  56. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/isCurrent.html">isCurrent</a></li>
  57. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/isFirst.html">isFirst</a></li>
  58. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/maintainState.html">maintainState</a></li>
  59. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/navigator.html">navigator</a></li>
  60. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/offstage.html">offstage</a></li>
  61. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/opaque.html">opaque</a></li>
  62. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/overlayEntries.html">overlayEntries</a></li>
  63. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/popped.html">popped</a></li>
  64. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/runtimeType.html">runtimeType</a></li>
  65. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/secondaryAnimation.html">secondaryAnimation</a></li>
  66. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/semanticsDismissible.html">semanticsDismissible</a></li>
  67. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/settings.html">settings</a></li>
  68. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/subtreeContext.html">subtreeContext</a></li>
  69. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/transitionDuration.html">transitionDuration</a></li>
  70. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/willHandlePopInternally.html">willHandlePopInternally</a></li>
  71. <li class="section-title"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute-class.html#instance-methods">Methods</a></li>
  72. <li><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/buildTransitions.html">buildTransitions</a></li>
  73. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/addLocalHistoryEntry.html">addLocalHistoryEntry</a></li>
  74. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/addScopedWillPopCallback.html">addScopedWillPopCallback</a></li>
  75. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/buildPage.html">buildPage</a></li>
  76. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/canTransitionFrom.html">canTransitionFrom</a></li>
  77. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/canTransitionTo.html">canTransitionTo</a></li>
  78. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/changedExternalState.html">changedExternalState</a></li>
  79. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/changedInternalState.html">changedInternalState</a></li>
  80. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/createAnimation.html">createAnimation</a></li>
  81. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/createAnimationController.html">createAnimationController</a></li>
  82. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/createOverlayEntries.html">createOverlayEntries</a></li>
  83. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/didChangeNext.html">didChangeNext</a></li>
  84. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/didChangePrevious.html">didChangePrevious</a></li>
  85. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/didComplete.html">didComplete</a></li>
  86. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/didPop.html">didPop</a></li>
  87. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/didPopNext.html">didPopNext</a></li>
  88. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/didPush.html">didPush</a></li>
  89. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/didReplace.html">didReplace</a></li>
  90. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/dispose.html">dispose</a></li>
  91. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/install.html">install</a></li>
  92. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/noSuchMethod.html">noSuchMethod</a></li>
  93. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/removeLocalHistoryEntry.html">removeLocalHistoryEntry</a></li>
  94. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/removeScopedWillPopCallback.html">removeScopedWillPopCallback</a></li>
  95. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/setState.html">setState</a></li>
  96. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/toString.html">toString</a></li>
  97. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/willPop.html">willPop</a></li>
  98. <li class="section-title inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute-class.html#operators">Operators</a></li>
  99. <li class="inherited"><a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/operator_equals.html">operator ==</a></li>
  100. </ol>
  101. </div><!--/.sidebar-offcanvas-->
  102. <div class="col-xs-12 col-sm-9 col-md-8 main-content">
  103. <h1>buildTransitions method</h1>
  104. <section class="multi-line-signature">
  105. <div>
  106. <ol class="annotation-list">
  107. <li>@override</li>
  108. </ol>
  109. </div>
  110. <span class="returntype">Widget</span>
  111. <span class="name ">buildTransitions</span>
  112. (<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">&lt;<wbr><span class="type-parameter">double</span>&gt;</span></span> <span class="parameter-name">animation</span>, </span> <span class="parameter" id="buildTransitions-param-secondaryAnimation"><span class="type-annotation">Animation<span class="signature">&lt;<wbr><span class="type-parameter">double</span>&gt;</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>)
  113. </section>
  114. <section class="desc markdown">
  115. <p>Override this method to wrap the <code>child</code> with one or more transition
  116. widgets that define how the route arrives on and leaves the screen.</p>
  117. <p>By default, the child (which contains the widget returned by <a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/buildPage.html">buildPage</a>)
  118. is not wrapped in any transition widgets.</p>
  119. <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
  120. time the <code>Route</code>'s state changes (e.g. the value of <a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/canPop.html">canPop</a>).</p>
  121. <p>The <a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/buildTransitions.html">buildTransitions</a> method is typically used to define transitions
  122. that animate the new topmost route's comings and goings. When the
  123. <code>Navigator</code> pushes a route on the top of its stack, the new route's
  124. primary <code>animation</code> runs from 0.0 to 1.0. When the Navigator pops the
  125. topmost route, e.g. because the use pressed the back button, the
  126. primary animation runs from 1.0 to 0.0.</p>
  127. <p>The following example uses the primary animation to drive a
  128. <code>SlideTransition</code> that translates the top of the new route vertically
  129. from the bottom of the screen when it is pushed on the Navigator's
  130. stack. When the route is popped the SlideTransition translates the
  131. route from the top of the screen back to the bottom.</p>
  132. <pre class="language-dart"><code class="language-dart">PageRouteBuilder(
  133. pageBuilder: (BuildContext context,
  134. Animation&lt;double&gt; animation,
  135. Animation&lt;double&gt; secondaryAnimation,
  136. Widget child,
  137. ) {
  138. return Scaffold(
  139. appBar: AppBar(title: Text('Hello')),
  140. body: Center(
  141. child: Text('Hello World'),
  142. ),
  143. );
  144. },
  145. transitionsBuilder: (
  146. BuildContext context,
  147. Animation&lt;double&gt; animation,
  148. Animation&lt;double&gt; secondaryAnimation,
  149. Widget child,
  150. ) {
  151. return SlideTransition(
  152. position: Tween&lt;Offset&gt;(
  153. begin: const Offset(0.0, 1.0),
  154. end: Offset.zero,
  155. ).animate(animation),
  156. child: child, // child is the value returned by pageBuilder
  157. );
  158. },
  159. );
  160. </code></pre>
  161. <p>We've used <code>PageRouteBuilder</code> to demonstrate the <a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/buildTransitions.html">buildTransitions</a> method
  162. here. The body of an override of the <a href="ui_noAnimationMaterialPageRoute/NoAnimationMaterialPageRoute/buildTransitions.html">buildTransitions</a> method would be
  163. defined in the same way.</p>
  164. <p>When the <code>Navigator</code> pushes a route on the top of its stack, the
  165. <code>secondaryAnimation</code> can be used to define how the route that was on
  166. the top of the stack leaves the screen. Similarly when the topmost route
  167. is popped, the secondaryAnimation can be used to define how the route
  168. below it reappears on the screen. When the Navigator pushes a new route
  169. on the top of its stack, the old topmost route's secondaryAnimation
  170. runs from 0.0 to 1.0. When the Navigator pops the topmost route, the
  171. secondaryAnimation for the route below it runs from 1.0 to 0.0.</p>
  172. <p>The example below adds a transition that's driven by the
  173. <code>secondaryAnimation</code>. When this route disappears because a new route has
  174. been pushed on top of it, it translates in the opposite direction of
  175. the new route. Likewise when the route is exposed because the topmost
  176. route has been popped off.</p>
  177. <pre class="language-dart"><code class="language-dart"> transitionsBuilder: (
  178. BuildContext context,
  179. Animation&lt;double&gt; animation,
  180. Animation&lt;double&gt; secondaryAnimation,
  181. Widget child,
  182. ) {
  183. return SlideTransition(
  184. position: AlignmentTween(
  185. begin: const Offset(0.0, 1.0),
  186. end: Offset.zero,
  187. ).animate(animation),
  188. child: SlideTransition(
  189. position: TweenOffset(
  190. begin: Offset.zero,
  191. end: const Offset(0.0, 1.0),
  192. ).animate(secondaryAnimation),
  193. child: child,
  194. ),
  195. );
  196. }
  197. </code></pre>
  198. <p>In practice the <code>secondaryAnimation</code> is used pretty rarely.</p>
  199. <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,
  200. the new route's primary <code>animation</code> runs from 0.0 to 1.0. When the <code>Navigator</code>
  201. 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
  202. on the top of its stack, the old topmost route's <code>secondaryAnimation</code>
  203. runs from 0.0 to 1.0. When the <code>Navigator</code> pops the topmost route, the
  204. <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>
  205. <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,
  206. and whose result is passed to the <code>child</code> argument of this method.</li></ul>
  207. </section>
  208. <section class="summary source-code" id="source">
  209. <h2><span>Implementation</span> </h2>
  210. <pre class="language-dart"><code class="language-dart">@override
  211. Widget buildTransitions(BuildContext context, Animation&lt;double&gt; animation,
  212. Animation&lt;double&gt; secondaryAnimation, Widget child) {
  213. return child;
  214. }</code></pre>
  215. </section>
  216. </div> <!-- /.main-content -->
  217. <div class="col-xs-6 col-sm-6 col-md-2 sidebar sidebar-offcanvas-right">
  218. </div><!--/.sidebar-offcanvas-->
  219. </main>
  220. <footer>
  221. <span class="no-break">
  222. touch_demonstrator 1.0.0+1
  223. </span>
  224. </footer>
  225. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  226. <script src="static-assets/typeahead.bundle.min.js"></script>
  227. <script src="static-assets/highlight.pack.js"></script>
  228. <script src="static-assets/URI.js"></script>
  229. <script src="static-assets/script.js"></script>
  230. </body>
  231. </html>