Simplified Text Widget Package
A Flutter package that provides beautifully styled text widgets with enforced font consistency.
π¦ Installation
Use this package as a library
π Depend on it
Run this command:
With Flutter:
flutter pub add simplified_text_widget
π οΈ Setup Your Font
1. Add Font Files
Place your font files in:
your_project/
βββ assets/
βββ fonts/
βββ YourFont.ttf
2. Configure pubspec.yaml
Add this configuration (must use exact family name):
fonts:
- family: CustomTextFont _# β REQUIRED NAME_
fonts:
- asset: assets/fonts/YourFont.ttf
3. Clean & Rebuild
flutter pub get
π― Basic Usage
import 'package:simplified_text_widget/simplified_text_widget.dart';
_// Available variants: Text[Size]w[Weight]_
Text14w400('Regular 14px text');
Text16w700('Bold 16px text', color: Colors.blue);
β¨ All Customization Options
Text18w500(
'Fully customizable',
color: Colors.purple,
letterSpacing: 1.2,
height: 1.5,
maxLines: 2,
overflow: TextOverflow.ellipsis,
);
π Available Text Variants
| Size | Weights Available | Example |
|---|---|---|
| 10 | 100-900 | Text10w400 |
| 12 | 100-900 | Text12w700 |
| 14 | 100-900 | Text14w500 |
| ... | ... | ... |
| 48 | 100-900 | Text48w900 |
π§ VS Code Snippets (Optional but Recommended)
To boost your productivity and ensure consistency, we've included a set of VS Code snippets to instantly generate styled text widgets with predefined font sizes and weights.
β How to Use
1. Open VS Code
2. Go to `Preferences` β `Configure Snippets`
3. Choose `dart.json` (or create if it doesn't exist)
4. Copy contents from the provided `dart.json` file (available in package github)
5. Save and restart VS Code
Now you can type shortcuts like:
t14w4 β Text14w400('Your text here')
t18w7 β Text18w700('Bold title')
π¨ Troubleshooting
Font Not Working?
- Verify exact path matches:
assets/fonts/YourFont.ttf - Check family name is exactly
CustomTextFont - Ensure proper indentation in
pubspec.yaml - Run:
flutter clean
flutter pub get
Error: "Unable to locate asset"
- Double-check your font files exist at the specified path
- File names are case-sensitive
π License
MIT - See LICENSE for details.
Made with β€οΈ by Raian Ruku. Enjoy consistent typography in your Flutter apps!