RichTrex: Span
An extended package of RichTrex
package which is used to encode list of TextSpan
into String
, and decode String
into list of TextSpan
.
Preview
![]() |
![]() |
Primary Feature
- Font Color ✅
- Font Weight ✅
- Font Size ✅
- Font Family ✅
- Custom ❌
- Italic ✅
- Underline ✅
- Strikethrough ✅
- Background Color ✅
- Image ✅
- Alignment ✅
- Ordered List ❌
- Unordered List ❌
- Block Quote ✅
- Hyperlink ✅
Secondary Feature
- Superscript ❌
- Subscript ❌
- Shadow ✅
- Vertical Space ✅
- Horizontal Space ✅
- Overline ✅
- Padding ✅
- Table ❌
- Video ❌
Install
Add this line to your pubspec.yaml.
dependencies:
richtrex_span: ^1.1.0
Usage
First, import the RichTrex: Span package.
import 'package:richtrex_span/richtrex_span.dart';
And to encode, you need to set a list of RichTrexSpan
just like this.
const List<RichTrexSpan> span = [
RichTrexSpan(
text: "RichTrex: Format",
fontWeight: FontWeight.bold,
fontSize: 25,
align: Alignment.center),
RichTrexSpan(
text: "\n This is an Example of using RichTrexFormat.")
];
String result = RichTrex.encode(span);
or if you want to decode list of RichTrexSpan
from String
you can use this.
String text = """<style="font-weight:6;font-size:25.0;align-x:0.0;align-y:0.0;">RichTrex: Format</style>
This is an Example of using RichTrexFormat.""";
List<RichTrexSpan> result = RichTrex.decode(text);
and implement the decoded result into Text.rich
just like this.
return Text.rich(
TextSpan(children: RichTrexSpan.decode(text)),
key: UniqueKey(),
);
Libraries
- richtrex_span
- An extended package of
RichTrex
package which is used to encode list of TextSpan into String, and decode String into list of TextSpan.