Skip to content

leoVolk/tracker

Repository files navigation

🏃‍♂️🏊‍♀️🚴‍♂️ Fitness Tracker App (Flutter)

A multi-sport fitness tracking app built with Flutter that allows users to log workouts, track progress over time, and unlock achievement badges — all offline-first using local storage.

The app currently supports:

  • 🏊 Swimming
  • 🏃 Running
  • 🚴 Biking

Each sport has its own tailored input flow, statistics, and badge evaluation while sharing a common data and UI structure.

✨ Key Features

📝 Activity Logging

  • Log workouts with sport-specific inputs:
    • Swimming: distance per lap + number of laps
    • Running: distance + start & end time
    • Biking: distance + start & end time
  • Date picker (defaults to today)
  • Swipe-to-delete entries

📊 Real-Time Statistics

Each sport shows:

  • Total distance
  • Calories burned
  • Time spent (for running & biking)
  • Sport-specific KPIs

📈 Visualizations

  • Tab-based layout:
    • Entries list
    • Graphs & statistics
  • Charts powered by fl_chart

🏆 Badge System

  • Unified badge system across all sports
  • Badges unlock dynamically based on activity history
  • Badges are revoked if requirements are no longer met
  • Horizontally scrollable badge row
  • Badge row only appears when at least one badge is unlocked

💾 Offline Persistence

  • All data stored locally using shared_preferences
  • No backend required
  • Data persists across app restarts

🧱 App Architecture

lib/
├── components/
│   ├── swimming.dart
│   ├── running.dart
│   ├── biking.dart
│   └── shared_widgets/
├── models/
│   ├── swim_entry.dart
│   ├── run_entry.dart
│   ├── biking_entry.dart
│   ├── badge.dart
│   ├── badge_type.dart
│   └── models.dart
├── utils/
│   └── chart_helpers.dart
├── main.dart

🧩 Sport Modules

🏊 Swimming

  • Lap-based tracking (25m / 50m)
  • Automatic distance & calorie calculation
  • Distance & calorie trend charts
  • Badge unlocks based on distance and consistency

🏃 Running

  • Distance input
  • Start & end time selection
  • Automatic duration calculation
  • Time-based statistics and badges

🚴 Biking

  • Distance input
  • Start & end time selection
  • Total ride duration tracking
  • Calories, distance & time overview

🧮 Calculations

Calories

Calories are calculated per sport using configurable constants:

calories = distance (meters) × kcalPerMeter

Duration (Running & Biking)

  • Calculated using start and end time
  • Handles overnight activities automatically

🏆 Badge Rules

  • Badges are defined centrally
  • Each badge:
    • Has a BadgeType
    • Implements an isUnlocked(List<Entry>) rule
  • Badge state is recalculated whenever entries are added or removed

Example Badge Definition

BadgeDefinition( type: BadgeType.firstWorkout, title: 'First Workout', isUnlocked: (entries) => entries.isNotEmpty, )

🧰 Dependencies

flutter: sdk: flutter shared_preferences: ^2.x.x fl_chart: ^0.66.x

🖼 Assets

flutter: assets: - assets/images/swimming.png - assets/images/running.png - assets/images/bike_riding.png

🚀 Roadmap / Future Improvements

  • Weekly & monthly summaries
  • Advanced analytics (pace, speed, averages)
  • Sport-specific badge categories
  • Cloud sync & authentication
  • Data export (CSV / JSON)
  • Dark mode support

🛠 Tech Stack

  • Flutter
  • Material Design
  • Stateful Widgets
  • Local persistence
  • Modular component architecture

📄 License

This project is intended for personal and educational use.
You are free to modify, extend, and adapt it to your needs.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors