Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add backdrop #57

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/src/just_the_tooltip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -76,6 +77,9 @@ class JustTheTooltip extends StatefulWidget implements JustTheInterface {
@override
final bool isModal;

@override
final bool hasBackdrop;

@override
final Duration? waitDuration;

Expand Down Expand Up @@ -638,13 +642,20 @@ abstract class JustTheTooltipState<T> extends State<JustTheInterface>
);
}

Widget _createBackdrop() {
return Container(
color: Colors.black.withOpacity(0.3),
);
}

Widget _createSkrim() {
return GestureDetector(
key: skrimKey,
behavior: barrierDismissible
? HitTestBehavior.translucent
: HitTestBehavior.deferToChild,
onTap: _hideTooltip,
child: widget.hasBackdrop ? _createBackdrop() : null,
);
}

Expand Down
4 changes: 4 additions & 0 deletions lib/src/just_the_tooltip_entry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -59,6 +60,9 @@ class JustTheTooltipEntry extends StatefulWidget implements JustTheInterface {
@override
final bool isModal;

@override
final bool hasBackdrop;

@override
final Duration? waitDuration;

Expand Down
3 changes: 3 additions & 0 deletions lib/src/models/just_the_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down