@@ -24,48 +24,39 @@ import 'package:flutter/material.dart';
24
24
import '../../showcaseview.dart' ;
25
25
26
26
class TooltipActionButton {
27
- /// A configuration for a tooltip action button or Provide a custom tooltip
28
- /// action.
27
+ /// A class that defines interactive action buttons within showcase tooltips.
29
28
///
30
- /// This class allows you to define predefined actions like "Next,"
31
- /// "Previous," and "Close," or specify a custom action widget.
29
+ /// Provides a way to add interactive buttons to tooltips in the showcase
30
+ /// view. These buttons can perform standard navigation actions also
31
+ /// supports custom actions through callback functions and fully custom
32
+ /// button widgets.
32
33
///
33
- /// **Required arguments:**
34
+ /// There are two ways to create tooltip action buttons:
35
+ /// 1. Using the default constructor for standard buttons with predefined
36
+ /// styles and standard action types (next, previous, skip).
37
+ /// 2. Using the [TooltipActionButton.custom] constructor for fully custom
38
+ /// button widgets.
34
39
///
35
- /// - `type` : The type of the action button (e.g.,
36
- /// `TooltipDefaultActionType.next` ).
40
+ /// Tooltip action buttons can be used in two contexts:
41
+ /// - As local actions specific to a single showcase tooltip by providing
42
+ /// them in [Showcase.tooltipActions] .
43
+ /// - As global actions that appear in all showcase tooltips by providing
44
+ /// them in [ShowcaseView.globalTooltipActions] .
37
45
///
38
- /// **Optional arguments:**
39
- ///
40
- /// - `backgroundColor` : The background color of the button
41
- /// - `textStyle` : The text style for the button label.
42
- /// - `borderRadius` : The border radius of the button. Defaults to a
43
- /// rounded shape.
44
- /// - `padding` : The padding around the button content.
45
- /// - `leadIcon` : An optional leading icon for the button.
46
- /// - `tailIcon` : An optional trailing icon for the button.
47
- /// - `name` : The text for the button label (ignored if `type` is provided).
48
- /// - `onTap` : A callback function triggered when the button is tapped.
49
- /// - `border` : A border to draw around the button.
50
- /// - `hideActionWidgetForShowcase` : A list of `GlobalKey` s of showcases
51
- /// where this action widget should be hidden. This only works for global
52
- /// action widgets.
46
+ /// The appearance and position of these buttons are controlled by the
47
+ /// [TooltipActionConfig] class, which can define whether the buttons appear
48
+ /// inside or outside the tooltip container and how they are aligned.
53
49
const TooltipActionButton ({
54
50
required this .type,
51
+ this .borderRadius = const BorderRadius .all (Radius .circular (50 )),
52
+ this .padding = const EdgeInsets .symmetric (horizontal: 15 , vertical: 4 ),
53
+ this .hideActionWidgetForShowcase = const [],
55
54
this .backgroundColor,
56
55
this .textStyle,
57
- this .borderRadius = const BorderRadius .all (
58
- Radius .circular (50 ),
59
- ),
60
- this .padding = const EdgeInsets .symmetric (
61
- horizontal: 15 ,
62
- vertical: 4 ,
63
- ),
64
56
this .leadIcon,
65
57
this .tailIcon,
66
58
this .name,
67
59
this .onTap,
68
- this .hideActionWidgetForShowcase = const [],
69
60
this .border,
70
61
}) : button = null ;
71
62
@@ -83,45 +74,51 @@ class TooltipActionButton {
83
74
onTap = null ,
84
75
border = null ;
85
76
86
- /// To Provide Background color to the action
77
+ /// Background color for the action button.
78
+ ///
79
+ /// If not provided, theme's primary color will be used as default.
87
80
final Color ? backgroundColor;
88
81
89
- /// To Provide borderRadius to the action
82
+ /// Border radius for the action button.
90
83
///
91
- /// Defaults to const BorderRadius.all(Radius. circular(50)),
84
+ /// Defaults to a rounded shape with circular radius of 50.
92
85
final BorderRadius ? borderRadius;
93
86
94
- /// To Provide textStyle to the action text
87
+ /// Text style for the button label.
88
+ ///
89
+ /// Controls the appearance of the text inside the button.
95
90
final TextStyle ? textStyle;
96
91
97
- /// To Provide padding to the action widget
98
- ///
99
- /// Defaults to const EdgeInsets.symmetric(horizontal: 15,vertical: 4,)
92
+ /// Padding inside the action button.
100
93
final EdgeInsets ? padding;
101
94
102
- /// To Provide a custom widget for the action in [TooltipActionButton.custom]
95
+ /// A custom widget to use instead of the default button appearance.
96
+ ///
97
+ /// When provided, most other appearance properties are ignored.
103
98
final Widget ? button;
104
99
105
- /// To Provide a leading icon for the action
100
+ /// Icon to display before the button text.
106
101
final ActionButtonIcon ? leadIcon;
107
102
108
- /// To Provide a tail icon for the action
103
+ /// Icon to display after the button text.
109
104
final ActionButtonIcon ? tailIcon;
110
105
111
- /// To Provide a action type
106
+ /// Predefined action type that determines the button's default behavior.
112
107
final TooltipDefaultActionType ? type;
113
108
114
- /// To Provide a text for action
109
+ /// Display text for the button.
115
110
///
116
- /// If type is provided then it will take type name
111
+ /// If not provided, uses the name from the action type.
117
112
final String ? name;
118
113
119
- /// To Provide a onTap for action
114
+ /// Callback function triggered when the button is tapped.
120
115
///
121
- /// If type is provided then it will take type's OnTap
116
+ /// When provided, this overrides the default behavior of the action type.
122
117
final VoidCallback ? onTap;
123
118
124
- /// To Provide a border for action
119
+ /// Border to apply around the button.
120
+ ///
121
+ /// Allows for custom border styling such as color, width, and style.
125
122
final Border ? border;
126
123
127
124
/// Hides action widgets for the showcase. Add key of particular showcase
0 commit comments