Chapter 2

  1. When should you use Stateful widgets in your apps?
    In your apps, you use Stateful widgets when your widgets need to keep a State, which is information that can change during the lifecycle of the user interface.

  2. Which method updates the State of your class?
    The setState() method updates the State.

  3. Which widget would you use to allow your user to select an option from a dropdown list?
    The DropdownButton widget allows you to create a list of DropdownMenuItem widgets that can be selected by the user.

  4. Which widget would you use to allow your user to type some text?
    TextField is a widget that allows the user to type some text.

  5. Which event can you use when you want to react to some user input?
    The onChanged event allows you to respond to changes in the content of TextField.

  6. What happens when your widgets take more space than what's available on the screen? How do you solve this issue?
    You can enclose your widgets into a scrolling widget, like the SingleChildScrollView widget.

  1. How can you get the width of the screen?
    You can use the MediaQuery.of(context).size.width instruction to get the width of the screen.
  2. What is Map in Flutter?
    In Flutter, Map widgets allow you to insert key-value pairs, where the first element is the key, and the second is the value.

  3. How can you style your text?
    You can create a TextStyle widget, and you can use it to apply the same text style to several widgets.

  4. How can you separate the logic of your apps from the UI?
    There are several approaches to separate the logic from the UI in Flutter. The most basic one, that you’ve seen in this chapter, is creating classes that contain the logic of your app, and use them from the user interface when appropriate.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.231.15