Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import the Flutter material package.
Flutter
import '[1]';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using cupertino.dart when building a Material Design app.
Forgetting to include the full package path.
✗ Incorrect
The main Flutter UI components are in the material.dart package, so we import it to use widgets like Scaffold and Text.
2fill in blank
mediumComplete the code to create the main entry point of a Flutter app.
Flutter
void main() => [1](MyApp()); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-existent function like startApp or launchApp.
Forgetting to call runApp in main.
✗ Incorrect
The runApp() function starts the Flutter app by inflating the given widget and attaching it to the screen.
3fill in blank
hardFix the error in the Flutter widget class declaration.
Flutter
class MyApp extends [1]Widget { @override Widget build(BuildContext context) { return MaterialApp(); } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using StatefulWidget without managing state.
Using a non-existent widget class like CustomWidget.
✗ Incorrect
Flutter widgets extend either StatelessWidget or StatefulWidget. Here, since no state is managed, it should extend StatelessWidget.
4fill in blank
hardFill both blanks to complete the Flutter widget tree with a Scaffold and AppBar.
Flutter
return MaterialApp( home: Scaffold( appBar: [1]( title: [2]('Home'), ), ), );
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Container or Column instead of AppBar for the appBar property.
Using Container or Column instead of Text for the title.
✗ Incorrect
The Scaffold widget uses an AppBar widget for the top bar, and the AppBar's title is a Text widget displaying 'Home'.
5fill in blank
hardFill all three blanks to create a Flutter widget with a Center, Column, and two Text widgets.
Flutter
return Scaffold( body: [1]( child: [2]( children: [ [3]('Hello'), Text('World'), ], ), ), );
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Row instead of Column for vertical layout.
Forgetting to wrap children in a Column.
Using Container instead of Center.
✗ Incorrect
The Scaffold body centers its child with Center, which contains a Column to arrange children vertically, including two Text widgets.