Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,27 @@ List<AnimatedTextExample> animatedTextExamples({VoidCallback? onTap}) =>
),
),
),

AnimatedTextExample(
label: 'Fade With Index',
color: Colors.brown[600],

child: DefaultTextStyle(
style: const TextStyle(
fontSize: 32.0,
fontWeight: FontWeight.bold,
),
child: AnimatedTextKit(
startIndex: 1,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove startIndex parameter from this example.

animatedTexts: [
FadeAnimatedText('do IT!'),
FadeAnimatedText('do it RIGHT!!'),
FadeAnimatedText('do it RIGHT NOW!!!'),
],
onTap: onTap,
),
),
),
AnimatedTextExample(
label: 'Typer',
color: Colors.lightGreen[800],
Expand Down
7 changes: 5 additions & 2 deletions lib/src/animated_text.dart
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this file changes since animated_text file has already been updated to handle this capability. Thank you.

Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,15 @@ class AnimatedTextKit extends StatefulWidget {
///
/// By default it is set to 3
final int totalRepeatCount;

final int startIndex;
const AnimatedTextKit({
Key? key,
required this.animatedTexts,
this.pause = const Duration(milliseconds: 1000),
this.displayFullTextOnTap = false,
this.stopPauseOnTap = false,
this.onTap,
this.startIndex = 0,
this.onNext,
this.onNextBeforePause,
this.onFinished,
Expand Down Expand Up @@ -150,6 +151,7 @@ class _AnimatedTextKitState extends State<AnimatedTextKit>

@override
void initState() {
_index = widget.startIndex< widget.animatedTexts.length?widget.startIndex:0;
super.initState();
_initAnimation();
}
Expand Down Expand Up @@ -212,8 +214,9 @@ class _AnimatedTextKitState extends State<AnimatedTextKit>
}

void _initAnimation() {

_currentAnimatedText = widget.animatedTexts[_index];

_controller = AnimationController(
duration: _currentAnimatedText.duration,
vsync: this,
Expand Down