https://github.com/nialixus/typewritertext
A simple typewriter text animation wrapper for flutter.
https://github.com/nialixus/typewritertext
dart flutter flutter-package pub-dev
Last synced: 7 months ago
JSON representation
A simple typewriter text animation wrapper for flutter.
- Host: GitHub
- URL: https://github.com/nialixus/typewritertext
- Owner: Nialixus
- License: mit
- Created: 2022-04-09T04:20:15.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-05-22T12:30:43.000Z (over 1 year ago)
- Last Synced: 2024-05-22T13:44:42.407Z (over 1 year ago)
- Topics: dart, flutter, flutter-package, pub-dev
- Language: Dart
- Homepage:
- Size: 1.05 MB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
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.
```yaml
dependencies:
typewritertext: ^3.0.9
```
## Usage
First, import the typewriter package.
```dart
import 'package:typewritertext/typewritertext.dart';
```
And use it like this
```dart
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.
```dart
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 like this one.
final streamController = TypeWriterController.fromStream(
StreamController().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