mirror of
https://github.com/flutter/flutter
synced 2024-09-20 00:32:02 +00:00
Remove deprecated androidOverscrollIndicator from ScrollBehaviors (#133181)
This commit is contained in:
parent
40af7db6bb
commit
721016c1db
|
@ -785,35 +785,26 @@ class MaterialApp extends StatefulWidget {
|
|||
/// discoverable, so consider adding a Scrollbar in these cases, either directly
|
||||
/// or through the [buildScrollbar] method.
|
||||
///
|
||||
/// [MaterialScrollBehavior.androidOverscrollIndicator] specifies the
|
||||
/// overscroll indicator that is used on [TargetPlatform.android]. When null,
|
||||
/// [ThemeData.androidOverscrollIndicator] is used. If also null, the default
|
||||
/// overscroll indicator is the [GlowingOverscrollIndicator]. These properties
|
||||
/// are deprecated. In order to use the [StretchingOverscrollIndicator], use
|
||||
/// the [ThemeData.useMaterial3] flag, or override
|
||||
/// [ScrollBehavior.buildOverscrollIndicator].
|
||||
/// [ThemeData.useMaterial3] specifies the
|
||||
/// overscroll indicator that is used on [TargetPlatform.android], which
|
||||
/// defaults to true, resulting in a [StretchingOverscrollIndicator]. Setting
|
||||
/// [ThemeData.useMaterial3] to false will instead use a
|
||||
/// [GlowingOverscrollIndicator].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [ScrollBehavior], the default scrolling behavior extended by this class.
|
||||
class MaterialScrollBehavior extends ScrollBehavior {
|
||||
/// 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].
|
||||
///
|
||||
/// [MaterialScrollBehavior.androidOverscrollIndicator] specifies the
|
||||
/// overscroll indicator that is used on [TargetPlatform.android]. When null,
|
||||
/// [ThemeData.androidOverscrollIndicator] is used. If also null, the default
|
||||
/// overscroll indicator is the [GlowingOverscrollIndicator].
|
||||
const MaterialScrollBehavior({
|
||||
@Deprecated(
|
||||
'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;
|
||||
/// [ThemeData.useMaterial3] specifies the
|
||||
/// overscroll indicator that is used on [TargetPlatform.android], which
|
||||
/// defaults to true, resulting in a [StretchingOverscrollIndicator]. Setting
|
||||
/// [ThemeData.useMaterial3] to false will instead use a
|
||||
/// [GlowingOverscrollIndicator].
|
||||
const MaterialScrollBehavior();
|
||||
|
||||
@override
|
||||
TargetPlatform getPlatform(BuildContext context) => Theme.of(context).platform;
|
||||
|
@ -847,14 +838,9 @@ class MaterialScrollBehavior extends ScrollBehavior {
|
|||
Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) {
|
||||
// When modifying this function, consider modifying the implementation in
|
||||
// the base class ScrollBehavior as well.
|
||||
late final AndroidOverscrollIndicator indicator;
|
||||
if (Theme.of(context).useMaterial3) {
|
||||
indicator = AndroidOverscrollIndicator.stretch;
|
||||
} else {
|
||||
indicator = _androidOverscrollIndicator
|
||||
?? Theme.of(context).androidOverscrollIndicator
|
||||
?? androidOverscrollIndicator;
|
||||
}
|
||||
final AndroidOverscrollIndicator indicator = Theme.of(context).useMaterial3
|
||||
? AndroidOverscrollIndicator.stretch
|
||||
: AndroidOverscrollIndicator.glow;
|
||||
switch (getPlatform(context)) {
|
||||
case TargetPlatform.iOS:
|
||||
case TargetPlatform.linux:
|
||||
|
|
|
@ -335,11 +335,6 @@ class ThemeData with Diagnosticable {
|
|||
ToggleButtonsThemeData? toggleButtonsTheme,
|
||||
TooltipThemeData? tooltipTheme,
|
||||
// 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(
|
||||
'No longer used by the framework, please remove any reference to it. '
|
||||
'For more information, consult the migration guide at '
|
||||
|
@ -636,7 +631,6 @@ class ThemeData with Diagnosticable {
|
|||
toggleButtonsTheme: toggleButtonsTheme,
|
||||
tooltipTheme: tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
androidOverscrollIndicator: androidOverscrollIndicator,
|
||||
toggleableActiveColor: toggleableActiveColor,
|
||||
selectedRowColor: selectedRowColor,
|
||||
errorColor: errorColor,
|
||||
|
@ -747,11 +741,6 @@ class ThemeData with Diagnosticable {
|
|||
required this.toggleButtonsTheme,
|
||||
required this.tooltipTheme,
|
||||
// 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(
|
||||
'No longer used by the framework, please remove any reference to it. '
|
||||
'For more information, consult the migration guide at '
|
||||
|
@ -1449,27 +1438,6 @@ class ThemeData with Diagnosticable {
|
|||
|
||||
// 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
|
||||
/// [TextField] fields. Use [ColorScheme.error] instead.
|
||||
@Deprecated(
|
||||
|
@ -1604,11 +1572,6 @@ class ThemeData with Diagnosticable {
|
|||
ToggleButtonsThemeData? toggleButtonsTheme,
|
||||
TooltipThemeData? tooltipTheme,
|
||||
// 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(
|
||||
'No longer used by the framework, please remove any reference to it. '
|
||||
'For more information, consult the migration guide at '
|
||||
|
@ -1738,7 +1701,6 @@ class ThemeData with Diagnosticable {
|
|||
toggleButtonsTheme: toggleButtonsTheme ?? this.toggleButtonsTheme,
|
||||
tooltipTheme: tooltipTheme ?? this.tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
androidOverscrollIndicator: androidOverscrollIndicator ?? this.androidOverscrollIndicator,
|
||||
toggleableActiveColor: toggleableActiveColor ?? _toggleableActiveColor,
|
||||
selectedRowColor: selectedRowColor ?? _selectedRowColor,
|
||||
errorColor: errorColor ?? _errorColor,
|
||||
|
@ -1932,7 +1894,6 @@ class ThemeData with Diagnosticable {
|
|||
toggleButtonsTheme: ToggleButtonsThemeData.lerp(a.toggleButtonsTheme, b.toggleButtonsTheme, t)!,
|
||||
tooltipTheme: TooltipThemeData.lerp(a.tooltipTheme, b.tooltipTheme, t)!,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
androidOverscrollIndicator:t < 0.5 ? a.androidOverscrollIndicator : b.androidOverscrollIndicator,
|
||||
toggleableActiveColor: Color.lerp(a.toggleableActiveColor, b.toggleableActiveColor, t),
|
||||
selectedRowColor: Color.lerp(a.selectedRowColor, b.selectedRowColor, t),
|
||||
errorColor: Color.lerp(a.errorColor, b.errorColor, t),
|
||||
|
@ -2038,7 +1999,6 @@ class ThemeData with Diagnosticable {
|
|||
other.toggleButtonsTheme == toggleButtonsTheme &&
|
||||
other.tooltipTheme == tooltipTheme &&
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
other.androidOverscrollIndicator == androidOverscrollIndicator &&
|
||||
other.toggleableActiveColor == toggleableActiveColor &&
|
||||
other.selectedRowColor == selectedRowColor &&
|
||||
other.errorColor == errorColor &&
|
||||
|
@ -2141,7 +2101,6 @@ class ThemeData with Diagnosticable {
|
|||
toggleButtonsTheme,
|
||||
tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
androidOverscrollIndicator,
|
||||
toggleableActiveColor,
|
||||
selectedRowColor,
|
||||
errorColor,
|
||||
|
@ -2246,7 +2205,6 @@ class ThemeData with Diagnosticable {
|
|||
properties.add(DiagnosticsProperty<ToggleButtonsThemeData>('toggleButtonsTheme', toggleButtonsTheme, level: DiagnosticLevel.debug));
|
||||
properties.add(DiagnosticsProperty<TooltipThemeData>('tooltipTheme', tooltipTheme, level: DiagnosticLevel.debug));
|
||||
// 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('selectedRowColor', selectedRowColor, defaultValue: defaultData.selectedRowColor, level: DiagnosticLevel.debug));
|
||||
properties.add(ColorProperty('errorColor', errorColor, defaultValue: defaultData.errorColor, level: DiagnosticLevel.debug));
|
||||
|
|
|
@ -613,19 +613,15 @@ enum _StretchDirection {
|
|||
/// To prevent the indicator from showing the indication, call
|
||||
/// [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
|
||||
/// [ScrollBehavior.androidOverscrollIndicator] is
|
||||
/// [AndroidOverscrollIndicator.stretch]. Otherwise, the default
|
||||
/// [GlowingOverscrollIndicator] is applied.
|
||||
/// [ScrollBehavior.androidOverscrollIndicator] is deprecated, use
|
||||
/// [ThemeData.useMaterial3], or override
|
||||
/// [ScrollBehavior.buildOverscrollIndicator] to choose the desired indicator.
|
||||
/// [ThemeData.useMaterial3] is true. Otherwise, when [ThemeData.useMaterial3]
|
||||
/// is false, a [GlowingOverscrollIndicator] is used instead.=
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [OverscrollIndicatorNotification], which can be used to prevent the stretch
|
||||
/// effect from being applied at all.
|
||||
/// * [OverscrollIndicatorNotification], which can be used to prevent the
|
||||
/// stretch effect from being applied at all.
|
||||
/// * [NotificationListener], to listen for the
|
||||
/// [OverscrollIndicatorNotification].
|
||||
/// * [GlowingOverscrollIndicator], the default overscroll indicator for
|
||||
|
@ -666,14 +662,6 @@ class StretchingOverscrollIndicator extends StatefulWidget {
|
|||
/// The overscroll indicator will apply a stretch effect to this child. This
|
||||
/// child (and its subtree) should include a source of [ScrollNotification]
|
||||
/// 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;
|
||||
|
||||
@override
|
||||
|
|
|
@ -27,10 +27,6 @@ const Set<PointerDeviceKind> _kTouchLikeDeviceTypes = <PointerDeviceKind>{
|
|||
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].
|
||||
enum AndroidOverscrollIndicator {
|
||||
/// Utilizes a [StretchingOverscrollIndicator], which transforms the contents
|
||||
|
@ -67,28 +63,7 @@ enum AndroidOverscrollIndicator {
|
|||
@immutable
|
||||
class ScrollBehavior {
|
||||
/// Creates a description of how [Scrollable] widgets should behave.
|
||||
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;
|
||||
const ScrollBehavior();
|
||||
|
||||
/// Creates a copy of this ScrollBehavior, making it possible to
|
||||
/// easily toggle `scrollbar` and `overscrollIndicator` effects.
|
||||
|
@ -105,11 +80,6 @@ class ScrollBehavior {
|
|||
Set<LogicalKeyboardKey>? pointerAxisModifiers,
|
||||
ScrollPhysics? physics,
|
||||
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(
|
||||
delegate: this,
|
||||
|
@ -119,7 +89,6 @@ class ScrollBehavior {
|
|||
pointerAxisModifiers: pointerAxisModifiers,
|
||||
physics: physics,
|
||||
platform: platform,
|
||||
androidOverscrollIndicator: androidOverscrollIndicator
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -187,23 +156,13 @@ class ScrollBehavior {
|
|||
case TargetPlatform.windows:
|
||||
return child;
|
||||
case TargetPlatform.android:
|
||||
switch (androidOverscrollIndicator) {
|
||||
case AndroidOverscrollIndicator.stretch:
|
||||
return StretchingOverscrollIndicator(
|
||||
axisDirection: details.direction,
|
||||
child: child,
|
||||
);
|
||||
case AndroidOverscrollIndicator.glow:
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.fuchsia:
|
||||
break;
|
||||
return GlowingOverscrollIndicator(
|
||||
axisDirection: details.direction,
|
||||
color: _kDefaultGlowColor,
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
return GlowingOverscrollIndicator(
|
||||
axisDirection: details.direction,
|
||||
color: _kDefaultGlowColor,
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
|
||||
/// Specifies the type of velocity tracker to use in the descendant
|
||||
|
@ -289,9 +248,7 @@ class _WrappedScrollBehavior implements ScrollBehavior {
|
|||
Set<LogicalKeyboardKey>? pointerAxisModifiers,
|
||||
this.physics,
|
||||
this.platform,
|
||||
AndroidOverscrollIndicator? androidOverscrollIndicator,
|
||||
}) : _androidOverscrollIndicator = androidOverscrollIndicator,
|
||||
_dragDevices = dragDevices,
|
||||
}) : _dragDevices = dragDevices,
|
||||
_pointerAxisModifiers = pointerAxisModifiers;
|
||||
|
||||
final ScrollBehavior delegate;
|
||||
|
@ -301,8 +258,6 @@ class _WrappedScrollBehavior implements ScrollBehavior {
|
|||
final TargetPlatform? platform;
|
||||
final Set<PointerDeviceKind>? _dragDevices;
|
||||
final Set<LogicalKeyboardKey>? _pointerAxisModifiers;
|
||||
@override
|
||||
final AndroidOverscrollIndicator? _androidOverscrollIndicator;
|
||||
|
||||
@override
|
||||
Set<PointerDeviceKind> get dragDevices => _dragDevices ?? delegate.dragDevices;
|
||||
|
@ -310,9 +265,6 @@ class _WrappedScrollBehavior implements ScrollBehavior {
|
|||
@override
|
||||
Set<LogicalKeyboardKey> get pointerAxisModifiers => _pointerAxisModifiers ?? delegate.pointerAxisModifiers;
|
||||
|
||||
@override
|
||||
AndroidOverscrollIndicator get androidOverscrollIndicator => _androidOverscrollIndicator ?? delegate.androidOverscrollIndicator;
|
||||
|
||||
@override
|
||||
Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) {
|
||||
if (overscroll) {
|
||||
|
@ -337,7 +289,6 @@ class _WrappedScrollBehavior implements ScrollBehavior {
|
|||
Set<LogicalKeyboardKey>? pointerAxisModifiers,
|
||||
ScrollPhysics? physics,
|
||||
TargetPlatform? platform,
|
||||
AndroidOverscrollIndicator? androidOverscrollIndicator
|
||||
}) {
|
||||
return delegate.copyWith(
|
||||
scrollbars: scrollbars ?? this.scrollbars,
|
||||
|
@ -346,7 +297,6 @@ class _WrappedScrollBehavior implements ScrollBehavior {
|
|||
pointerAxisModifiers: pointerAxisModifiers ?? this.pointerAxisModifiers,
|
||||
physics: physics ?? this.physics,
|
||||
platform: platform ?? this.platform,
|
||||
androidOverscrollIndicator: androidOverscrollIndicator ?? this.androidOverscrollIndicator,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1299,9 +1299,8 @@ void main() {
|
|||
expect(find.byType(GlowingOverscrollIndicator), findsNothing);
|
||||
}, 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(
|
||||
scrollBehavior: const MaterialScrollBehavior(androidOverscrollIndicator: AndroidOverscrollIndicator.stretch),
|
||||
home: ListView(
|
||||
children: const <Widget>[
|
||||
SizedBox(
|
||||
|
@ -1319,8 +1318,8 @@ void main() {
|
|||
|
||||
testWidgetsWithLeakTracking('Overscroll indicator can be set by theme', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
// The current default is glowing, setting via the theme should override.
|
||||
theme: ThemeData().copyWith(androidOverscrollIndicator: AndroidOverscrollIndicator.stretch),
|
||||
// The current default is M3 and stretch overscroll, setting via the theme should override.
|
||||
theme: ThemeData().copyWith(useMaterial3: false),
|
||||
home: ListView(
|
||||
children: const <Widget>[
|
||||
SizedBox(
|
||||
|
@ -1332,28 +1331,8 @@ void main() {
|
|||
),
|
||||
));
|
||||
|
||||
expect(find.byType(StretchingOverscrollIndicator), findsOneWidget);
|
||||
expect(find.byType(GlowingOverscrollIndicator), 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);
|
||||
expect(find.byType(GlowingOverscrollIndicator), findsOneWidget);
|
||||
expect(find.byType(StretchingOverscrollIndicator), findsNothing);
|
||||
}, variant: TargetPlatformVariant.only(TargetPlatform.android));
|
||||
|
||||
testWidgetsWithLeakTracking('Material3 - ListView clip behavior updates overscroll indicator clip behavior', (WidgetTester tester) async {
|
||||
|
|
|
@ -809,7 +809,6 @@ void main() {
|
|||
toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.black)),
|
||||
tooltipTheme: const TooltipThemeData(height: 100),
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
androidOverscrollIndicator: AndroidOverscrollIndicator.glow,
|
||||
toggleableActiveColor: Colors.black,
|
||||
selectedRowColor: Colors.black,
|
||||
errorColor: Colors.black,
|
||||
|
@ -928,7 +927,6 @@ void main() {
|
|||
tooltipTheme: const TooltipThemeData(height: 100),
|
||||
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
|
||||
toggleableActiveColor: Colors.white,
|
||||
selectedRowColor: Colors.white,
|
||||
errorColor: Colors.white,
|
||||
|
@ -1030,7 +1028,6 @@ void main() {
|
|||
tooltipTheme: otherTheme.tooltipTheme,
|
||||
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
androidOverscrollIndicator: otherTheme.androidOverscrollIndicator,
|
||||
toggleableActiveColor: otherTheme.toggleableActiveColor,
|
||||
selectedRowColor: otherTheme.selectedRowColor,
|
||||
errorColor: otherTheme.errorColor,
|
||||
|
@ -1133,7 +1130,6 @@ void main() {
|
|||
expect(themeDataCopy.tooltipTheme, equals(otherTheme.tooltipTheme));
|
||||
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
expect(themeDataCopy.androidOverscrollIndicator, equals(otherTheme.androidOverscrollIndicator));
|
||||
expect(themeDataCopy.toggleableActiveColor, equals(otherTheme.toggleableActiveColor));
|
||||
expect(themeDataCopy.selectedRowColor, equals(otherTheme.selectedRowColor));
|
||||
expect(themeDataCopy.errorColor, equals(otherTheme.errorColor));
|
||||
|
@ -1267,7 +1263,6 @@ void main() {
|
|||
'toggleButtonsTheme',
|
||||
'tooltipTheme',
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
'androidOverscrollIndicator',
|
||||
'toggleableActiveColor',
|
||||
'selectedRowColor',
|
||||
'errorColor',
|
||||
|
|
|
@ -154,32 +154,6 @@ void main() {
|
|||
expect(find.byType(GlowingOverscrollIndicator), findsOneWidget);
|
||||
}, 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', () {
|
||||
testWidgets('dragDevices', (WidgetTester tester) async {
|
||||
// Regression test for https://github.com/flutter/flutter/issues/91673
|
||||
|
@ -203,22 +177,6 @@ void main() {
|
|||
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 {
|
||||
// Regression test for https://github.com/flutter/flutter/issues/91673
|
||||
late ScrollPhysics defaultPhysics;
|
||||
|
|
Loading…
Reference in a new issue