# typewritertext 3.0.9

A simple typewriter text animation wrapper for flutter. Supports iOS, Android, web, Windows, macOS, and Linux.




## Installing
```
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add 'typewritertext:3.0.9'
```
Published: 2024-09-14T08:02:08.110460Z
Expected archive SHA-256: c6b90cdc9f7fd7ae3235d9c926012000f7a1765cd49d67b78370dc61123212b2

Available in cache; verification: upstream_checksum
## Direct dependencies
- flutter: map[sdk:flutter]

## Package README (untrusted upstream documentation)
<p align="center">
  <img src="https://user-images.githubusercontent.com/45191605/272785686-7a626063-6047-463a-b931-db256c708335.png" alt="TypeWeriter Text Dall-E Logo" width="150">
</p>

# Type Writer Text

<a href='https://pub.dev/packages/typewritertext'><img src='https://img.shields.io/pub/v/typewritertext.svg?logo=flutter&color=blue&style=flat-square'/></a>
<a href="https://codecov.io/gh/Nialixus/typewritertext"><img src="https://codecov.io/gh/Nialixus/typewritertext/graph/badge.svg?token=T66X1R33QE"/></a>
<a href="https://github.com/Nialixus/typewritertext/actions"><img src="https://github.com/Nialixus/typewritertext/actions/workflows/test_coverage.yaml/badge.svg" alt="test"/></a>
\
\
A simple typewriter text animation wrapper for flutter, supports iOS, Android, web, Windows, macOS, and Linux.

## Preview

<img src="https://github.com/user-attachments/assets/451d0265-dd2d-4134-807d-a02e1f17b8bb" alt="TypeWriterText Preview" width="300">


## 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<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

- <a href="https://github.com/Nialixus/typewritertext/blob/master/example/lib/main.dart">typewritertext/example/lib/main.dart</a>

## 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 `onFinished` callback.

## 3.0.4

- Added `Mounted` checker for safety
- Deprecated `TypeWriterText`
- Split the library into `TypeWriter` (v3) and `TypeWriterText` (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.fromStream` documentation
- Add `autorun` parameter in `TypeWriterController` and `TypeWriterController.fromValue`
- Add try and catch in getting index
- Now support empty string

## 3.0.9

- Add try & catch in returning text






 
