Part 3: Implementing the UI for the HomeScreen

Firebase

I.UI Analysis

Looking at the screen UI, we can categorize it into the following general Widgets:

The UI components overlap, to construct this, we will use the Stack Widget.

II.Breaking Down the Small Widgets

1. Building the Background, Header Widget, and Axis Widgets

As shown in the image, the build function returns a Container containing the background image at the bottom. Inside the Stack, it sequentially contains the following Widgets: HeaderHomeWidget, HomeHorizontalAxisWidget, and HomeVerticalAxisWidget.

After running, you will have the UI:

2.List of Questions

Next is the Widget that displays the list of questions, which includes the QuestionMainWidget representing one question. 

The list of questions will have left padding of 50, right padding of 40, top padding of 90, and bottom padding of 110. We will use SliverGrid to display the list in three columns.:

In which

Each child component will have two states:

They will contain: 

We will complete the QuestionMainWidget after fully implementing the logic to retrieve data from the backend, along with checking the condition of passed questions. Currently, it's just temporarily displaying the background and text.

III.Summary

In this tutorial, we have learned how to analyze the UI and build a basic UI. The current UI does not have real data; in the next tutorial, we will continue to build the connection and retrieve real data from the backend.