Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a simple Text widget displaying 'Hello World'.
Flutter
Text([1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the text string.
Passing a widget instead of a string.
✗ Incorrect
The Text widget requires a string inside quotes to display text. So, 'Hello World' is correct.
2fill in blank
mediumComplete the code to set the text color to blue using the style property.
Flutter
Text('Hello', style: TextStyle(color: [1]))
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Color.blue instead of Colors.blue.
Using a string like 'Blue' instead of Colors.blue.
✗ Incorrect
Colors.blue is the correct way to set the color to blue in Flutter's material colors.
3fill in blank
hardFix the error in the code to make the font size 24 pixels.
Flutter
Text('Big Text', style: TextStyle(fontSize: [1]))
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting font size in quotes making it a string.
Adding units like 'px' which is not valid in Flutter.
✗ Incorrect
fontSize expects a double value without quotes or units, so 24.0 is correct.
4fill in blank
hardFill both blanks to make the text bold and italic.
Flutter
Text('Styled Text', style: TextStyle(fontWeight: [1], fontStyle: [2]))
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using FontWeight.normal or FontStyle.normal which do not style text.
Confusing fontWeight and fontStyle properties.
✗ Incorrect
FontWeight.bold makes text bold, and FontStyle.italic makes it italic.
5fill in blank
hardFill all three blanks to create a Text widget with red color, font size 18, and underlined decoration.
Flutter
Text('Decorated', style: TextStyle(color: [1], fontSize: [2], decoration: [3]))
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using TextDecoration.lineThrough instead of underline.
Putting fontSize in quotes or without decimal.
Using color names as strings instead of Colors class.
✗ Incorrect
Colors.red sets the color red, 18.0 sets font size, and TextDecoration.underline adds underline.