@@ -118,21 +118,33 @@ abstract class WidgetNodeTransformerManager extends NodeTransformerManager<
118
118
/// Convenience method to handle widget reactions.
119
119
Widget wrapWithReaction (BuildContext context, BaseNode node, Widget widget) {
120
120
if (node is ! ReactionMixin ) return widget;
121
- if (node is ! BlendMixin ) return widget;
122
121
if (node case CanvasNode () || SpacerNode ()) return widget;
123
- if (node is CustomPropertiesMixin && node is ! IconNode ) return widget;
124
- final InkWellModel ? inkWell = node.inkWell;
122
+ if (node is CustomPropertiesMixin &&
123
+ node.handlesDefaultReactionsInternally) {
124
+ // Node is a custom properties mixin and intends to handle reactions
125
+ // internally, even default ones. So, we don't need to wrap it with
126
+ // reactions.
127
+ return widget;
128
+ }
129
+ final InkWellModel ? inkWell = node is BlendMixin ? node.inkWell : null ;
125
130
131
+ // Due to the way inkwell works internally, it is handled by
132
+ // the individual node transformers internally if it is default shape mixin
133
+ // because then it has fills that obscure the inkwell effect.
126
134
if (node is DefaultShapeNode && inkWell != null ) return widget;
127
135
128
136
final List <Reaction > onClickReactions = (node as ReactionMixin )
129
137
.reactions
130
- .where ((reaction) => reaction.trigger.type == TriggerType .click)
138
+ .where ((reaction) =>
139
+ reaction.trigger.type == TriggerType .click &&
140
+ reaction.action.enabled)
131
141
.toList ();
132
142
133
143
final List <Reaction > onLongPressReactions = (node as ReactionMixin )
134
144
.reactions
135
- .where ((reaction) => reaction.trigger.type == TriggerType .longPress)
145
+ .where ((reaction) =>
146
+ reaction.trigger.type == TriggerType .longPress &&
147
+ reaction.action.enabled)
136
148
.toList ();
137
149
138
150
if (inkWell != null ) {
@@ -151,9 +163,8 @@ abstract class WidgetNodeTransformerManager extends NodeTransformerManager<
151
163
),
152
164
borderRadius: getBorderRadius (node),
153
165
overlayColor: inkWell.overlayColor != null
154
- ? MaterialStatePropertyAll <Color >(
155
- inkWell.overlayColor! .toFlutterColor (),
156
- )
166
+ ? WidgetStatePropertyAll <Color >(
167
+ inkWell.overlayColor! .toFlutterColor ())
157
168
: null ,
158
169
splashColor: inkWell.splashColor? .toFlutterColor (),
159
170
highlightColor: inkWell.highlightColor? .toFlutterColor (),
@@ -163,12 +174,15 @@ abstract class WidgetNodeTransformerManager extends NodeTransformerManager<
163
174
),
164
175
);
165
176
} else {
166
- if ((node as ReactionMixin ).reactions .isEmpty) {
177
+ if (onClickReactions.isEmpty && onLongPressReactions .isEmpty) {
167
178
return widget;
168
179
}
180
+ // TODO: should handle TriggerType.hover and TriggerType.unhover too.
169
181
return MouseRegion (
170
182
cursor: SystemMouseCursors .click,
183
+ hitTestBehavior: HitTestBehavior .opaque,
171
184
child: GestureDetector (
185
+ behavior: HitTestBehavior .opaque,
172
186
onTap: () => FunctionsRepository .triggerAction (
173
187
context,
174
188
TriggerType .click,
0 commit comments