Skip to content

Commit d641d89

Browse files
committed
Fix button transformer being invisible due to Node Enabling features colliding with it.
1 parent 985d1a6 commit d641d89

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

lib/src/transformers/node_transformers/passive_button_transformer.dart

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,12 @@ class PassiveButtonWidget extends StatelessWidget {
145145
switch (node.properties.buttonType) {
146146
case ButtonTypeEnum.elevated:
147147
buttonWidget = ElevatedButton(
148-
onPressed: enabled ? () => onPressed?.call(context) : null,
149-
onLongPress: enabled ? () => onLongPress?.call(context) : null,
148+
onPressed: enabled && onPressed != null
149+
? () => onPressed?.call(context)
150+
: null,
151+
onLongPress: enabled && onLongPress != null
152+
? () => onLongPress?.call(context)
153+
: null,
150154
style: buttonStyle,
151155
child: iconWidget != null
152156
? Row(
@@ -171,8 +175,12 @@ class PassiveButtonWidget extends StatelessWidget {
171175
);
172176
case ButtonTypeEnum.text:
173177
buttonWidget = TextButton(
174-
onPressed: () => onPressed?.call(context),
175-
onLongPress: () => onLongPress?.call(context),
178+
onPressed: enabled && onPressed != null
179+
? () => onPressed?.call(context)
180+
: null,
181+
onLongPress: enabled && onLongPress != null
182+
? () => onLongPress?.call(context)
183+
: null,
176184
style: buttonStyle,
177185
child: iconWidget != null
178186
? Row(
@@ -195,8 +203,12 @@ class PassiveButtonWidget extends StatelessWidget {
195203
);
196204
case ButtonTypeEnum.outlined:
197205
buttonWidget = OutlinedButton(
198-
onPressed: enabled ? () => onPressed?.call(context) : null,
199-
onLongPress: enabled ? () => onLongPress?.call(context) : null,
206+
onPressed: enabled && onPressed != null
207+
? () => onPressed?.call(context)
208+
: null,
209+
onLongPress: enabled && onLongPress != null
210+
? () => onLongPress?.call(context)
211+
: null,
200212
style: buttonStyle,
201213
child: iconWidget != null
202214
? Row(
@@ -222,7 +234,12 @@ class PassiveButtonWidget extends StatelessWidget {
222234
style: buttonStyle.copyWith(
223235
textStyle: WidgetStateProperty.all(const TextStyle()),
224236
),
225-
onPressed: enabled ? () => onPressed?.call(context) : null,
237+
onPressed: enabled && onPressed != null
238+
? () => onPressed?.call(context)
239+
: null,
240+
onLongPress: enabled && onLongPress != null
241+
? () => onLongPress?.call(context)
242+
: null,
226243
child: iconWidget,
227244
);
228245
}

lib/src/transformers/passive_transformer_manager.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class PassiveNodeTransformerManager extends WidgetNodeTransformerManager {
124124
}) {
125125
final bool enabled = PropertyValueDelegate.getPropertyValue<bool>(
126126
node,
127-
'enabled',
127+
'node_enabled',
128128
scopedValues: ScopedValues.of(context),
129129
) ??
130130
node.enabled;

0 commit comments

Comments
 (0)