Skip to content

A sample project showcasing robust state management in Flutter. This timer app is built using the flutter_bloc library and follows a feature-first Clean Architecture.

License

javerage/javerage_timer

Repository files navigation

Header

Flutter Timer App: BLoC & Clean Architecture

This project is a functional timer application built with Flutter. It serves as a practical exercise to demonstrate professional software development principles, including state management with the BLoC (Business Logic Component) pattern and the implementation of Clean Architecture.

The application features a countdown timer with controls to start, pause, resume, and reset, all within a clean user interface with an animated background.

✨ Key Features

  • Countdown Timer: Starts a countdown from a preset duration of 60 seconds.
  • State Controls:
    • Start: Begins the countdown.
    • Pause: Stops the timer at the current time.
    • Resume: Continues the countdown from where it was paused.
    • Reset: Resets the timer to its initial state.
  • Reactive UI: The user interface dynamically updates to show the correct action buttons based on the timer's current state (Initial, InProgress, Paused, Completed).
  • Animated Background: Uses the wave package for a visually appealing wave effect in the background.

🏛️ Architecture

The project follows Clean Architecture principles to separate concerns and create maintainable, scalable, and testable code. The structure is divided into the following layers:

  • domain: The innermost layer. It contains the pure business logic (the Ticker entity) and abstract contracts (TimerRepository). It has no dependencies on other layers.
  • data: Implements the contracts defined in the domain. It acts as a bridge, providing concrete data to the application (with TimerRepositoryImpl).
  • application: Orchestrates the application's logic. This is where our TimerBloc resides, responding to UI events and managing the feature's state.
  • presentation: The User Interface (UI) layer. It contains all the Flutter widgets, organized into screens, views, and reusable widgets.

This separation ensures that changes in the UI do not affect the business logic, and vice versa.

🛠️ Technologies & Packages Used

  • Framework: Flutter
  • Language: Dart
  • State Management:
    • flutter_bloc: To implement the BLoC pattern and connect state logic with the UI.
    • equatable: To simplify object comparisons and optimize performance by preventing unnecessary rebuilds.
  • UI:
    • google_fonts: For easily using custom fonts from the Google Fonts library.
    • lottie: For rendering high-quality After Effects animations.
    • numberpicker: A widget for selecting a number from a scrollable list.
    • wave: To create the animated wave background.
  • App Setup & Splash Screen:
    • flutter_native_splash: To create and manage the native splash screen for a professional app launch.
    • splash_master: A helper package for implementing splash screen logic.
  • Testing (Dev Dependency):
    • mocktail: A popular mocking library for creating mocks in Dart tests.

🚀 Getting Started

Follow these steps to run the project on your local machine.

Prerequisites

-(https://flutter.dev/docs/get-started/install) installed.

  • A configured Android/iOS emulator or a physical device.

Installation & Setup

  1. Clone the repository:

    git clone https://github.com/javerage/javerage_timer.git
  2. Navigate to the project directory:

    cd javerage_timer
  3. Install dependencies:

    flutter pub get
  4. Run the application:

    flutter run

And that's it! The timer application should now be running on your device or emulator.

💬 You're not alone on this journey! If you have questions, ideas, or just want to share your progress, follow us and join the conversation.

If you find a bug or have a suggestion to improve a practice, the best way to help is by opening an "Issue" directly in this GitHub repository.

📄 License This project is distributed under the MIT License. You are free to use, modify, and share this code as you wish. Happy coding!

About

A sample project showcasing robust state management in Flutter. This timer app is built using the flutter_bloc library and follows a feature-first Clean Architecture.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published