rich_highlight_text_codespark 0.0.2 copy "rich_highlight_text_codespark: ^0.0.2" to clipboard
rich_highlight_text_codespark: ^0.0.2 copied to clipboard

Adds extension methods to highlight substrings in Text or String using Text.rich and custom styles. Simple inline highlighting with minimal code.

example/main.dart

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

void main() => runApp(const HighlightExampleApp());

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Rich Highlight Demo',
      home: Scaffold(
        backgroundColor: Colors.white,
        appBar: AppBar(title: const Text('Rich Highlight Example')),
        body: const Center(child: HighlightDemo()),
      ),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(16),
      child: Text(
        'Hello, Sai Kiran! Welcome to Flutter.' * 9,
        style: const TextStyle(color: Colors.red, fontSize: 18),
        textAlign: TextAlign.center,
        maxLines: 2,
        overflow: TextOverflow.ellipsis,
      ).highlight(
        'Kiran',
        highlightStyle: const TextStyle(
          color: Colors.red,
          fontWeight: FontWeight.bold,
        ),
        textAlign: TextAlign.center,
        maxLines: 2,
        overflow: TextOverflow.ellipsis,
      ),
    );
  }
}
5
likes
150
points
61
downloads
screenshot

Publisher

verified publisherksaikiran.tech

Weekly Downloads

Adds extension methods to highlight substrings in Text or String using Text.rich and custom styles. Simple inline highlighting with minimal code.

Repository (GitHub)

Topics

#text #highlight #richtext #inline-style #textspan

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on rich_highlight_text_codespark