@@ -283,40 +283,33 @@ class ShowcaseController {
283283 ///
284284 /// @return List of tooltip action widgets
285285 List <Widget > _getTooltipActions () {
286- final actionData = (config.tooltipActions? .isNotEmpty ?? false )
286+ final doesHaveLocalActions = config.tooltipActions? .isNotEmpty ?? false ;
287+ final actionData = doesHaveLocalActions
287288 ? config.tooltipActions!
288289 : showCaseWidgetState.globalTooltipActions ?? [];
289-
290- final actionWidgets = < Widget > [];
291290 final actionDataLength = actionData.length;
292- for (var i = 0 ; i < actionDataLength; i++ ) {
293- final action = actionData[i];
294-
295- // Skip actions that should be hidden for this specific showcase key
296- // when no local actions are defined (using global actions)
297- if (action.hideActionWidgetForShowcase.contains (config.showcaseKey) &&
298- (config.tooltipActions? .isEmpty ?? true )) {
299- continue ;
300- }
301-
302- actionWidgets.add (
303- Padding (
304- padding: EdgeInsetsDirectional .only (
305- end: action == actionData.last
306- ? 0
307- : _getTooltipActionConfig ().actionGap,
308- ),
309- child: TooltipActionButtonWidget (
310- config: action,
311- // We have to pass showcaseState from here because
312- // [TooltipActionButtonWidget] is not direct child of showcaseWidget
313- // so it won't be able to get the state by using it's context
314- showCaseState: showCaseWidgetState,
291+
292+ return [
293+ for (var i = 0 ; i < actionDataLength; i++ )
294+ if (doesHaveLocalActions ||
295+ ! actionData[i]
296+ .hideActionWidgetForShowcase
297+ .contains (config.showcaseKey))
298+ Padding (
299+ padding: EdgeInsetsDirectional .only (
300+ end: actionData[i] == actionData.last
301+ ? 0
302+ : _getTooltipActionConfig ().actionGap,
303+ ),
304+ child: TooltipActionButtonWidget (
305+ config: actionData[i],
306+ // We have to pass showcaseState from here because
307+ // [TooltipActionButtonWidget] is not direct child of showcaseWidget
308+ // so it won't be able to get the state by using it's context
309+ showCaseState: showCaseWidgetState,
310+ ),
315311 ),
316- ),
317- );
318- }
319- return actionWidgets;
312+ ];
320313 }
321314
322315 /// Gets the tooltip action configuration
0 commit comments