Skip to content
0xOpCodePublic

About

Offline-first Android mental math trainer built with Flutter and Isar. Adaptive problem engine, local analytics, streaks, and zero-network privacy.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

ZenMath App Icon

ZenMath

Offline-first Android mental math practice app with adaptive problem generation, local analytics, and zero-network privacy.

Latest Release Build Status Platform Offline


Tech Stack

Flutter Dart Android Riverpod GoRouter Isar FL Chart GitHub Actions

ZenMath runs completely offline on Android. You practice arithmetic, algebra, fractions, percentages, decimals, and powers without accounts, telemetry, or internet access. Every session, streak, XP calculation, and chart lives in a local Isar database on your device.


Key Capabilities

10 Quantitative Practice Topics

Train across Addition, Subtraction, Multiplication, Division, Fractions, Percentages, Decimals, Algebra, Powers, and Mixed drills. Algebra covers seven distinct linear forms (x + a = b, x - a = b, a - x = b, ax = b, ax + b = c, ax - b = c, and (x + a) / b = c), while arithmetic generators include operand-specific hints such as complements to 100, compensation, and distributive splits.

Stateful Question Session Engine

QuestionSessionEngine tracks every expression generated within a run so sessions stay varied and balanced:

  • Zero Duplicate or Mirrored Prompts: Filters identical expressions and commutative pairs (a + b and b + a, a x b and b x a).
  • Answer-Diversity Guard: Prevents consecutive identical answers, caps each answer to once per session in runs up to 15 questions, and enforces a minimum 6-question gap in longer timed runs.
  • Progressive Session Curve: Structures drills into a 20% warm-up, 60% core mental-math patterns, and 20% stretch problems.
  • Live Adaptive Modulation: Three consecutive fast correct answers step the active tier up (easy -> medium -> hard), and two consecutive misses step it down without falling back to trivial + 0 or x 1 expressions.

Unified XP and Polynomial Leveling

XpCalculator serves as a single pure-Dart engine shared by persistence and the results summary so displayed XP matches stored XP:

  • Difficulty & Topic Multipliers: Scales base XP by difficulty (1.0x easy, 1.5x medium, 2.2x hard) and topic weight (1.0x basic arithmetic up to 1.25x Algebra).
  • Accuracy, Streak & Pace Bonuses: Rewards >= 80% accuracy (+15%), 100% accuracy (+30%), in-session streaks (>= 3), fast pacing, and first-of-day Daily Challenge completion (+50 XP).
  • Anti-Spam Floor: Zero correct answers award 0 XP, and sessions under 3 questions exclude bonus multipliers.
  • Non-Linear Level Curve: Each level requires 500 * level + 150 * (level - 1)^2 XP (500 for Level 1, 1150 for Level 2, 2100 for Level 3).

Practice Modes & Local Analytics

  • Three Modes: Standard configurable drills, 60-second Timed Sprints, and deterministic date-seeded Daily Challenges.
  • Tactile Practice Arena: Custom zero-shadow numpad, optional auto-advance on correct answers, haptic feedback, and pause controls.
  • Progress Tracking: 28-day activity heatmap, 7-day / 30-day / all-time fl_chart accuracy trends, topic mastery bars, and date-grouped session history.
  • Warm Editorial Ink UI: Bundled static TTF typefaces (Newsreader, Plus Jakarta Sans, JetBrains Mono) with light warm-paper (#FAF9F5) and dark charcoal (#141413) themes.

Privacy and Offline Storage

ZenMath requests no network permissions and bundles all fonts, icons, and question engines inside the APK. Local state persists through:

  • Isar (3.1.0+1): Typed SessionScore, DailyProgress, and TopicStats collections updated atomically per completed session.
  • SharedPreferences: User preferences (theme, default difficulty, question count, daily goal, haptics, reduced motion, auto-advance).

Architecture

zenmath/
├── assets/
│   ├── fonts/                # Bundled Newsreader, Plus Jakarta Sans, JetBrains Mono TTFs
│   └── icon/                 # App launcher artwork
├── docs/
│   ├── ARCHITECTURE.md       # Engine internals, Isar schemas, and provider graph
│   ├── DESIGN_SYSTEM.md      # Warm Editorial Ink color tokens, typography, and motion rules
│   └── ROADMAP.md            # Shipped milestones and planned work
├── lib/
│   ├── core/                 # QuestionSessionEngine, XpCalculator, theme tokens, custom widgets
│   ├── data/                 # Isar service and collection models
│   ├── features/             # Play, Practice, Results, History, Stats, Settings, Splash
│   ├── providers/            # Riverpod state and query providers
│   └── main.dart             # App entrypoint and GoRouter routes
├── test/                     # Question engine, XP calculator, and widget test suites
├── tool/                     # Launcher icon generation utility
└── .github/workflows/        # Automated build_runner, flutter test, and APK release pipeline

For technical implementation details, read docs/ARCHITECTURE.md and docs/DESIGN_SYSTEM.md.


Installation & Cloud Build Workflow

Download Prebuilt Android APK

  1. Open the latest GitHub Release.
  2. Download app-release.apk (android-arm64) and install it on your Android device.

Build from Source or Deploy via ADB

GitHub Actions builds every push to main through .github/workflows/build-release.yml (running flutter pub get, dart run build_runner build, flutter test --no-pub, and signed arm64 APK compilation).

# Monitor the latest CI build
gh run list -L 1
gh run watch <run_id> --exit-status

# Download the latest release APK and install over USB debugging
./update_app.sh

If an existing local build uses a different signing key (INSTALL_FAILED_UPDATE_INCOMPATIBLE), uninstall first and re-run the installer:

adb uninstall com.akashiverse.zenmath
./update_app.sh

To build locally with Flutter 3.44.0:

flutter pub get
dart run build_runner build --delete-conflicting-outputs
flutter test --no-pub
flutter build apk --release --target-platform android-arm64

License

Copyright (c) Akashiverse. Built for focused offline math training on Android.

About

Offline-first Android mental math trainer built with Flutter and Isar. Adaptive problem engine, local analytics, streaks, and zero-network privacy.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages