Unverified Commit 721016c1 authored by Kate Lovett's avatar Kate Lovett Committed by GitHub

Remove deprecated androidOverscrollIndicator from ScrollBehaviors (#133181)

parent 40af7db6
...@@ -785,35 +785,26 @@ class MaterialApp extends StatefulWidget { ...@@ -785,35 +785,26 @@ class MaterialApp extends StatefulWidget {
/// discoverable, so consider adding a Scrollbar in these cases, either directly /// discoverable, so consider adding a Scrollbar in these cases, either directly
/// or through the [buildScrollbar] method. /// or through the [buildScrollbar] method.
/// ///
/// [MaterialScrollBehavior.androidOverscrollIndicator] specifies the /// [ThemeData.useMaterial3] specifies the
/// overscroll indicator that is used on [TargetPlatform.android]. When null, /// overscroll indicator that is used on [TargetPlatform.android], which
/// [ThemeData.androidOverscrollIndicator] is used. If also null, the default /// defaults to true, resulting in a [StretchingOverscrollIndicator]. Setting
/// overscroll indicator is the [GlowingOverscrollIndicator]. These properties /// [ThemeData.useMaterial3] to false will instead use a
/// are deprecated. In order to use the [StretchingOverscrollIndicator], use /// [GlowingOverscrollIndicator].
/// the [ThemeData.useMaterial3] flag, or override
/// [ScrollBehavior.buildOverscrollIndicator].
/// ///
/// See also: /// See also:
/// ///
/// * [ScrollBehavior], the default scrolling behavior extended by this class. /// * [ScrollBehavior], the default scrolling behavior extended by this class.
class MaterialScrollBehavior extends ScrollBehavior { class MaterialScrollBehavior extends ScrollBehavior {
/// Creates a MaterialScrollBehavior that decorates [Scrollable]s with /// Creates a MaterialScrollBehavior that decorates [Scrollable]s with
/// [GlowingOverscrollIndicator]s and [Scrollbar]s based on the current /// [StretchingOverscrollIndicator]s and [Scrollbar]s based on the current
/// platform and provided [ScrollableDetails]. /// platform and provided [ScrollableDetails].
/// ///
/// [MaterialScrollBehavior.androidOverscrollIndicator] specifies the /// [ThemeData.useMaterial3] specifies the
/// overscroll indicator that is used on [TargetPlatform.android]. When null, /// overscroll indicator that is used on [TargetPlatform.android], which
/// [ThemeData.androidOverscrollIndicator] is used. If also null, the default /// defaults to true, resulting in a [StretchingOverscrollIndicator]. Setting
/// overscroll indicator is the [GlowingOverscrollIndicator]. /// [ThemeData.useMaterial3] to false will instead use a
const MaterialScrollBehavior({ /// [GlowingOverscrollIndicator].
@Deprecated( const MaterialScrollBehavior();
'Use ThemeData.useMaterial3 or override ScrollBehavior.buildOverscrollIndicator. '
'This feature was deprecated after v2.13.0-0.0.pre.'
)
super.androidOverscrollIndicator,
}) : _androidOverscrollIndicator = androidOverscrollIndicator;
final AndroidOverscrollIndicator? _androidOverscrollIndicator;
@override @override
TargetPlatform getPlatform(BuildContext context) => Theme.of(context).platform; TargetPlatform getPlatform(BuildContext context) => Theme.of(context).platform;
...@@ -847,14 +838,9 @@ class MaterialScrollBehavior extends ScrollBehavior { ...@@ -847,14 +838,9 @@ class MaterialScrollBehavior extends ScrollBehavior {
Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) { Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) {
// When modifying this function, consider modifying the implementation in // When modifying this function, consider modifying the implementation in
// the base class ScrollBehavior as well. // the base class ScrollBehavior as well.
late final AndroidOverscrollIndicator indicator; final AndroidOverscrollIndicator indicator = Theme.of(context).useMaterial3
if (Theme.of(context).useMaterial3) { ? AndroidOverscrollIndicator.stretch
indicator = AndroidOverscrollIndicator.stretch; : AndroidOverscrollIndicator.glow;
} else {
indicator = _androidOverscrollIndicator
?? Theme.of(context).androidOverscrollIndicator
?? androidOverscrollIndicator;
}
switch (getPlatform(context)) { switch (getPlatform(context)) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.linux: case TargetPlatform.linux:
......
...@@ -335,11 +335,6 @@ class ThemeData with Diagnosticable { ...@@ -335,11 +335,6 @@ class ThemeData with Diagnosticable {
ToggleButtonsThemeData? toggleButtonsTheme, ToggleButtonsThemeData? toggleButtonsTheme,
TooltipThemeData? tooltipTheme, TooltipThemeData? tooltipTheme,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
@Deprecated(
'Use ThemeData.useMaterial3 or override ScrollBehavior.buildOverscrollIndicator. '
'This feature was deprecated after v2.13.0-0.0.pre.'
)
AndroidOverscrollIndicator? androidOverscrollIndicator,
@Deprecated( @Deprecated(
'No longer used by the framework, please remove any reference to it. ' 'No longer used by the framework, please remove any reference to it. '
'For more information, consult the migration guide at ' 'For more information, consult the migration guide at '
...@@ -636,7 +631,6 @@ class ThemeData with Diagnosticable { ...@@ -636,7 +631,6 @@ class ThemeData with Diagnosticable {
toggleButtonsTheme: toggleButtonsTheme, toggleButtonsTheme: toggleButtonsTheme,
tooltipTheme: tooltipTheme, tooltipTheme: tooltipTheme,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
androidOverscrollIndicator: androidOverscrollIndicator,
toggleableActiveColor: toggleableActiveColor, toggleableActiveColor: toggleableActiveColor,
selectedRowColor: selectedRowColor, selectedRowColor: selectedRowColor,
errorColor: errorColor, errorColor: errorColor,
...@@ -747,11 +741,6 @@ class ThemeData with Diagnosticable { ...@@ -747,11 +741,6 @@ class ThemeData with Diagnosticable {
required this.toggleButtonsTheme, required this.toggleButtonsTheme,
required this.tooltipTheme, required this.tooltipTheme,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
@Deprecated(
'Use ThemeData.useMaterial3 or override ScrollBehavior.buildOverscrollIndicator. '
'This feature was deprecated after v2.13.0-0.0.pre.'
)
this.androidOverscrollIndicator,
@Deprecated( @Deprecated(
'No longer used by the framework, please remove any reference to it. ' 'No longer used by the framework, please remove any reference to it. '
'For more information, consult the migration guide at ' 'For more information, consult the migration guide at '
...@@ -1449,27 +1438,6 @@ class ThemeData with Diagnosticable { ...@@ -1449,27 +1438,6 @@ class ThemeData with Diagnosticable {
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
/// Specifies which overscroll indicator to use on [TargetPlatform.android].
///
/// When null, the default value of
/// [MaterialScrollBehavior.androidOverscrollIndicator] is
/// [AndroidOverscrollIndicator.glow].
///
/// This property is deprecated. Use the [useMaterial3] flag instead, or
/// override [ScrollBehavior.buildOverscrollIndicator].
///
/// See also:
///
/// * [StretchingOverscrollIndicator], a Material Design edge effect
/// that transforms the contents of a scrollable when overscrolled.
/// * [GlowingOverscrollIndicator], an edge effect that paints a glow
/// over the contents of a scrollable when overscrolled.
@Deprecated(
'Use ThemeData.useMaterial3 or override ScrollBehavior.buildOverscrollIndicator. '
'This feature was deprecated after v2.13.0-0.0.pre.'
)
final AndroidOverscrollIndicator? androidOverscrollIndicator;
/// Obsolete property that was used for input validation errors, e.g. in /// Obsolete property that was used for input validation errors, e.g. in
/// [TextField] fields. Use [ColorScheme.error] instead. /// [TextField] fields. Use [ColorScheme.error] instead.
@Deprecated( @Deprecated(
...@@ -1604,11 +1572,6 @@ class ThemeData with Diagnosticable { ...@@ -1604,11 +1572,6 @@ class ThemeData with Diagnosticable {
ToggleButtonsThemeData? toggleButtonsTheme, ToggleButtonsThemeData? toggleButtonsTheme,
TooltipThemeData? tooltipTheme, TooltipThemeData? tooltipTheme,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
@Deprecated(
'Use ThemeData.useMaterial3 or override ScrollBehavior.buildOverscrollIndicator. '
'This feature was deprecated after v2.13.0-0.0.pre.'
)
AndroidOverscrollIndicator? androidOverscrollIndicator,
@Deprecated( @Deprecated(
'No longer used by the framework, please remove any reference to it. ' 'No longer used by the framework, please remove any reference to it. '
'For more information, consult the migration guide at ' 'For more information, consult the migration guide at '
...@@ -1738,7 +1701,6 @@ class ThemeData with Diagnosticable { ...@@ -1738,7 +1701,6 @@ class ThemeData with Diagnosticable {
toggleButtonsTheme: toggleButtonsTheme ?? this.toggleButtonsTheme, toggleButtonsTheme: toggleButtonsTheme ?? this.toggleButtonsTheme,
tooltipTheme: tooltipTheme ?? this.tooltipTheme, tooltipTheme: tooltipTheme ?? this.tooltipTheme,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
androidOverscrollIndicator: androidOverscrollIndicator ?? this.androidOverscrollIndicator,
toggleableActiveColor: toggleableActiveColor ?? _toggleableActiveColor, toggleableActiveColor: toggleableActiveColor ?? _toggleableActiveColor,
selectedRowColor: selectedRowColor ?? _selectedRowColor, selectedRowColor: selectedRowColor ?? _selectedRowColor,
errorColor: errorColor ?? _errorColor, errorColor: errorColor ?? _errorColor,
...@@ -1932,7 +1894,6 @@ class ThemeData with Diagnosticable { ...@@ -1932,7 +1894,6 @@ class ThemeData with Diagnosticable {
toggleButtonsTheme: ToggleButtonsThemeData.lerp(a.toggleButtonsTheme, b.toggleButtonsTheme, t)!, toggleButtonsTheme: ToggleButtonsThemeData.lerp(a.toggleButtonsTheme, b.toggleButtonsTheme, t)!,
tooltipTheme: TooltipThemeData.lerp(a.tooltipTheme, b.tooltipTheme, t)!, tooltipTheme: TooltipThemeData.lerp(a.tooltipTheme, b.tooltipTheme, t)!,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
androidOverscrollIndicator:t < 0.5 ? a.androidOverscrollIndicator : b.androidOverscrollIndicator,
toggleableActiveColor: Color.lerp(a.toggleableActiveColor, b.toggleableActiveColor, t), toggleableActiveColor: Color.lerp(a.toggleableActiveColor, b.toggleableActiveColor, t),
selectedRowColor: Color.lerp(a.selectedRowColor, b.selectedRowColor, t), selectedRowColor: Color.lerp(a.selectedRowColor, b.selectedRowColor, t),
errorColor: Color.lerp(a.errorColor, b.errorColor, t), errorColor: Color.lerp(a.errorColor, b.errorColor, t),
...@@ -2038,7 +1999,6 @@ class ThemeData with Diagnosticable { ...@@ -2038,7 +1999,6 @@ class ThemeData with Diagnosticable {
other.toggleButtonsTheme == toggleButtonsTheme && other.toggleButtonsTheme == toggleButtonsTheme &&
other.tooltipTheme == tooltipTheme && other.tooltipTheme == tooltipTheme &&
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
other.androidOverscrollIndicator == androidOverscrollIndicator &&
other.toggleableActiveColor == toggleableActiveColor && other.toggleableActiveColor == toggleableActiveColor &&
other.selectedRowColor == selectedRowColor && other.selectedRowColor == selectedRowColor &&
other.errorColor == errorColor && other.errorColor == errorColor &&
...@@ -2141,7 +2101,6 @@ class ThemeData with Diagnosticable { ...@@ -2141,7 +2101,6 @@ class ThemeData with Diagnosticable {
toggleButtonsTheme, toggleButtonsTheme,
tooltipTheme, tooltipTheme,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
androidOverscrollIndicator,
toggleableActiveColor, toggleableActiveColor,
selectedRowColor, selectedRowColor,
errorColor, errorColor,
...@@ -2246,7 +2205,6 @@ class ThemeData with Diagnosticable { ...@@ -2246,7 +2205,6 @@ class ThemeData with Diagnosticable {
properties.add(DiagnosticsProperty<ToggleButtonsThemeData>('toggleButtonsTheme', toggleButtonsTheme, level: DiagnosticLevel.debug)); properties.add(DiagnosticsProperty<ToggleButtonsThemeData>('toggleButtonsTheme', toggleButtonsTheme, level: DiagnosticLevel.debug));
properties.add(DiagnosticsProperty<TooltipThemeData>('tooltipTheme', tooltipTheme, level: DiagnosticLevel.debug)); properties.add(DiagnosticsProperty<TooltipThemeData>('tooltipTheme', tooltipTheme, level: DiagnosticLevel.debug));
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
properties.add(EnumProperty<AndroidOverscrollIndicator>('androidOverscrollIndicator', androidOverscrollIndicator, defaultValue: null, level: DiagnosticLevel.debug));
properties.add(ColorProperty('toggleableActiveColor', toggleableActiveColor, defaultValue: defaultData.toggleableActiveColor, level: DiagnosticLevel.debug)); properties.add(ColorProperty('toggleableActiveColor', toggleableActiveColor, defaultValue: defaultData.toggleableActiveColor, level: DiagnosticLevel.debug));
properties.add(ColorProperty('selectedRowColor', selectedRowColor, defaultValue: defaultData.selectedRowColor, level: DiagnosticLevel.debug)); properties.add(ColorProperty('selectedRowColor', selectedRowColor, defaultValue: defaultData.selectedRowColor, level: DiagnosticLevel.debug));
properties.add(ColorProperty('errorColor', errorColor, defaultValue: defaultData.errorColor, level: DiagnosticLevel.debug)); properties.add(ColorProperty('errorColor', errorColor, defaultValue: defaultData.errorColor, level: DiagnosticLevel.debug));
......
...@@ -613,19 +613,15 @@ enum _StretchDirection { ...@@ -613,19 +613,15 @@ enum _StretchDirection {
/// To prevent the indicator from showing the indication, call /// To prevent the indicator from showing the indication, call
/// [OverscrollIndicatorNotification.disallowIndicator] on the notification. /// [OverscrollIndicatorNotification.disallowIndicator] on the notification.
/// ///
/// Created by [ScrollBehavior.buildOverscrollIndicator] on platforms /// Created by [MaterialScrollBehavior.buildOverscrollIndicator] on platforms
/// (e.g., Android) that commonly use this type of overscroll indication when /// (e.g., Android) that commonly use this type of overscroll indication when
/// [ScrollBehavior.androidOverscrollIndicator] is /// [ThemeData.useMaterial3] is true. Otherwise, when [ThemeData.useMaterial3]
/// [AndroidOverscrollIndicator.stretch]. Otherwise, the default /// is false, a [GlowingOverscrollIndicator] is used instead.=
/// [GlowingOverscrollIndicator] is applied.
/// [ScrollBehavior.androidOverscrollIndicator] is deprecated, use
/// [ThemeData.useMaterial3], or override
/// [ScrollBehavior.buildOverscrollIndicator] to choose the desired indicator.
/// ///
/// See also: /// See also:
/// ///
/// * [OverscrollIndicatorNotification], which can be used to prevent the stretch /// * [OverscrollIndicatorNotification], which can be used to prevent the
/// effect from being applied at all. /// stretch effect from being applied at all.
/// * [NotificationListener], to listen for the /// * [NotificationListener], to listen for the
/// [OverscrollIndicatorNotification]. /// [OverscrollIndicatorNotification].
/// * [GlowingOverscrollIndicator], the default overscroll indicator for /// * [GlowingOverscrollIndicator], the default overscroll indicator for
...@@ -666,14 +662,6 @@ class StretchingOverscrollIndicator extends StatefulWidget { ...@@ -666,14 +662,6 @@ class StretchingOverscrollIndicator extends StatefulWidget {
/// The overscroll indicator will apply a stretch effect to this child. This /// The overscroll indicator will apply a stretch effect to this child. This
/// child (and its subtree) should include a source of [ScrollNotification] /// child (and its subtree) should include a source of [ScrollNotification]
/// notifications. /// notifications.
///
/// Typically a [StretchingOverscrollIndicator] is created by a
/// [ScrollBehavior.buildOverscrollIndicator] method when opted-in using the
/// [ScrollBehavior.androidOverscrollIndicator] flag. In this case
/// the child is usually the one provided as an argument to that method.
/// [ScrollBehavior.androidOverscrollIndicator] is deprecated, use
/// [ThemeData.useMaterial3], or override
/// [ScrollBehavior.buildOverscrollIndicator] to choose the desired indicator.
final Widget? child; final Widget? child;
@override @override
......
...@@ -27,10 +27,6 @@ const Set<PointerDeviceKind> _kTouchLikeDeviceTypes = <PointerDeviceKind>{ ...@@ -27,10 +27,6 @@ const Set<PointerDeviceKind> _kTouchLikeDeviceTypes = <PointerDeviceKind>{
PointerDeviceKind.unknown, PointerDeviceKind.unknown,
}; };
/// The default overscroll indicator applied on [TargetPlatform.android].
// TODO(Piinks): Complete migration to stretch by default.
const AndroidOverscrollIndicator _kDefaultAndroidOverscrollIndicator = AndroidOverscrollIndicator.glow;
/// Types of overscroll indicators supported by [TargetPlatform.android]. /// Types of overscroll indicators supported by [TargetPlatform.android].
enum AndroidOverscrollIndicator { enum AndroidOverscrollIndicator {
/// Utilizes a [StretchingOverscrollIndicator], which transforms the contents /// Utilizes a [StretchingOverscrollIndicator], which transforms the contents
...@@ -67,28 +63,7 @@ enum AndroidOverscrollIndicator { ...@@ -67,28 +63,7 @@ enum AndroidOverscrollIndicator {
@immutable @immutable
class ScrollBehavior { class ScrollBehavior {
/// Creates a description of how [Scrollable] widgets should behave. /// Creates a description of how [Scrollable] widgets should behave.
const ScrollBehavior({ const ScrollBehavior();
@Deprecated(
'Use ThemeData.useMaterial3 or override ScrollBehavior.buildOverscrollIndicator. '
'This feature was deprecated after v2.13.0-0.0.pre.'
)
AndroidOverscrollIndicator? androidOverscrollIndicator,
}): _androidOverscrollIndicator = androidOverscrollIndicator;
/// Specifies which overscroll indicator to use on [TargetPlatform.android].
///
/// Cannot be null. Defaults to [AndroidOverscrollIndicator.glow].
///
/// See also:
///
/// * [MaterialScrollBehavior], which supports setting this property
/// using [ThemeData].
@Deprecated(
'Use ThemeData.useMaterial3 or override ScrollBehavior.buildOverscrollIndicator. '
'This feature was deprecated after v2.13.0-0.0.pre.'
)
AndroidOverscrollIndicator get androidOverscrollIndicator => _androidOverscrollIndicator ?? _kDefaultAndroidOverscrollIndicator;
final AndroidOverscrollIndicator? _androidOverscrollIndicator;
/// Creates a copy of this ScrollBehavior, making it possible to /// Creates a copy of this ScrollBehavior, making it possible to
/// easily toggle `scrollbar` and `overscrollIndicator` effects. /// easily toggle `scrollbar` and `overscrollIndicator` effects.
...@@ -105,11 +80,6 @@ class ScrollBehavior { ...@@ -105,11 +80,6 @@ class ScrollBehavior {
Set<LogicalKeyboardKey>? pointerAxisModifiers, Set<LogicalKeyboardKey>? pointerAxisModifiers,
ScrollPhysics? physics, ScrollPhysics? physics,
TargetPlatform? platform, TargetPlatform? platform,
@Deprecated(
'Use ThemeData.useMaterial3 or override ScrollBehavior.buildOverscrollIndicator. '
'This feature was deprecated after v2.13.0-0.0.pre.'
)
AndroidOverscrollIndicator? androidOverscrollIndicator,
}) { }) {
return _WrappedScrollBehavior( return _WrappedScrollBehavior(
delegate: this, delegate: this,
...@@ -119,7 +89,6 @@ class ScrollBehavior { ...@@ -119,7 +89,6 @@ class ScrollBehavior {
pointerAxisModifiers: pointerAxisModifiers, pointerAxisModifiers: pointerAxisModifiers,
physics: physics, physics: physics,
platform: platform, platform: platform,
androidOverscrollIndicator: androidOverscrollIndicator
); );
} }
...@@ -187,24 +156,14 @@ class ScrollBehavior { ...@@ -187,24 +156,14 @@ class ScrollBehavior {
case TargetPlatform.windows: case TargetPlatform.windows:
return child; return child;
case TargetPlatform.android: case TargetPlatform.android:
switch (androidOverscrollIndicator) {
case AndroidOverscrollIndicator.stretch:
return StretchingOverscrollIndicator(
axisDirection: details.direction,
child: child,
);
case AndroidOverscrollIndicator.glow:
break;
}
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
break;
}
return GlowingOverscrollIndicator( return GlowingOverscrollIndicator(
axisDirection: details.direction, axisDirection: details.direction,
color: _kDefaultGlowColor, color: _kDefaultGlowColor,
child: child, child: child,
); );
} }
}
/// Specifies the type of velocity tracker to use in the descendant /// Specifies the type of velocity tracker to use in the descendant
/// [Scrollable]s' drag gesture recognizers, for estimating the velocity of a /// [Scrollable]s' drag gesture recognizers, for estimating the velocity of a
...@@ -289,9 +248,7 @@ class _WrappedScrollBehavior implements ScrollBehavior { ...@@ -289,9 +248,7 @@ class _WrappedScrollBehavior implements ScrollBehavior {
Set<LogicalKeyboardKey>? pointerAxisModifiers, Set<LogicalKeyboardKey>? pointerAxisModifiers,
this.physics, this.physics,
this.platform, this.platform,
AndroidOverscrollIndicator? androidOverscrollIndicator, }) : _dragDevices = dragDevices,
}) : _androidOverscrollIndicator = androidOverscrollIndicator,
_dragDevices = dragDevices,
_pointerAxisModifiers = pointerAxisModifiers; _pointerAxisModifiers = pointerAxisModifiers;
final ScrollBehavior delegate; final ScrollBehavior delegate;
...@@ -301,8 +258,6 @@ class _WrappedScrollBehavior implements ScrollBehavior { ...@@ -301,8 +258,6 @@ class _WrappedScrollBehavior implements ScrollBehavior {
final TargetPlatform? platform; final TargetPlatform? platform;
final Set<PointerDeviceKind>? _dragDevices; final Set<PointerDeviceKind>? _dragDevices;
final Set<LogicalKeyboardKey>? _pointerAxisModifiers; final Set<LogicalKeyboardKey>? _pointerAxisModifiers;
@override
final AndroidOverscrollIndicator? _androidOverscrollIndicator;
@override @override
Set<PointerDeviceKind> get dragDevices => _dragDevices ?? delegate.dragDevices; Set<PointerDeviceKind> get dragDevices => _dragDevices ?? delegate.dragDevices;
...@@ -310,9 +265,6 @@ class _WrappedScrollBehavior implements ScrollBehavior { ...@@ -310,9 +265,6 @@ class _WrappedScrollBehavior implements ScrollBehavior {
@override @override
Set<LogicalKeyboardKey> get pointerAxisModifiers => _pointerAxisModifiers ?? delegate.pointerAxisModifiers; Set<LogicalKeyboardKey> get pointerAxisModifiers => _pointerAxisModifiers ?? delegate.pointerAxisModifiers;
@override
AndroidOverscrollIndicator get androidOverscrollIndicator => _androidOverscrollIndicator ?? delegate.androidOverscrollIndicator;
@override @override
Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) { Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) {
if (overscroll) { if (overscroll) {
...@@ -337,7 +289,6 @@ class _WrappedScrollBehavior implements ScrollBehavior { ...@@ -337,7 +289,6 @@ class _WrappedScrollBehavior implements ScrollBehavior {
Set<LogicalKeyboardKey>? pointerAxisModifiers, Set<LogicalKeyboardKey>? pointerAxisModifiers,
ScrollPhysics? physics, ScrollPhysics? physics,
TargetPlatform? platform, TargetPlatform? platform,
AndroidOverscrollIndicator? androidOverscrollIndicator
}) { }) {
return delegate.copyWith( return delegate.copyWith(
scrollbars: scrollbars ?? this.scrollbars, scrollbars: scrollbars ?? this.scrollbars,
...@@ -346,7 +297,6 @@ class _WrappedScrollBehavior implements ScrollBehavior { ...@@ -346,7 +297,6 @@ class _WrappedScrollBehavior implements ScrollBehavior {
pointerAxisModifiers: pointerAxisModifiers ?? this.pointerAxisModifiers, pointerAxisModifiers: pointerAxisModifiers ?? this.pointerAxisModifiers,
physics: physics ?? this.physics, physics: physics ?? this.physics,
platform: platform ?? this.platform, platform: platform ?? this.platform,
androidOverscrollIndicator: androidOverscrollIndicator ?? this.androidOverscrollIndicator,
); );
} }
......
...@@ -1299,9 +1299,8 @@ void main() { ...@@ -1299,9 +1299,8 @@ void main() {
expect(find.byType(GlowingOverscrollIndicator), findsNothing); expect(find.byType(GlowingOverscrollIndicator), findsNothing);
}, variant: TargetPlatformVariant.only(TargetPlatform.android)); }, variant: TargetPlatformVariant.only(TargetPlatform.android));
testWidgetsWithLeakTracking('ScrollBehavior stretch android overscroll indicator', (WidgetTester tester) async { testWidgetsWithLeakTracking('MaterialScrollBehavior default stretch android overscroll indicator', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
scrollBehavior: const MaterialScrollBehavior(androidOverscrollIndicator: AndroidOverscrollIndicator.stretch),
home: ListView( home: ListView(
children: const <Widget>[ children: const <Widget>[
SizedBox( SizedBox(
...@@ -1319,8 +1318,8 @@ void main() { ...@@ -1319,8 +1318,8 @@ void main() {
testWidgetsWithLeakTracking('Overscroll indicator can be set by theme', (WidgetTester tester) async { testWidgetsWithLeakTracking('Overscroll indicator can be set by theme', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
// The current default is glowing, setting via the theme should override. // The current default is M3 and stretch overscroll, setting via the theme should override.
theme: ThemeData().copyWith(androidOverscrollIndicator: AndroidOverscrollIndicator.stretch), theme: ThemeData().copyWith(useMaterial3: false),
home: ListView( home: ListView(
children: const <Widget>[ children: const <Widget>[
SizedBox( SizedBox(
...@@ -1332,28 +1331,8 @@ void main() { ...@@ -1332,28 +1331,8 @@ void main() {
), ),
)); ));
expect(find.byType(StretchingOverscrollIndicator), findsOneWidget); expect(find.byType(GlowingOverscrollIndicator), findsOneWidget);
expect(find.byType(GlowingOverscrollIndicator), findsNothing); expect(find.byType(StretchingOverscrollIndicator), findsNothing);
}, variant: TargetPlatformVariant.only(TargetPlatform.android));
testWidgetsWithLeakTracking('Overscroll indicator in MaterialScrollBehavior takes precedence over theme', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
// MaterialScrollBehavior.androidOverscrollIndicator takes precedence over theme.
scrollBehavior: const MaterialScrollBehavior(androidOverscrollIndicator: AndroidOverscrollIndicator.stretch),
theme: ThemeData().copyWith(androidOverscrollIndicator: AndroidOverscrollIndicator.glow),
home: ListView(
children: const <Widget>[
SizedBox(
height: 1000.0,
width: 1000.0,
child: Text('Test'),
),
],
),
));
expect(find.byType(StretchingOverscrollIndicator), findsOneWidget);
expect(find.byType(GlowingOverscrollIndicator), findsNothing);
}, variant: TargetPlatformVariant.only(TargetPlatform.android)); }, variant: TargetPlatformVariant.only(TargetPlatform.android));
testWidgetsWithLeakTracking('Material3 - ListView clip behavior updates overscroll indicator clip behavior', (WidgetTester tester) async { testWidgetsWithLeakTracking('Material3 - ListView clip behavior updates overscroll indicator clip behavior', (WidgetTester tester) async {
......
...@@ -809,7 +809,6 @@ void main() { ...@@ -809,7 +809,6 @@ void main() {
toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.black)), toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.black)),
tooltipTheme: const TooltipThemeData(height: 100), tooltipTheme: const TooltipThemeData(height: 100),
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
androidOverscrollIndicator: AndroidOverscrollIndicator.glow,
toggleableActiveColor: Colors.black, toggleableActiveColor: Colors.black,
selectedRowColor: Colors.black, selectedRowColor: Colors.black,
errorColor: Colors.black, errorColor: Colors.black,
...@@ -928,7 +927,6 @@ void main() { ...@@ -928,7 +927,6 @@ void main() {
tooltipTheme: const TooltipThemeData(height: 100), tooltipTheme: const TooltipThemeData(height: 100),
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
toggleableActiveColor: Colors.white, toggleableActiveColor: Colors.white,
selectedRowColor: Colors.white, selectedRowColor: Colors.white,
errorColor: Colors.white, errorColor: Colors.white,
...@@ -1030,7 +1028,6 @@ void main() { ...@@ -1030,7 +1028,6 @@ void main() {
tooltipTheme: otherTheme.tooltipTheme, tooltipTheme: otherTheme.tooltipTheme,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
androidOverscrollIndicator: otherTheme.androidOverscrollIndicator,
toggleableActiveColor: otherTheme.toggleableActiveColor, toggleableActiveColor: otherTheme.toggleableActiveColor,
selectedRowColor: otherTheme.selectedRowColor, selectedRowColor: otherTheme.selectedRowColor,
errorColor: otherTheme.errorColor, errorColor: otherTheme.errorColor,
...@@ -1133,7 +1130,6 @@ void main() { ...@@ -1133,7 +1130,6 @@ void main() {
expect(themeDataCopy.tooltipTheme, equals(otherTheme.tooltipTheme)); expect(themeDataCopy.tooltipTheme, equals(otherTheme.tooltipTheme));
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
expect(themeDataCopy.androidOverscrollIndicator, equals(otherTheme.androidOverscrollIndicator));
expect(themeDataCopy.toggleableActiveColor, equals(otherTheme.toggleableActiveColor)); expect(themeDataCopy.toggleableActiveColor, equals(otherTheme.toggleableActiveColor));
expect(themeDataCopy.selectedRowColor, equals(otherTheme.selectedRowColor)); expect(themeDataCopy.selectedRowColor, equals(otherTheme.selectedRowColor));
expect(themeDataCopy.errorColor, equals(otherTheme.errorColor)); expect(themeDataCopy.errorColor, equals(otherTheme.errorColor));
...@@ -1267,7 +1263,6 @@ void main() { ...@@ -1267,7 +1263,6 @@ void main() {
'toggleButtonsTheme', 'toggleButtonsTheme',
'tooltipTheme', 'tooltipTheme',
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
'androidOverscrollIndicator',
'toggleableActiveColor', 'toggleableActiveColor',
'selectedRowColor', 'selectedRowColor',
'errorColor', 'errorColor',
......
...@@ -154,32 +154,6 @@ void main() { ...@@ -154,32 +154,6 @@ void main() {
expect(find.byType(GlowingOverscrollIndicator), findsOneWidget); expect(find.byType(GlowingOverscrollIndicator), findsOneWidget);
}, variant: TargetPlatformVariant.only(TargetPlatform.android)); }, variant: TargetPlatformVariant.only(TargetPlatform.android));
testWidgets('ScrollBehavior stretch android overscroll indicator', (WidgetTester tester) async {
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: MediaQuery(
data: const MediaQueryData(size: Size(800, 600)),
child: ScrollConfiguration(
behavior: const ScrollBehavior(androidOverscrollIndicator: AndroidOverscrollIndicator.stretch),
child: ListView(
children: const <Widget>[
SizedBox(
height: 1000.0,
width: 1000.0,
child: Text('Test'),
),
],
),
),
),
),
);
expect(find.byType(StretchingOverscrollIndicator), findsOneWidget);
expect(find.byType(GlowingOverscrollIndicator), findsNothing);
}, variant: TargetPlatformVariant.only(TargetPlatform.android));
group('ScrollBehavior configuration is maintained over multiple copies', () { group('ScrollBehavior configuration is maintained over multiple copies', () {
testWidgets('dragDevices', (WidgetTester tester) async { testWidgets('dragDevices', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/91673 // Regression test for https://github.com/flutter/flutter/issues/91673
...@@ -203,22 +177,6 @@ void main() { ...@@ -203,22 +177,6 @@ void main() {
expect(twiceCopiedBehavior.dragDevices, PointerDeviceKind.values.toSet()); expect(twiceCopiedBehavior.dragDevices, PointerDeviceKind.values.toSet());
}); });
testWidgets('androidOverscrollIndicator', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/91673
const ScrollBehavior defaultBehavior = ScrollBehavior();
expect(defaultBehavior.androidOverscrollIndicator, AndroidOverscrollIndicator.glow);
// Use copyWith to modify androidOverscrollIndicator
final ScrollBehavior onceCopiedBehavior = defaultBehavior.copyWith(
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
);
expect(onceCopiedBehavior.androidOverscrollIndicator, AndroidOverscrollIndicator.stretch);
// Copy again. The previously modified value should carry over.
final ScrollBehavior twiceCopiedBehavior = onceCopiedBehavior.copyWith();
expect(twiceCopiedBehavior.androidOverscrollIndicator, AndroidOverscrollIndicator.stretch);
});
testWidgets('physics', (WidgetTester tester) async { testWidgets('physics', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/91673 // Regression test for https://github.com/flutter/flutter/issues/91673
late ScrollPhysics defaultPhysics; late ScrollPhysics defaultPhysics;
......
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