Unverified Commit 77bbd28c authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Random trivial fixes in the animation packages (#30276)

parent 3c8dabef
...@@ -44,7 +44,7 @@ const Tolerance _kFlingTolerance = Tolerance( ...@@ -44,7 +44,7 @@ const Tolerance _kFlingTolerance = Tolerance(
/// Configures how an [AnimationController] behaves when animations are disabled. /// Configures how an [AnimationController] behaves when animations are disabled.
/// ///
/// When [AccessibilityFeatures.disableAnimations] is true, the device is asking /// When [AccessibilityFeatures.disableAnimations] is true, the device is asking
/// flutter to reduce or disable animations as much as possible. To honor this, /// Flutter to reduce or disable animations as much as possible. To honor this,
/// we reduce the duration and the corresponding number of frames for animations. /// we reduce the duration and the corresponding number of frames for animations.
/// This enum is used to allow certain [AnimationController]s to opt out of this /// This enum is used to allow certain [AnimationController]s to opt out of this
/// behavior. /// behavior.
...@@ -209,7 +209,7 @@ class AnimationController extends Animation<double> ...@@ -209,7 +209,7 @@ class AnimationController extends Animation<double>
with AnimationEagerListenerMixin, AnimationLocalListenersMixin, AnimationLocalStatusListenersMixin { with AnimationEagerListenerMixin, AnimationLocalListenersMixin, AnimationLocalStatusListenersMixin {
/// Creates an animation controller. /// Creates an animation controller.
/// ///
/// * [value] is the initial value of the animation. If defaults to the lower /// * `value` is the initial value of the animation. If defaults to the lower
/// bound. /// bound.
/// ///
/// * [duration] is the length of time this animation should last. /// * [duration] is the length of time this animation should last.
...@@ -524,11 +524,10 @@ class AnimationController extends Animation<double> ...@@ -524,11 +524,10 @@ class AnimationController extends Animation<double>
return _animateToInternal(target, duration: duration, curve: curve); return _animateToInternal(target, duration: duration, curve: curve);
} }
TickerFuture _animateToInternal(double target, { Duration duration, Curve curve = Curves.linear, AnimationBehavior animationBehavior }) { TickerFuture _animateToInternal(double target, { Duration duration, Curve curve = Curves.linear }) {
final AnimationBehavior behavior = animationBehavior ?? this.animationBehavior;
double scale = 1.0; double scale = 1.0;
if (SemanticsBinding.instance.disableAnimations) { if (SemanticsBinding.instance.disableAnimations) {
switch (behavior) { switch (animationBehavior) {
case AnimationBehavior.normal: case AnimationBehavior.normal:
// Since the framework cannot handle zero duration animations, we run it at 5% of the normal // Since the framework cannot handle zero duration animations, we run it at 5% of the normal
// duration to limit most animations to a single frame. // duration to limit most animations to a single frame.
......
...@@ -111,8 +111,8 @@ class SawTooth extends Curve { ...@@ -111,8 +111,8 @@ class SawTooth extends Curve {
} }
} }
/// A curve that is 0.0 until [begin], then curved (according to [curve] from /// A curve that is 0.0 until [begin], then curved (according to [curve]) from
/// 0.0 to 1.0 at [end], then 1.0. /// 0.0 at [begin] to 1.0 at [end], then remains 1.0 past [end].
/// ///
/// An [Interval] can be used to delay an animation. For example, a six second /// An [Interval] can be used to delay an animation. For example, a six second
/// animation that uses an [Interval] with its [begin] set to 0.5 and its [end] /// animation that uses an [Interval] with its [begin] set to 0.5 and its [end]
......
...@@ -7,17 +7,16 @@ import 'package:flutter/foundation.dart'; ...@@ -7,17 +7,16 @@ import 'package:flutter/foundation.dart';
import 'animation.dart'; import 'animation.dart';
import 'tween.dart'; import 'tween.dart';
/// Enables creating an [Animation] whose value is defined by a /// Enables creating an [Animation] whose value is defined by a sequence of
/// sequence of [Tween]s. /// [Tween]s.
/// ///
/// Each [TweenSequenceItem] has a weight that defines its percentage /// Each [TweenSequenceItem] has a weight that defines its percentage of the
/// of the animation's duration. Each tween defines the animation's value /// animation's duration. Each tween defines the animation's value during the
/// during the interval indicated by its weight. /// interval indicated by its weight.
/// ///
/// For example, to define an animation that uses an easing curve to /// For example, to define an animation that uses an easing curve to interpolate
/// interpolate between 5.0 and 10.0 during the first 40% of the /// between 5.0 and 10.0 during the first 40% of the animation, remain at 10.0
/// animation, remain at 10.0 for the next 20%, and then return to /// for the next 20%, and then return to 10.0 for the final 40%:
/// 10.0 for the final 40%:
/// ///
/// ```dart /// ```dart
/// final Animation<double> animation = TweenSequence( /// final Animation<double> animation = TweenSequence(
...@@ -42,12 +41,11 @@ import 'tween.dart'; ...@@ -42,12 +41,11 @@ import 'tween.dart';
class TweenSequence<T> extends Animatable<T> { class TweenSequence<T> extends Animatable<T> {
/// Construct a TweenSequence. /// Construct a TweenSequence.
/// ///
/// The [items] parameter must be a list of one or more /// The [items] parameter must be a list of one or more [TweenSequenceItem]s.
/// [TweenSequenceItem]s.
/// ///
/// There's a small cost associated with building a `TweenSequence` so /// There's a small cost associated with building a `TweenSequence` so it's
/// it's best to reuse one, rather than rebuilding it on every frame, /// best to reuse one, rather than rebuilding it on every frame, when that's
/// when that's possible. /// possible.
TweenSequence(List<TweenSequenceItem<T>> items) TweenSequence(List<TweenSequenceItem<T>> items)
: assert(items != null), : assert(items != null),
assert(items.isNotEmpty) { assert(items.isNotEmpty) {
...@@ -124,8 +122,8 @@ class TweenSequenceItem<T> { ...@@ -124,8 +122,8 @@ class TweenSequenceItem<T> {
/// An arbitrary value that indicates the relative percentage of a /// An arbitrary value that indicates the relative percentage of a
/// [TweenSequence] animation's duration when [tween] will be used. /// [TweenSequence] animation's duration when [tween] will be used.
/// ///
/// The percentage for an individual item is the item's weight divided /// The percentage for an individual item is the item's weight divided by the
/// by the sum of all of the items' weights. /// sum of all of the items' weights.
final double weight; final double weight;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment