diff --git a/AUTHORS b/AUTHORS index ab63cf6af5..c8e76db803 100644 --- a/AUTHORS +++ b/AUTHORS @@ -24,3 +24,4 @@ Tetsuhiro Ueda Dan Field Noah Groß Victor Choueiri +Lukasz Piliszczuk diff --git a/packages/flutter/lib/src/material/refresh_indicator.dart b/packages/flutter/lib/src/material/refresh_indicator.dart index 82bc0363ee..265bf73dc3 100644 --- a/packages/flutter/lib/src/material/refresh_indicator.dart +++ b/packages/flutter/lib/src/material/refresh_indicator.dart @@ -32,7 +32,7 @@ const Duration _kIndicatorScaleDuration = const Duration(milliseconds: 200); /// finished. /// /// Used by [RefreshIndicator.onRefresh]. -typedef Future RefreshCallback(); +typedef Future RefreshCallback(); // The state machine moves through these modes only when the scrollable // identified by scrollableKey has been scrolled to its min or max limit. @@ -146,7 +146,7 @@ class RefreshIndicatorState extends State with TickerProviderS Animation _valueColor; _RefreshIndicatorMode _mode; - Future _pendingRefreshFuture; + Future _pendingRefreshFuture; bool _isIndicatorAtTop; double _dragOffset; @@ -297,7 +297,7 @@ class RefreshIndicatorState extends State with TickerProviderS } // Stop showing the refresh indicator. - Future _dismiss(_RefreshIndicatorMode newMode) async { + Future _dismiss(_RefreshIndicatorMode newMode) async { // This can only be called from _show() when refreshing and // _handleScrollNotification in response to a ScrollEndNotification or // direction change. @@ -327,7 +327,7 @@ class RefreshIndicatorState extends State with TickerProviderS void _show() { assert(_mode != _RefreshIndicatorMode.refresh); assert(_mode != _RefreshIndicatorMode.snap); - final Completer completer = new Completer(); + final Completer completer = new Completer(); _pendingRefreshFuture = completer.future; _mode = _RefreshIndicatorMode.snap; _positionController @@ -340,7 +340,7 @@ class RefreshIndicatorState extends State with TickerProviderS _mode = _RefreshIndicatorMode.refresh; }); - final Future refreshResult = widget.onRefresh(); + final Future refreshResult = widget.onRefresh(); assert(() { if (refreshResult == null) FlutterError.reportError(new FlutterErrorDetails( @@ -381,7 +381,7 @@ class RefreshIndicatorState extends State with TickerProviderS /// When initiated in this manner, the refresh indicator is independent of any /// actual scroll view. It defaults to showing the indicator at the top. To /// show it at the bottom, set `atTop` to false. - Future show({ bool atTop = true }) { + Future show({ bool atTop = true }) { if (_mode != _RefreshIndicatorMode.refresh && _mode != _RefreshIndicatorMode.snap) { if (_mode == null) diff --git a/packages/flutter/test/material/refresh_indicator_test.dart b/packages/flutter/test/material/refresh_indicator_test.dart index 841ef8a96d..ac5873235b 100644 --- a/packages/flutter/test/material/refresh_indicator_test.dart +++ b/packages/flutter/test/material/refresh_indicator_test.dart @@ -10,14 +10,14 @@ import 'package:flutter/material.dart'; bool refreshCalled = false; -Future refresh() { +Future refresh() { refreshCalled = true; - return new Future.value(); + return new Future.value(); } -Future holdRefresh() { +Future holdRefresh() { refreshCalled = true; - return new Completer().future; + return new Completer().future; } void main() { @@ -248,7 +248,7 @@ void main() { bool completed = false; tester.state(find.byType(RefreshIndicator)) .show() - .then((Null value) { completed = true; }); + .then((void value) { completed = true; }); await tester.pump(); expect(completed, false); await tester.pump(const Duration(seconds: 1)); @@ -260,7 +260,7 @@ void main() { refreshCalled = false; tester.state(find.byType(RefreshIndicator)) .show() - .then((Null value) { completed = true; }); + .then((void value) { completed = true; }); await tester.pump(); expect(completed, false); await tester.pump(const Duration(seconds: 1)); @@ -291,7 +291,7 @@ void main() { bool completed = false; tester.state(find.byType(RefreshIndicator)) .show() - .then((Null value) { completed = true; }); + .then((void value) { completed = true; }); await tester.pump(); expect(completed, false); await tester.pump(const Duration(seconds: 1)); @@ -303,7 +303,7 @@ void main() { refreshCalled = false; tester.state(find.byType(RefreshIndicator)) .show() - .then((Null value) { completed = true; }); + .then((void value) { completed = true; }); await tester.pump(); expect(completed, false); await tester.pump(const Duration(seconds: 1)); @@ -335,11 +335,11 @@ void main() { bool completed1 = false; tester.state(find.byType(RefreshIndicator)) .show() - .then((Null value) { completed1 = true; }); + .then((void value) { completed1 = true; }); bool completed2 = false; tester.state(find.byType(RefreshIndicator)) .show() - .then((Null value) { completed2 = true; }); + .then((void value) { completed2 = true; }); await tester.pump(); expect(completed1, false); expect(completed2, false);