Skip to content
/ Adati Public

Adat Tracker: An open-source, offline-first habit tracker built with Flutter, featuring user-controlled cloud sync.

License

Notifications You must be signed in to change notification settings

Zyzto/Adati

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Adati

A beautiful habit tracking app with timeline visualization

Latest Release GitHub Workflow Status Downloads GitHub Stars

Flutter Dart License: CC BY-NC-SA 4.0

πŸ“₯ Download

Current Version: 0.2.7+1

Pre-built releases are available on GitHub Releases.

Android

Option 1: Obtainium (Recommended) - Automatic Updates

Add to Obtainium

  • Manual Setup: Install Obtainium from F-Droid or GitHub Releases, then:
    • Open Obtainium and tap the "+" button
    • Select "GitHub Releases" as the source
    • Enter repository: Zyzto/Adati
  • Obtainium will automatically track new releases and notify you of updates

Option 2: Google Play Store WIP

  • Available on Google Play Store (when published)
  • Automatic updates through Play Store

Option 3: Direct Install (APK)

  • Download adati-VERSION-android.apk from GitHub Releases
  • Enable "Install from unknown sources" in your Android settings
  • Tap the downloaded APK file to install

Linux

AppImage (Recommended)

  1. Download adati-VERSION-linux-x86_64.AppImage from GitHub Releases
  2. Make it executable:
    chmod +x adati-*-linux-x86_64.AppImage
  3. Run it:
    ./adati-*-linux-x86_64.AppImage

Note: AppImage is portable and doesn't require installation. It includes all dependencies and works on most modern Linux distributions (requires GLIBC 2.31+, Ubuntu 20.04+).

Windows

ZIP Package (Recommended)

  1. Download adati-VERSION-windows-x64.zip from GitHub Releases
  2. Extract the ZIP file to a folder (e.g., C:\Program Files\Adati\)
  3. Run adati.exe from the extracted folder

Standalone EXE

  • Download adati-VERSION-windows-x64.exe (requires DLLs from the ZIP package to run properly)
  • Note: The ZIP package is recommended as it includes all required dependencies

macOS & iOS

Build instructions are available in the Building for Production section. Pre-built releases for macOS and iOS may be available in future releases.

Web

Web builds are available for development. See the Building for Production section for build instructions.

πŸ“± About

Adati is a modern, feature-rich habit tracking application built with Flutter. It helps you build and maintain good habits through visual tracking, streak monitoring, and an intuitive timeline interface. The app supports multiple languages, themes, and runs seamlessly across all major platforms.

✨ Features

Core Functionality

  • Habit Management: Create, edit, and delete habits with custom names, descriptions, colors, and icons
  • Multiple Tracking Types:
    • Completed: Simple yes/no tracking (e.g., "Meditated today")
    • Measurable: Track numeric values with units (e.g., "Walked 5 km", "Drank 8 glasses of water")
    • Occurrences: Track multiple occurrences per day (e.g., "Exercised: Morning, Evening")
  • Good & Bad Habits: Track both positive habits you want to build and negative habits you want to break
    • Configurable Bad Habit Logic: Choose how bad habits affect your timeline completion (see Settings)
  • Goal Setting: Set daily, weekly, or monthly goals for measurable habits
  • Streak Tracking: Automatic calculation and display of current and longest streaks (separate for good/bad habits)
  • Tag System: Organize habits with custom tags for better categorization
  • Timeline Visualization: Beautiful calendar grid showing your completion history at a glance
  • Day Details: View and edit all entries for a specific date
  • Habit Details: Comprehensive view of each habit with calendar modal, statistics, and management options
  • Reminders: Set up daily reminders for your habits
  • Data Import/Export: Import and export your data in JSON or CSV format

User Experience

  • Material Design 3: Modern, beautiful UI following Material Design principles
  • Dark & Light Themes: System-aware theme with manual override option
  • Multi-language Support: Currently supports English and Arabic (RTL support included)
  • Smooth Animations: Polished transitions and loading states
  • Responsive Layout: Optimized for phones, tablets, and desktop
  • Skeleton Loading: Better perceived performance with skeleton screens

Technical Features

  • Offline-First: All data stored locally using SQLite
  • Database Migrations: Seamless schema updates without data loss
  • Notifications: Local notifications support (with permission handling)
  • Preferences: Persistent user settings and preferences
  • Timezone Support: Accurate date handling across timezones
  • Logging: Comprehensive logging for debugging and error tracking
  • Desktop Mouse Support: Custom scroll behavior enables mouse drag gestures on desktop platforms (Linux, Windows, macOS) for PageView and other scrollable widgets

