Skip to content

Commit d0b2a0c

Browse files
authored
🐛 fix issue #121 - SlideTransition widget in tooltip_widget.dart is constantly rebuildung even after the showcasing is supposed to have stopped. (#177)
- Move animation controller from showcase widget to tooltip widget. - Update Readme.md
1 parent 40463a6 commit d0b2a0c

9 files changed

+95
-132
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
## [1.1.5] - November 29, 2021 [Unreleased]
1+
## [1.1.5] - December 2, 2021 [Unreleased]
22

33
- Fixed [#173](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/173) - showArrow not working
4+
- Fixed [#121](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/121) - SlideTransition widget in tooltip_widget.dart is constantly rebuildung even after the showcasing is supposed to have stopped
45

56
## [1.1.4] - November 26, 2021
67

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,18 @@ Check out the **example** app in the [example](example) directory or the 'Exampl
130130

131131
<table>
132132
<tr>
133-
<td align="center"><a href="https://github.com/birjuvachhani"><img src="https://avatars.githubusercontent.com/u/20423471?s=100" width="80px;" alt=""/><br /><sub><b>Birju Vachhani</b></sub></a></td>
134-
<td align="center"><a href="https://github.com/DevarshRanpara"><img src="https://avatars.githubusercontent.com/u/26064415?s=100" width="80px;" alt=""/><br /><sub><b>Devarsh Ranpara</b></sub></a></td>
135-
<td align="center"><a href="https://github.com/AnkitPanchal10"><img src="https://avatars.githubusercontent.com/u/38405884?s=100" width="80px;" alt=""/><br /><sub><b>Ankit Panchal</b></sub></a></td>
136-
<td align="center"><a href="https://github.com/Kashifalaliwala"><img src="https://avatars.githubusercontent.com/u/30998350?s=100" width="80px;" alt=""/><br /><sub><b>Kashifa Laliwala</b></sub></a></td>
137-
<td align="center"><a href="https://github.com/vatsaltanna"><img src="https://avatars.githubusercontent.com/u/25323183?s=100" width="80px;" alt=""/><br /><sub><b>Vatsal Tanna</b></sub></a></td>
138-
<td align="center"><a href="https://github.com/ShwetaChauhan18"><img src="https://avatars.githubusercontent.com/u/34509457" width="80px;" alt=""/><br /><sub><b>Shweta Chauhan</b></sub></a></td>
139-
<td align="center"><a href="https://github.com/ParthBaraiya"><img src="https://avatars.githubusercontent.com/u/36261739" width="80px;" alt=""/><br /><sub><b>Parth Baraiya</b></sub></a></td>
133+
<td align="center"><a href="https://github.com/birjuvachhani"><img src="https://avatars.githubusercontent.com/u/20423471?s=100" width="100px;" alt=""/><br /><sub><b>Birju Vachhani</b></sub></a></td>
134+
<td align="center"><a href="https://github.com/DevarshRanpara"><img src="https://avatars.githubusercontent.com/u/26064415?s=100" width="100px;" alt=""/><br /><sub><b>Devarsh Ranpara</b></sub></a></td>
135+
<td align="center"><a href="https://github.com/AnkitPanchal10"><img src="https://avatars.githubusercontent.com/u/38405884?s=100" width="100px;" alt=""/><br /><sub><b>Ankit Panchal</b></sub></a></td>
136+
<td align="center"><a href="https://github.com/Kashifalaliwala"><img src="https://avatars.githubusercontent.com/u/30998350?s=100" width="100px;" alt=""/><br /><sub><b>Kashifa Laliwala</b></sub></a></td>
137+
<td align="center"><a href="https://github.com/vatsaltanna"><img src="https://avatars.githubusercontent.com/u/25323183?s=100" width="100px;" alt=""/><br /><sub><b>Vatsal Tanna</b></sub></a></td>
138+
<td align="center"><a href="https://github.com/sanket-simform"><img src="https://avatars.githubusercontent.com/u/65167856?v=4" width="100px;" alt=""/><br /><sub><b>Sanket Kachhela</b></sub></a></td>
139+
<td align="center"><a href="https://github.com/ParthBaraiya"><img src="https://avatars.githubusercontent.com/u/36261739?v=4" width="100px;" alt=""/><br /><sub><b>Parth Baraiya</b></sub></a></td>
140+
<td align="center"><a href="https://github.com/ShwetaChauhan18"><img src="https://avatars.githubusercontent.com/u/34509457" width="80px;" alt=""/><br /><sub><b>Shweta Chauhan</b></sub></a></td>
140141
</tr>
141142
</table>
142143
<br/>
143144

144-
145145
## Note
146146

147147
We have updated license of flutter_showcaseview from BSD 2-Clause "Simplified" to MIT.

example/.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,9 @@ pubspec.lock
7474
# Windows project.
7575
windows/flutter/generated_plugin_registrant.cc
7676
windows/flutter/generated_plugin_registrant.h
77-
windows/flutter/generated_plugins.cmake
77+
windows/flutter/generated_plugins.cmake
78+
79+
# Linux Project
80+
linux/flutter/generated_plugin_registrant.cc
81+
linux/flutter/generated_plugin_registrant.h
82+
linux/flutter/generated_plugins.cmake

example/linux/flutter/generated_plugin_registrant.cc

-11
This file was deleted.

example/linux/flutter/generated_plugin_registrant.h

-15
This file was deleted.

example/linux/flutter/generated_plugins.cmake

-15
This file was deleted.

lib/src/showcase.dart

+9-44
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import 'dart:ui';
2525

2626
import 'package:flutter/foundation.dart';
2727
import 'package:flutter/material.dart';
28-
import 'package:flutter/scheduler.dart';
2928

3029
import 'get_position.dart';
3130
import 'layout_overlays.dart';
@@ -95,7 +94,7 @@ class Showcase extends StatefulWidget {
9594
width = null,
9695
container = null,
9796
assert(overlayOpacity >= 0.0 && overlayOpacity <= 1.0,
98-
"overlay opacity should be >= 0.0 and <= 1.0."),
97+
"overlay opacity must be between 0 and 1."),
9998
assert(
10099
onTargetClick == null
101100
? true
@@ -133,49 +132,17 @@ class Showcase extends StatefulWidget {
133132
}) : showArrow = false,
134133
onToolTipClick = null,
135134
assert(overlayOpacity >= 0.0 && overlayOpacity <= 1.0,
136-
"overlay opacity should be >= 0.0 and <= 1.0.");
135+
"overlay opacity must be between 0 and 1.");
137136

138137
@override
139138
_ShowcaseState createState() => _ShowcaseState();
140139
}
141140

