highlightable 1.0.5 copy "highlightable: ^1.0.5" to clipboard
highlightable: ^1.0.5 copied to clipboard

A text widget alternative, that highligts defined chars (from pattern / pure-string)

example/main.dart

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

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

class App extends StatelessWidget {
  const App({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) => const MaterialApp(home: Home());
}

class Home extends StatelessWidget {
  const Home({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("Highlightable Examples")),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(15),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              // Basic usage.
              HighlightText(
                'Only numbers: [1, 25, 50, ...] will be highlighted',
                // would highlight only numbers.
                highlight: const Highlight(pattern: r'\d'),
              ),

              const SizedBox(height: 50),

              // Custom Usage
              HighlightText(
                "Hello, Flutter!",
                // Would highlight only "Flutter"
                // full word 'cause [detectWords] is enabled.
                highlight: const Highlight(
                  words: ["Flutter"],
                ),
                caseSensitive: true, // Turn on case-sensitive.
                detectWords: true,
                style: const TextStyle(
                  fontSize: 25,
                  color: Colors.black,
                  fontWeight: FontWeight.bold,
                ),
                highlightStyle: const TextStyle(
                  fontSize: 25,
                  letterSpacing: 2.5,
                  color: Colors.white,
                  backgroundColor: Colors.blue,
                  fontWeight: FontWeight.bold,
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
14
likes
160
pub points
68%
popularity

Publisher

verified publishertheiskaa.com

A text widget alternative, that highligts defined chars (from pattern / pure-string)

Repository (GitHub)
View/report issues
Contributing

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on highlightable