diff --git a/lib/src/just_the_tooltip.dart b/lib/src/just_the_tooltip.dart index bb7c22b..327c4d5 100644 --- a/lib/src/just_the_tooltip.dart +++ b/lib/src/just_the_tooltip.dart @@ -31,6 +31,7 @@ class JustTheTooltip extends StatefulWidget implements JustTheInterface { // the tooltip open. But in that case, it seems like we can create a new // more narrow field in favor. this.isModal = false, + this.hasBackdrop = false, this.waitDuration, this.showDuration, this.triggerMode, @@ -76,6 +77,9 @@ class JustTheTooltip extends StatefulWidget implements JustTheInterface { @override final bool isModal; + @override + final bool hasBackdrop; + @override final Duration? waitDuration; @@ -638,6 +642,12 @@ abstract class JustTheTooltipState extends State ); } + Widget _createBackdrop() { + return Container( + color: Colors.black.withOpacity(0.3), + ); + } + Widget _createSkrim() { return GestureDetector( key: skrimKey, @@ -645,6 +655,7 @@ abstract class JustTheTooltipState extends State ? HitTestBehavior.translucent : HitTestBehavior.deferToChild, onTap: _hideTooltip, + child: widget.hasBackdrop ? _createBackdrop() : null, ); } diff --git a/lib/src/just_the_tooltip_entry.dart b/lib/src/just_the_tooltip_entry.dart index 4c9d535..68d7597 100644 --- a/lib/src/just_the_tooltip_entry.dart +++ b/lib/src/just_the_tooltip_entry.dart @@ -14,6 +14,7 @@ class JustTheTooltipEntry extends StatefulWidget implements JustTheInterface { this.onShow, this.controller, this.isModal = false, + this.hasBackdrop = false, this.waitDuration, this.showDuration, this.triggerMode, @@ -59,6 +60,9 @@ class JustTheTooltipEntry extends StatefulWidget implements JustTheInterface { @override final bool isModal; + @override + final bool hasBackdrop; + @override final Duration? waitDuration; diff --git a/lib/src/models/just_the_interface.dart b/lib/src/models/just_the_interface.dart index 71a84b8..036310c 100644 --- a/lib/src/models/just_the_interface.dart +++ b/lib/src/models/just_the_interface.dart @@ -107,6 +107,9 @@ abstract class JustTheInterface extends StatefulWidget { /// `scrim` is clicked or it is forcibly closed bool get isModal; + /// If true, once the tooltip is opened, render the backdrop + bool get hasBackdrop; + /// The length of time that a pointer must hover over a tooltip's widget /// before the tooltip will be shown. ///