Icons
Part of the Your First App section of Coddy's Flutter journey. Lesson 25 of 32.
Flutter comes with more than a thousand ready icons. Show one with the Icon widget and a name from Icons:
Icon(Icons.home)
Icon(Icons.search)
Icon(Icons.settings)Many icons come in several versions. Icons.star is a filled star, and Icons.star_border is only its outline. Icons are drawn like letters, so they stay sharp at any size.
Challenge
EasyNext to Favorites there is a star. Make it a filled heart: Icons.favorite.
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: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.star),
SizedBox(width: 8),
Text('Favorites', 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