diff --git a/.gitignore b/.gitignore index 6434e88c..21a44655 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,6 @@ ios/Runner.xcworkspace/xcshareddata/ example/ios/Flutter/flutter_export_environment.sh flutter_showcaseview.iml pubspec.lock + +# FVM Version Cache +.fvm/ \ No newline at end of file diff --git a/lib/showcaseview.dart b/lib/showcaseview.dart index 7aa3951a..5311fa52 100644 --- a/lib/showcaseview.dart +++ b/lib/showcaseview.dart @@ -25,6 +25,7 @@ library showcaseview; export 'src/models/action_button_icon.dart'; export 'src/models/tooltip_action_button.dart'; export 'src/models/tooltip_action_config.dart'; +export 'src/models/showcase_changed_state.dart'; export 'src/showcase/showcase.dart'; export 'src/showcase/showcase_view.dart'; export 'src/showcase_widget.dart'; diff --git a/lib/src/models/showcase_changed_state.dart b/lib/src/models/showcase_changed_state.dart new file mode 100644 index 00000000..7c59d577 --- /dev/null +++ b/lib/src/models/showcase_changed_state.dart @@ -0,0 +1,9 @@ +class ShowcaseChangedState { + final int index; + final int total; + + const ShowcaseChangedState({ + required this.index, + required this.total, + }); +} diff --git a/lib/src/showcase/showcase.dart b/lib/src/showcase/showcase.dart index b836ee39..087da616 100644 --- a/lib/src/showcase/showcase.dart +++ b/lib/src/showcase/showcase.dart @@ -173,6 +173,8 @@ class Showcase extends StatefulWidget { /// ``` const Showcase.withWidget({ required GlobalKey key, + this.height, + this.width, required this.container, required this.child, this.floatingActionWidget, @@ -201,8 +203,8 @@ class Showcase extends StatefulWidget { this.enableAutoScroll, this.toolTipMargin = 14, this.targetTooltipGap = 10, - }) : showArrow = false, - onToolTipClick = null, + this.showArrow = true, + }) : onToolTipClick = null, scaleAnimationDuration = const Duration(milliseconds: 300), scaleAnimationCurve = Curves.decelerate, scaleAnimationAlignment = null, diff --git a/lib/src/showcase/showcase_view.dart b/lib/src/showcase/showcase_view.dart index 1c1ce383..9101d0ad 100644 --- a/lib/src/showcase/showcase_view.dart +++ b/lib/src/showcase/showcase_view.dart @@ -24,6 +24,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import '../../showcaseview.dart'; import '../models/tooltip_action_button.dart'; import '../models/tooltip_action_config.dart'; import '../utils/constants.dart'; @@ -211,6 +212,10 @@ class ShowcaseView { []; } + final _onShowcaseChanged = ValueNotifier( + const ShowcaseChangedState(index: 0, total: 0), + ); + /// Starts showcase with given widget ids after the optional delay. /// /// * [widgetIds] - List of GlobalKeys for widgets to showcase @@ -350,6 +355,10 @@ class ShowcaseView { if (delay == Duration.zero) { _ids = widgetIds; _activeWidgetId = 0; + _onShowcaseChanged.value = ShowcaseChangedState( + total: widgetIds.length, + index: 0, + ); _onStart(); OverlayManager.instance.update(show: isShowcaseRunning, scope: scope); } else { @@ -376,6 +385,12 @@ class ShowcaseView { // Update active widget ID before starting the next showcase _activeWidgetId = id; + // Update value onShowcaseChanged + onShowcaseChanged.value = ShowcaseChangedState( + total: _ids?.length ?? 0, + index: id, + ); + if (_activeWidgetId! >= _ids!.length) { _cleanupAfterSteps(); onFinish?.call(); @@ -510,6 +525,9 @@ class ShowcaseView { OverlayManager.instance.update(show: isShowcaseRunning, scope: scope); } + ValueNotifier get onShowcaseChanged => + _onShowcaseChanged; + @override bool operator ==(Object other) { if (identical(this, other)) return true; diff --git a/lib/src/showcase/target_widget.dart b/lib/src/showcase/target_widget.dart index 4d8be894..05023d17 100644 --- a/lib/src/showcase/target_widget.dart +++ b/lib/src/showcase/target_widget.dart @@ -95,7 +95,7 @@ class TargetWidget extends StatelessWidget { top: offset.dy - targetPadding.top, left: offset.dx - targetPadding.left, child: disableDefaultChildGestures - ? IgnorePointer(child: targetWidgetContent) + ? AbsorbPointer(child: targetWidgetContent) : MouseRegion( cursor: SystemMouseCursors.click, child: targetWidgetContent,