Platform Support

  • βœ… Android
  • βœ… iOS
  • βœ… Linux
  • βœ… macOS
  • βœ… Windows
  • βœ… Web

πŸ“– Usage

Creating a Habit

  1. Navigate to the Timeline or Habits tab
  2. Tap the "+" button or "New Habit" option
  3. Enter habit name, optional description, choose a color and icon
  4. Select habit type (Good or Bad habit)
  5. Choose tracking type:
    • Completed: Simple completion tracking
    • Measurable: Set unit (minutes, km, glasses, etc.) and goal value
    • Occurrences: Define occurrence names (e.g., "Morning", "Evening")
  6. Set goal period (daily, weekly, or monthly) for measurable habits
  7. Optionally enable reminders and set reminder time
  8. Add tags to organize your habits
  9. Save to start tracking

Tracking Habits

Completed Habits

  • Tap on a day in the calendar grid to mark habits as complete/incomplete
  • Add optional notes to any entry

Measurable Habits

  • Tap on a day to enter a numeric value
  • The app automatically marks as complete when goal is reached
  • Track values like: minutes exercised, km walked, glasses of water, pages read, etc.

Occurrences Habits

  • Tap on a day to select which occurrences happened
  • Track multiple occurrences per day (e.g., "Exercised in the morning and evening")

Viewing Timeline

  • The main timeline shows a calendar grid with color-coded completion status
  • Completion Calculation: The timeline uses a weighted completion system that respects your bad habit logic mode setting:
    • Negative Mode: (good completed - bad marked) / total good habits. If only bad habits exist, starts at 100% and decreases by bad marked / total bad habits. Completion rate is clamped to 0-100%.
    • Positive Mode: (good completed + bad not marked) / total habits. Completion rate is clamped to 0-100%.
  • Tap any day to view and edit all entries for that date
  • Statistics at the top show your overall progress
  • Filter habits by tags or search by name

Habit Details

  • Tap on any habit card to see:
    • Calendar view with completion history
    • Current and longest streaks
    • Statistics and progress
    • Edit or delete the habit

Data Management

  • Export Data: Export all data, habits only, or settings only (JSON or CSV format)
  • Import Data: Import data from exported files (supports JSON and CSV)
  • Auto-Backup: Automatic daily backups with configurable retention (see Settings)
  • Manual Backup: Create backups on-demand from Settings
  • Backup Restoration: Restore from previous backups
  • Database Statistics: View database size and record counts
  • Reset Habits: Option to reset all habits and tracking data

Settings

  • Language: Switch between English and Arabic (with RTL support)
  • Theme: Choose Light, Dark, or System theme
  • Bad Habit Logic Mode: Choose how bad habits affect timeline completion
    • Negative Mode (Default): Marking a bad habit counts as negative, reducing completion rate. Good habits add +1, bad habits subtract -1 when marked. If you only have bad habits, the timeline starts at 100% and decreases when you mark them.
    • Positive Mode: Not marking a bad habit counts as positive. Good habits add +1 when completed, bad habits add +1 when NOT marked. This is the traditional behavior where avoiding bad habits is rewarded.
  • Data & Export: Import/export your data
  • Advanced: Database statistics and reset options
  • All preferences are saved automatically

πŸ–₯️ Desktop-Specific Features

Mouse Drag Support

The app includes a custom scroll behavior (AppScrollBehavior) that enables mouse drag gestures on desktop platforms. This allows users to:

  • Click and hold to drag PageView slides (e.g., in the onboarding screen)
  • Use mouse drag for all scrollable widgets throughout the app
  • Support trackpad gestures

Implementation: The custom behavior extends MaterialScrollBehavior and includes PointerDeviceKind.mouse and PointerDeviceKind.trackpad in the allowed drag devices. This is applied globally via MaterialApp.scrollBehavior.

Why it's needed: Flutter's default MaterialScrollBehavior only allows drag gestures for touch devices, stylus, and inverted stylus. Without this custom behavior, users on desktop platforms cannot drag scrollable widgets with a mouse.

πŸš€ Getting Started

Prerequisites

  • Flutter SDK (3.9.2 or higher)
  • Dart SDK (3.9.2 or higher)
  • For platform-specific builds:
    • Android: Android Studio with Android SDK
    • iOS: Xcode (macOS only)
    • Linux: CMake and required development libraries
    • Windows: Visual Studio with C++ tools
    • Web: Chrome (for development)

Installation

  1. Clone the repository

    git clone https://github.com/Zyzto/Adati.git
    cd Adati
  2. Install dependencies

    flutter pub get
  3. Generate code (for Drift database)

    flutter pub run build_runner build --delete-conflicting-outputs
  4. Run the app

    flutter run

