Skip to content

Commit 7f11a09

Browse files
committed
fix: 🩹Resolved merge conflict and PR review comments
1 parent b25b793 commit 7f11a09

File tree

3 files changed

+93
-76
lines changed

3 files changed

+93
-76
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ A Flutter package allows you to Showcase/Highlight your widgets step by step.
1414
## Migration guide for release 4.0.0
1515
Renamed parameters `titleAlignment` to `titleTextAlign` and `descriptionAlignment` to `descriptionTextAlign` to correspond it more with the TextAlign property
1616

17+
Before:
18+
`titleAlignment` and `descriptionAlignment` is used for text alignment, so actual widget alignment
19+
will always be start.
20+
21+
After:
22+
`titleAlignment` and `descriptionAlignment` will be used for widget alignment and for the text
23+
alignment use `titleTextAlign` and `descriptionTextAlign`. Default `titleAlignment`
24+
and `descriptionAlignment` will be center and `titleTextAlign` and `descriptionTextAlign` will be
25+
start.
26+
1727
## Migration guide for release 3.0.0
1828
Removed builder widget from `ShowCaseWidget` and replaced it with builder function
1929

lib/src/showcase.dart

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ class Showcase extends StatefulWidget {
5151
/// Represents subject line of target widget
5252
final String? title;
5353

54-
/// Title text alignment with in tooltip widget
55-
///
56-
/// Defaults to [TextAlign.start]
57-
/// To understand how text is aligned, check [TextAlign]
58-
final TextAlign titleTextAlign;
59-
6054
/// Represents summary description of target widget
6155
final String? description;
6256

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

181-
/// Description text alignment with in tooltip widget
182-
///
183-
/// Defaults to [TextAlign.start]
184-
/// To understand how text is aligned, check [TextAlign]
185-
final TextAlign descriptionTextAlign;
186-
187175
/// if `disableDefaultTargetGestures` parameter is true
188176
/// onTargetClick, onTargetDoubleTap, onTargetLongPress and
189177
/// disposeOnTap parameter will not work
@@ -257,16 +245,28 @@ class Showcase extends StatefulWidget {
257245
/// Defaults to 7.
258246
final double toolTipSlideEndDistance;
259247

260-
/// Title alignment within tooltip widget
248+
/// Title widget alignment within tooltip widget
261249
///
262250
/// Defaults to [Alignment.center]
263251
final AlignmentGeometry titleAlignment;
264252

265-
/// Description alignment within tooltip widget
253+
/// Title text alignment with in tooltip widget
254+
///
255+
/// Defaults to [TextAlign.start]
256+
/// To understand how text is aligned, check [TextAlign]
257+
final TextAlign titleTextAlign;
258+
259+
/// Description widget alignment within tooltip widget
266260
///
267261
/// Defaults to [Alignment.center]
268262
final AlignmentGeometry descriptionAlignment;
269263

264+
/// Description text alignment with in tooltip widget
265+
///
266+
/// Defaults to [TextAlign.start]
267+
/// To understand how text is aligned, check [TextAlign]
268+
final TextAlign descriptionTextAlign;
269+
270270
/// Defines the margin for the tooltip.
271271
/// Which is from 0 to [toolTipSlideEndDistance].
272272
///
@@ -413,22 +413,22 @@ class Showcase extends StatefulWidget {
413413
"can't use onBarrierClick & disableBarrierInteraction property at same time");
414414

415415
/// Creates a Showcase widget with a custom tooltip widget.
416-
416+
///
417417
/// This constructor allows you to provide a completely custom widget
418418
/// for the tooltip instead of using the default one with title and
419419
/// description. This gives you more flexibility in designing the
420420
/// appearance and behavior of the tooltip.
421-
421+
///
422422
/// **Required arguments:**
423423
///
424424
/// - `key`: A unique key for this Showcase widget.
425425
/// - `height`: The height of the custom tooltip widget.
426426
/// - `width`: The width of the custom tooltip widget.
427427
/// - `container`: The custom widget to use as the tooltip.
428428
/// - `child`: The widget you want to highlight.
429-
429+
///
430430
/// **Optional arguments:**
431-
431+
///
432432
/// **Highlight:**
433433
/// - `targetShapeBorder`: The border to draw around the showcased widget (defaults to a rounded rectangle).
434434
/// - `targetBorderRadius`: The border radius of the showcased widget.
@@ -447,19 +447,19 @@ class Showcase extends StatefulWidget {
447447
/// - `tooltipPosition`: The position of the tooltip relative to the showcased widget.
448448
/// - `onBarrierClick`: A callback function called when the user clicks outside the showcase overlay.
449449
/// - `disableBarrierInteraction`: Disables user interaction with the area outside the showcase overlay.
450-
450+
///
451451
/// **Advanced:**
452452
/// - `toolTipSlideEndDistance`: The distance the tooltip slides in from the edge of the screen (defaults to 7dp).
453453
/// - `tooltipActions`: A list of custom actions (widgets) to display within the tooltip.
454454
/// - `tooltipActionConfig`: Configuration options for custom tooltip actions.
455-
455+
///
456456
/// **Differences from default constructor:**
457457
///
458458
/// - This constructor doesn't require `title` or `description` arguments.
459459
/// - By default, the tooltip won't have an arrow pointing to the target widget (`showArrow` is set to `false`).
460460
/// - Default click behavior is disabled (`onToolTipClick` is set to `null`).
461461
/// - Default animation settings are slightly different (e.g., `scaleAnimationCurve` is `Curves.decelerate`).
462-
462+
///
463463
/// **Assertions:**
464464
/// - `overlayOpacity` must be between 0.0 and 1.0.
465465
/// - `onBarrierClick` cannot be used with `disableBarrierInteraction`.

lib/src/tooltip_widget.dart

Lines changed: 62 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ class ToolTipWidget extends StatefulWidget {
7575
required this.offset,
7676
required this.screenSize,
7777
required this.title,
78-
required this.titleTextAlign,
7978
required this.description,
8079
required this.titleTextStyle,
8180
required this.descTextStyle,
@@ -87,6 +86,7 @@ class ToolTipWidget extends StatefulWidget {
8786
required this.contentWidth,
8887
required this.onTooltipTap,
8988
required this.movingAnimationDuration,
89+
required this.titleTextAlign,
9090
required this.descriptionTextAlign,
9191
required this.titleAlignment,
9292
required this.descriptionAlignment,
@@ -556,69 +556,76 @@ class _ToolTipWidgetState extends State<ToolTipWidget>
556556
),
557557
color: widget.tooltipBackgroundColor,
558558
child: Column(
559-
crossAxisAlignment: widget.title != null
560-
? CrossAxisAlignment.start
561-
: CrossAxisAlignment.center,
562559
children: <Widget>[
563560
if (widget.title != null)
564-
Padding(
565-
padding: (widget.titlePadding ??
566-
zeroPadding)
567-
.add(
568-
EdgeInsets.only(
569-
left:
570-
widget.tooltipPadding?.left ??
571-
0,
572-
right: widget
573-
.tooltipPadding?.right ??
574-
0,
561+
Align(
562+
alignment: widget.titleAlignment,
563+
child: Padding(
564+
padding: (widget.titlePadding ??
565+
zeroPadding)
566+
.add(
567+
EdgeInsets.only(
568+
left: widget
569+
.tooltipPadding?.left ??
570+
0,
571+
right: widget.tooltipPadding
572+
?.right ??
573+
0,
574+
),
575575
),
576-
),
577-
child: Text(
578-
widget.title!,
579-
textAlign: widget.titleAlignment,
580-
textDirection:
581-
widget.titleTextDirection,
582-
style: widget.titleTextStyle ??
583-
Theme.of(context)
584-
.textTheme
585-
.titleLarge!
586-
.merge(
587-
TextStyle(
588-
color: widget.textColor,
576+
child: Text(
577+
widget.title!,
578+
textAlign: widget.titleTextAlign,
579+
textDirection:
580+
widget.titleTextDirection,
581+
style: widget.titleTextStyle ??
582+
Theme.of(context)
583+
.textTheme
584+
.titleLarge!
585+
.merge(
586+
TextStyle(
587+
color:
588+
widget.textColor,
589+
),
589590
),
590-
),
591+
),
591592
),
592593
),
593594
if (widget.description != null)
594-
Padding(
595-
padding: (widget.descriptionPadding ??
596-
zeroPadding)
597-
.add(
598-
EdgeInsets.only(
599-
left:
600-
widget.tooltipPadding?.left ??
601-
0,
602-
right: widget
603-
.tooltipPadding?.right ??
604-
0,
595+
Align(
596+
alignment:
597+
widget.descriptionAlignment,
598+
child: Padding(
599+
padding:
600+
(widget.descriptionPadding ??
601+
zeroPadding)
602+
.add(
603+
EdgeInsets.only(
604+
left: widget
605+
.tooltipPadding?.left ??
606+
0,
607+
right: widget.tooltipPadding
608+
?.right ??
609+
0,
610+
),
605611
),
606-
),
607-
child: Text(
608-
widget.description!,
609-
textAlign:
610-
widget.descriptionAlignment,
611-
textDirection:
612-
widget.descriptionTextDirection,
613-
style: widget.descTextStyle ??
614-
Theme.of(context)
615-
.textTheme
616-
.titleSmall!
617-
.merge(
618-
TextStyle(
619-
color: widget.textColor,
612+
child: Text(
613+
widget.description!,
614+
textAlign:
615+
widget.descriptionTextAlign,
616+
textDirection: widget
617+
.descriptionTextDirection,
618+
style: widget.descTextStyle ??
619+
Theme.of(context)
620+
.textTheme
621+
.titleSmall!
622+
.merge(
623+
TextStyle(
624+
color:
625+
widget.textColor,
626+
),
620627
),
621-
),
628+
),
622629
),
623630
),
624631
if (widget.tooltipActions.isNotEmpty &&

0 commit comments

Comments
 (0)