sequence_aware_rich_text_renderer 1.0.2 copy "sequence_aware_rich_text_renderer: ^1.0.2" to clipboard
sequence_aware_rich_text_renderer: ^1.0.2 copied to clipboard

An extended Flutter RichText widget that applies custom properties to the TextSpan of specified character sequences

sequence-aware-rich-text-renderer #

License: MIT pub package test publish

A RichText widget that allows you to break-down and customize certain parts of its content as spans just by specifying the actual segment or characters you want styled differently.

Features #

  • RichTextWidget.

Getting started #

Run

flutter pub add sequence-aware-rich-text-renderer

Usage #

The use case that inspired the creation of this package is about a problem with custom fonts that fail to support some characters like '₦' for example, but is supported by the native font being used by the application. I recon there are also other use cases where multiple font families have to be combined to produce some sort of visual effect.

Below is an example of how you'd typically use the widget this package provides, to solve the problem, or achieve what you have in mind.

This package was built with flexibility in mind and may be used beyond what I imagined it for.

Nevertheless, contributions are always welcome.

import 'package:sequence_aware_rich_text_renderer/sequence_aware_rich_text_renderer.dart';
.
.
.
const SequenceAwareRichText(
    "Please note that transactions below ₦5,000 will attract a service charge of ₦10, while transactions "
    "above ₦5,000 will attract a service charge of ₦25.",
    sequences: [
        Sequence(
        '₦',
        style: TextStyle(
            fontFamily: 'Roboto',
            color: Colors.red,
            ),
        ),
    ],
    style: TextStyle(
        color: Colors.black,
        fontFamily: 'DMSans',
    ),
);

Additional information #

PRs are welcome.

2
likes
0
points
52
downloads

Publisher

verified publisherfrancisilechukwu.com

Weekly Downloads

An extended Flutter RichText widget that applies custom properties to the TextSpan of specified character sequences

Repository (GitHub)
View/report issues

Topics

#flutter #richtext #render-special-characters #render-currency

License

unknown (license)

Dependencies

flutter

More

Packages that depend on sequence_aware_rich_text_renderer