Skip to content

Commit ff521eb

Browse files
committed
fix: 🩹Resolved merge conflict and PR review comments
1 parent dbbf5fe commit ff521eb

File tree

3 files changed

+86
-69
lines changed

3 files changed

+86
-69
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: 14 additions & 14 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
///

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,
@@ -553,69 +553,76 @@ class _ToolTipWidgetState extends State<ToolTipWidget>
553553
),
554554
color: widget.tooltipBackgroundColor,
555555
child: Column(
556-
crossAxisAlignment: widget.title != null
557-
? CrossAxisAlignment.start
558-
: CrossAxisAlignment.center,
559556
children: <Widget>[
560557
if (widget.title != null)
561-
Padding(
562-
padding: (widget.titlePadding ??
563-
zeroPadding)
564-
.add(
565-
EdgeInsets.only(
566-
left:
567-
widget.tooltipPadding?.left ??
568-
0,
569-
right: widget
570-
.tooltipPadding?.right ??
571-
0,
558+
Align(
559+
alignment: widget.titleAlignment,
560+
child: Padding(
561+
padding: (widget.titlePadding ??
562+
zeroPadding)
563+
.add(
564+
EdgeInsets.only(
565+
left: widget
566+
.tooltipPadding?.left ??
567+
0,
568+
right: widget.tooltipPadding
569+
?.right ??
570+
0,
571+
),
572572
),
573-
),
574-
child: Text(
575-
widget.title!,
576-
textAlign: widget.titleAlignment,
577-
textDirection:
578-
widget.titleTextDirection,
579-
style: widget.titleTextStyle ??
580-
Theme.of(context)
581-
.textTheme
582-
.titleLarge!
583-
.merge(
584-
TextStyle(
585-
color: widget.textColor,
573+
child: Text(
574+
widget.title!,
575+
textAlign: widget.titleTextAlign,
576+
textDirection:
577+
widget.titleTextDirection,
578+
style: widget.titleTextStyle ??
579+
Theme.of(context)
580+
.textTheme
581+
.titleLarge!
582+
.merge(
583+
TextStyle(
584+
color:
585+
widget.textColor,
586+
),
586587
),
587-
),
588+
),
588589
),
589590
),
590591
if (widget.description != null)
591-
Padding(
592-
padding: (widget.descriptionPadding ??
593-
zeroPadding)
594-
.add(
595-
EdgeInsets.only(
596-
left:
597-
widget.tooltipPadding?.left ??
598-
0,
599-
right: widget
600-
.tooltipPadding?.right ??
601-
0,
592+
Align(
593+
alignment:
594+
widget.descriptionAlignment,
595+
child: Padding(
596+
padding:
597+
(widget.descriptionPadding ??
598+
zeroPadding)
599+
.add(
600+
EdgeInsets.only(
601+
left: widget
602+
.tooltipPadding?.left ??
603+
0,
604+
right: widget.tooltipPadding
605+
?.right ??
606+
0,
607+
),
602608
),
603-
),
604-
child: Text(
605-
widget.description!,
606-
textAlign:
607-
widget.descriptionAlignment,
608-
textDirection:
609-
widget.descriptionTextDirection,
610-
style: widget.descTextStyle ??
611-
Theme.of(context)
612-
.textTheme
613-
.titleSmall!
614-
.merge(
615-
TextStyle(
616-
color: widget.textColor,
609+
child: Text(
610+
widget.description!,
611+
textAlign:
612+
widget.descriptionTextAlign,
613+
textDirection: widget
614+
.descriptionTextDirection,
615+
style: widget.descTextStyle ??
616+
Theme.of(context)
617+
.textTheme
618+
.titleSmall!
619+
.merge(
620+
TextStyle(
621+
color:
622+
widget.textColor,
623+
),
617624
),
618-
),
625+
),
619626
),
620627
),
621628
if (widget.tooltipActions.isNotEmpty &&

0 commit comments

Comments
 (0)