Fixed a typo in AnimationController.repeat() (#8816)

This commit is contained in:
Hans Muller
2017-03-16 07:28:47 -07:00
committed by GitHub
parent cefcd249ac
commit e0f26b44f2
2 changed files with 12 additions and 3 deletions

View File

@@ -306,10 +306,10 @@ class AnimationController extends Animation<double>
max ??= upperBound;
period ??= duration;
assert(() {
if (duration == null) {
if (period == null) {
throw new FlutterError(
'AnimationController.repeat() called with no explicit Duration and default Duration.\n'
'Either the "duration" argument to the repeat() method should be provided, or the '
'AnimationController.repeat() called without an explicit period and with no default Duration.\n'
'Either the "period" argument to the repeat() method should be provided, or the '
'"duration" property should be set, either in the constructor or later, before '
'calling the repeat() function.'
);

View File

@@ -277,4 +277,13 @@ void main() {
controller.dispose();
expect(controller.dispose, throwsFlutterError);
});
test('AnimationController repeat() throws if period is not specified', () {
final AnimationController controller = new AnimationController(
vsync: const TestVSync(),
);
expect((){ controller.repeat(); }, throwsFlutterError);
expect((){ controller.repeat(period: null); }, throwsFlutterError);
});
}