Skip to content

Commit

Permalink
add y offset at target focus
Browse files Browse the repository at this point in the history
  • Loading branch information
syaiful-aa committed Sep 25, 2023
1 parent ba344d1 commit b8c2b45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/src/target/target_focus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class TargetFocus {
this.focusAnimationDuration,
this.unFocusAnimationDuration,
this.pulseVariation,
this.yOffset = 0,
}) : assert(keyTarget != null || targetPosition != null);

final dynamic identify;
Expand All @@ -37,6 +38,7 @@ class TargetFocus {
final Duration? focusAnimationDuration;
final Duration? unFocusAnimationDuration;
final Tween<double>? pulseVariation;
final double yOffset;

@override
String toString() {
Expand Down
5 changes: 3 additions & 2 deletions lib/src/widgets/tutorial_coach_mark_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,15 @@ class TutorialCoachMarkWidgetState extends State<TutorialCoachMarkWidget>
double? bottom;
double? left;
double? right;
final double yOffset = currentTarget?.yOffset ?? 0;

children = currentTarget!.contents!.map<Widget>((i) {
switch (i.align) {
case ContentAlign.bottom:
{
weight = MediaQuery.of(context).size.width;
left = 0;
top = positioned.dy + haloHeight;
top = positioned.dy + haloHeight + yOffset;
bottom = null;
}
break;
Expand All @@ -188,7 +189,7 @@ class TutorialCoachMarkWidgetState extends State<TutorialCoachMarkWidget>
left = 0;
top = null;
bottom = haloHeight +
(MediaQuery.of(context).size.height - positioned.dy);
(MediaQuery.of(context).size.height - positioned.dy - yOffset);
}
break;
case ContentAlign.left:
Expand Down

0 comments on commit b8c2b45

Please sign in to comment.