Skip to content

Commit 26effd4

Browse files
committed
fix: 🩹Resolved merge conflict and PR review comments
1 parent 015a022 commit 26effd4

File tree

6 files changed

+104
-87
lines changed

6 files changed

+104
-87
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/models/tooltip_action_button.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@ class TooltipActionButton {
5151
final List<GlobalKey> hideActionWidgetForShowcase;
5252

5353
/// A configuration for a tooltip action button or Provide a custom tooltip action.
54-
54+
///
5555
/// This class allows you to define predefined actions like "Next,"
5656
/// "Previous," and "Close," or specify a custom action widget.
57-
57+
///
5858
/// **Required arguments:**
59-
59+
///
6060
/// - `type`: The type of the action button (e.g., `TooltipDefaultActionType.next`).
61-
61+
///
6262
/// **Optional arguments:**
63-
63+
///
6464
/// - `backgroundColor`: The background color of the button
6565
/// - `textStyle`: The text style for the button label.
6666
/// - `borderRadius`: The border radius of the button. Defaults to a rounded shape.

lib/src/models/tooltip_action_config.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import '../../showcaseview.dart';
44

55
class TooltipActionConfig {
66
/// Configuration options for tooltip action buttons.
7-
7+
///
88
/// This class allows you to configure the overall appearance and layout of
99
/// action buttons within a tooltip widget.
1010
const TooltipActionConfig({

lib/src/showcase.dart

Lines changed: 23 additions & 23 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
///
@@ -285,20 +285,20 @@ class Showcase extends StatefulWidget {
285285
final TooltipActionConfig? tooltipActionConfig;
286286

287287
/// Highlights a specific widget on the screen with an informative tooltip.
288-
288+
///
289289
/// This widget helps you showcase specific parts of your UI by drawing an
290290
/// overlay around it and displaying a description. You can customize the
291291
/// appearance and behavior of the showcase and tooltip for a seamless user
292292
/// experience.
293-
293+
///
294294
/// **Required arguments:**
295295
///
296296
/// - `key`: A unique key for this Showcase widget.
297297
/// - `description`: A description of the widget being showcased.
298298
/// - `child`: The widget you want to highlight.
299-
299+
///
300300
/// **Optional arguments:**
301-
301+
///
302302
/// **Tooltip:**
303303
/// - `title`: An optional title for the tooltip.
304304
/// - `titleAlignment`: Alignment of the title text within the tooltip (defaults to start).
@@ -310,20 +310,20 @@ class Showcase extends StatefulWidget {
310310
/// - `tooltipPadding`: Padding around the content inside the tooltip.
311311
/// - `onToolTipClick`: A callback function called when the user clicks the tooltip.
312312
/// - `tooltipBorderRadius`: The border radius of the tooltip (defaults to 8dp).
313-
313+
///
314314
/// **Highlight:**
315315
/// - `targetShapeBorder`: The border to draw around the showcased widget (defaults to a rounded rectangle).
316316
/// - `targetPadding`: Padding around the showcased widget (defaults to none).
317317
/// - `showArrow`: Whether to show an arrow pointing to the showcased widget (defaults to true).
318-
318+
///
319319
/// **Animations:**
320320
/// - `movingAnimationDuration`: Duration of the animation when moving the tooltip (defaults to 2 seconds).
321321
/// - `disableMovingAnimation`: Disables the animation when moving the tooltip.
322322
/// - `disableScaleAnimation`: Disables the animation when scaling the tooltip.
323323
/// - `scaleAnimationDuration`: Duration of the animation when scaling the tooltip (defaults to 300 milliseconds).
324324
/// - `scaleAnimationCurve`: The curve used for the scaling animation (defaults to ease-in).
325325
/// - `scaleAnimationAlignment`: The alignment point for the scaling animation.
326-
326+
///
327327
/// **Interactions:**
328328
/// - `onTargetClick`: A callback function called when the user clicks the showcased widget.
329329
/// - `disposeOnTap`: Whether to dispose of the showcase after a tap on the showcased widget (requires `onTargetClick`).
@@ -332,7 +332,7 @@ class Showcase extends StatefulWidget {
332332
/// - `disableDefaultTargetGestures`: Disables default gestures on the target widget (panning, zooming).
333333
/// - `onBarrierClick`: A callback function called when the user clicks outside the showcase overlay.
334334
/// - `disableBarrierInteraction`: Disables user interaction with the area outside the showcase overlay.
335-
335+
///
336336
/// **Advanced:**
337337
/// - `container`: A custom widget to use as the tooltip instead of the default one.
338338
/// - `overlayColor`: Color of the showcase overlay (defaults to black with 75% opacity).
@@ -344,7 +344,7 @@ class Showcase extends StatefulWidget {
344344
/// - `toolTipMargin`: The margin around the tooltip (defaults to 14dp).
345345
/// - `tooltipActions`: A list of custom actions (widgets) to display within the tooltip.
346346
/// - `tooltipActionConfig`: Configuration options for custom tooltip actions.
347-
347+
///
348348
/// **Assertions:**
349349
///
350350
/// - `overlayOpacity` must be between 0.0 and 1.0.

lib/src/showcase_widget.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ class ShowCaseWidget extends StatefulWidget {
9090
final TooltipActionConfig? globalTooltipActionConfig;
9191

9292
/// A widget that manages multiple Showcase widgets.
93-
93+
///
9494
/// This widget provides a way to sequentially showcase multiple widgets
9595
/// with customizable options like auto-play, animation, and user interaction.
96-
96+
///
9797
/// **Required arguments:**
9898
///
9999
/// - `builder`: A builder function that returns a widget containing the `Showcase` widgets to be showcased.
100-
100+
///
101101
/// **Optional arguments:**
102102
///
103103
/// - `onFinish`: A callback function triggered when all showcases are completed.

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,
@@ -563,69 +563,76 @@ class _ToolTipWidgetState extends State<ToolTipWidget>
563563
),
564564
color: widget.tooltipBackgroundColor,
565565
child: Column(
566-
crossAxisAlignment: widget.title != null
567-
? CrossAxisAlignment.start
568-
: CrossAxisAlignment.center,
569566
children: <Widget>[
570567
if (widget.title != null)
571-
Padding(
572-
padding: (widget.titlePadding ??
573-
zeroPadding)
574-
.add(
575-
EdgeInsets.only(
576-
left:
577-
widget.tooltipPadding?.left ??
578-
0,
579-
right: widget
580-
.tooltipPadding?.right ??
581-
0,
568+
Align(
569+
alignment: widget.titleAlignment,
570+
child: Padding(
571+
padding: (widget.titlePadding ??
572+
zeroPadding)
573+
.add(
574+
EdgeInsets.only(
575+
left: widget
576+
.tooltipPadding?.left ??
577+
0,
578+
right: widget.tooltipPadding
579+
?.right ??
580+
0,
581+
),
582582
),
583-
),
584-
child: Text(
585-
widget.title!,
586-
textAlign: widget.titleAlignment,
587-
textDirection:
588-
widget.titleTextDirection,
589-
style: widget.titleTextStyle ??
590-
Theme.of(context)
591-
.textTheme
592-
.titleLarge!
593-
.merge(
594-
TextStyle(
595-
color: widget.textColor,
583+
child: Text(
584+
widget.title!,
585+
textAlign: widget.titleTextAlign,
586+
textDirection:
587+
widget.titleTextDirection,
588+
style: widget.titleTextStyle ??
589+
Theme.of(context)
590+
.textTheme
591+
.titleLarge!
592+
.merge(
593+
TextStyle(
594+
color:
595+
widget.textColor,
596+
),
596597
),
597-
),
598+
),
598599
),
599600
),
600601
if (widget.description != null)
601-
Padding(
602-
padding: (widget.descriptionPadding ??
603-
zeroPadding)
604-
.add(
605-
EdgeInsets.only(
606-
left:
607-
widget.tooltipPadding?.left ??
608-
0,
609-
right: widget
610-
.tooltipPadding?.right ??
611-
0,
602+
Align(
603+
alignment:
604+
widget.descriptionAlignment,
605+
child: Padding(
606+
padding:
607+
(widget.descriptionPadding ??
608+
zeroPadding)
609+
.add(
610+
EdgeInsets.only(
611+
left: widget
612+
.tooltipPadding?.left ??
613+
0,
614+
right: widget.tooltipPadding
615+
?.right ??
616+
0,
617+
),
612618
),
613-
),
614-
child: Text(
615-
widget.description!,
616-
textAlign:
617-
widget.descriptionAlignment,
618-
textDirection:
619-
widget.descriptionTextDirection,
620-
style: widget.descTextStyle ??
621-
Theme.of(context)
622-
.textTheme
623-
.titleSmall!
624-
.merge(
625-
TextStyle(
626-
color: widget.textColor,
619+
child: Text(
620+
widget.description!,
621+
textAlign:
622+
widget.descriptionTextAlign,
623+
textDirection: widget
624+
.descriptionTextDirection,
625+
style: widget.descTextStyle ??
626+
Theme.of(context)
627+
.textTheme
628+
.titleSmall!
629+
.merge(
630+
TextStyle(
631+
color:
632+
widget.textColor,
633+
),
627634
),
628-
),
635+
),
629636
),
630637
),
631638
if (widget.tooltipActions.isNotEmpty &&

0 commit comments

Comments
 (0)