Google Flutter Google Flutter Widgets 2 — Questions and Answers
Question 1: Which widget displays a Material Design app bar at the top of the screen?
- TopBar
- Header
- AppBar (Correct answer)
- NavigationBar
Correct answer: AppBar
AppBar is a Material Design widget that typically shows the title, leading icon, and actions at the top of a Scaffold.
Question 2: What is the role of the Scaffold widget in Flutter?
- It renders images from the network
- It provides the basic Material Design visual layout structure with AppBar, body, FAB, etc. (Correct answer)
- It manages widget animations
- It handles HTTP requests
Correct answer: It provides the basic Material Design visual layout structure with AppBar, body, FAB, etc.
Scaffold provides a standard screen layout with slots for an AppBar, body, drawer, bottom navigation, and FloatingActionButton.
Question 3: Which widget should you use to display text that automatically wraps across multiple lines?
- RichText
- Text (Correct answer)
- Label
- Span
Correct answer: Text
The Text widget displays a string and automatically wraps it onto multiple lines based on available width.
Question 4: What is the purpose of the Padding widget?
- To clip a widget to a shape
- To add empty space around a child widget (Correct answer)
- To scale a child widget
- To add a border around a widget
Correct answer: To add empty space around a child widget
Padding inserts empty space around its child using EdgeInsets to specify amounts on each side.
Question 5: Which widget displays a list of items in a two-dimensional grid layout?
- ListView
- Table
- GridView (Correct answer)
- Wrap
Correct answer: GridView
GridView arranges children in a scrollable two-dimensional array of fixed or variable-sized tiles.
Question 6: Which widget would you use to show a Material Design card with elevation and rounded corners?
- Container
- Card (Correct answer)
- BoxDecoration
- Panel
Correct answer: Card
Card is a Material Design sheet with rounded corners and configurable elevation to show depth.
Which widget displays a Material Design app bar at the top of the screen?