Fix: The enableFeedback property of InkWell cannot be set to a nullab… (#158907)

*I found that enableFeedback can be set to null, but in actual use,
setting it to null has no effect and is overwritten by true. I think
this is an issue.*


```dart
class InkWell extends InkResponse {
  const InkWell({
    super.key,
    super.child,
    super.onTap,
    super.onDoubleTap,
    super.onLongPress,
    super.onTapDown,
    super.onTapUp,
    super.onTapCancel,
    super.onSecondaryTap,
    super.onSecondaryTapUp,
    super.onSecondaryTapDown,
    super.onSecondaryTapCancel,
    super.onHighlightChanged,
    super.onHover,
    super.mouseCursor,
    super.focusColor,
    super.hoverColor,
    super.highlightColor,
    super.overlayColor,
    super.splashColor,
    super.splashFactory,
    super.radius,
    super.borderRadius,
    super.customBorder,
    bool? enableFeedback = true,
    super.excludeFromSemantics,
    super.focusNode,
    super.canRequestFocus,
    super.onFocusChange,
    super.autofocus,
    super.statesController,
    super.hoverDuration,
  }) : super(
    containedInkWell: true,
    highlightShape: BoxShape.rectangle,
    enableFeedback: enableFeedback ?? true,
  );
}
```

Call Error
```dart
InkWell(
    enableFeedback: null,
)
```
This commit is contained in:
StanleyCocos 2024-11-21 03:23:24 +08:00 committed by GitHub
parent 1894436ec3
commit 3f1ea760e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View File

@ -407,7 +407,7 @@ class _ButtonStyleState extends State<ButtonStyleButton> with TickerProviderStat
final VisualDensity? resolvedVisualDensity = effectiveValue((ButtonStyle? style) => style?.visualDensity);
final MaterialTapTargetSize? resolvedTapTargetSize = effectiveValue((ButtonStyle? style) => style?.tapTargetSize);
final Duration? resolvedAnimationDuration = effectiveValue((ButtonStyle? style) => style?.animationDuration);
final bool? resolvedEnableFeedback = effectiveValue((ButtonStyle? style) => style?.enableFeedback);
final bool resolvedEnableFeedback = effectiveValue((ButtonStyle? style) => style?.enableFeedback) ?? true;
final AlignmentGeometry? resolvedAlignment = effectiveValue((ButtonStyle? style) => style?.alignment);
final Offset densityAdjustment = resolvedVisualDensity!.baseSizeAdjustment;
final InteractiveInkFeatureFactory? resolvedSplashFactory = effectiveValue((ButtonStyle? style) => style?.splashFactory);

View File

@ -1462,7 +1462,7 @@ class InkWell extends InkResponse {
super.radius,
super.borderRadius,
super.customBorder,
bool? enableFeedback = true,
super.enableFeedback,
super.excludeFromSemantics,
super.focusNode,
super.canRequestFocus,
@ -1473,6 +1473,5 @@ class InkWell extends InkResponse {
}) : super(
containedInkWell: true,
highlightShape: BoxShape.rectangle,
enableFeedback: enableFeedback ?? true,
);
}