From 691c25faca438a895b5d166a496aab04bcb17b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99=20Tiselice?= Date: Wed, 7 Sep 2016 13:58:04 -0700 Subject: [PATCH] Renamed Step curve to Threshold. (#5755) In the interest of using the name in the case of Material steppers, this commit renames Step curve to Threshold. --- packages/flutter/lib/src/animation/curves.dart | 6 +++--- packages/flutter/lib/src/material/drop_down.dart | 4 ++-- packages/flutter/lib/src/material/snack_bar.dart | 2 +- packages/flutter/test/animation/curves_test.dart | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/flutter/lib/src/animation/curves.dart b/packages/flutter/lib/src/animation/curves.dart index 26f036393b..0ce3f832c6 100644 --- a/packages/flutter/lib/src/animation/curves.dart +++ b/packages/flutter/lib/src/animation/curves.dart @@ -112,11 +112,11 @@ class Interval extends Curve { } /// A curve that is 0.0 until it hits the threshold, then it jumps to 1.0. -class Step extends Curve { - /// Creates a step cruve. +class Threshold extends Curve { + /// Creates a threshold curve. /// /// The [threshold] argument must not be null. - const Step(this.threshold); + const Threshold(this.threshold); /// The value before which the curve is 0.0 and after which the curve is 1.0. /// diff --git a/packages/flutter/lib/src/material/drop_down.dart b/packages/flutter/lib/src/material/drop_down.dart index 2b3bf40fc9..af46d26613 100644 --- a/packages/flutter/lib/src/material/drop_down.dart +++ b/packages/flutter/lib/src/material/drop_down.dart @@ -125,7 +125,7 @@ class _DropDownMenuState extends State<_DropDownMenu> { _resize = new CurvedAnimation( parent: config.route.animation, curve: const Interval(0.25, 0.5), - reverseCurve: const Step(0.0) + reverseCurve: const Threshold(0.0) ); } @@ -145,7 +145,7 @@ class _DropDownMenuState extends State<_DropDownMenu> { for (int itemIndex = 0; itemIndex < route.items.length; ++itemIndex) { CurvedAnimation opacity; if (itemIndex == route.selectedIndex) { - opacity = new CurvedAnimation(parent: route.animation, curve: const Step(0.0)); + opacity = new CurvedAnimation(parent: route.animation, curve: const Threshold(0.0)); } else { final double start = (0.5 + (itemIndex + 1) * unit).clamp(0.0, 1.0); final double end = (start + 1.5 * unit).clamp(0.0, 1.0); diff --git a/packages/flutter/lib/src/material/snack_bar.dart b/packages/flutter/lib/src/material/snack_bar.dart index 646dec83ef..6aca6cc904 100644 --- a/packages/flutter/lib/src/material/snack_bar.dart +++ b/packages/flutter/lib/src/material/snack_bar.dart @@ -152,7 +152,7 @@ class SnackBar extends StatelessWidget { if (action != null) children.add(action); CurvedAnimation heightAnimation = new CurvedAnimation(parent: animation, curve: _snackBarHeightCurve); - CurvedAnimation fadeAnimation = new CurvedAnimation(parent: animation, curve: _snackBarFadeCurve, reverseCurve: const Step(0.0)); + CurvedAnimation fadeAnimation = new CurvedAnimation(parent: animation, curve: _snackBarFadeCurve, reverseCurve: const Threshold(0.0)); ThemeData theme = Theme.of(context); return new ClipRect( child: new AnimatedBuilder( diff --git a/packages/flutter/test/animation/curves_test.dart b/packages/flutter/test/animation/curves_test.dart index ce18745732..f3921c1ccd 100644 --- a/packages/flutter/test/animation/curves_test.dart +++ b/packages/flutter/test/animation/curves_test.dart @@ -25,8 +25,8 @@ void main() { expect(flippedEase, hasOneLineDescription); }); - test('Step has a step', () { - Curve step = new Step(0.25); + test('Threshold has a threshold', () { + Curve step = new Threshold(0.25); expect(step.transform(0.0), 0.0); expect(step.transform(0.24), 0.0); expect(step.transform(0.25), 1.0);