Recall & Review
beginner
What is an ElevatedButton in Flutter?
An ElevatedButton is a button with a shadow that lifts it above the surface, making it stand out. It is used for important actions in your app.
Click to reveal answer
beginner
What is a TextButton in Flutter?
A TextButton is a simple button with no shadow or background by default. It looks like text and is used for less prominent actions.
Click to reveal answer
beginner
How do you create an ElevatedButton with a label 'Click Me'?
Use ElevatedButton(onPressed: () {}, child: Text('Click Me')) to create a button with the label 'Click Me'.
Click to reveal answer
beginner
How do you handle a button press in Flutter?
You provide a function to the onPressed property of the button. This function runs when the user taps the button.
Click to reveal answer
beginner
When should you use ElevatedButton vs TextButton?
Use ElevatedButton for main actions that need emphasis. Use TextButton for less important actions or inline links.
Click to reveal answer
Which Flutter button shows a shadow by default?
✗ Incorrect
ElevatedButton has a shadow that makes it appear raised, while TextButton does not.
What property do you use to specify what happens when a button is tapped?
✗ Incorrect
The onPressed property takes a function that runs when the button is tapped.
Which button type looks like plain text by default?
✗ Incorrect
TextButton appears as text without background or shadow.
How do you add a label to an ElevatedButton?
✗ Incorrect
You pass a Text widget to the child property to show a label.
Which button is best for a primary action in your app?
✗ Incorrect
ElevatedButton stands out with shadow and is used for main actions.
Explain the difference between ElevatedButton and TextButton in Flutter.
Think about how each button looks and when you would use them.
You got /4 concepts.
Describe how to create a button in Flutter that prints 'Hello' when tapped.
Focus on the onPressed and child properties.
You got /4 concepts.