-
Notifications
You must be signed in to change notification settings - Fork 104
/
Copy pathrichtext.dart
46 lines (44 loc) · 1.31 KB
/
richtext.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import 'package:flutter/material.dart';
class MyRichText extends StatelessWidget {
const MyRichText({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Rich Text')),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 300,
child: Image.asset(
'assets/images/death-note.jpeg',
fit: BoxFit.cover,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: RichText(
text: const TextSpan(
// default style
style: TextStyle(color: Colors.black, fontSize: 20),
children: [
TextSpan(
text: 'Death Note: ',
style: TextStyle(fontWeight: FontWeight.bold),
),
TextSpan(
text:
'This ia a very long caption. RichText is modified version of simple Text widget.',
style: TextStyle(
color: Colors.grey,
),
),
],
),
),
)
],
),
);
}
}