-
-
Notifications
You must be signed in to change notification settings - Fork 324
Added new animated text - Flicker Animation #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
aagarwal1012
merged 6 commits into
aagarwal1012:v4.2.0
from
CoderInTheWoods:issue234_effect12_kalgisheth
Apr 14, 2021
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bc97011
Added new animated text - Flicker Animation
CoderInTheWoods 223c9aa
Update Comments and Tried to Fix the Smoke Test
CoderInTheWoods 94a4789
Smoke Test Passed
CoderInTheWoods 2ff1860
Using FlickerAnimatedText class instead of FlickerAnimatedTextKit class
CoderInTheWoods 181f5e6
Updated README with Flicker Animation as per Version 3
CoderInTheWoods f12878f
Updated README with Flicker Animation, changed a minor error in READM…
CoderInTheWoods File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'animated_text.dart'; | ||
|
|
||
| /// Animated Text that displays a [Text] element, as a flickering glow text. | ||
| /// | ||
| ///  | ||
| class FlickerAnimatedText extends AnimatedText { | ||
| /// Marks ending of flickering entry interval of text | ||
| final double entryEnd; | ||
| final Duration speed; | ||
|
|
||
| FlickerAnimatedText( | ||
| String text, { | ||
| TextAlign textAlign = TextAlign.start, | ||
| TextStyle? textStyle, | ||
| this.speed = const Duration(milliseconds: 1600), | ||
| this.entryEnd = 0.5, | ||
| }) : super( | ||
| text: text, | ||
| textStyle: textStyle, | ||
| duration: speed, | ||
| ); | ||
|
|
||
| late Animation<double> _entry; | ||
|
|
||
| @override | ||
| void initAnimation(AnimationController controller) { | ||
| _entry = Tween<double>(begin: 0.0, end: 1.0).animate( | ||
| CurvedAnimation( | ||
| parent: controller, | ||
| curve: Interval(0.0, entryEnd, curve: Curves.bounceIn), | ||
| ), | ||
| ); | ||
| } | ||
|
|
||
| @override | ||
| Widget completeText(BuildContext context) => SizedBox.shrink(); | ||
|
|
||
| @override | ||
| Widget animatedBuilder(BuildContext context, Widget? child) { | ||
| return Opacity( | ||
| opacity: _entry.value != 1.0 ? _entry.value : _entry.value, | ||
| child: textWidget(text), | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| @Deprecated('Use AnimatedTextKit with FlickerAnimatedText instead.') | ||
| class FlickerAnimatedTextKit extends AnimatedTextKit { | ||
| FlickerAnimatedTextKit({ | ||
| Key? key, | ||
| required List<String> text, | ||
| TextAlign textAlign = TextAlign.start, | ||
| TextStyle? textStyle, | ||
| TextDirection textDirection = TextDirection.ltr, | ||
| Duration speed = const Duration(milliseconds: 1600), | ||
| double entryEnd = 0.5, | ||
| VoidCallback? onTap, | ||
| void Function(int, bool)? onNext, | ||
| void Function(int, bool)? onNextBeforePause, | ||
| VoidCallback? onFinished, | ||
| bool isRepeatingAnimation = true, | ||
| int totalRepeatCount = 3, | ||
| bool repeatForever = false, | ||
| bool displayFullTextOnTap = false, | ||
| bool stopPauseOnTap = false, | ||
| }) : super( | ||
| key: key, | ||
| animatedTexts: | ||
| _animatedTexts(text, textAlign, textStyle, speed, entryEnd), | ||
| onTap: onTap, | ||
| onNext: onNext, | ||
| onNextBeforePause: onNextBeforePause, | ||
| onFinished: onFinished, | ||
| isRepeatingAnimation: isRepeatingAnimation, | ||
| totalRepeatCount: totalRepeatCount, | ||
| repeatForever: repeatForever, | ||
| displayFullTextOnTap: displayFullTextOnTap, | ||
| stopPauseOnTap: stopPauseOnTap, | ||
| ); | ||
|
|
||
| static List<AnimatedText> _animatedTexts( | ||
| List<String> text, | ||
| TextAlign textAlign, | ||
| TextStyle? textStyle, | ||
| Duration speed, | ||
| double entryEnd, | ||
| ) => | ||
| text | ||
| .map((_) => FlickerAnimatedText( | ||
| _, | ||
| textAlign: textAlign, | ||
| textStyle: textStyle, | ||
| speed: speed, | ||
| entryEnd: entryEnd, | ||
| )) | ||
| .toList(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.