Skip to content

Commit 9a94177

Browse files
committed
fix: 🔨Fixed PR comments
1 parent 1aa080d commit 9a94177

File tree

5 files changed

+212
-186
lines changed

5 files changed

+212
-186
lines changed

lib/src/constants.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'package:flutter/material.dart';
22

3-
import 'widget/showcase_circular_progress_indecator.dart';
3+
import 'widget/showcase_circular_progress_indicator.dart';
44

55
class Constants {
66
Constants._();

lib/src/showcase/showcase.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,8 @@ class Showcase extends StatefulWidget {
559559
class _ShowcaseState extends State<Showcase> {
560560
ShowcaseController get _controller =>
561561
_showCaseWidgetState.getControllerForShowcase(
562-
widget.showcaseKey,
563-
_uniqueId,
562+
key: widget.showcaseKey,
563+
showcaseId: _uniqueId,
564564
);
565565

566566
late var _showCaseWidgetState = ShowCaseWidget.of(context);

lib/src/showcase/showcase_controller.dart

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)