From 3dbec8405288c7aa5659a008cb125e98c46f93e4 Mon Sep 17 00:00:00 2001 From: xster Date: Tue, 5 Feb 2019 19:12:37 -0800 Subject: [PATCH] Small cleanup in CupertinoSliverRefreshControl (#27570) --- .../flutter/lib/src/cupertino/refresh.dart | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/packages/flutter/lib/src/cupertino/refresh.dart b/packages/flutter/lib/src/cupertino/refresh.dart index fd64f06476..6a1df7a994 100644 --- a/packages/flutter/lib/src/cupertino/refresh.dart +++ b/packages/flutter/lib/src/cupertino/refresh.dart @@ -27,6 +27,7 @@ class _CupertinoSliverRefresh extends SingleChildRenderObjectWidget { // The amount of space the indicator should occupy in the sliver in a // resting state when in the refreshing mode. final double refreshIndicatorLayoutExtent; + // _RenderCupertinoSliverRefresh will paint the child in the available // space either way but this instructs the _RenderCupertinoSliverRefresh // on whether to also occupy any layoutExtent space or not. @@ -82,8 +83,8 @@ class _RenderCupertinoSliverRefresh extends RenderSliver } // The child box will be laid out and painted in the available space either - // way but this determines whether to also occupy any layoutExtent space or - // not. + // way but this determines whether to also occupy any + // [SliverGeometry.layoutExtent] space or not. bool get hasLayoutExtent => _hasLayoutExtent; bool _hasLayoutExtent; set hasLayoutExtent(bool value) { @@ -268,7 +269,7 @@ class CupertinoSliverRefreshControl extends StatefulWidget { /// Create a new refresh control for inserting into a list of slivers. /// /// The [refreshTriggerPullDistance] and [refreshIndicatorExtent] arguments - /// must not be null. + /// must not be null and must be >= 0. /// /// The [builder] argument may be null, in which case no indicator UI will be /// shown but the [onRefresh] will still be invoked. By default, [builder] @@ -389,8 +390,8 @@ class CupertinoSliverRefreshControl extends StatefulWidget { } class _CupertinoSliverRefreshControlState extends State { - /// Reset the state from done to inactive when only this fraction of the - /// original `refreshTriggerPullDistance` is left. + // Reset the state from done to inactive when only this fraction of the + // original `refreshTriggerPullDistance` is left. static const double _inactiveResetOverscrollFraction = 0.1; RefreshIndicatorMode refreshState; @@ -399,12 +400,12 @@ class _CupertinoSliverRefreshControlState extends State widget.refreshIndicatorExtent) { + if (latestIndicatorBoxExtent > widget.refreshIndicatorExtent) { return RefreshIndicatorMode.armed; } else { nextState = RefreshIndicatorMode.refresh; @@ -496,7 +497,7 @@ class _CupertinoSliverRefreshControlState extends State + if (latestIndicatorBoxExtent > widget.refreshTriggerPullDistance * _inactiveResetOverscrollFraction) { return RefreshIndicatorMode.done; } else { @@ -517,13 +518,13 @@ class _CupertinoSliverRefreshControlState extends State