Building for Production

Android

flutter build apk --release --no-tree-shake-icons
# or for app bundle
flutter build appbundle --release --no-tree-shake-icons

iOS

flutter build ios --release

Linux

flutter build linux --release --no-tree-shake-icons

macOS

flutter build macos --release

Windows

flutter build windows --release --no-tree-shake-icons

Web

flutter build web --release

Automated Releases

The project includes GitHub Actions workflows for automated builds and releases:

  • Automatic Release: Push a tag (e.g., v0.1.0) to automatically build and release for Android, Linux, and Windows
  • Manual Trigger: Use the "Run workflow" button in GitHub Actions to manually trigger builds
  • Artifacts: Built apps are automatically uploaded to GitHub Releases

See .github/workflows/release-beta.yml for the complete workflow configuration.

πŸ—οΈ Project Structure

lib/
β”œβ”€β”€ main.dart                 # App entry point and initialization
β”œβ”€β”€ app.dart                  # Main app widget and routing
β”‚
β”œβ”€β”€ core/                     # Core functionality
β”‚   β”œβ”€β”€ database/            # Database models, DAOs, and connection
β”‚   β”‚   β”œβ”€β”€ models/          # Drift table definitions
β”‚   β”‚   β”œβ”€β”€ daos/            # Data Access Objects
β”‚   β”‚   └── app_database.dart
β”‚   β”œβ”€β”€ services/            # App-wide services
β”‚   β”‚   β”œβ”€β”€ notification_service.dart
β”‚   β”‚   β”œβ”€β”€ preferences_service.dart
β”‚   β”‚   β”œβ”€β”€ logging_service.dart
β”‚   β”‚   β”œβ”€β”€ reminder_service.dart
β”‚   β”‚   β”œβ”€β”€ export_service.dart
β”‚   β”‚   β”œβ”€β”€ import_service.dart
β”‚   β”‚   β”œβ”€β”€ auto_backup_service.dart
β”‚   β”‚   └── demo_data_service.dart
β”‚   β”œβ”€β”€ theme/               # App theming
β”‚   β”‚   β”œβ”€β”€ app_theme.dart
β”‚   β”‚   └── app_scroll_behavior.dart  # Custom scroll behavior for desktop mouse support
β”‚   └── utils/               # Utility functions
β”‚
└── features/                 # Feature modules
    β”œβ”€β”€ habits/              # Habit management
    β”‚   β”œβ”€β”€ habit_repository.dart  # Data layer (repository)
    β”‚   β”œβ”€β”€ pages/           # Page widgets
    β”‚   β”œβ”€β”€ providers/       # Riverpod providers
    β”‚   └── widgets/         # Reusable widgets
    β”œβ”€β”€ timeline/            # Timeline visualization
    β”‚   β”œβ”€β”€ pages/           # Timeline pages
    β”‚   └── widgets/         # Timeline widgets
    β”œβ”€β”€ settings/            # Settings page
    β”‚   β”œβ”€β”€ pages/           # Settings pages
    β”‚   └── providers/       # Settings providers
    └── onboarding/          # Onboarding flow
        β”œβ”€β”€ pages/           # Onboarding pages
        └── widgets/         # Onboarding widgets

πŸ“š Documentation

  • SERVICES.md - Comprehensive documentation for all services in the codebase, including usage examples and API reference
  • SECURITY.md - Security guidelines, best practices, and how to handle sensitive information

πŸ› οΈ Technology Stack

πŸ§ͺ Development

Debug Menu

When running the app in debug mode (flutter run or debug builds), a debug menu button (πŸ› bug icon) appears next to the settings button in the main timeline page. This menu provides quick access to debugging tools:

Available Debug Tools

  1. Log All Preferences - Logs all stored preferences (keys and values) to the console
  2. Log All Habits - Logs detailed information about all habits (ID, name, type, color, icon)
  3. Log All Tags - Logs all tag data (ID, name, color)
  4. Log All Entries - Logs all tracking entries (habitId, date, completed status, notes)
  5. Log All Streaks - Logs all streak data (combined, good, bad, current, longest streaks)
  6. Database Path - Shows the database file location in a dialog (useful for manual database inspection)
  7. Force Refresh - Invalidates all providers to force a refresh of the UI
  8. Performance Indicator - Toggles a real-time FPS counter overlay in the top-right corner
  9. Test Reminder (Immediate) - Test the reminder system with an immediate notification
  10. Test Notification (30s) - Schedule a test notification in 30 seconds
  11. Reschedule All Reminders - Manually reschedule all habit reminders

