word_colorizer 1.0.0 copy "word_colorizer: ^1.0.0" to clipboard
word_colorizer: ^1.0.0 copied to clipboard

A Flutter package that enables dynamic text highlighting by specifying words to emphasize. Customize colors, fonts, and add interactivity for an engaging experience.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:word_colorizer/word_colorizer.dart';

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

class WordColorizerApp extends StatelessWidget {
  const WordColorizerApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Word Colorizer Demo',
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Word Colorizer Example'),
          backgroundColor: Colors.teal,
        ),
        body: const Center(
          child: Padding(
            padding: EdgeInsets.all(20.0),
            child: WordColorizer(
              text: "Flutter is powerful, open source, and fun!",
              highlightWordsWithColors: {
                "Flutter": Colors.blue,
                "open source": Colors.green,
                "fun": Colors.orange,
              },
              defaultColor: Colors.grey,
              textAlign: TextAlign.left,
              fontSize: 20,
              fontFamily: "google.Nunito",
              fontWeight: FontWeight.w900,
              fontStyle: FontStyle.italic,
              isHighlightClickable: true,
              onHighlightTap: {
                "Flutter": _onFlutterTap,
                "open source": _onOpenSourceTap,
                "fun": _onFunTap,
              },
              underlineHighlights: true,
              underlineColor: Colors.purple,
            ),
          ),
        ),
      ),
    );
  }

  static void _onFlutterTap() {
    debugPrint("Flutter tapped! Magic enabled.");
  }

  static void _onOpenSourceTap() {
    debugPrint("Open source tapped! Community power.");
  }

  static void _onFunTap() {
    debugPrint("Fun tapped! Let's party!");
  }
}
3
likes
140
points
47
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package that enables dynamic text highlighting by specifying words to emphasize. Customize colors, fonts, and add interactivity for an engaging experience.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, google_fonts

More

Packages that depend on word_colorizer