my_custom_text_package 0.0.7
my_custom_text_package: ^0.0.7 copied to clipboard
A lightweight Flutter package providing a next-gen customizable text widget and utility classes for reusable UI components.
My Custom Text Package #
A lightweight Flutter package providing a next-gen customizable text widget and utility classes for reusable UI components.
Features #
- Fully customizable font, size, color, letter spacing, word spacing
- Handles text overflow and max lines
- Selectable text support
- RichText support for mentions (
@user), hashtags (#flutter), and emojis - Tap callbacks per word/mention/hashtag
- Gradient text support and animated gradients
- Shadow and glow effects
- Predefined style presets (
title,subtitle,body,caption,buttonText) - Pub.dev-ready
textScalerfor non-linear text scaling
Requirements #
- Flutter 3.12 or higher
Installation #
Add this to your pubspec.yaml:
dependencies:
my_custom_text_package: ^0.0.7
Usage #
- Basic Text
CustomTextWidget(
text: 'Hello Flutter!',
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.deepPurple,
textAlign: TextAlign.center,
);
- Rich Text with Mentions & Hashtags
CustomTextWidget(
text: 'Hello @user! Check out #Flutter',
richTextMode: true,
onTapWord: (word) {
if (word.startsWith('@')) print('Tapped mention: $word');
if (word.startsWith('#')) print('Tapped hashtag: $word');
},
fontSize: 18,
fontWeight: FontWeight.w500,
color: Colors.black87,
);
- Gradient Text
CustomTextWidget(
text: 'Gradient Text Example',
fontSize: 24,
fontWeight: FontWeight.bold,
gradient: LinearGradient(
colors: [Colors.blue, Colors.purple],
),
);
- Animated Gradient Text
CustomTextWidget(
text: 'Animated Gradient!',
fontSize: 28,
fontWeight: FontWeight.bold,
gradient: LinearGradient(
colors: [Colors.red, Colors.orange, Colors.yellow],
),
animatedGradient: true,
);
- Text with Shadows
CustomTextWidget(
text: 'Text with Shadow',
fontSize: 24,
fontWeight: FontWeight.bold,
shadows: const [
Shadow(
color: Colors.black26,
offset: Offset(2, 2),
blurRadius: 4,
),
],
);
- Selectable Text
CustomTextWidget(
text: 'You can select this text!',
selectable: true,
fontSize: 18,
color: Colors.teal,
);
- Using Preset Styles
CustomTextWidget(
text: 'Title Preset',
preset: TextPresets.title,
);
CustomTextWidget(
text: 'Subtitle Preset',
preset: TextPresets.subtitle,
);