Widgets Flashcards

1
Q

What is a Flutter widget?

A

A Flutter widget is a description of part of a user interface.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the root widget in a Flutter app?

A

The root widget is the top-level widget that initializes the app.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the purpose of the StatelessWidget class in Flutter?

A

The StatelessWidget class is used for widgets that do not require mutable state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the purpose of the StatefulWidget class in Flutter?

A

The StatefulWidget class is used for widgets that require mutable state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the difference between StatelessWidget and StatefulWidget in Flutter?

A

StatelessWidget is immutable, while StatefulWidget can change state during the lifetime of the widget.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the build() method in Flutter widgets used for?

A

The build() method is used to describe the part of the user interface represented by the widget.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the key property used for in Flutter widgets?

A

The key property is used to uniquely identify a widget.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the purpose of the setState() method in Flutter?

A

The setState() method is used to notify the framework that the internal state of a widget has changed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the difference between stateful and stateless widgets in Flutter?

A

Stateful widgets can change state during the lifetime of the widget, while stateless widgets are immutable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a StatefulWidget’s createState() method used for?

A

The createState() method is used to create the mutable state for a StatefulWidget.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the purpose of a layout widget in Flutter?

A

Layout widgets are used to define the visual structure of a user interface.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the purpose of a material widget in Flutter?

A

Material widgets implement the Material Design guidelines for visual elements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the purpose of a Cupertino widget in Flutter?

A

Cupertino widgets implement the iOS design guidelines for visual elements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the purpose of an InheritedWidget in Flutter?

A

InheritedWidgets propagate information down the widget tree.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the difference between StatelessWidget and InheritedWidget in Flutter?

A

StatelessWidget is a single immutable widget, while InheritedWidget can propagate information down the widget tree.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the purpose of a GestureDetector widget in Flutter?

A

GestureDetector widgets recognize gestures made by the user.

17
Q

What is the purpose of a Scaffold widget in Flutter?

A

The Scaffold widget provides a visual structure for a material design app.

18
Q

What is the purpose of a ListView widget in Flutter?

A

ListView widgets display a scrolling list of children.

19
Q

What is the main function of a MaterialApp widget in Flutter?

A

The MaterialApp widget is the root widget for a Flutter application.

20
Q

What is the purpose of a Container widget in Flutter?

A

Container widgets are used to create visual elements with customizable properties.

21
Q

What is the purpose of an Expanded widget in Flutter?

A

Expanded widgets expand to fill the available space in a Row, Column, or Flex.

22
Q

What is the purpose of a Positioned widget in Flutter?

A

Positioned widgets place a child widget at a specific position within a Stack.

23
Q

What is the purpose of a Row widget in Flutter?

A

Row widgets display their children in a horizontal arrangement.

24
Q

What is the purpose of a Column widget in Flutter?

A

Column widgets display their children in a vertical arrangement.

25
Q

What is the purpose of a Stack widget in Flutter?

A

Stack widgets allow children to be stacked on top of each other.