We will be building a Magic 8 Ball app that will give you the answers to all fun tricky questions (basically it is a fun game app that will change its state of image Flatbutton using Stateful widgets). For this, we will use Stateless and Stateful Flutter widgets, a Flatbutton.
We will be using VS Code IDE for this project, you can also use Android Studio or any other IDE. Now, First, create the Flutter project with the initial steps and follow the below steps:
- Step 1: Create an images folder in the project directory and add the required images.
Note: The images used in the article can be download images from here if you want to follow along.
- Step 2: Now, include the images in pubspec.yaml file to use them in the app.
Note: Use proper indentation, otherwise your images will not be included.
- Step 3: Now, add the following code in main.dart file: