curl_text 1.2.1
curl_text: ^1.2.1 copied to clipboard
A simple and flexible Flutter package for creating text with customizable outlines.
example/curl_text_example.dart
import 'package:curl_text/curl_text.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(
debugShowCheckedModeBanner: false,
theme: ThemeData.dark(),
home: const CurlTextDemoScreen(),
);
}
}
class CurlTextDemoScreen extends StatelessWidget {
const CurlTextDemoScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('CurlTextWidget — Examples')),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'1. Base example (Good)',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 8),
CurlTextWidget(
text: 'Hello, World!',
fontSize: 42,
textColor: Colors.white,
strokeColor: Colors.black,
strokeWidth: 6,
fontWeight: FontWeight.bold,
),
const Divider(height: 40),
// ==================== RTL ====================
const Text(
'2. RTL — Arabic text (Correct)',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 8),
CurlTextWidget(
text: '123 مرحبا بالعالم',
fontSize: 40,
textColor: Colors.cyanAccent,
strokeColor: Colors.deepPurple,
strokeWidth: 7,
fontWeight: FontWeight.w900,
textDirection: TextDirection.rtl,
),
const Divider(height: 40),
// ==================== Bad example ====================
const Text(
'3. Bad: Without textDirection in RTL environment',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.red,
),
),
const SizedBox(height: 8),
CurlTextWidget(
text: '123 مرحبا بالعالم',
fontSize: 36,
textColor: Colors.white,
strokeColor: Colors.black,
strokeWidth: 5,
fontWeight: FontWeight.bold,
// textDirection not specified — will be a problem!
),
const Divider(height: 40),
// ==================== Good examples ====================
const Text(
'4. letterSpacing, height and wordSpacing (Good)',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
CurlTextWidget(
text: 'STYLISH TEXT',
fontSize: 38,
textColor: Colors.yellow,
strokeColor: Colors.red,
strokeWidth: 5,
fontWeight: FontWeight.w900,
letterSpacing: 6,
height: 1.9,
wordSpacing: 10,
),
const SizedBox(height: 30),
const Text(
'5. maxLines and overflow (Good)',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
CurlTextWidget(
text:
'Very long text that should be wrapped or truncated correctly',
fontSize: 24,
textColor: Colors.white,
strokeColor: Colors.blue,
strokeWidth: 4,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
const Divider(height: 40),
const Text(
'6. shadows (Looks cool)',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
CurlTextWidget(
text: "SHADOW TEXT",
fontSize: 50,
textColor: Colors.white,
strokeColor: Colors.green,
strokeWidth: 4,
fontWeight: FontWeight.bold,
shadows: [
const Shadow(
offset: Offset(3, 3),
blurRadius: 8,
color: Colors.greenAccent,
),
],
),
const Divider(height: 40),
// 7. Glow animation
CurlTextWidget(
text: "NEON TEXT",
fontSize: 48,
textColor: Colors.white,
strokeColor: Colors.cyan,
strokeWidth: 6,
enableGlowAnimation: true,
glowIntensity: 1.3,
),
],
),
),
);
}
}