mirror of
https://github.com/Arsybai/flutter-spannable-string.git
synced 2024-11-12 18:16:16 +01:00
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
.metadata | ||
analysis_options.yaml | ||
flutter_spannable_string.dart | ||
LICENSE | ||
README.md |
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).
Installation
Add the following to your pubspec.yaml
file:
dependencies:
flutter_spannable_string: ^1.0.0
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 /> }"),
),
),
),
),
),
),
);
}
Supported Properties
text-color
to specifies color of text
SpannableString.parse("Hello { `World` < text-color:#0000FF /> }")
background-color
specifies the background color of text
SpannableString.parse("Hello { `World` < background-color:#44FF00FF /> }")
font-size
set the size of text
SpannableString.parse("Hello { `World` < font-size:20 /> }")
text-decoration
set the kind of text decoration like underline, strikethrough etc
SpannableString.parse("Hello { `Universe` < text-decoration:strikethrough /> } World")
font-style
specifies the styles of text
SpannableString.parse("Hello { `World` < font-style:italic /> }")