The Rich Text widget displays text that uses multiple different styles.
Properties
- children
- runtimeType
- text
- textAlign
- maxLines
- overflow
- softWrap
- textDirection
- textHightBehaviour
- textScaleFactor
- textWidthBasis
Example:
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text(
'Sample App',
),
),
body: Center(
child: RichText(
text: const TextSpan(
text: 'First',
style: TextStyle(fontSize: 20, color: Colors.green),
children: <TextSpan>[
TextSpan(
text: 'Second',
style: TextStyle(fontSize: 30, color: Colors.blue),
), // TextSpan
TextSpan(
text: 'Third',
style: TextStyle(fontSize: 40, color: Colors.black),
), // TextSpan
TextSpan(text: 'Default'),
],
),
),
),
),
),
);
}
Video Link: