This Flutter app is a quiz application developed using Dart. It presents questions, records user answers, and displays the results at the end of the quiz. The app follows Flutter best practices, using stateless and stateful widgets, and state management to ensure a seamless user experience.
- Question Shuffling: Randomizes question order for each quiz attempt.
- Answer Tracking: Tracks user answers and compares them to the correct answers.
- Results Summary: Provides a summary of correct and incorrect answers at the end of the quiz.
- Responsive UI: Utilizes Google Fonts for styling and responsive layout design.
- Restart Functionality: Allows users to restart the quiz and try again.
The app makes use of both stateless and stateful widgets to manage the UI and state efficiently. Stateless widgets are used where the UI does not change dynamically, while stateful widgets handle parts of the UI that change in response to user interactions.
State management is achieved using the setState
method, which ensures that the UI updates correctly when the state changes. For example, the ResultsScreen
and QuestionsScreen
widgets rely on setState
to update the displayed content based on user input and quiz progress.
Conditional rendering is used to switch between different screens, such as the start screen, questions screen, and results screen. This is achieved by maintaining the current screen state and using conditional statements to render the appropriate widget.
A gradient background is implemented using the BoxDecoration
and LinearGradient
classes. This adds a visually appealing background to the app, enhancing the user experience.
The app integrates Google Fonts using the google_fonts
package. This allows for custom font styles, providing a consistent and aesthetically pleasing look across different devices.
Quiz questions and answers are managed using Dart's list and map data structures. The QuestionsSummary
widget, for example, uses a list of maps to display each question along with the user's answer and the correct answer.
The app is designed to be responsive, adjusting to different screen sizes and orientations. This ensures a consistent user experience across various devices, from mobile phones to tablets.
- Clone the repository.
- Ensure you have Flutter installed on your machine.
- Navigate to the project directory and run
flutter pub get
to install dependencies. - Use
flutter run
to start the app on your preferred device or emulator.
For help getting started with Flutter, view the online documentation.
Check out the code to explore more about Flutter's widget tree and state management!