riching_text 0.1.1 copy "riching_text: ^0.1.1" to clipboard
riching_text: ^0.1.1 copied to clipboard

Build a rich text by providing a text and the words/phrases you want to highlight within.

RichingText
#

Build a rich text and highlight actionable words/phrases within.

Motivation #

Sometimes we need to create a RichText containing many TextSpan depending on the different styles we would like to apply to each substring. To do so, we need to create all the substrings separately which does not make much sense independently.

Therefore, RichingText is a new way of creating rich text by specifying the whole meaningful text. Then, create a list of words or phrases you would like to highlight within the main text. Furthermore, you can specify the style for both the whole text and the highlighted word/phrase. Additionally, you can make the highlighted text actionable so you can execute an action when the word/phrase is pressed.

coverage

Usage #

void main() => runApp(MyApp());

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(),
      home: Scaffold(
        appBar: AppBar(title: const Text('RichingText')),
        body: RichingText(
          highlights: [
            const ActionableText(
              text: 'RichingText example',
              style: TextStyle(color: Colors.pink),
            ),
            ActionableText(
              text: 'here',
              style: const TextStyle(
                color: Colors.green,
                decoration: TextDecoration.lineThrough,
              ),
              action: () {
                // Execute action
              },
            ),
          ],
          text: 'RichingText example available here',
          style: const TextStyle(
            color: Colors.black,
            fontSize: 24,
            fontWeight: FontWeight.bold,
          ),
        ),
      ),
    );
  }
}

Author #

3
likes
150
points
7
downloads

Publisher

verified publishernetwriper.com

Weekly Downloads

Build a rich text by providing a text and the words/phrases you want to highlight within.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on riching_text