Which button type has a filled background?
ElevatedButton has a filled background, making it stand out.
Interactive widgets for user input
Passing the Quiz & Exercises is mandatory to earn FX and proceed. If you fail, try again to gain the required FX, then the Proceed button will become available.
You can read this lesson publicly. Sign in to unlock exercises, quiz, and FX progress tracking.
Having trouble? AI is here to help
Ask context-aware questions about this lesson. Free plan: 5 questions/day. Upgrade to Premium for higher daily limits.
Use the AI button at the bottom of the screen
Flutter provides several built-in button types, each designed for a different level of visual emphasis. Choosing the right button helps users understand the importance of each action.
1// ElevatedButton - Primary action (filled)2ElevatedButton(3onPressed: () {4print('Clicked!');5},6child: Text('Sign Up'),7)89// TextButton - Low emphasis (no background)10TextButton(11onPressed: () {},12child: Text('Learn More'),13)1415// OutlinedButton - Medium emphasis (border only)16OutlinedButton(17onPressed: () {},18child: Text('Cancel'),19)2021// IconButton - Icon only22IconButton(23icon: Icon(Icons.favorite),24onPressed: () {},25)2627// FloatingActionButton - Main action28FloatingActionButton(29onPressed: () {},30child: Icon(Icons.add),31)
You can customize the appearance of any Flutter button using the styleFrom method. This gives you control over background color, text color, padding, and shape.
1ElevatedButton(2onPressed: () {},3style: ElevatedButton.styleFrom(4backgroundColor: Colors.blue,5foregroundColor: Colors.white,6padding: EdgeInsets.symmetric(horizontal: 32, vertical: 16),7shape: RoundedRectangleBorder(8borderRadius: BorderRadius.circular(12),9),10),11child: Text('Styled Button'),12)1314// Button with icon15ElevatedButton.icon(16onPressed: () {},17icon: Icon(Icons.download),18label: Text('Download'),19)
Set `onPressed: null` to disable a button.
GestureDetector lets you make any widget respond to taps, swipes, and other touch gestures. This is useful when you need custom interactive elements that are not standard buttons.
1GestureDetector(2onTap: () => print('Tapped!'),3onDoubleTap: () => print('Double tap!'),4onLongPress: () => print('Long press!'),5child: Container(6padding: EdgeInsets.all(20),7color: Colors.blue,8child: Text('Tap me'),9),10)1112// InkWell - same but with ripple effect13InkWell(14onTap: () {},15borderRadius: BorderRadius.circular(12),16child: Container(17padding: EdgeInsets.all(20),18child: Text('Tap me'),19),20)
Not all actions should look equally important:
When hierarchy is clear, users make faster decisions and commit fewer mistakes.
Interactive widgets for user input. Widgets are reusable UI blocks. You combine them like LEGO pieces to build screens.
Build confidence with basics first; speed comes later.
Sketch the widget tree first, then code from top to bottom.
Most Flutter productivity comes from understanding layout rules and composing widgets cleanly.
ElevatedButton has a filled background, making it stand out.
Setting onPressed to null makes the button disabled and greyed out.
InkWell shows Material ripple animation on tap.
ElevatedButton.icon() constructor creates a button with both an icon and label.
Something seems incorrect, unclear, or missing? Let us know.
FlutterCraft editorial lessons are reviewed by experienced Flutter developers and updated to stay aligned with modern Flutter and Dart best practices.
Reference docs: Flutter Documentation, Dart Language Tour, and official package documentation where relevant.
Sign in to continue with exercises and quiz for this lesson.
Sign In to Continue