From eb056162c996f0b56e3e4ed466354e660cb2a929 Mon Sep 17 00:00:00 2001 From: Dzmitry Kasianiuk Date: Mon, 27 Nov 2023 11:06:36 +0300 Subject: [PATCH] added contentdxOffset --- lib/src/popover.dart | 6 ++++++ lib/src/popover_item.dart | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/src/popover.dart b/lib/src/popover.dart index db6ec2c..b634269 100644 --- a/lib/src/popover.dart +++ b/lib/src/popover.dart @@ -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. @@ -88,6 +92,7 @@ Future showPopover({ double arrowDxOffset = 0, double arrowDyOffset = 0, double contentDyOffset = 0, + double contentDxOffset = 0, bool barrierDismissible = true, double? width, double? height, @@ -131,6 +136,7 @@ Future showPopover({ arrowDxOffset: arrowDxOffset, arrowDyOffset: arrowDyOffset, contentDyOffset: contentDyOffset, + contentDxOffset: contentDxOffset, key: key, ), ); diff --git a/lib/src/popover_item.dart b/lib/src/popover_item.dart index 6791732..fe8fab8 100644 --- a/lib/src/popover_item.dart +++ b/lib/src/popover_item.dart @@ -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({ @@ -36,6 +37,7 @@ class PopoverItem extends StatefulWidget { this.arrowDxOffset = 0, this.arrowDyOffset = 0, this.contentDyOffset = 0, + this.contentDxOffset = 0, super.key, }); @@ -142,7 +144,7 @@ class _PopoverItemState extends State { _attachRect = Rect.fromLTWH( offset.dx + (widget.arrowDxOffset), offset.dy + (widget.arrowDyOffset), - bounds.width, + bounds.width + (widget.contentDxOffset), bounds.height + (widget.contentDyOffset), ); }