10.1 Incorporating Rich Text Example import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { const title = 'RichText Demo'; return MaterialApp( title: title, home: Scaffold( appBar: AppBar( title: const Text(title), ), body: const MyRichText(), ), ); } } double screenHeight = 0.0; class MyRichText extends StatelessWidget { const MyRichText({Key? key}) : super(key: key); @override Widget build(BuildContext context) { screenHeight = MediaQuery.of(context).size.height / 3; return RichText( text: const TextSpan( children: [ TextSpan( text: 'Hello', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 24), ), TextSpan( text: 'Luxembourg', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 32, color: Colors.grey), ), ], ), ); } }