Loading topic
Text widget draws a string on screen. Almost every Flutter screen uses it, so its defaults and failure modes are worth knowing before you style anything. This chapter covers how Text is constructed, where its appearance comes from when you set nothing, and the mistakes that most often cause 4 min readStatelessWidget, know Dart named parameters, and have already shown text with the Text widget. It covers TextStyle, the class that controls how text looks: size, weight, color, spacing, and decoration. It also covers how styles merge, since that is the sour4 min readText widget places its lines inside the space its parent gives it, and what happens when the text does not fit. It assumes you can write a StatelessWidget, know that Flutter layout passes constraints down from parent to child, and have used Row and Column. The previ4 min readStatelessWidget, you know how Text and TextStyle work, and you have a Flutter project that uses MaterialApp. It covers how to take text styles from the app's theme instead of hard-coding them in each widget.4 min readStatelessWidget, know that Text takes a style argument, and have used Theme.of(context).textTheme. It also assumes you know what a StatefulWidget lifecycle (initState and dispose) is.3 min readpubspec.yaml, how Flutter picks the right file for a style, how to apply the font to one widget or the whole ap5 min readStatelessWidget, you know the basics of Text and TextStyle, and you have used Theme.of(context).textTheme. It covers what happens when a user changes the font size in their device settings, and how to keep your layouts working when they do.4 min readImage widget: what it is, how it turns a source into pixels, and the properties and mistakes you will meet first. It assumes you can write a StatelessWidget, know that pubspec.yaml configures a project, and can run a Flutter app on an emulator, device, or the web. L5 min readImage widget can draw pixels from four places: files bundled with the app, a URL, a file on the device, and bytes already in memory. This chapter covers the constructor for each source and the setup each one needs. It also covers the platform errors that appear when that setup is missing4 min readStatelessWidget, you have a Flutter project that runs, and you have opened pubspec.yaml before. It covers how Flutter finds bundled image files, how you register them, and how the framework picks the right file for each screen density.5 min readImage.asset or Image.network, that you know how BoxConstraints flow from parent to child, and that your project already declares assets/images/ in pubspec.yaml. It covers how an Image chooses its box, how BoxFit paints into that box, and 5 min readImage.network widget, size it with width, height, and fit, and write a `Stat4 min readImage.asset and Image.network work, and you have set up BoxFit and image sizes. Here you will learn how Flutter keeps decoded images in memory, why a large file can cost much more memory than you expect, and how to control that c4 min readStatelessWidget, read named parameters in Dart, and run a Flutter app with MaterialApp. It also assumes pubspec.yaml is familiar to you. The Icon widget draws a small glyph, such as a heart, a magnifying glass, or a home symbol. You will see how Icon wo5 min readIcon widget draws one glyph from an icon font. Setting color and size on every icon works for a handful of icons, but it breaks down in a toolbar, a list, or a whole app. IconTheme lets you set those values once for a subtree. This chapter covers how icons find their style, how to overrid4 min readIcons class covers common needs. Sooner or later a design calls for a brand mark, a domain-specific symbol such as a barbell or a lab flask, or a set of icons that must match one visual style. This chapter shows how to ship those as an icon font and use them through the same Icon wi5 min readText, Image, and Icon to assistive technology such as screen readers, and how to keep them usable when users change their font settings. It assumes you can write a StatelessWidget, you know Theme.of(context).textTheme, and you have seen the Image a4 min read