Skip to content

Commit

Permalink
fix: 🩹Resolved merge conflict and PR review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Sahil-Simform committed Nov 21, 2024
1 parent b25b793 commit 7f11a09
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 76 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ A Flutter package allows you to Showcase/Highlight your widgets step by step.
## Migration guide for release 4.0.0
Renamed parameters `titleAlignment` to `titleTextAlign` and `descriptionAlignment` to `descriptionTextAlign` to correspond it more with the TextAlign property

Before:
`titleAlignment` and `descriptionAlignment` is used for text alignment, so actual widget alignment
will always be start.

After:
`titleAlignment` and `descriptionAlignment` will be used for widget alignment and for the text
alignment use `titleTextAlign` and `descriptionTextAlign`. Default `titleAlignment`
and `descriptionAlignment` will be center and `titleTextAlign` and `descriptionTextAlign` will be
start.

## Migration guide for release 3.0.0
Removed builder widget from `ShowCaseWidget` and replaced it with builder function

Expand Down
42 changes: 21 additions & 21 deletions lib/src/showcase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ class Showcase extends StatefulWidget {
/// Represents subject line of target widget
final String? title;

/// Title text alignment with in tooltip widget
///
/// Defaults to [TextAlign.start]
/// To understand how text is aligned, check [TextAlign]
final TextAlign titleTextAlign;

/// Represents summary description of target widget
final String? description;

Expand Down Expand Up @@ -178,12 +172,6 @@ class Showcase extends StatefulWidget {
/// Default to [BorderRadius.circular(8)]
final BorderRadius? tooltipBorderRadius;

/// Description text alignment with in tooltip widget
///
/// Defaults to [TextAlign.start]
/// To understand how text is aligned, check [TextAlign]
final TextAlign descriptionTextAlign;

/// if `disableDefaultTargetGestures` parameter is true
/// onTargetClick, onTargetDoubleTap, onTargetLongPress and
/// disposeOnTap parameter will not work
Expand Down Expand Up @@ -257,16 +245,28 @@ class Showcase extends StatefulWidget {
/// Defaults to 7.
final double toolTipSlideEndDistance;

/// Title alignment within tooltip widget
/// Title widget alignment within tooltip widget
///
/// Defaults to [Alignment.center]
final AlignmentGeometry titleAlignment;

/// Description alignment within tooltip widget
/// Title text alignment with in tooltip widget
///
/// Defaults to [TextAlign.start]
/// To understand how text is aligned, check [TextAlign]
final TextAlign titleTextAlign;

/// Description widget alignment within tooltip widget
///
/// Defaults to [Alignment.center]
final AlignmentGeometry descriptionAlignment;

/// Description text alignment with in tooltip widget
///
/// Defaults to [TextAlign.start]
/// To understand how text is aligned, check [TextAlign]
final TextAlign descriptionTextAlign;

/// Defines the margin for the tooltip.
/// Which is from 0 to [toolTipSlideEndDistance].
///
Expand Down Expand Up @@ -413,22 +413,22 @@ class Showcase extends StatefulWidget {
"can't use onBarrierClick & disableBarrierInteraction property at same time");

/// Creates a Showcase widget with a custom tooltip widget.
///
/// This constructor allows you to provide a completely custom widget
/// for the tooltip instead of using the default one with title and
/// description. This gives you more flexibility in designing the
/// appearance and behavior of the tooltip.
///
/// **Required arguments:**
///
/// - `key`: A unique key for this Showcase widget.
/// - `height`: The height of the custom tooltip widget.
/// - `width`: The width of the custom tooltip widget.
/// - `container`: The custom widget to use as the tooltip.
/// - `child`: The widget you want to highlight.
///
/// **Optional arguments:**
///
/// **Highlight:**
/// - `targetShapeBorder`: The border to draw around the showcased widget (defaults to a rounded rectangle).
/// - `targetBorderRadius`: The border radius of the showcased widget.
Expand All @@ -447,19 +447,19 @@ class Showcase extends StatefulWidget {
/// - `tooltipPosition`: The position of the tooltip relative to the showcased widget.
/// - `onBarrierClick`: A callback function called when the user clicks outside the showcase overlay.
/// - `disableBarrierInteraction`: Disables user interaction with the area outside the showcase overlay.
///
/// **Advanced:**
/// - `toolTipSlideEndDistance`: The distance the tooltip slides in from the edge of the screen (defaults to 7dp).
/// - `tooltipActions`: A list of custom actions (widgets) to display within the tooltip.
/// - `tooltipActionConfig`: Configuration options for custom tooltip actions.
///
/// **Differences from default constructor:**
///
/// - This constructor doesn't require `title` or `description` arguments.
/// - By default, the tooltip won't have an arrow pointing to the target widget (`showArrow` is set to `false`).
/// - Default click behavior is disabled (`onToolTipClick` is set to `null`).
/// - Default animation settings are slightly different (e.g., `scaleAnimationCurve` is `Curves.decelerate`).
///
/// **Assertions:**
/// - `overlayOpacity` must be between 0.0 and 1.0.
/// - `onBarrierClick` cannot be used with `disableBarrierInteraction`.
Expand Down
117 changes: 62 additions & 55 deletions lib/src/tooltip_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class ToolTipWidget extends StatefulWidget {
required this.offset,
required this.screenSize,
required this.title,
required this.titleTextAlign,
required this.description,
required this.titleTextStyle,
required this.descTextStyle,
Expand All @@ -87,6 +86,7 @@ class ToolTipWidget extends StatefulWidget {
required this.contentWidth,
required this.onTooltipTap,
required this.movingAnimationDuration,
required this.titleTextAlign,
required this.descriptionTextAlign,
required this.titleAlignment,
required this.descriptionAlignment,
Expand Down Expand Up @@ -556,69 +556,76 @@ class _ToolTipWidgetState extends State<ToolTipWidget>
),
color: widget.tooltipBackgroundColor,
child: Column(
crossAxisAlignment: widget.title != null
? CrossAxisAlignment.start
: CrossAxisAlignment.center,
children: <Widget>[
if (widget.title != null)
Padding(
padding: (widget.titlePadding ??
zeroPadding)
.add(
EdgeInsets.only(
left:
widget.tooltipPadding?.left ??
0,
right: widget
.tooltipPadding?.right ??
0,
Align(
alignment: widget.titleAlignment,
child: Padding(
padding: (widget.titlePadding ??
zeroPadding)
.add(
EdgeInsets.only(
left: widget
.tooltipPadding?.left ??
0,
right: widget.tooltipPadding
?.right ??
0,
),
),
),
child: Text(
widget.title!,
textAlign: widget.titleAlignment,
textDirection:
widget.titleTextDirection,
style: widget.titleTextStyle ??
Theme.of(context)
.textTheme
.titleLarge!
.merge(
TextStyle(
color: widget.textColor,
child: Text(
widget.title!,
textAlign: widget.titleTextAlign,
textDirection:
widget.titleTextDirection,
style: widget.titleTextStyle ??
Theme.of(context)
.textTheme
.titleLarge!
.merge(
TextStyle(
color:
widget.textColor,
),
),
),
),
),
),
if (widget.description != null)
Padding(
padding: (widget.descriptionPadding ??
zeroPadding)
.add(
EdgeInsets.only(
left:
widget.tooltipPadding?.left ??
0,
right: widget
.tooltipPadding?.right ??
0,
Align(
alignment:
widget.descriptionAlignment,
child: Padding(
padding:
(widget.descriptionPadding ??
zeroPadding)
.add(
EdgeInsets.only(
left: widget
.tooltipPadding?.left ??
0,
right: widget.tooltipPadding
?.right ??
0,
),
),
),
child: Text(
widget.description!,
textAlign:
widget.descriptionAlignment,
textDirection:
widget.descriptionTextDirection,
style: widget.descTextStyle ??
Theme.of(context)
.textTheme
.titleSmall!
.merge(
TextStyle(
color: widget.textColor,
child: Text(
widget.description!,
textAlign:
widget.descriptionTextAlign,
textDirection: widget
.descriptionTextDirection,
style: widget.descTextStyle ??
Theme.of(context)
.textTheme
.titleSmall!
.merge(
TextStyle(
color:
widget.textColor,
),
),
),
),
),
),
if (widget.tooltipActions.isNotEmpty &&
Expand Down

0 comments on commit 7f11a09

Please sign in to comment.