keyboard_typing 0.0.4
keyboard_typing: ^0.0.4 copied to clipboard
Creates an animation effect where the text appears as if it's being typed on a keyboard.
KeyboardTyping Widget #
🌱 Getting Started #
Add
flutter pub add keyboard_typing
Import
import 'package:keyboard_typing/keyboard_typing.dart';
🌤 Update #
- If you define
previewTextColor
paremeter, you can see preview TextWidget's data.
KeyboardTyping(
text: Text("Something Text"),
previewTextColor: Colors.grey.withOpacity(0.5),
)
🚀 Usage #
- If you don't define a
KeyboardTypingController
, TheKeyboardTyping
Widget plays automatically.
Create KeyboardTyping Widget ⌨
parameter | required | type | default |
---|---|---|---|
text | ✔️ | Text | |
controller | ❌ | KeyboardTypingController? | |
previewTextColor | ❌ | Color? | |
mode | ❌ | KeyboardTypingMode | KeyboardTypingMode.normal |
duration | ❌ | Duration? | Duration(milliseconds: 150) |
KeyboardTyping(
text: Text("Something Text"),
)
Play Typing Animation 🚩
KeyboardTypingController controller = KeyboardTypingController();
controller.play();
Stop Typing Animation 🚧
KeyboardTypingController controller = KeyboardTypingController();
controller.stop();
Repeat Typing Animation 🌀
KeyboardTyping(
text: Text("Something Text"),
mode: KeyboardTypingMode.repeat,
)
Listen Typing event state 🎈
controller.addStateEventListener((KeyboardTypingState state) {
setState(() {
switch (state) {
case KeyboardTypingState.idle:
// TODO: Handle this case.
case KeyboardTypingState.active:
// TODO: Handle this case.
case KeyboardTypingState.pause:
// TODO: Handle this case.
case KeyboardTypingState.stop:
// TODO: Handle this case.
case KeyboardTypingState.complete:
// TODO: Handle this case.
}
});
},);
// remove
// controller.removeStateEventListener(...);