@@ -25,7 +25,6 @@ import 'dart:ui';
25
25
26
26
import 'package:flutter/foundation.dart' ;
27
27
import 'package:flutter/material.dart' ;
28
- import 'package:flutter/scheduler.dart' ;
29
28
30
29
import 'get_position.dart' ;
31
30
import 'layout_overlays.dart' ;
@@ -95,7 +94,7 @@ class Showcase extends StatefulWidget {
95
94
width = null ,
96
95
container = null ,
97
96
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 ." ),
99
98
assert (
100
99
onTargetClick == null
101
100
? true
@@ -133,49 +132,17 @@ class Showcase extends StatefulWidget {
133
132
}) : showArrow = false ,
134
133
onToolTipClick = null ,
135
134
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 ." );
137
136
138
137
@override
139
138
_ShowcaseState createState () => _ShowcaseState ();
140
139
}
141
140
142
- class _ShowcaseState extends State <Showcase > with TickerProviderStateMixin {
141
+ class _ShowcaseState extends State <Showcase > {
143
142
bool _showShowCase = false ;
144
- Animation <double >? _slideAnimation;
145
- late AnimationController _slideAnimationController;
146
143
Timer ? timer;
147
144
GetPosition ? position;
148
145
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
-
179
146
@override
180
147
void didChangeDependencies () {
181
148
super .didChangeDependencies ();
@@ -188,7 +155,6 @@ class _ShowcaseState extends State<Showcase> with TickerProviderStateMixin {
188
155
showOverlay ();
189
156
}
190
157
191
- ///
192
158
/// show overlay if there is any target widget
193
159
///
194
160
void showOverlay () {
@@ -198,7 +164,6 @@ class _ShowcaseState extends State<Showcase> with TickerProviderStateMixin {
198
164
});
199
165
200
166
if (activeStep == widget.key) {
201
- _slideAnimationController.forward ();
202
167
if (ShowCaseWidget .of (context)! .autoPlay) {
203
168
timer = Timer (
204
169
Duration (
@@ -236,9 +201,6 @@ class _ShowcaseState extends State<Showcase> with TickerProviderStateMixin {
236
201
timer = null ;
237
202
}
238
203
ShowCaseWidget .of (context)! .completed (widget.key);
239
- if (! widget.disableAnimation) {
240
- _slideAnimationController.forward ();
241
- }
242
204
}
243
205
244
206
void _getOnTargetTap () {
@@ -288,15 +250,17 @@ class _ShowcaseState extends State<Showcase> with TickerProviderStateMixin {
288
250
width: MediaQuery .of (context).size.width,
289
251
height: MediaQuery .of (context).size.height,
290
252
decoration: BoxDecoration (
291
- color: widget.overlayColor,
253
+ color: widget.overlayColor
254
+ .withOpacity (widget.overlayOpacity),
292
255
),
293
256
),
294
257
)
295
258
: Container (
296
259
width: MediaQuery .of (context).size.width,
297
260
height: MediaQuery .of (context).size.height,
298
261
decoration: BoxDecoration (
299
- color: widget.overlayColor,
262
+ color: widget.overlayColor
263
+ .withOpacity (widget.overlayOpacity),
300
264
),
301
265
),
302
266
),
@@ -313,7 +277,6 @@ class _ShowcaseState extends State<Showcase> with TickerProviderStateMixin {
313
277
screenSize: screenSize,
314
278
title: widget.title,
315
279
description: widget.description,
316
- animationOffset: _slideAnimation,
317
280
titleTextStyle: widget.titleTextStyle,
318
281
descTextStyle: widget.descTextStyle,
319
282
container: widget.container,
@@ -324,6 +287,8 @@ class _ShowcaseState extends State<Showcase> with TickerProviderStateMixin {
324
287
contentWidth: widget.width,
325
288
onTooltipTap: _getOnTooltipTap,
326
289
contentPadding: widget.contentPadding,
290
+ disableAnimation: widget.disableAnimation,
291
+ animationDuration: widget.animationDuration,
327
292
),
328
293
],
329
294
)
0 commit comments