ttext_widget 1.0.0
ttext_widget: ^1.0.0 copied to clipboard
Enhanced text widget with simplified styling options for Flutter.
example/lib/main.dart
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'TText Widget Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
useMaterial3: true,
),
home: const TTextDemo(),
);
}
}
class TTextDemo extends StatelessWidget {
const TTextDemo({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('TText Widget Demo'),
elevation: 2,
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildSection('Font Weights', [
const TText('Thin (w100)', style: TText.w100, size: 20),
const TText('Light (w300)', style: TText.w300, size: 20),
const TText('Normal (w400)', style: TText.w400, size: 20),
const TText('Medium (w500)', style: TText.w500, size: 20),
const TText('Semi-Bold (w600)', style: TText.w600, size: 20),
const TText('Bold (w700)', style: TText.bold, size: 20),
const TText('Extra-Bold (w800)', style: TText.w800, size: 20),
const TText('Black (w900)', style: TText.w900, size: 20),
]),
const Divider(height: 40),
_buildSection('Text Styles', [
const TText('Italic Text', style: TText.italic, size: 20),
const TText('Underlined Text', style: TText.underline, size: 20),
const TText('Bold Italic', style: TText.boldItalic, size: 20),
]),
const Divider(height: 40),
_buildSection('Colors', [
const TText('Red Color', color: TText.red, size: 20),
const TText('Blue Color', color: TText.blue, size: 20),
const TText('Green Color', color: TText.green, size: 20),
const TText('Purple Color', color: TText.purple, size: 20),
const TText('Orange Color', color: TText.orange, size: 20),
const TText('Teal Color', color: TText.teal, size: 20),
]),
const Divider(height: 40),
_buildSection('Special Effects', [
const TText('Text with Shadow', shadow: true, size: 20),
const TText('Letter Spacing', spacing: 3, size: 20),
const TText('uppercase text', uppercase: true, size: 20),
const TText(
'Combined Effects',
size: 24,
color: TText.deepPurple,
style: TText.bold,
shadow: true,
spacing: 1.5,
),
]),
const Divider(height: 40),
_buildSection('Complex Example', [
const TText(
'hello flutter',
size: 32,
color: TText.blue,
style: TText.boldItalic,
uppercase: true,
shadow: true,
spacing: 2,
),
]),
],
),
),
);
}
Widget _buildSection(String title, List<Widget> children) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(bottom: 12),
child: Text(
title,
style: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
),
...children.map((widget) => Padding(
padding: const EdgeInsets.only(bottom: 8),
child: widget,
)),
],
);
}
}