flutter_keyword_highlighter 1.1.1 copy "flutter_keyword_highlighter: ^1.1.1" to clipboard
flutter_keyword_highlighter: ^1.1.1 copied to clipboard

A flexible Flutter package for highlighting specific keywords and characters in text with customizable styles, making it perfect for text-based applications and user interfaces.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Keyword Highlighter Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const HighlightExampleScreen(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text(
          'Keyword Highlighter Example',
          style: TextStyle(fontSize: 18.0),
        ),
      ),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: HighlightedText(
          content:
              'Flutter is an open-source UI software development toolkit created by Google Googleee. It is used to develop cross-platform applications for Android, iOS, Linux, and more.',
          defaultTextStyle: const TextStyle(
            fontSize: 16.0,
          ),
          highlightedTextStyles: [
            HighlightedTextStyle(
              highlightedText: 'Flutter',
              customStyle: const TextStyle(
                  color: Colors.blue, fontWeight: FontWeight.bold),
              allowsPartialMatch:
                  true, // Highlights any occurrence of "Flutter"
            ),
            HighlightedTextStyle(
              highlightedText: 'Google',

              customStyle: const TextStyle(
                  color: Colors.green, fontStyle: FontStyle.italic),
              allowsPartialMatch:
                  false, // Highlights exact word match for "Google"
            ),
            HighlightedTextStyle(
              highlightedText: 'applications',
              customStyle: const TextStyle(
                  backgroundColor: Colors.yellow,
                  color: Colors.red,
                  fontWeight: FontWeight.w600),
            ),
          ],
        ),
      ),
    );
  }
}
3
likes
160
points
29
downloads

Publisher

unverified uploader

Weekly Downloads

A flexible Flutter package for highlighting specific keywords and characters in text with customizable styles, making it perfect for text-based applications and user interfaces.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_keyword_highlighter