Skip to content

jinzishuai/fitnessPipe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

43 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FitnessPipe

AI-Powered Fitness Tracking with Real-Time Pose Detection

FitnessPipe is a cross-platform Flutter application that uses AI-powered pose estimation to track your exercise form in real-time. Built with Google ML Kit for pose detection, it works completely offline with all ML models bundled in the app.

Flutter Platforms

✨ Features

  • 🎯 Real-time Pose Detection - Track 33 body landmarks using MediaPipe
  • πŸ“± Cross-Platform - Runs on iOS, macOS, and Android
  • πŸ”’ Offline-First - All ML models bundled, no internet required
  • 🌏 China-Compatible - No Firebase or Google Cloud dependencies
  • 🎨 Live Skeleton Overlay - Visual feedback of detected pose
  • πŸ“· Multi-Camera Support - Front and back camera support with proper mirroring

πŸš€ Quick Start

Prerequisites

  • Flutter SDK: 3.38.0 or higher
  • Dart SDK: 3.8.0 or higher
  • Platform-specific tools:
    • iOS/macOS: Xcode 14.0+, CocoaPods
    • Android: Android Studio, Android SDK 21+

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/fitnessPipe.git
    cd fitnessPipe
  2. Install dependencies

    flutter pub get
  3. Install iOS/macOS pods (if building for Apple platforms)

    cd ios && pod install && cd ..
    # or for macOS
    cd macos && pod install && cd ..
  4. Configure iOS Development Team (required for iOS device builds)

    # Copy the template
    cp ios/Config.local.xcconfig.template ios/Config.local.xcconfig
    
    # Edit ios/Config.local.xcconfig and set:
    #   DEVELOPMENT_TEAM = your Apple Developer Team ID (Xcode > Preferences > Accounts)
    #   PRODUCT_BUNDLE_IDENTIFIER = a unique bundle ID, e.g. com.yourname.fitnessPipe

Running the App

iOS (Physical Device or Simulator)

# List available devices
flutter devices

# Run on connected iPhone
flutter run -d <device-id>

# Or simply run on any available iOS device
flutter run

Note: Make sure you've configured your development team in ios/Config.local.xcconfig (see Installation step 4).

iOS Simulator & Virtual Camera

To run on the iOS Simulator, use the helper script which handles Rosetta mode automatically:

./run_rosetta.sh

For detailed information about the Simulator setup and Virtual Camera architecture, see docs/ios_simulator.md.

macOS

flutter run -d macos

Android

# Run on connected Android device or emulator
flutter run -d <device-id>

Building Release Versions

iOS

# Build without code signing (for CI/testing)
flutter build ios --no-codesign

# Build with code signing (for distribution)
flutter build ios

The built app will be at build/ios/iphoneos/Runner.app

macOS

flutter build macos

The built app will be at build/macos/Build/Products/Release/fitness_pipe.app

Android

# Build APK
flutter build apk

# Build App Bundle (for Play Store)
flutter build appbundle

The built APK will be at build/app/outputs/flutter-apk/app-release.apk

πŸ› οΈ Development

Project Structure

lib/
β”œβ”€β”€ main.dart                 # App entry point
β”œβ”€β”€ domain/                   # Business logic layer
β”‚   β”œβ”€β”€ models/              # Data models (Pose, PoseLandmark)
β”‚   └── interfaces/          # Abstract interfaces (PoseDetector)
β”œβ”€β”€ data/                    # Data layer
β”‚   └── ml_kit/             # ML Kit implementation
└── presentation/            # UI layer
    β”œβ”€β”€ screens/            # App screens
    └── widgets/            # Reusable widgets

Code Quality Checks

Before committing any changes, run:

# Analyze code for errors and warnings
flutter analyze

# Run tests
flutter test
(cd packages/fitness_counter && flutter test)

# Format code
dart format lib/ test/ packages/

Or use the verification workflow:

flutter analyze && flutter test && (cd packages/fitness_counter && flutter test) && dart format lib/ test/ packages/ --set-exit-if-changed

Architecture

FitnessPipe follows clean architecture principles with three main layers:

  • Presentation Layer: Flutter UI widgets and screens
  • Domain Layer: Business logic and data models
  • Data Layer: ML Kit integration and pose detection implementation

The app uses an abstract PoseDetector interface, making it easy to swap ML backends in the future (e.g., native MediaPipe via FFI for better performance).

For detailed architecture documentation, see docs/architecture.md.

πŸ“‹ Requirements

Minimum Platform Versions

  • iOS: 13.0+
  • macOS: 10.14+
  • Android: API 21+ (Android 5.0 Lollipop)

Permissions

The app requires camera access:

  • iOS/macOS: Camera permission is requested at runtime
  • Android: Camera permission is declared in AndroidManifest.xml

πŸ§ͺ Testing

Run All Tests

flutter test
(cd packages/fitness_counter && flutter test)

Run Specific Test File

flutter test test/unit/pose_detector_test.dart

Package Tests (fitness_counter)

The exercise counting logic is isolated in the packages/fitness_counter directory. To run logic tests for counters (including lateral raise):

cd packages/fitness_counter
flutter test

To run a specific test file within the package:

cd packages/fitness_counter
flutter test test/lateral_raise_counter_test.dart

🀝 Contributing

Contributions are welcome! Please read AGENTS.md for development guidelines.

Development Workflow

  1. Create a feature branch
  2. Make your changes
  3. Run verification: flutter analyze && flutter test && (cd packages/fitness_counter && flutter test)
  4. Format code: dart format lib/ test/ packages/
  5. Submit a pull request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Google ML Kit for pose detection
  • MediaPipe for the pose estimation model
  • Flutter team for the amazing framework

πŸ“š Additional Resources

πŸ› Known Issues

  • Front camera mirroring is handled automatically by the platform
  • Build artifacts may contain .mobileprovision files (already gitignored)

πŸ“ž Support

For issues and questions, please open an issue on GitHub.


Built with ❀️ using Flutter and ML Kit

About

AI Fitness App Based on MediaPipe

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors