text_style 0.0.2
text_style: ^0.0.2 copied to clipboard
A minimal Flutter package for quickly applying TextStyle with shorthand.
π¨ text_style #
A simple and expressive way to manage and reuse TextStyles in your Flutter apps.
With text_style, you can define a consistent typography system using shorthand syntax like:
Text('Hello', style: T.s16w700.white);
β¨ Features #
- Shorthand TextStyle syntax (e.g.
T.s14w400.primary) - Built-in extension methods for commonly used colors
- responsive fonts size
- Support for dynamic primary color
- Flexible and clean structure for typography management
- Works out of the box β no setup required!
π Getting Started #
1. Install the package #
Add to your pubspec.yaml:
dependencies:
text_style: ^0.0.2
Then run:
flutter pub get
2. Usage #
import 'package:text_style/text_style.dart';
Text(
'Welcome!',
style: T.s20w700.primary,
);
You can also use extensions for color:
Text(
'White Text',
style: T.s16w400.white,
);
Set the primary color globally:
TextStyleConfig.primaryColor = Colors.deepPurple;
π‘ Best Practices #
- Use
T.s14w400.primaryto maintain consistency across your app. - Use extensions like
.white,.black,.primaryto simplify styling. - Inject your theme's primary color once at the app level.
π§ͺ Example #
Check the example/text_style_example.dart folder for a full working demo.
π License #
This package is released under the MIT License.
See LICENSE for details.
β€οΈ Contributions #
Contributions, issues, and feature requests are welcome!
Feel free to open a pull request or an issue.
π« Contact #
For any questions or ideas, feel free to reach out!