Skip to content

Commit

Permalink
added contentdxOffset
Browse files Browse the repository at this point in the history
  • Loading branch information
Dzmitry Kasianiuk authored and Dzmitry Kasianiuk committed Nov 27, 2023
1 parent d86ef98 commit eb05616
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/src/popover.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ import 'utils/popover_utils.dart';
/// position on Y axis. It can be positive or negative number.
/// This argument defaults to 0.
///
/// The`contentDxOffset` offsets [Popover]s content
/// position on X axis. It can be positive or negative number.
/// This argument defaults to 0.
///
/// The `barrierDismissible` argument is used to determine whether this route
/// can be dismissed by tapping the modal barrier. This argument defaults
/// to true.
Expand Down Expand Up @@ -88,6 +92,7 @@ Future<T?> showPopover<T extends Object?>({
double arrowDxOffset = 0,
double arrowDyOffset = 0,
double contentDyOffset = 0,
double contentDxOffset = 0,
bool barrierDismissible = true,
double? width,
double? height,
Expand Down Expand Up @@ -131,6 +136,7 @@ Future<T?> showPopover<T extends Object?>({
arrowDxOffset: arrowDxOffset,
arrowDyOffset: arrowDyOffset,
contentDyOffset: contentDyOffset,
contentDxOffset: contentDxOffset,
key: key,
),
);
Expand Down
4 changes: 3 additions & 1 deletion lib/src/popover_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class PopoverItem extends StatefulWidget {
final double arrowDxOffset;
final double arrowDyOffset;
final double contentDyOffset;
final double contentDxOffset;
final PopoverTransition transition;

const PopoverItem({
Expand All @@ -36,6 +37,7 @@ class PopoverItem extends StatefulWidget {
this.arrowDxOffset = 0,
this.arrowDyOffset = 0,
this.contentDyOffset = 0,
this.contentDxOffset = 0,
super.key,
});

Expand Down Expand Up @@ -142,7 +144,7 @@ class _PopoverItemState extends State<PopoverItem> {
_attachRect = Rect.fromLTWH(
offset.dx + (widget.arrowDxOffset),
offset.dy + (widget.arrowDyOffset),
bounds.width,
bounds.width + (widget.contentDxOffset),
bounds.height + (widget.contentDyOffset),
);
}
Expand Down

0 comments on commit eb05616

Please sign in to comment.