typewritertext
3.0.9A simple typewriter text animation wrapper for flutter. Supports iOS, Android, web, Windows, macOS, and Linux.
Readme
Type Writer Text
A simple typewriter text animation wrapper for flutter, supports iOS, Android, web, Windows, macOS, and Linux.
Preview
Install
Add this line to your pubspec.yaml.
dependencies:
typewritertext: ^3.0.9
Usage
First, import the typewriter package.
import 'package:typewritertext/typewritertext.dart';
And use it like this
TypeWriter.text(
'lorem ipsum dolot sit amet ...',
duration: const Duration(milliseconds: 50),
);
And for the builder, you need to initiate a controller like this one.
final controller = TypeWriterController(text: 'Hello World',
duration: const Duration(milliseconds: 50),
);
// also if you want the typewriter to not only changing
// the character but also words, you can use this controller.
final valueController = TypeWriterController.fromValue(
TypeWriterValue([
'First Paragraph',
'Next Paragraph',
'Last Paragraph',
]),
duration: const Duration(milliseconds: 50),
);
// you can also integrate the controller with Stream<String> like this one.
final streamController = TypeWriterController.fromStream(
StreamController<String>().stream
);
TypeWriter(
controller: controller, // valueController // streamController
builder: (context, value) {
return Text(
value.text,
maxLines: 2,
minFontSize: 2.0,
);
}
);
Documentation
TypeWriter.text
| Property | Purpose |
|---|---|
| repeat | Specifies whether the animation should repeat once completed (default is false). |
| enabled | Is the flag to play the animation or not. |
| maintainSize | Specifies whether the size of the layout text should be maintained. |
| duration | Delay time between each character. |
| alignment | Alignment of the text layout. |
| text | The text to be displayed during the typewriter animation. |
| onChanged | Callback function for when the text is changed. |
| textAlign | Alignment of the text. |
| style | Style of the text. |
| maxLines | Maximum number of lines to be displayed. |
| overflow | Overflow behavior of the text. |
| semanticsLabel | Semantics label of the text. |
| softWrap | Specifies whether the text should break at soft line breaks. |
| strutStyle | Strut style of the text. |
| locale | Locale of the text. |
| textDirection | Text direction of the text. |
| textHeightBehavior | Text height behavior of the text. |
| textWidthBasis | Text width basis of the text. |
| selectionColor | Color of the selection. |
| onFinished | Is a callback that triggered when the animation is done. This requires [enabled] as true and repeat as false. |
TypeWriter
| Property | Purpose |
|---|---|
| controller | Controller that manage the animation. You can use TypeWriterController or TypeWriterController.fromValue. |
| enabled | Is the flag to play the animation or not. |
| builder | Builder that contains TypeWriterValue in sequence. |
| onFinished | Is a callback that triggered when the animation is done. This requires [enabled] as true and repeat as false. |
Example
- typewritertext/example/lib/main.dart
Changelog
0.0.1
- Initial release.
1.0.0
- Add alignment and documentation.
1.1.0
- Change documentation.
1.2.0
- Hide Library.
1.3.0
- Fix empty string case.
1.4.0
- Fix state used after being disposed.
1.5.0
- Migrate from provider to statefulwidget.
1.6.0
- Update documentation.
1.7.0
- Add Repeat & Dispose
1.8.0
- Update Documentation
1.9.0
- Add WidgetsBinding
2.0.0
- Change Timer to TickerProvider
2.1.0
- Add TypeWriterText.builder
2.2.0
- Update pubspec
2.3.0
- Fix Changelog
2.3.1-new
- Remove deprecated
textScaleFactor
3.0.0
- Add TypeWriter v3
3.0.1
- Calling stop before dispose
3.0.2
- Add assertion of text length
- Update readme
3.0.3
- Add
onFinishedcallback.
3.0.4
- Added
Mountedchecker for safety - Deprecated
TypeWriterText - Split the library into
TypeWriter(v3) andTypeWriterText(v1) - Increase Unit Test
3.0.5
- Fix README
3.0.6
- Merge library
3.0.7
- Fix text overflow clipped
- Add
TypeWriterController.fromStream - Support emoji in text
3.0.8
- Add
TypeWriterController.fromStreamdocumentation - Add
autorunparameter inTypeWriterControllerandTypeWriterController.fromValue - Add try and catch in getting index
- Now support empty string
3.0.9
- Add try & catch in returning text
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add typewritertextpubspec.yaml
name: typewritertext
description: A simple typewriter text animation wrapper for flutter. Supports iOS, Android, web, Windows, macOS, and Linux.
version: 3.0.9
homepage: https://inidia.app
repository: https://github.com/Nialixus/typewritertext.git
issue_tracker: https://github.com/Nialixus/typewritertext/issues
funding:
- https://ko-fi.com/nialixus
screenshots:
- description: "TypeWriter Logo"
path: logo.png
topics:
- utility
- animation
environment:
sdk: ">=2.17.0 <4.0.0"
flutter: ">=1.17.0"
dependencies:
flutter:
sdk: flutter
dev_dependencies:
flutter_lints: ^3.0.1
flutter_test:
sdk: flutter
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.0.1 | On demand | Download | f4fbbefa…3eacba |
| 1.0.0 | On demand | Download | 78cc9d92…5108f0 |
| 1.1.0 | On demand | Download | 8931ba48…59fd6e |
| 1.2.0 | On demand | Download | ae0a9ab1…a31dfd |
| 1.3.0 | On demand | Download | 230edc71…0b3990 |
| 1.4.0 | On demand | Download | c3c0f79c…6d2d23 |
| 1.5.0 | On demand | Download | 9c609a80…bd1321 |
| 1.6.0 | On demand | Download | 90ffdccb…93f429 |
| 1.7.0 | On demand | Download | cd85a69b…76e771 |
| 1.8.0 | On demand | Download | 2b69baf6…594e32 |
| 1.9.0 | On demand | Download | b21e3a5b…5e2b42 |
| 2.0.0 | On demand | Download | 9036d872…226858 |
| 2.1.0 | On demand | Download | 4b533690…93a3ed |
| 2.2.0 | On demand | Download | b441bb15…5b9efa |
| 2.3.0 | On demand | Download | 1b21e01d…69be0c |
| 2.3.1-new | On demand | Download | 455bad9b…683ba0 |
| 2.3.1 | On demand | Download | d787ea21…bc4ed3 |
| 3.0.0 | On demand | Download | b065a2f5…22baac |
| 3.0.1 | On demand | Download | 13cc8fa5…7d0e91 |
| 3.0.2 | On demand | Download | b7989683…286ffe |
| 3.0.3 | On demand | Download | 918686ee…84912f |
| 3.0.4 | On demand | Download | b1186604…937938 |
| 3.0.5 | On demand | Download | c13fe8c9…fea9c9 |
| 3.0.6 | On demand | Download | fc4a2ae6…5bb2db |
| 3.0.7 | On demand | Download | 007e8b47…320a80 |
| 3.0.8 | On demand | Download | acfe1974…03f9c7 |
| 3.0.9 | Cached · Upstream SHA-256 matched | Download | c6b90cdc…3212b2 |
Dependencies
flutter {
"sdk": "flutter"
}