From 3f1ea760e8fe08284947ef7eb3eaafdefc12f4b0 Mon Sep 17 00:00:00 2001 From: StanleyCocos Date: Thu, 21 Nov 2024 03:23:24 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20The=20enableFeedback=20property=20of=20I?= =?UTF-8?q?nkWell=20cannot=20be=20set=20to=20a=20nullab=E2=80=A6=20(#15890?= =?UTF-8?q?7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit *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, ) ``` --- packages/flutter/lib/src/material/button_style_button.dart | 2 +- packages/flutter/lib/src/material/ink_well.dart | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/flutter/lib/src/material/button_style_button.dart b/packages/flutter/lib/src/material/button_style_button.dart index 74cf34c3f6..3684e13dd2 100644 --- a/packages/flutter/lib/src/material/button_style_button.dart +++ b/packages/flutter/lib/src/material/button_style_button.dart @@ -407,7 +407,7 @@ class _ButtonStyleState extends State 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); diff --git a/packages/flutter/lib/src/material/ink_well.dart b/packages/flutter/lib/src/material/ink_well.dart index 6a0e37cab5..831776bdfb 100644 --- a/packages/flutter/lib/src/material/ink_well.dart +++ b/packages/flutter/lib/src/material/ink_well.dart @@ -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, ); }