flutter_sketchy_text 2.0.0 copy "flutter_sketchy_text: ^2.0.0" to clipboard
flutter_sketchy_text: ^2.0.0 copied to clipboard

Library to create sketchy text. with highlight, underline, strikethrough, circle and rectangle.

Flutter Sketchy Text 🎨✍️ #

Flutter Sketchy Text is a fun and dynamic package that brings a human-like, hand-drawn text animation to your Flutter apps. It provides effects like highlighting, underlining, circling, strikethrough, and more to create lively and engaging text animations.

πŸ“Œ Live Demo:
Abdul Wahab Khan


πŸ“Έ Example Preview #

Demo


✨ Features #

βœ”οΈ Sketchy Text Effects – Highlight, Underline, Strikethrough, Circle, and Rectangle animations.
βœ”οΈ Smooth Hand-Drawn Look – Mimics human-like drawing with organic strokes.
βœ”οΈ Customizable – Adjust animation speed, colors, and delays.
βœ”οΈ Lightweight & Easy to Use – Simple API for quick integration.
βœ”οΈ Supports Plain & Organic Modes – Choose between a precise straight-line effect or a natural hand-drawn style.


Getting started #

TODO: List prerequisites and provide or point to information on how to start using the package.

πŸ“¦ Installation #

Add the package to your pubspec.yaml:

  flutter_sketchy_text: latest_version

Run the command:

flutter pub get

Add the package to your pubspec.yaml:

  flutter_sketchy_text: latest_version

πŸš€ Usage #

1️⃣ Define Sketchy Models

Create headings and paragraphs with different animation styles:

/// **Sketchy Models for Headings**
final plainHeadingModel = SketchyModel(
  paragraph: "Plain Animation",
  highlightSentances: [
    SketchySentance(
      text: "Plain Animation",
      textStyle: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
    ),
  ],
);

final organicHeadingModel = SketchyModel(
  paragraph: "Organic Animation",
  highlightSentances: [
    SketchySentance(
      text: "Organic Animation",
      textStyle: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
    ),
  ],
);

/// **Paragraph with words highlighted using sketchy effects.**
SketchyModel paragraphModel = SketchyModel(
  paragraph: """
Flutter Sketchy Text makes animations fun!
You can use highlighted text, underlined words,
circled techniques, strikethrough effects,
or rectangled challenges to bring text to life.
""",
  highlightSentances: [
    SketchySentance(text: "highlighted text", sketchyType: SketchyType.highlight),
    SketchySentance(text: "underlined words", sketchyType: SketchyType.underline),
    SketchySentance(text: "circled techniques", sketchyType: SketchyType.circle),
    SketchySentance(text: "strikethrough effects", sketchyType: SketchyType.strikethrough),
    SketchySentance(text: "rectangled challenges", sketchyType: SketchyType.rectangle),
  ],
);

2️⃣ Display Plain & Organic Animations Together

Use SketchyParagraph to render the animated text inside your widget tree:

void main() {
  runApp(const MyApp());
}

/// **Main Application Widget**
class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Sketchy Text Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(),
    );
  }
}

/// **Home Page with Plain and Organic Animations**
class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Flutter Sketchy Text Demo')),
      body: Padding(
        padding: const EdgeInsets.all(20),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            /// **Plain Animation**
            SketchyParagraph(
              paragraph: plainHeadingModel.paragraph,
              highlights: plainHeadingModel.highlightSentances,
              animationMode: SketchyAnimationMode.plain,
            ),
            SketchyParagraph(
              paragraph: paragraphModel.paragraph,
              highlights: paragraphModel.highlightSentances,
              animationMode: SketchyAnimationMode.plain,
            ),

            const SizedBox(height: 20),

            /// **Organic Animation**
            SketchyParagraph(
              paragraph: organicHeadingModel.paragraph,
              highlights: organicHeadingModel.highlightSentances,
              animationMode: SketchyAnimationMode.organic,
            ),
            SketchyParagraph(
              paragraph: paragraphModel.paragraph,
              highlights: paragraphModel.highlightSentances,
              animationMode: SketchyAnimationMode.organic,
            ),
          ],
        ),
      ),
    );
  }
}

βš™οΈ Customization #

Each sketchy effect can be customized using the SketchySentance properties:

SketchySentance(
  text: 'Flutter is awesome!',
  sketchyColor: Colors.purple.withValues(alpha: 0.4), // Custom color
  sketchyType: SketchyType.circle, // Choose an effect
  duration: const Duration(milliseconds: 500), // Speed of the animation
  onTap: () => debugPrint('Flutter is awesome! tapped'), // Action when tapped
),

🎭 Plain vs. Organic Mode #

You can choose between two animation styles:

1️⃣. Plain Mode: Perfect straight-line animations for a clean effect. 2️⃣. Organic Mode: Hand-drawn, wavy lines for a natural effect.

SketchyParagraph(
  paragraph: paragraphModel.paragraph,
  highlights: paragraphModel.highlightSentances,
  animationMode: SketchyAnimationMode.plain,  // 🟒 Straight-line animation
)
SketchyParagraph(
  paragraph: paragraphModel.paragraph,
  highlights: paragraphModel.highlightSentances,
  animationMode: SketchyAnimationMode.organic, // πŸ”΅ Hand-drawn animation
)

🀝 Contributing #

Want to improve Flutter Sketchy Text? Contributions are welcome!

Steps to Contribute:

  1. Fork the Repo – Click the β€œFork” button on GitHub
  2. Clone Your Fork – git clone https://github.com/Wahab-Khan/flutter_sketchy_text.git
  3. Create a Branch – git checkout -b my-feature
  4. Make Your Changes – Improve animations, fix bugs, or optimize code
  5. Push Your Changes – git push origin my-feature
  6. Create a Pull Request – Submit your PR for review

πŸ“œ License #

This project is licensed under the MIT License.

πŸ’‘ Enjoy using Flutter Sketchy Text? Give it a ⭐ on GitHub! πŸš€


πŸŽ‰ Final Thoughts #

Now you have everything you need to add sketchy text animations to your Flutter app with ease. Whether you’re aiming for a clean-cut look or a hand-drawn feel, this package has you covered! βœοΈπŸŽ¨πŸš€

6
likes
0
points
42
downloads

Publisher

unverified uploader

Weekly Downloads

Library to create sketchy text. with highlight, underline, strikethrough, circle and rectangle.

Repository (GitHub)
View/report issues

Topics

#sketchy #text #highlight #underline #animated

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_sketchy_text