flutter_spannable_string 1.0.1 copy "flutter_spannable_string: ^1.0.1" to clipboard
flutter_spannable_string: ^1.0.1 copied to clipboard

...

Flutter Spannable String #

A Flutter package for parsing and displaying spannable strings with various styling options, including text color, background color, text size, text decoration (underline, strikethrough), font style (italic) and font weight (bold).

GitHub code size in bytes

Installation #

Add the following to your pubspec.yaml file:

dependencies:
  flutter_spannable_string: ^1.0.0
copied to clipboard

Then, run:

flutter pub get
copied to clipboard

Usage #

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

void main() {
  runApp(
    MaterialApp(
      home: Builder(
        builder: (context) => Scaffold(
          body: Center(
            child: RichText(
              text: TextSpan(
                children: SpannableString.parse("Hello { `World` < text-color:#0000FF,text-decoration:underline, font-style:italic, font-size:20 /> }"),
              ),
            ),
          ),
        ),
      ),
    ),
  );
}
copied to clipboard

image

Supported Properties #

text-color #

to specifies color of text

SpannableString.parse("Hello { `World` < text-color:#0000FF /> }")
copied to clipboard

image

background-color #

specifies the background color of text

SpannableString.parse("Hello { `World` < background-color:#44FF00FF /> }")
copied to clipboard

image

font-size #

set the size of text

SpannableString.parse("Hello { `World` < font-size:20 /> }")
copied to clipboard

image

text-decoration #

set the kind of text decoration like underline, strikethrough etc

SpannableString.parse("Hello { `Universe` < text-decoration:strikethrough /> } World")
copied to clipboard

image

font-style #

specifies the styles of text

SpannableString.parse("Hello { `World` < font-style:italic /> }")
copied to clipboard

image

more properties coming soon #

2
likes
120
points
32
downloads

Publisher

verified publisherarsybai.com

Weekly Downloads

2024.08.07 - 2025.02.19

...

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_spannable_string