Core Widgets Cheat Sheet
Core Widgets Cheat Sheet
MaterialApp / Scaffold /
CupertinoApp CupertinoPageScaffold
Layout
MaterialApp / CupertinoApp
Scaffold / CupertinoPageScaffold
Container
Row / Column
§ Must-use if you need multiple widgets sit next to each other horizontally or vertically
§ Limited styling options => Wrap with a Container (or wrap child widgets) to apply styling
§ Children can be aligned along main-axis and cross-axis (see separate cheat sheet)
Most Important Widgets
Layout
Flexible Expanded
Details
Flexible / Expanded
§ Also see separate cheat sheet attached to lecture about Row / Column / Flexible / Expanded
§ Helps you size the child widgets of Row / Column
Most Important Widgets
Content Containers
Stack Card
Details
Stack
Card
§ A container with some default styling (shadow, background color, rounded corners)
§ Can take one child (can be anything)
§ Typically used to output a single piece / group of information
Most Important Widgets
Repeat Elements
Content Types
Hi!
Details
ListView / GridView
ListTile
§ A pre-styled container / Row() that allows you to achieve a typical “list-item look”
§ Offers various slots for widgets (e.g. at the beginning, a title, at the end)
§ Not a must-use but can be handy for a default list-item look
Details
Text
Image
Icon
User Input
RaisedButton /
TextField
FlatButton
Click
Click
GestureDetector
InkWell
Details
TextField
§ Renders an editable text field where the user can enter (type) information
§ Many, many configuration options (e.g. autocorrection, error messages, labels, styles)
§ Supports different kinds of keyboard (email, number, normal text, …)
RaisedButton / FlatButton /
IconButton
§ Differently styled buttons that handle user taps
§ A custom function that should execute upon a tap can (and has to be) provided
§ Can be styled / customized
GestureDetector / InkWell
§ GestureDetector allows you to wrap ANY widget with touch listeners (e.g. double tap, long tap)
§ InkWell does the same but adds a visual ripple effect upon touches (effect can be configured)
§ You can build your own buttons / touchable widgets with these widgets