30 Questions
What is the primary purpose of the Container class in Flutter?
To store one or more widgets and position them on the screen
What is the default behavior of a Container class in terms of its size?
It takes the space that is required by the child
What is the purpose of the 'margin' property in the Container class?
To create an empty space around the container
What is the effect of setting the 'color' property in the Container class?
It sets the background color of the entire container
What is the 'child' property used for in the Container class?
To store the child widgets
What is the central purpose of Flutter widgets?
To build the app's user interface
How can the padding of a container be set?
Using the 'EdgeInsets.geometry' property
What happens when you make any alteration in the code?
The widget rebuilds its description by calculating the difference of the previous and current widgets
What is the characteristic of a stateless widget?
It never changes
What is an example of a stateful widget?
Checkbox
How are widgets organized in a Flutter app?
They are organized in a hierarchical structure
What is the purpose of a widget in a Flutter app?
To describe how the app's view should look and behave
What is the primary purpose of the MaterialApp widget in Flutter?
To wrap around other Material widgets and provide access to Flutter SDK components
What is the primary purpose of the AppBar widget in Flutter?
To provide the functionality of the AppBar out of the box
What is the data type of the 'actions' property in the AppBar widget?
List of widgets
Which property of the MaterialApp class is used to control the primary color of the application?
color
Which property is used to set the z-coordinate of the AppBar relative to its parent?
elevation
What is the purpose of the checkerboardRasterCacheImage property of the MaterialApp class?
To turn on the checkerboarding of raster cache images
What is the purpose of the RichText widget in Flutter?
To display text that uses various different styles
What is the purpose of the home property of the MaterialApp class?
To show the default route of the application
Which property of the MaterialApp class is used to provide a locale for the application?
locale
What is used to describe the displayed text in the RichText widget?
A tree of TextSpan objects
Which property is used to give shape to the AppBar and manage its shadow?
shape
What is the purpose of the debugShowMaterialGrid property of the MaterialApp class?
To paint a baseline grid material app
What is the purpose of the maxLines property in the RichText widget?
To set the maximum number of lines for the text to expand and wrap
What is the data type of the object provided to the textScaleFactor property?
Double
What is the purpose of the textDirection property in the RichText widget?
To decide the direction of the text
What is the purpose of the softWrap property in the RichText widget?
To control the wrapping of the text
What is the purpose of the overflow property in the RichText widget?
To control the text in case of overflow
What is the purpose of the local property in the RichText widget?
To control the font used for the text depending on the language
Study Notes
Flutter Widgets
- In Flutter, everything is a widget, and widgets are nested to build an app.
- A widget describes how the app view should look with its current configuration and state.
- When code changes, the widget rebuilds its description by calculating the difference of the previous and current widgets to determine the minimal changes for rendering in the UI of the app.
Widgets Categories
- Accessibility
- Animation and Motion
- Assets, Images, and Icons
- Async
- Basics
- Cupertino
- Input
- Interaction
- Models
- Layout
- Material Components
- Painting and effects
- Scrolling
- Styling
- Text
Stateful and Stateless Widgets
- A widget is either stateful or stateless.
- A stateful widget can change, e.g., when a user interacts with it, and subclasses StatefulWidget.
- Examples of stateful widgets: Checkbox, Radio, Slider, InkWell, Form, and TextField.
- A stateless widget never changes and subclasses StatelessWidget.
- Examples of stateless widgets: Icon, IconButton, and Text.
Container Class
- A convenience widget that combines common painting, positioning, and sizing of widgets.
- Can be used to store one or more widgets and position them on the screen according to our convenience.
- Properties:
- child: stores its children
- color: sets the background color of the entire container
- height and width: can specify the height and width of the container
- margin: creates an empty space around the container
AppBar Widget
- Usually the topmost component of the app, contains the toolbar and some other common action buttons.
- Key properties:
- actions: takes in a list of widgets to be displayed after the title
- title: takes in the main widget to be displayed in the AppBar
- backgroundColor: sets the background color of the Appbar
- elevation: sets the z-coordinate at which to place this app bar relative to its parent
- shape: gives shape to the Appbar and manages its shadow
RichText Widget
- Displays text that uses various different styles.
- The displayed text is described using a tree of TextSpan objects, each with its own associated style.
- Key properties:
- children: the widgets below this widget in the tree
- text: the text to display in this widget
- textAlign: how the text should be aligned horizontally
- maxLines: the maximum number of lines that can be there for the text to expand and wrap
- overflow: controls the text in case of overflow
- softWrap: if set to false, the gulphs in the text become wider
- textDirection: decides the direction of the text, either from left-to-right or right-to-left
- textScaleFactor: determines the relative size of the font
Test your knowledge of Flutter widgets, the building blocks of a Flutter app. Learn how to describe the app's view, configure and state, and understand how widgets rebuild and determine minimal changes for rendering in the UI.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free