Bold and Italic
Part of the Your First App section of Coddy's Flutter journey. Lesson 8 of 32.
A TextStyle can hold several settings at once, separated by commas. Two of them change the shape of the letters:
Text(
'Read me',
style: TextStyle(
fontWeight: FontWeight.bold,
fontStyle: FontStyle.italic,
),
)FontWeight.bold makes the letters thick. FontStyle.italic slants them. You can use either one on its own, or both together.
Challenge
EasyMake Important both bold and italic. It already has a TextStyle with its size: add the two settings to it.
Try it yourself
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: Text(
'Important',
style: TextStyle(
fontSize: 24,
),
),
),
),
);
}
}
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Your First App
Practice on your own: Online Flutter compiler