fix cupertino refresh control style (#79842)

This commit is contained in:
c1yde3 2021-04-07 14:04:02 +08:00 committed by GitHub
parent a2f67720ef
commit 3dbe7f23c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View File

@ -420,7 +420,7 @@ class CupertinoSliverRefreshControl extends StatefulWidget {
double refreshTriggerPullDistance, double refreshTriggerPullDistance,
double refreshIndicatorExtent, double refreshIndicatorExtent,
) { ) {
final double percentageComplete = pulledExtent / refreshTriggerPullDistance; final double percentageComplete = (pulledExtent / refreshTriggerPullDistance).clamp(0.0, 1.0);
// Place the indicator at the top of the sliver that opens up. Note that we're using // Place the indicator at the top of the sliver that opens up. Note that we're using
// a Stack/Positioned widget because the CupertinoActivityIndicator does some internal // a Stack/Positioned widget because the CupertinoActivityIndicator does some internal

View File

@ -1322,6 +1322,26 @@ void main() {
); );
expect(tester.widget<CupertinoActivityIndicator>(find.byType(CupertinoActivityIndicator)).progress, 100.0 / 100.0); expect(tester.widget<CupertinoActivityIndicator>(find.byType(CupertinoActivityIndicator)).progress, 100.0 / 100.0);
}); });
testWidgets('indicator should not become larger when overscrolled', (WidgetTester tester) async {
// test for https://github.com/flutter/flutter/issues/79841
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: Builder(
builder: (BuildContext context) {
return CupertinoSliverRefreshControl.buildRefreshIndicator(
context,
RefreshIndicatorMode.done,
120, 100, 10,
);
},
),
),
);
expect(tester.widget<CupertinoActivityIndicator>(find.byType(CupertinoActivityIndicator)).radius, 14.0);
});
} }
group('UI tests long list', uiTestGroup); group('UI tests long list', uiTestGroup);