A modern Flutter application for tracking time spent at different locations using geofencing technology. The app automatically detects when you're at predefined locations (Home, Office) or traveling, and provides detailed daily summaries of your time allocation.
- Automatic Location Tracking: Uses GPS and geofencing to detect your current location
- Predefined Geofences: Tracks time at Home and Office locations with 50-meter radius detection
- Background Tracking: Continues monitoring location even when app is minimized
- Daily Summaries: Comprehensive breakdown of time spent in each location
- Historical Data: View past tracking data with date picker navigation
- Real-time Updates: Live tracking status and time calculations
- Clean Modern Design: Sleek, minimalistic interface without shadows
- Intuitive Navigation: Simple Clock In/Out workflow with visual feedback
- Color-coded Status: Different colors for active tracking, stopped, and location states
- Responsive Layout: Optimized for mobile devices with touch-friendly controls
- Local Storage: Uses Hive database for efficient local data persistence
- Custom Geofences: Support for adding user-defined locations (bonus feature)
- Data Export: Time entries and summaries stored in structured format
- Privacy First: All data stored locally on device
- Flutter: Cross-platform mobile development framework
- Dart: Programming language
- Material Design 3: Modern UI components and theming
- go_router: Navigation and routing management
- provider: State management solution
- hive: Local database for data persistence
- location: Background location tracking
- geolocator: GPS and location services
- permission_handler: Runtime permission management
- intl: Internationalization and date formatting
- Provider Pattern: Reactive state management
- Service Layer: Separation of business logic
- Repository Pattern: Data access abstraction
- Clean Architecture: Modular and testable code structure
lib/
├── models/ # Data models with Hive annotations
│ ├── location_data.dart
│ ├── geofence_data.dart
│ ├── time_entry.dart
│ └── daily_summary.dart
├── providers/ # State management
│ ├── location_provider.dart
│ └── time_tracking_provider.dart
├── services/ # Business logic services
│ ├── location_service.dart
│ ├── geofence_service.dart
│ ├── hive_service.dart
│ └── tracking_coordinator.dart
├── screens/ # UI screens
│ ├── splash_screen.dart
│ ├── main_screen/
│ └── summary_screen/
├── utils/ # Utilities and helpers
│ └── app_router.dart
└── main.dart # Application entry point
- Flutter SDK (3.2.0 or higher)
- Android Studio / Xcode for mobile development
- Git for version control
-
Clone the repository
git clone <repository-url> cd test-app
-
Install dependencies
flutter pub get
-
Generate code (for Hive type adapters)
flutter packages pub run build_runner build
-
Run the application
flutter run
- Minimum SDK: 21
- Target SDK: 34
- Permissions automatically handled in AndroidManifest.xml
- Minimum iOS version: 12.0
- Location permissions configured in Info.plist
- Background location capability enabled
- Launch the app - The splash screen will initialize all services
- Grant permissions - Allow location access when prompted
- Clock In - Tap the large blue button to start tracking
- Move around - App automatically detects location changes
- Clock Out - Tap the red button to stop tracking and save data
- View Summary - Navigate to summary screen to see detailed breakdowns
- Home: 37.7749°N, 122.4194°W (San Francisco area)
- Office: 37.7858°N, 122.4364°W (San Francisco area)
- Traveling: When outside any defined geofence
- Today's Live Data: Real-time tracking on main screen
- Historical Summaries: Use date picker in summary screen
- Location Breakdown: See time and percentage spent in each location
- Progress Visualization: Color-coded progress bars for each location
The app uses the Provider pattern with multiple providers:
- LocationProvider: Manages GPS tracking and geofence detection
- TimeTrackingProvider: Handles time calculations and data persistence
- LocationService monitors GPS coordinates
- GeofenceService determines current location based on coordinates
- TrackingCoordinator synchronizes location changes with time tracking
- Providers update UI state and persist data to Hive database
- Location updates continue when app is backgrounded
- Time entries are automatically saved when location changes
- Daily summaries generated and stored on Clock Out
- ACCESS_FINE_LOCATION: High-accuracy GPS tracking
- ACCESS_COARSE_LOCATION: Network-based location
- ACCESS_BACKGROUND_LOCATION: Background location updates
- FOREGROUND_SERVICE: Service for continuous tracking
- WAKE_LOCK: Prevent device sleep during tracking
- NSLocationWhenInUseUsageDescription: Location access when app is active
- NSLocationAlwaysAndWhenInUseUsageDescription: Background location access
- UIBackgroundModes: Background location updates
flutter build apk --release # Android
flutter build ios --release # iOSWhen modifying Hive models, regenerate type adapters:
flutter packages pub run build_runner build --delete-conflicting-outputsflutter test # Unit tests
flutter analyze # Static analysisLocation permissions denied
- Check device location settings
- Ensure app has location permissions in system settings
- For iOS, check Location Services is enabled
Background tracking not working
- Verify background app refresh is enabled
- Check battery optimization settings
- Ensure location permissions include "Always" option
Build errors
- Run
flutter cleanandflutter pub get - Check Android NDK version matches requirements
- Ensure all dependencies are compatible
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Flutter team for the excellent framework
- Community packages that made this project possible
- Contributors and testers who helped improve the app