Skip to content

Commit fe2d20c

Browse files
💥 Fix!: parameter changes of the Showcase and ShowCaseWidget class
1 parent 580de7a commit fe2d20c

File tree

6 files changed

+83
-71
lines changed

6 files changed

+83
-71
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Fixed [#253](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/253) - Add TextAlign attribute for title and description
66
- `pull_request_template.md.` file updated with proper document
77
- `CONTRIBUTING.md` file updated with proper document
8+
- Updated parameter name of `ShowCaseWidget` and `Showcase` class
89

910
## [1.1.8] - August 5, 2022
1011
- Fixed [#237](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/237) - Feature added to enable/disable overlay click using `disableBarrierInteraction` parameters

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ Showcase(
6767
titleAlignment: TextAlign.start,
6868
descriptionAlignment: TextAlign.start,
6969
disableAnimation: true,
70-
shapeBorder: CircleBorder(),
71-
radius: BorderRadius.all(Radius.circular(40)),
70+
targetShapeBorder: CircleBorder(),
71+
targetBorderRadius: BorderRadius.all(Radius.circular(40)),
7272
showArrow: false,
73-
tipBorderRadius: BorderRadius.all(Radius.circular(8)),
74-
overlayPadding: EdgeInsets.all(5),
73+
tooltipBorderRadius: BorderRadius.all(Radius.circular(8)),
74+
targetPadding: EdgeInsets.all(5),
7575
slideDuration: Duration(milliseconds: 1500),
76-
tooltipColor: Colors.blueGrey,
76+
tooltipBackgroundColor: Colors.blueGrey,
7777
blurValue: 2,
7878
disableDefaultTargetGestures: true,
7979
child: ...,
@@ -85,9 +85,9 @@ Showcase(
8585
```dart
8686
Showcase.withWidget(
8787
key: _three,
88-
cHeight: 80,
89-
cWidth: 140,
90-
shapeBorder: CircleBorder(),
88+
height: 80,
89+
width: 140,
90+
targetShapeBorder: CircleBorder(),
9191
container: Column(
9292
crossAxisAlignment: CrossAxisAlignment.start,
9393
children: <Widget>[

example/lib/main.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,14 @@ class _MailPageState extends State<MailPage> {
216216
),
217217
),
218218
Showcase(
219-
overlayPadding: const EdgeInsets.all(5),
219+
targetPadding: const EdgeInsets.all(5),
220220
key: _two,
221221
title: 'Profile',
222222
description:
223223
"Tap to see profile which contains user's name, profile picture, mobile number and country",
224-
showcaseBackgroundColor: Theme.of(context).primaryColor,
224+
tooltipBackgroundColor: Theme.of(context).primaryColor,
225225
textColor: Colors.white,
226-
shapeBorder: const CircleBorder(),
226+
targetShapeBorder: const CircleBorder(),
227227
child: Container(
228228
padding: const EdgeInsets.all(5),
229229
width: 45,
@@ -278,7 +278,7 @@ class _MailPageState extends State<MailPage> {
278278
key: _five,
279279
title: 'Compose Mail',
280280
description: 'Click here to compose mail',
281-
shapeBorder: const CircleBorder(),
281+
targetShapeBorder: const CircleBorder(),
282282
child: FloatingActionButton(
283283
backgroundColor: Theme.of(context).primaryColor,
284284
onPressed: () {
@@ -413,8 +413,10 @@ class MailTile extends StatelessWidget {
413413
key: showCaseKey!,
414414
height: 50,
415415
width: 140,
416-
shapeBorder: const CircleBorder(),
417-
radius: const BorderRadius.all(Radius.circular(150)),
416+
targetShapeBorder: const CircleBorder(),
417+
targetBorderRadius: const BorderRadius.all(
418+
Radius.circular(150),
419+
),
418420
container: Column(
419421
crossAxisAlignment: CrossAxisAlignment.start,
420422
children: <Widget>[

lib/src/showcase.dart

Lines changed: 47 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ class Showcase extends StatefulWidget {
3939

4040
final Widget child;
4141
final String? title;
42-
final TextAlign? titleAlignment;
42+
final TextAlign titleAlignment;
4343
final String? description;
44-
final ShapeBorder? shapeBorder;
45-
final BorderRadius? radius;
44+
final ShapeBorder targetShapeBorder;
45+
final BorderRadius? targetBorderRadius;
4646
final TextStyle? titleTextStyle;
4747
final TextStyle? descTextStyle;
48-
final EdgeInsets contentPadding;
48+
final EdgeInsets tooltipPadding;
4949
final Color overlayColor;
5050
final double overlayOpacity;
5151
final Widget? container;
52-
final Color showcaseBackgroundColor;
52+
final Color tooltipBackgroundColor;
5353
final Color textColor;
5454
final Widget scrollLoadingWidget;
5555
final bool showArrow;
@@ -60,10 +60,10 @@ class Showcase extends StatefulWidget {
6060
final VoidCallback? onTargetClick;
6161
final bool? disposeOnTap;
6262
final bool? disableAnimation;
63-
final EdgeInsets overlayPadding;
63+
final EdgeInsets targetPadding;
6464
final VoidCallback? onTargetDoubleTap;
6565
final VoidCallback? onTargetLongPress;
66-
final BorderRadius? tipBorderRadius;
66+
final BorderRadius? tooltipBorderRadius;
6767
final TextAlign descriptionAlignment;
6868

6969
/// if disableDefaultTargetGestures parameter is true
@@ -87,12 +87,16 @@ class Showcase extends StatefulWidget {
8787
this.titleAlignment = TextAlign.start,
8888
required this.description,
8989
this.descriptionAlignment = TextAlign.start,
90-
this.shapeBorder,
90+
this.targetShapeBorder = const RoundedRectangleBorder(
91+
borderRadius: BorderRadius.all(
92+
Radius.circular(8),
93+
),
94+
),
9195
this.overlayColor = Colors.black45,
9296
this.overlayOpacity = 0.75,
9397
this.titleTextStyle,
9498
this.descTextStyle,
95-
this.showcaseBackgroundColor = Colors.white,
99+
this.tooltipBackgroundColor = Colors.white,
96100
this.textColor = Colors.black,
97101
this.scrollLoadingWidget = const CircularProgressIndicator(
98102
valueColor: AlwaysStoppedAnimation(Colors.white)),
@@ -101,15 +105,15 @@ class Showcase extends StatefulWidget {
101105
this.disposeOnTap,
102106
this.animationDuration = const Duration(milliseconds: 2000),
103107
this.disableAnimation,
104-
this.contentPadding =
108+
this.tooltipPadding =
105109
const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
106110
this.onToolTipClick,
107-
this.overlayPadding = EdgeInsets.zero,
111+
this.targetPadding = EdgeInsets.zero,
108112
this.blurValue,
109-
this.radius,
113+
this.targetBorderRadius,
110114
this.onTargetLongPress,
111115
this.onTargetDoubleTap,
112-
this.tipBorderRadius,
116+
this.tooltipBorderRadius,
113117
this.disableDefaultTargetGestures = false,
114118
}) : height = null,
115119
width = null,
@@ -133,33 +137,37 @@ class Showcase extends StatefulWidget {
133137
required this.container,
134138
required this.height,
135139
required this.width,
136-
this.title,
137-
this.titleAlignment = TextAlign.start,
138-
this.description,
139-
this.descriptionAlignment = TextAlign.start,
140-
this.shapeBorder,
140+
this.targetShapeBorder = const RoundedRectangleBorder(
141+
borderRadius: BorderRadius.all(
142+
Radius.circular(8),
143+
),
144+
),
141145
this.overlayColor = Colors.black45,
142-
this.radius,
146+
this.targetBorderRadius,
143147
this.overlayOpacity = 0.75,
144-
this.titleTextStyle,
145-
this.descTextStyle,
146-
this.showcaseBackgroundColor = Colors.white,
147-
this.textColor = Colors.black,
148148
this.scrollLoadingWidget = const CircularProgressIndicator(
149149
valueColor: AlwaysStoppedAnimation(Colors.white)),
150150
this.onTargetClick,
151151
this.disposeOnTap,
152152
this.animationDuration = const Duration(milliseconds: 2000),
153153
this.disableAnimation,
154-
this.contentPadding = const EdgeInsets.symmetric(vertical: 8),
155-
this.overlayPadding = EdgeInsets.zero,
154+
this.targetPadding = EdgeInsets.zero,
156155
this.blurValue,
157156
this.onTargetLongPress,
158157
this.onTargetDoubleTap,
159-
this.tipBorderRadius,
160158
this.disableDefaultTargetGestures = false,
161159
}) : showArrow = false,
162160
onToolTipClick = null,
161+
title = null,
162+
description = null,
163+
titleAlignment = TextAlign.start,
164+
descriptionAlignment = TextAlign.start,
165+
titleTextStyle = null,
166+
descTextStyle = null,
167+
tooltipBackgroundColor = Colors.white,
168+
textColor = Colors.black,
169+
tooltipBorderRadius = null,
170+
tooltipPadding = const EdgeInsets.symmetric(vertical: 8),
163171
assert(overlayOpacity >= 0.0 && overlayOpacity <= 1.0,
164172
"overlay opacity must be between 0 and 1.");
165173

@@ -180,7 +188,7 @@ class _ShowcaseState extends State<Showcase> {
180188
super.didChangeDependencies();
181189
position ??= GetPosition(
182190
key: widget.key,
183-
padding: widget.overlayPadding,
191+
padding: widget.targetPadding,
184192
screenWidth: MediaQuery.of(context).size.width,
185193
screenHeight: MediaQuery.of(context).size.height,
186194
);
@@ -231,7 +239,7 @@ class _ShowcaseState extends State<Showcase> {
231239
final size = MediaQuery.of(context).size;
232240
position = GetPosition(
233241
key: widget.key,
234-
padding: widget.overlayPadding,
242+
padding: widget.targetPadding,
235243
screenWidth: size.width,
236244
screenHeight: size.height,
237245
);
@@ -244,7 +252,7 @@ class _ShowcaseState extends State<Showcase> {
244252

245253
void _nextIfAny() {
246254
if (timer != null && timer!.isActive) {
247-
if (showCaseWidgetState.autoPlayLockEnable) {
255+
if (showCaseWidgetState.enableAutoPlayLock) {
248256
return;
249257
}
250258
timer!.cancel();
@@ -297,12 +305,13 @@ class _ShowcaseState extends State<Showcase> {
297305
child: ClipPath(
298306
clipper: RRectClipper(
299307
area: _isScrollRunning ? Rect.zero : rectBound,
300-
isCircle: widget.shapeBorder == const CircleBorder(),
301-
radius:
302-
_isScrollRunning ? BorderRadius.zero : widget.radius,
308+
isCircle: widget.targetShapeBorder == const CircleBorder(),
309+
radius: _isScrollRunning
310+
? BorderRadius.zero
311+
: widget.targetBorderRadius,
303312
overlayPadding: _isScrollRunning
304313
? EdgeInsets.zero
305-
: widget.overlayPadding,
314+
: widget.targetPadding,
306315
),
307316
child: blur != 0
308317
? BackdropFilter(
@@ -332,10 +341,10 @@ class _ShowcaseState extends State<Showcase> {
332341
offset: offset,
333342
size: size,
334343
onTap: _getOnTargetTap,
335-
radius: widget.radius,
344+
radius: widget.targetBorderRadius,
336345
onDoubleTap: widget.onTargetDoubleTap,
337346
onLongPress: widget.onTargetLongPress,
338-
shapeBorder: widget.shapeBorder,
347+
shapeBorder: widget.targetShapeBorder,
339348
disableDefaultChildGestures:
340349
widget.disableDefaultTargetGestures,
341350
),
@@ -351,17 +360,17 @@ class _ShowcaseState extends State<Showcase> {
351360
titleTextStyle: widget.titleTextStyle,
352361
descTextStyle: widget.descTextStyle,
353362
container: widget.container,
354-
tooltipColor: widget.showcaseBackgroundColor,
363+
tooltipBackgroundColor: widget.tooltipBackgroundColor,
355364
textColor: widget.textColor,
356365
showArrow: widget.showArrow,
357366
contentHeight: widget.height,
358367
contentWidth: widget.width,
359368
onTooltipTap: _getOnTooltipTap,
360-
contentPadding: widget.contentPadding,
369+
tooltipPadding: widget.tooltipPadding,
361370
disableAnimation: widget.disableAnimation ??
362371
showCaseWidgetState.disableAnimation,
363372
animationDuration: widget.animationDuration,
364-
borderRadius: widget.tipBorderRadius,
373+
tooltipBorderRadius: widget.tooltipBorderRadius,
365374
),
366375
],
367376
)

lib/src/showcase_widget.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ShowCaseWidget extends StatefulWidget {
3131
final Function(int?, GlobalKey)? onComplete;
3232
final bool autoPlay;
3333
final Duration autoPlayDelay;
34-
final bool autoPlayLockEnable;
34+
final bool enableAutoPlayLock;
3535
final bool disableAnimation;
3636
final bool disableBarrierInteraction;
3737
final Duration scrollDuration;
@@ -50,7 +50,7 @@ class ShowCaseWidget extends StatefulWidget {
5050
this.onComplete,
5151
this.autoPlay = false,
5252
this.autoPlayDelay = const Duration(milliseconds: 2000),
53-
this.autoPlayLockEnable = false,
53+
this.enableAutoPlayLock = false,
5454
this.blurValue = 0,
5555
this.scrollDuration = const Duration(milliseconds: 300),
5656
this.disableAnimation = false,
@@ -83,7 +83,7 @@ class ShowCaseWidgetState extends State<ShowCaseWidget> {
8383
late bool autoPlay;
8484
late bool disableAnimation;
8585
late Duration autoPlayDelay;
86-
late bool autoPlayLockEnable;
86+
late bool enableAutoPlayLock;
8787
late bool enableAutoScroll;
8888
late bool disableBarrierInteraction;
8989

@@ -106,7 +106,7 @@ class ShowCaseWidgetState extends State<ShowCaseWidget> {
106106
autoPlayDelay = widget.autoPlayDelay;
107107
autoPlay = widget.autoPlay;
108108
disableAnimation = widget.disableAnimation;
109-
autoPlayLockEnable = widget.autoPlayLockEnable;
109+
enableAutoPlayLock = widget.enableAutoPlayLock;
110110
enableAutoScroll = widget.enableAutoScroll;
111111
disableBarrierInteraction = widget.disableBarrierInteraction;
112112
}

0 commit comments

Comments
 (0)