Skip to content
Merged
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
20 changes: 20 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,26 @@
"contributions": [
"code"
]
},
{
"login": "Koniiro",
"name": "Koniiro",
"avatar_url": "https://avatars.githubusercontent.com/u/81352867?v=4",
"profile": "https://github.com/Koniiro",
"contributions": [
"doc"
]
},
{
"login": "CoderInTheWoods",
"name": "Kalgi Sheth",
"avatar_url": "https://avatars.githubusercontent.com/u/25412142?v=4",
"profile": "https://github.com/CoderInTheWoods",
"contributions": [
"code",
"example",
"doc"
]
}
],
"contributorsPerLine": 7,
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 4.2.0

**New Animated Text**

- Flicker Animated Text by [@CoderInTheWoods](https://github.com/CoderInTheWoods).

## 4.1.1

- `TypewriterAnimatedText` may now be customized to adjust the cursor.
Expand Down
41 changes: 40 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
- [Colorize](#colorize)
- [TextLiquidFill](#textliquidfill)
- [Wavy](#wavy)
- [Flicker](#flicker)
- [Create your own Animations](#create-your-own-animations)
- [Bugs or Requests](#bugs-or-requests)
- [Donate](#donate)
Expand All @@ -83,7 +84,7 @@ Add this to your package's `pubspec.yaml` file:

```yaml
dependencies:
animated_text_kit: ^4.1.1
animated_text_kit: ^4.2.0
```

### 2. Install it
Expand Down Expand Up @@ -427,6 +428,40 @@ return DefaultTextStyle(
);
```

## Flicker

<img src="https://github.com/aagarwal1012/Animated-Text-Kit/blob/master/display/flicker.gif?raw=true" align = "right" height = "300px">

```dart
return SizedBox(
width: 250.0,
child: DefaultTextStyle(
style: const TextStyle(
fontSize: 35,
color: Colors.white,
shadows: [
Shadow(
blurRadius: 7.0,
color: Colors.white,
offset: Offset(0, 0),
),
],
),
child: AnimatedTextKit(
repeatForever: true,
animatedTexts: [
FlickerAnimatedText('Flicker Frenzy'),
FlickerAnimatedText('Night Vibes On'),
FlickerAnimatedText("C'est La Vie !"),
],
onTap: () {
print("Tap Event");
},
),
),
);
```

## Create your own Animations

You can easily create your own animations by creating new classes that extend
Expand Down Expand Up @@ -486,6 +521,10 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center"><a href="https://medium.com/@abhayvashokan"><img src="https://avatars1.githubusercontent.com/u/35297280?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Abhay V Ashokan</b></sub></a><br /><a href="https://github.com/aagarwal1012/Animated-Text-Kit/commits?author=AbhayVAshokan" title="Code">💻</a></td>
<td align="center"><a href="https://linktr.ee/ritvij14"><img src="https://avatars.githubusercontent.com/u/51456744?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ritvij Kumar Sharma</b></sub></a><br /><a href="https://github.com/aagarwal1012/Animated-Text-Kit/commits?author=ritvij14" title="Code">💻</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/Koniiro"><img src="https://avatars.githubusercontent.com/u/81352867?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Koniiro</b></sub></a><br /><a href="https://github.com/aagarwal1012/Animated-Text-Kit/commits?author=Koniiro" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/CoderInTheWoods"><img src="https://avatars.githubusercontent.com/u/25412142?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kalgi Sheth</b></sub></a><br /><a href="https://github.com/aagarwal1012/Animated-Text-Kit/commits?author=CoderInTheWoods" title="Code">💻</a> <a href="#example-CoderInTheWoods" title="Examples">💡</a> <a href="https://github.com/aagarwal1012/Animated-Text-Kit/commits?author=CoderInTheWoods" title="Documentation">📖</a></td>
</tr>
</table>

<!-- markdownlint-restore -->
Expand Down
Binary file added display/flicker.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class AnimatedTextExample {
final String label;
final Color? color;
final Widget child;

const AnimatedTextExample({
required this.label,
required this.color,
Expand Down Expand Up @@ -311,6 +312,32 @@ List<AnimatedTextExample> animatedTextExamples({VoidCallback? onTap}) =>
),
),
),
AnimatedTextExample(
label: 'Flicker',
color: Colors.pink[300],
child: DefaultTextStyle(
style: const TextStyle(
fontSize: 35,
color: Colors.white,
shadows: [
Shadow(
blurRadius: 7.0,
color: Colors.white,
offset: Offset(0, 0),
),
],
),
child: AnimatedTextKit(
repeatForever: true,
animatedTexts: [
FlickerAnimatedText('Flicker Frenzy'),
FlickerAnimatedText('Night Vibes On'),
FlickerAnimatedText("C'est La Vie !"),
],
onTap: onTap,
),
),
),
AnimatedTextExample(
label: 'Combination',
color: Colors.pink,
Expand Down
1 change: 1 addition & 0 deletions lib/animated_text_kit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export 'src/colorize.dart';
export 'src/scale.dart';
export 'src/text_liquid_fill.dart';
export 'src/wavy.dart';
export 'src/flicker.dart';
98 changes: 98 additions & 0 deletions lib/src/flicker.dart
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.
///
/// ![Flicker example](https://raw.githubusercontent.com/aagarwal1012/Animated-Text-Kit/master/display/flicker.gif)
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();
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: animated_text_kit
description: A flutter package project which contains a collection of cool and beautiful text animations.
version: 4.1.1
version: 4.2.0
homepage: https://github.com/aagarwal1012/Animated-Text-Kit/
maintainer: Ayush Agarwal (@aagarwal1012)

Expand Down
10 changes: 10 additions & 0 deletions test/smoke_test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

// ignore: avoid_relative_lib_imports
import '../example/lib/main.dart';

Expand Down Expand Up @@ -102,6 +103,15 @@ void main() {
tapped = true;
},
),
// ignore: deprecated_member_use_from_same_package
FlickerAnimatedTextKit(
text: tripleText,
textStyle: textStyle,
displayFullTextOnTap: true,
onTap: () {
tapped = true;
},
),
];

for (var widget in tapableWidgets) {
Expand Down