https://github.com/arsybai/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).
https://github.com/arsybai/flutter-spannable-string
dart flutter string string-manipulation stringify strings
Last synced: 6 months ago
JSON representation
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).
- Host: GitHub
- URL: https://github.com/arsybai/flutter-spannable-string
- Owner: Arsybai
- License: mit
- Created: 2023-12-01T15:39:53.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-01T15:24:54.000Z (over 1 year ago)
- Last Synced: 2025-06-10T23:49:35.995Z (8 months ago)
- Topics: dart, flutter, string, string-manipulation, stringify, strings
- Language: Dart
- Homepage: https://pub.dev/packages/flutter_spannable_string
- Size: 12.7 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```yaml
dependencies:
flutter_spannable_string: ^1.0.1
```
Then, run:
```bash
flutter pub get
```
## Usage
```dart
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
```dart
SpannableString.parse("Hello { `World` < text-color:#0000FF /> }")
```

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

### `font-size`
set the size of text
```dart
SpannableString.parse("Hello { `World` < font-size:20 /> }")
```

### `text-decoration`
set the kind of text decoration like underline, strikethrough etc
```dart
SpannableString.parse("Hello { `Universe` < text-decoration:strikethrough /> } World")
```

### `font-style`
specifies the styles of text
```dart
SpannableString.parse("Hello { `World` < font-style:italic /> }")
```

### `more properties coming soon`