Flutter Streaming Text Markdown
A Flutter package that provides a customizable widget for displaying text and markdown content with typing animation effects.
Features
- 📝 Supports both plain text and markdown content
- ⌨️ Customizable typing animation
- 🎭 Word-by-word or character-by-character typing
- ✨ Fade-in animation effects
- 🌐 RTL (Right-to-Left) language support
- 📱 Responsive and customizable design
- 🎯 Interactive tap-to-complete feature (skip animation)
Installation
Add this to your package's pubspec.yaml
file:
dependencies:
flutter_streaming_text_markdown: ^1.0.0
Usage
Basic Example
StreamingTextMarkdown(
text: '''# Welcome! 👋
This is a **demo** of streaming text with *markdown* support.''',
typingSpeed: Duration(milliseconds: 50),
fadeInEnabled: true,
)
Advanced Example
StreamingTextMarkdown(
text: markdownText,
initialText: 'Loading...\n\n',
fadeInEnabled: true,
fadeInDuration: Duration(milliseconds: 300),
wordByWord: true,
typingSpeed: Duration(milliseconds: 100),
textDirection: TextDirection.ltr,
textAlign: TextAlign.left,
onComplete: () {
print('Animation complete!');
},
)
Configuration
Property | Type | Description |
---|---|---|
text |
String |
The text content to display |
initialText |
String? |
Initial text to show before animation starts |
typingSpeed |
Duration |
Speed of typing animation |
wordByWord |
bool |
Whether to animate word by word |
chunkSize |
int |
Number of characters to reveal at once |
fadeInEnabled |
bool |
Enable fade-in animation |
fadeInDuration |
Duration |
Duration of fade-in animation |
textDirection |
TextDirection? |
Text direction (LTR or RTL) |
textAlign |
TextAlign? |
Text alignment |
onComplete |
VoidCallback? |
Callback when animation completes |
Markdown Support
The widget supports common markdown syntax:
- Headers (
#
,##
,###
) - Bold text (
**text**
or__text__
) - Italic text (
*text*
or_text_
) - Lists (ordered and unordered)
- Line breaks
RTL Support
For right-to-left languages:
StreamingTextMarkdown(
text: '''# مرحباً بكم! 👋
هذا **عرض توضيحي** للنص المتدفق.''',
textDirection: TextDirection.rtl,
textAlign: TextAlign.right,
)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.