Widgets Flashcards
What is a Flutter widget?
A Flutter widget is a description of part of a user interface.
What is the root widget in a Flutter app?
The root widget is the top-level widget that initializes the app.
What is the purpose of the StatelessWidget class in Flutter?
The StatelessWidget class is used for widgets that do not require mutable state.
What is the purpose of the StatefulWidget class in Flutter?
The StatefulWidget class is used for widgets that require mutable state.
What is the difference between StatelessWidget and StatefulWidget in Flutter?
StatelessWidget is immutable, while StatefulWidget can change state during the lifetime of the widget.
What is the build() method in Flutter widgets used for?
The build() method is used to describe the part of the user interface represented by the widget.
What is the key property used for in Flutter widgets?
The key property is used to uniquely identify a widget.
What is the purpose of the setState() method in Flutter?
The setState() method is used to notify the framework that the internal state of a widget has changed.
What is the difference between stateful and stateless widgets in Flutter?
Stateful widgets can change state during the lifetime of the widget, while stateless widgets are immutable.
What is a StatefulWidget’s createState() method used for?
The createState() method is used to create the mutable state for a StatefulWidget.
What is the purpose of a layout widget in Flutter?
Layout widgets are used to define the visual structure of a user interface.
What is the purpose of a material widget in Flutter?
Material widgets implement the Material Design guidelines for visual elements.
What is the purpose of a Cupertino widget in Flutter?
Cupertino widgets implement the iOS design guidelines for visual elements.
What is the purpose of an InheritedWidget in Flutter?
InheritedWidgets propagate information down the widget tree.
What is the difference between StatelessWidget and InheritedWidget in Flutter?
StatelessWidget is a single immutable widget, while InheritedWidget can propagate information down the widget tree.