Merge pull request #2339 from sethladd/doc
move the link around for flutter doc homepage
diff --git a/packages/flutter/lib/src/animation/animation_controller.dart b/packages/flutter/lib/src/animation/animation_controller.dart
index e4c0b20..205ecd4 100644
--- a/packages/flutter/lib/src/animation/animation_controller.dart
+++ b/packages/flutter/lib/src/animation/animation_controller.dart
@@ -125,13 +125,17 @@
}
/// Starts running this animation forwards (towards the end).
- Future forward() {
+ Future forward({ double from }) {
+ if (from != null)
+ value = from;
_direction = _AnimationDirection.forward;
return animateTo(upperBound);
}
/// Starts running this animation in reverse (towards the beginning).
- Future reverse() {
+ Future reverse({ double from }) {
+ if (from != null)
+ value = from;
_direction = _AnimationDirection.reverse;
return animateTo(lowerBound);
}
diff --git a/packages/flutter/lib/src/material/icon.dart b/packages/flutter/lib/src/material/icon.dart
index e3ed79d..d27572d 100644
--- a/packages/flutter/lib/src/material/icon.dart
+++ b/packages/flutter/lib/src/material/icon.dart
@@ -9,11 +9,24 @@
import 'icon_theme.dart';
import 'theme.dart';
+/// A material design icon.
+///
+/// Available icons are shown on this page:
+/// <https://design.google.com/icons/>
+///
+/// Icons are identified by their name (as given on that page), with
+/// spaces converted to underscores, from the [Icons] class. For
+/// example, the "alarm add" icon is [Icons.alarm_add].
+///
+/// To use this class, make sure you set `uses-material-design: true`
+/// in your project's `flutter.yaml` file. This ensures that the
+/// MaterialIcons font is included in your application. This font is
+/// used to display the icons.
class Icon extends StatelessComponent {
Icon({
Key key,
- this.size: 24.0,
this.icon,
+ this.size: 24.0,
this.color
}) : super(key: key) {
assert(size != null);
@@ -52,16 +65,19 @@
if (iconAlpha != 255)
iconColor = color.withAlpha((iconAlpha * color.opacity).round());
- return new SizedBox(
- width: size,
- height: size,
- child: new Center(
- child: new Text(new String.fromCharCode(icon.codePoint),
- style: new TextStyle(
- inherit: false,
- color: iconColor,
- fontSize: size,
- fontFamily: 'MaterialIcons'
+ return new ExcludeSemantics(
+ child: new SizedBox(
+ width: size,
+ height: size,
+ child: new Center(
+ child: new Text(
+ new String.fromCharCode(icon.codePoint),
+ style: new TextStyle(
+ inherit: false,
+ color: iconColor,
+ fontSize: size,
+ fontFamily: 'MaterialIcons'
+ )
)
)
)
diff --git a/packages/flutter/test/animation/animation_controller_test.dart b/packages/flutter/test/animation/animation_controller_test.dart
index f7f1903..b561bff 100644
--- a/packages/flutter/test/animation/animation_controller_test.dart
+++ b/packages/flutter/test/animation/animation_controller_test.dart
@@ -102,4 +102,32 @@
controller.stop();
});
+
+ test("Forward and reverse from values", () {
+ WidgetFlutterBinding.ensureInitialized();
+ AnimationController controller = new AnimationController(
+ duration: const Duration(milliseconds: 100)
+ );
+ List<double> valueLog = <double>[];
+ List<AnimationStatus> statusLog = <AnimationStatus>[];
+ controller
+ ..addStatusListener((AnimationStatus status) {
+ statusLog.add(status);
+ })
+ ..addListener(() {
+ valueLog.add(controller.value);
+ });
+
+ controller.reverse(from: 0.2);
+ expect(statusLog, equals([ AnimationStatus.reverse ]));
+ expect(valueLog, equals([ 0.2 ]));
+ expect(controller.value, equals(0.2));
+ statusLog.clear();
+ valueLog.clear();
+
+ controller.forward(from: 0.0);
+ expect(statusLog, equals([ AnimationStatus.dismissed, AnimationStatus.forward ]));
+ expect(valueLog, equals([ 0.0 ]));
+ expect(controller.value, equals(0.0));
+ });
}