@@ -33,8 +33,8 @@ import 'models/tooltip_action_button.dart';
33
33
import 'models/tooltip_action_config.dart' ;
34
34
import 'shape_clipper.dart' ;
35
35
import 'showcase_widget.dart' ;
36
+ import 'tooltip/tooltip.dart' ;
36
37
import 'tooltip_action_button_widget.dart' ;
37
- import 'tooltip_widget.dart' ;
38
38
import 'widget/floating_action_widget.dart' ;
39
39
40
40
class Showcase extends StatefulWidget {
@@ -272,8 +272,8 @@ class Showcase extends StatefulWidget {
272
272
/// To understand how text is aligned, check [TextAlign]
273
273
final TextAlign descriptionTextAlign;
274
274
275
- /// Defines the margin for the tooltip.
276
- /// Which is from 0 to [toolTipSlideEndDistance] .
275
+ /// Defines the margin from the screen edge for the tooltip.
276
+ /// ToolTip will try to not cross this border around the screen
277
277
///
278
278
/// Defaults to 14.
279
279
final double toolTipMargin;
@@ -357,7 +357,7 @@ class Showcase extends StatefulWidget {
357
357
/// - `blurValue` : The amount of background blur applied during the showcase.
358
358
/// - `tooltipPosition` : The position of the tooltip relative to the showcased widget.
359
359
/// - `toolTipSlideEndDistance` : The distance the tooltip slides in from the edge of the screen (defaults to 7dp).
360
- /// - `toolTipMargin` : The margin around the tooltip (defaults to 14dp).
360
+ /// - `toolTipMargin` : The margin around the screen which tooltip try not to cross (defaults to 14dp).
361
361
/// - `tooltipActions` : A list of custom actions (widgets) to display within the tooltip.
362
362
/// - `tooltipActionConfig` : Configuration options for custom tooltip actions.
363
363
/// - `scrollAlignment` : Defines the alignment for the auto scroll function.
@@ -424,14 +424,22 @@ class Showcase extends StatefulWidget {
424
424
}) : height = null ,
425
425
width = null ,
426
426
container = null ,
427
- assert (overlayOpacity >= 0.0 && overlayOpacity <= 1.0 ,
428
- "overlay opacity must be between 0 and 1." ),
429
- assert (onTargetClick == null || disposeOnTap != null ,
430
- "disposeOnTap is required if you're using onTargetClick" ),
431
- assert (disposeOnTap == null || onTargetClick != null ,
432
- "onTargetClick is required if you're using disposeOnTap" ),
433
- assert (onBarrierClick == null || disableBarrierInteraction == false ,
434
- "can't use onBarrierClick & disableBarrierInteraction property at same time" );
427
+ assert (
428
+ overlayOpacity >= 0.0 && overlayOpacity <= 1.0 ,
429
+ "overlay opacity must be between 0 and 1." ,
430
+ ),
431
+ assert (
432
+ onTargetClick == null || disposeOnTap != null ,
433
+ "disposeOnTap is required if you're using onTargetClick" ,
434
+ ),
435
+ assert (
436
+ disposeOnTap == null || onTargetClick != null ,
437
+ "onTargetClick is required if you're using disposeOnTap" ,
438
+ ),
439
+ assert (
440
+ onBarrierClick == null || disableBarrierInteraction == false ,
441
+ "can't use onBarrierClick & disableBarrierInteraction property at same time" ,
442
+ );
435
443
436
444
/// Creates a Showcase widget with a custom tooltip widget.
437
445
///
@@ -501,7 +509,8 @@ class Showcase extends StatefulWidget {
501
509
this .targetBorderRadius,
502
510
this .overlayOpacity = 0.75 ,
503
511
this .scrollLoadingWidget = const CircularProgressIndicator (
504
- valueColor: AlwaysStoppedAnimation (Colors .white)),
512
+ valueColor: AlwaysStoppedAnimation (Colors .white),
513
+ ),
505
514
this .onTargetClick,
506
515
this .disposeOnTap,
507
516
this .movingAnimationDuration = const Duration (milliseconds: 2000 ),
@@ -542,10 +551,14 @@ class Showcase extends StatefulWidget {
542
551
titleTextDirection = null ,
543
552
descriptionTextDirection = null ,
544
553
toolTipMargin = 14 ,
545
- assert (overlayOpacity >= 0.0 && overlayOpacity <= 1.0 ,
546
- "overlay opacity must be between 0 and 1." ),
547
- assert (onBarrierClick == null || disableBarrierInteraction == false ,
548
- "can't use onBarrierClick & disableBarrierInteraction property at same time" );
554
+ assert (
555
+ overlayOpacity >= 0.0 && overlayOpacity <= 1.0 ,
556
+ "overlay opacity must be between 0 and 1." ,
557
+ ),
558
+ assert (
559
+ onBarrierClick == null || disableBarrierInteraction == false ,
560
+ "can't use onBarrierClick & disableBarrierInteraction property at same time" ,
561
+ );
549
562
550
563
@override
551
564
State <Showcase > createState () => _ShowcaseState ();
@@ -606,8 +619,9 @@ class _ShowcaseState extends State<Showcase> {
606
619
607
620
if (showCaseWidgetState.autoPlay) {
608
621
timer = Timer (
609
- Duration (seconds: showCaseWidgetState.autoPlayDelay.inSeconds),
610
- _nextIfAny);
622
+ Duration (seconds: showCaseWidgetState.autoPlayDelay.inSeconds),
623
+ _nextIfAny,
624
+ );
611
625
}
612
626
} else if (timer? .isActive ?? false ) {
613
627
timer? .cancel ();
@@ -770,6 +784,9 @@ class _ShowcaseState extends State<Showcase> {
770
784
height: mediaQuerySize.height,
771
785
decoration: BoxDecoration (
772
786
color: widget.overlayColor
787
+
788
+ //TODO: Update when we remove support for older version
789
+ //ignore: deprecated_member_use
773
790
.withOpacity (widget.overlayOpacity),
774
791
),
775
792
),
@@ -779,6 +796,8 @@ class _ShowcaseState extends State<Showcase> {
779
796
height: mediaQuerySize.height,
780
797
decoration: BoxDecoration (
781
798
color: widget.overlayColor
799
+ //TODO: Update when we remove support for older version
800
+ //ignore: deprecated_member_use
782
801
.withOpacity (widget.overlayOpacity),
783
802
),
784
803
),
@@ -799,8 +818,6 @@ class _ShowcaseState extends State<Showcase> {
799
818
),
800
819
ToolTipWidget (
801
820
position: position,
802
- offset: offset,
803
- screenSize: screenSize,
804
821
title: widget.title,
805
822
titleTextAlign: widget.titleTextAlign,
806
823
description: widget.description,
@@ -810,22 +827,19 @@ class _ShowcaseState extends State<Showcase> {
810
827
titleTextStyle: widget.titleTextStyle,
811
828
descTextStyle: widget.descTextStyle,
812
829
container: widget.container,
813
- floatingActionWidget:
814
- widget.floatingActionWidget ?? _globalFloatingActionWidget,
815
830
tooltipBackgroundColor: widget.tooltipBackgroundColor,
816
831
textColor: widget.textColor,
817
832
showArrow: widget.showArrow,
818
- contentHeight: widget.height,
819
- contentWidth: widget.width,
820
833
onTooltipTap:
821
834
widget.disposeOnTap == true || widget.onToolTipClick != null
822
835
? _getOnTooltipTap
823
836
: null ,
824
837
tooltipPadding: widget.tooltipPadding,
825
838
disableMovingAnimation: widget.disableMovingAnimation ??
826
839
showCaseWidgetState.disableMovingAnimation,
827
- disableScaleAnimation: widget.disableScaleAnimation ??
828
- showCaseWidgetState.disableScaleAnimation,
840
+ disableScaleAnimation: (widget.disableScaleAnimation ??
841
+ showCaseWidgetState.disableScaleAnimation) ||
842
+ widget.container != null ,
829
843
movingAnimationDuration: widget.movingAnimationDuration,
830
844
tooltipBorderRadius: widget.tooltipBorderRadius,
831
845
scaleAnimationDuration: widget.scaleAnimationDuration,
@@ -841,12 +855,17 @@ class _ShowcaseState extends State<Showcase> {
841
855
toolTipMargin: widget.toolTipMargin,
842
856
tooltipActionConfig: _getTooltipActionConfig (),
843
857
tooltipActions: _getTooltipActions (),
858
+ targetPadding: widget.targetPadding,
844
859
),
860
+ if (_getFloatingActionWidget != null ) _getFloatingActionWidget! ,
845
861
],
846
862
],
847
863
);
848
864
}
849
865
866
+ Widget ? get _getFloatingActionWidget =>
867
+ widget.floatingActionWidget ?? _globalFloatingActionWidget;
868
+
850
869
List <Widget > _getTooltipActions () {
851
870
final actionData = (widget.tooltipActions? .isNotEmpty ?? false )
852
871
? widget.tooltipActions!
0 commit comments