Flutter Cheatsheet
Flutter Cheatsheet
Key concept:
In this example:
- Scaffold is a Widget
- appBar is an argument of the Scaffold Widget
- AppBar is a Widget placed inside the appBar argument.
- title is an argument of the AppBar Widget
- Text is a Widget placed inside the title argument.
Remember, it’s Widget inside Widget..!
Commands:
Basic Widgets:
- Scaffold
- AppBar
- Text
- Center
- Column
- Row
- Wrap
- SizedBox
- Image.asset
- ElevatedButton
- Container
- ListTile
- SingleChildScrollView
- Drawer
- SafeArea
- Drawerheader
If you want a list of every flutter widget, you can watch this video on YouTube:
If you want my top 70 Widgets, you can watch this video on YouTube:
Create a Variable:
In this example:
1. Read: Expected to find ,
2. Each Widget in a list needs to be separated by a comma “,”.
3. This will solve your problem
Type 2: Red Screen
3. The top link will show you where the error is from
4. If you can’t understand, google search the error (Flutter [‘Your error’])
5. Find the solution on StackOverFlow, unusually it’s one of the top answers
Stateless vs Stateful
Case 1: StatelessWidget
- Create your second page (stateless)
- Add the required this. (2nd red line)
- Add the final (3rd red line)
- Use the argument (4th red line, this is a String in this example but it can be anything)
Case 2: StatefulWidget
- Create your second page (stateful)
- Add the required this. (2nd red line)
- Add the final (3rd red line)
- Use the argument with a widget. (4th red line, make sure to use the
widget.yourArgument)
-