Unverified Commit 7d1842bf authored by Jason C.H's avatar Jason C.H Committed by GitHub

Deprecate iOS13 style ActivityIndicator (#62741)

parent 6b2ef0df
......@@ -21,6 +21,10 @@ const Color _kActiveTickColor = CupertinoDynamicColor.withBrightness(
/// Define the iOS version style of [CupertinoActivityIndicator].
enum CupertinoActivityIndicatorIOSVersionStyle {
/// The style that is used in iOS13 and earlier (12 points).
@Deprecated(
'Use iOS14 instead. '
'This feature was deprecated after v1.21.0-1.0.pre.'
)
iOS13,
/// The style that was introduced in iOS14 (8 points).
......@@ -40,7 +44,11 @@ class CupertinoActivityIndicator extends StatefulWidget {
Key key,
this.animating = true,
this.radius = _kDefaultIndicatorRadius,
this.iOSVersionStyle = CupertinoActivityIndicatorIOSVersionStyle.iOS13,
@Deprecated(
'Leave this field default to use latest style. '
'This feature was deprecated after v1.21.0-1.0.pre.'
)
this.iOSVersionStyle = CupertinoActivityIndicatorIOSVersionStyle.iOS14,
}) : assert(animating != null),
assert(radius != null),
assert(radius > 0.0),
......@@ -57,7 +65,11 @@ class CupertinoActivityIndicator extends StatefulWidget {
Key key,
this.radius = _kDefaultIndicatorRadius,
this.progress = 1.0,
this.iOSVersionStyle = CupertinoActivityIndicatorIOSVersionStyle.iOS13,
@Deprecated(
'Leave this field default to use latest style. '
'This feature was deprecated after v1.21.0-1.0.pre.'
)
this.iOSVersionStyle = CupertinoActivityIndicatorIOSVersionStyle.iOS14,
}) : assert(radius != null),
assert(radius > 0.0),
assert(progress != null),
......@@ -86,8 +98,8 @@ class CupertinoActivityIndicator extends StatefulWidget {
/// The iOS version style of activity indicator.
///
/// Defaults to [CupertinoActivityIndicatorIOSVersionStyle.iOS13].
// TODO(ctrysbita): Change default style to iOS14 after official release, https://github.com/flutter/flutter/issues/60047
/// Defaults to [CupertinoActivityIndicatorIOSVersionStyle.iOS14].
// TODO(ctrysbita): Deprecate after official release, https://github.com/flutter/flutter/issues/62521
final CupertinoActivityIndicatorIOSVersionStyle iOSVersionStyle;
@override
......
......@@ -77,60 +77,6 @@ void main() {
);
});
testWidgets('Activity indicator with iOS14 style',
(WidgetTester tester) async {
final Key key = UniqueKey();
await tester.pumpWidget(
Center(
child: MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.light),
child: RepaintBoundary(
key: key,
child: Container(
color: CupertinoColors.white,
child: const CupertinoActivityIndicator(
animating: false,
radius: 35,
iOSVersionStyle:
CupertinoActivityIndicatorIOSVersionStyle.iOS14,
),
),
),
),
),
);
await expectLater(
find.byKey(key),
matchesGoldenFile('activityIndicator.iOS14.paused.light.png'),
);
await tester.pumpWidget(
Center(
child: MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.dark),
child: RepaintBoundary(
key: key,
child: Container(
color: CupertinoColors.black,
child: const CupertinoActivityIndicator(
animating: false,
radius: 35,
iOSVersionStyle:
CupertinoActivityIndicatorIOSVersionStyle.iOS14,
),
),
),
),
),
);
await expectLater(
find.byKey(key),
matchesGoldenFile('activityIndicator.iOS14.paused.dark.png'),
);
});
testWidgets('Activity indicator 0% in progress', (WidgetTester tester) async {
final Key key = UniqueKey();
await tester.pumpWidget(
......@@ -209,7 +155,8 @@ void main() {
// first tick was changed to be at 12 o'clock.
expect(
find.byType(CupertinoActivityIndicator),
paints..rrect(rrect: const RRect.fromLTRBXY(-10, -50, 10, -100, 10, 10)),
paints
..rrect(rrect: const RRect.fromLTRBXY(-10, -100 / 3, 10, -100, 10, 10)),
);
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment