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). https://pub.dev/packages/flutter_spannable_string
Find a file
2023-12-02 00:33:04 +07:00
lib Move script inside lib directory 2023-12-01 23:41:16 +07:00
.gitignore Add .gitignore 2023-12-01 23:40:18 +07:00
.metadata Add metadata 2023-12-01 23:40:06 +07:00
analysis_options.yaml Add metadata 2023-12-01 23:40:06 +07:00
CHANGELOG.md Updateversion to 1.0.1 2023-12-01 23:49:04 +07:00
LICENSE Initial commit 2023-12-01 22:39:54 +07:00
pubspec.yaml Updateversion to 1.0.1 2023-12-01 23:49:04 +07:00
README.md Update README.md 2023-12-02 00:33:04 +07:00

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.1

Then, run:

flutter pub get

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 /> }"),
              ),
            ),
          ),
        ),
      ),
    ),
  );
}

image

Supported Properties

text-color

to specifies color of text

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

image

background-color

specifies the background color of text

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

image

font-size

set the size of text

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

image

text-decoration

set the kind of text decoration like underline, strikethrough etc

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

image

font-style

specifies the styles of text

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

image

more properties coming soon