Skip to content

Commit

Permalink
Merge pull request #49 from rosera/tastethedream-patch-47
Browse files Browse the repository at this point in the history
Update ex9-1.md
  • Loading branch information
rosera authored Dec 16, 2022
2 parents 535a0ff + d0de95a commit bbd5cc7
Showing 1 changed file with 12 additions and 38 deletions.
50 changes: 12 additions & 38 deletions ch09/ex9-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ void main() {
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
const title = 'Rich Text';
const title = 'RichText Demo';
return MaterialApp(
title: title,
home: Scaffold(
Expand All @@ -31,49 +29,25 @@ class MyApp extends StatelessWidget {
double screenHeight = 0.0;
class MyRichText extends StatelessWidget {
const MyRichText();
const MyRichText({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
screenHeight = MediaQuery.of(context).size.height/3;
return SingleChildScrollView(
child: Column(
screenHeight = MediaQuery.of(context).size.height / 3;
return RichText(
text: const TextSpan(
children: [
Container(
height: screenHeight,
color: Colors.red,
TextSpan(
text: 'Hello',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 24),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(height: screenHeight),
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),
),
],
),
),
]),
Container(
height: screenHeight,
color: Colors.blue,
TextSpan(
text: 'Luxembourg',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 32, color: Colors.grey),
),
],
),
);
}
}
```

0 comments on commit bbd5cc7

Please sign in to comment.