142-
class _ShowcaseState extends State<Showcase> with TickerProviderStateMixin {
141+
class _ShowcaseState extends State<Showcase> {
143142
bool _showShowCase = false;
144-
Animation<double>? _slideAnimation;
145-
late AnimationController _slideAnimationController;
146143
Timer? timer;
147144
GetPosition? position;
148145

149-
@override
150-
void initState() {
151-
super.initState();
152-
153-
_slideAnimationController = AnimationController(
154-
duration: widget.animationDuration,
155-
vsync: this,
156-
)..addStatusListener((status) {
157-
if (status == AnimationStatus.completed) {
158-
_slideAnimationController.reverse();
159-
}
160-
if (_slideAnimationController.isDismissed) {
161-
if (!widget.disableAnimation) {
162-
_slideAnimationController.forward();
163-
}
164-
}
165-
});
166-
167-
_slideAnimation = CurvedAnimation(
168-
parent: _slideAnimationController,
169-
curve: Curves.easeInOut,
170-
);
171-
}
172-
173-
@override
174-
void dispose() {
175-
_slideAnimationController.dispose();
176-
super.dispose();
177-
}
178-
179146
@override
180147
void didChangeDependencies() {
181148
super.didChangeDependencies();
@@ -188,7 +155,6 @@ class _ShowcaseState extends State<Showcase> with TickerProviderStateMixin {
188155
showOverlay();
189156
}
190157

191-
///
192158
/// show overlay if there is any target widget
193159
///
194160
void showOverlay() {
@@ -198,7 +164,6 @@ class _ShowcaseState extends State<Showcase> with TickerProviderStateMixin {
198164
});
199165

200166
if (activeStep == widget.key) {
201-
_slideAnimationController.forward();
202167
if (ShowCaseWidget.of(context)!.autoPlay) {
203168
timer = Timer(
204169
Duration(
@@ -236,9 +201,6 @@ class _ShowcaseState extends State<Showcase> with TickerProviderStateMixin {
236201
timer = null;
237202
}
238203
ShowCaseWidget.of(context)!.completed(widget.key);
239-
if (!widget.disableAnimation) {
240-
_slideAnimationController.forward();
241-
}
242204
}
243205

244206
void _getOnTargetTap() {
@@ -288,15 +250,17 @@ class _ShowcaseState extends State<Showcase> with TickerProviderStateMixin {
288250
width: MediaQuery.of(context).size.width,
289251
height: MediaQuery.of(context).size.height,
290252
decoration: BoxDecoration(
291-
color: widget.overlayColor,
253+
color: widget.overlayColor
254+
.withOpacity(widget.overlayOpacity),
292255
),
293256
),
294257
)
295258
: Container(
296259
width: MediaQuery.of(context).size.width,
297260
height: MediaQuery.of(context).size.height,
298261
decoration: BoxDecoration(
299-
color: widget.overlayColor,
262+
color: widget.overlayColor
263+
.withOpacity(widget.overlayOpacity),
300264
),
301265
),
302266
),
@@ -313,7 +277,6 @@ class _ShowcaseState extends State<Showcase> with TickerProviderStateMixin {
313277
screenSize: screenSize,
314278
title: widget.title,
315279
description: widget.description,
316-
animationOffset: _slideAnimation,
317280
titleTextStyle: widget.titleTextStyle,
318281
descTextStyle: widget.descTextStyle,
319282
container: widget.container,
@@ -324,6 +287,8 @@ class _ShowcaseState extends State<Showcase> with TickerProviderStateMixin {
324287
contentWidth: widget.width,
325288
onTooltipTap: _getOnTooltipTap,
326289
contentPadding: widget.contentPadding,
290+
disableAnimation: widget.disableAnimation,
291+
animationDuration: widget.animationDuration,
327292
),
328293
],
329294
)

lib/src/showcase_widget.dart

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
* SOFTWARE.
2121
*/
2222

23-
import 'dart:ui';
24-
2523
import 'package:flutter/material.dart';
2624

2725
import '../showcaseview.dart';

0 commit comments

Comments
 (0)