Using the Debug Menu

  1. Run the app in debug mode: flutter run
  2. Navigate to the main timeline page
  3. Look for the bug icon (πŸ›) in the app bar next to the settings button
  4. Tap the bug icon to open the debug menu
  5. Select any option to execute the debug action

Note: The debug menu is only available in debug mode and will not appear in release builds. All logs are written using the app's logging system and can be viewed in the console or exported via the Settings β†’ Advanced β†’ Logs section.

Running Tests

flutter test

Code Generation

When you modify database models or DAOs, regenerate the code:

flutter pub run build_runner build --delete-conflicting-outputs

Generating Icons

After updating assets/icon.png, regenerate platform-specific icons:

flutter pub run flutter_launcher_icons

Linting

The project uses flutter_lints for code quality:

flutter analyze

CI/CD

The project uses GitHub Actions for automated builds and releases:

  • Workflow files:
    • .github/workflows/release-beta.yml - Beta releases (triggers on v* tags)
    • .github/workflows/release-production.yml - Production releases
    • .github/workflows/build.yml - Build workflow
  • Triggers on version tags (v*) or manual dispatch
  • Builds for Android (APK/AAB), Linux (AppImage), and Windows (ZIP)
  • Automatically creates GitHub releases with artifacts

πŸ“ Database Schema

The app uses SQLite with the following main tables:

  • habits: Stores habit information including:
    • Basic info: name, description, color, icon
    • Type: good (0) or bad (1) habit
    • Tracking type: completed, measurable, or occurrences
    • Measurable config: unit, goal value, goal period (daily/weekly/monthly)
    • Occurrences config: JSON array of occurrence names
    • Reminders: enabled flag and reminder time
  • tracking_entries: Daily tracking records with:
    • Completion status (for completed habits)
    • Numeric value (for measurable habits)
    • Occurrence data as JSON array (for occurrences habits)
    • Optional notes
  • streaks: Calculated streak data for each habit:
    • Combined streak (main display)
    • Good streak (for good habits)
    • Bad streak (for bad habits - days not doing the bad habit)
    • Longest streaks for each type
  • tags: Habit tags for organization (name, color, icon)
  • habit_tags: Junction table linking habits to tags (many-to-many relationship)

Entity Relationship Diagram

erDiagram
    HABITS ||--o{ TRACKING_ENTRIES : "has"
    HABITS ||--|| STREAKS : "has"
    HABITS ||--o{ HABIT_TAGS : "has"
    TAGS ||--o{ HABIT_TAGS : "has"
    
    HABITS {
        int id PK
        string name
        string description
        int color
        string icon
        int habitType "0=good, 1=bad"
        string trackingType "completed, measurable, occurrences"
        string unit "for measurable tracking"
        real goalValue "for measurable tracking"
        string goalPeriod "daily, weekly, monthly"
        string occurrenceNames "JSON array for occurrences tracking"
        bool reminderEnabled
        string reminderTime "JSON format"
        datetime createdAt
        datetime updatedAt
    }
    
    TRACKING_ENTRIES {
        int habitId PK,FK
        datetime date PK
        bool completed
        real value "for measurable tracking"
        string occurrenceData "JSON array for occurrences tracking"
        string notes
    }
    
    STREAKS {
        int id PK
        int habitId FK "unique"
        int combinedStreak "main streak shown on main page"
        int combinedLongestStreak
        int goodStreak "for good habits"
        int goodLongestStreak
        int badStreak "for bad habits (not doing bad habit)"
        int badLongestStreak
        int currentStreak "backward compatibility"
        int longestStreak "backward compatibility"
        datetime lastUpdated
    }
    
    TAGS {
        int id PK
        string name
        int color
        string icon
        datetime createdAt
    }
    
    HABIT_TAGS {
        int habitId PK,FK
        int tagId PK,FK
    }
Loading

🌍 Localization

Currently supported languages:

  • English (en)
  • Arabic (ar) - with RTL support

To add a new language:

  1. Add translation files in assets/translations/
  2. Update main.dart to include the new locale
  3. Add language option in settings

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License - see the LICENSE file for details.

CC BY-NC-SA 4.0 means:

  • βœ… You can share and adapt the code
  • βœ… You must give appropriate credit
  • ❌ You cannot use it for commercial purposes
  • βœ… You must share adaptations under the same license

πŸ‘€ Author

Zyzto

πŸ™ Acknowledgments

πŸ“ž Support

If you encounter any issues or have questions, please open an issue on GitHub.


Made with ❀️ using Flutter

About

Adat Tracker: An open-source, offline-first habit tracker built with Flutter, featuring user-controlled cloud sync.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published