Skip to content

linyeping/GemMate

Repository files navigation

GemMate Logo

GemMate

Your AI Study Companion — Powered by Gemma 4

FeaturesArchitectureDemoInstallationTech StackLicense


🌟 What is GemMate?

GemMate transforms how university students learn by combining Google's Gemma 4 E2B model with proven study science techniques. It's a cross-platform Flutter app that runs Gemma 4 100% locally — no cloud, no API keys, no data leaves your device.

💡 The Problem: Students struggle to create effective study materials from lectures and textbooks. Existing AI tools require cloud connectivity and raise privacy concerns.

The Solution: GemMate runs Gemma 4 E2B on your own hardware, generating personalized flashcards, quizzes, and explanations — even on an airplane.

Chat Demo


✨ Features

🧠 AI Chat with Gemma 4

Chat with Gemma 4 E2B to understand complex concepts. Ask questions in any of 6 supported languages, and get bilingual explanations tailored to your level.

Chat Demo

📚 Smart Flashcard Decks

Generate flashcard decks from any chat conversation. Cards use the SM-2 spaced repetition algorithm for scientifically-optimized review schedules. Decks are displayed as beautiful fan-shaped card piles with flip animations.

Front Back

📊 Interactive Quizzes

AI-generated multiple-choice quizzes that test your understanding. Wrong answers automatically become flashcards for targeted review.

📷 Camera / OCR

Photograph textbook pages, lecture slides, or handwritten notes. Gemma 4's vision capabilities extract and explain the content.

Chat Demo

🎤 Voice Input

Tap the microphone to ask questions by voice — perfect for hands-free studying. Supports Chinese, English, Japanese, Korean, French, and Spanish.

Chat Demo

🌍 6 Languages

Full UI localization and AI responses in: English, 简体中文, 日本語, 한국어, Français, Español.

Chat Demo

🔔 Smart Notifications

Spaced repetition reminders, daily study prompts, and inactivity nudges keep you on track.

Chat Demo

🎨 Neomorphic Design

Beautiful neomorphic UI with dark/light mode, customizable accent colors, and adjustable font sizes.

Chat Demo


🏗️ Architecture

GemMate uses a smart routing architecture that automatically selects the best available AI model:

┌─────────────────────────────────────────────────┐
│                  📱 PHONE                      │
│             GemMate Flutter App                 │
│                                                 │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐       │
│  │   Chat   │  │  Cards   │  │   Quiz   │       │
│  └────┬─────┘  └────┬─────┘  └────┬─────┘       │
│       │              │              │           │
│       └──────────────┼──────────────┘           │
│                      │                          │
│              ┌───────▼────────┐                 │
│              │  Smart Router  │                 │
│              └───┬───────┬─-──┘                 │
│                  │       │                      │
│     ┌────────────▼─┐  ┌──▼───────────────┐      │
│     │  On-Device   │  │   Ollama HTTP    │      │
│     │  Gemma 4 E2B │  │   Connection     │      │
│     │  (Offline)   │  │   (WiFi LAN)     │      │
│     └──────────────┘  └──────┬───────────┘      │
│                              │                  │
└──────────────────────────────┼──────────────────┘
                               │ WiFi (Local Network)
┌──────────────────────────────▼───────────────────┐
│                  💻 LAPTOP                       │
│           Ollama + Gemma 4 E4B                   │
│         (RTX 4060, <1s response)                 │
└──────────────────────────────────────────────────┘

Smart Routing Logic

Condition Model Used Latency
WiFi + Laptop available Gemma 4 E4B via Ollama (laptop GPU) <1s
No WiFi, model installed Gemma 4 E2B on-device (phone CPU) 3-8s
WiFi + No laptop Gemma 4 E2B on-device 3-8s
No WiFi, no model Prompt to download model

🎬 Demo

📺 Watch the 3-minute demo video →

📦 Download APK →


🚀 Installation

Prerequisites

  • Flutter 3.41+ (Install Flutter)
  • Android device (Android 8.0+) or emulator
  • For laptop AI: Ollama + ollama pull gemma4:e2b

Build from Source

# Clone the repository
git clone https://github.com/linyeping/GemMate.git
cd GemMate

# Install dependencies
flutter pub get

# Run on connected device
flutter run

# Build APK
flutter build apk --release

Set Up Laptop AI (Optional, Recommended)

# Install Ollama (https://ollama.ai)
ollama pull gemma4:e2b

# Start with network access
OLLAMA_HOST=0.0.0.0:11434 ollama serve

# In GemMate Settings → Connection → Enter laptop IP

Install On-Device Model (Optional, for Offline Use)

Option A: Download in-app (Settings → Model Management → Download)

Option B: Manual install via ADB:

# Download from Hugging Face mirror (China)
curl -L -o gemma-4-E2B-it.litertlm "https://hf-mirror.com/litert-community/gemma-4-E2B-it-litert-lm/resolve/main/gemma-4-E2B-it.litertlm"

# Push to phone
adb push gemma-4-E2B-it.litertlm /sdcard/Download/

# In app: Settings → Model Management → Load from /sdcard/Download/

🛠️ Tech Stack

Component Technology
AI Model Gemma 4 E2B /Gemma 4 E4B
On-Device Runtime LiteRT-LM via flutter_gemma
Local Server Ollama (laptop, GPU-accelerated)
App Framework Flutter 3.41 / Dart
Study Algorithm SM-2 Spaced Repetition
Voice Input speech_to_text
OCR / Vision Gemma 4 multimodal (via Ollama)
Notifications flutter_local_notifications
Storage SharedPreferences + JSON
UI Design Custom Neomorphic widgets

📁 Project Structure

lib/
├── main.dart                          # App entry point + model initialization
├── app/
│   ├── router.dart                    # Bottom navigation + page routing
│   └── theme.dart                     # Neumorphic theme (light/dark)
├── core/
│   ├── constants.dart                 # App constants + colors
│   ├── json_utils.dart                # JSON parsing utilities
│   ├── text_utils.dart                # Text processing and formatting
│   └── utils.dart                     # General helper functions
├── l10n/
│   ├── app_localizations.dart         # i18n delegate
│   ├── locale_en.dart                 # English localization
│   ├── locale_es.dart                 # Spanish localization
│   ├── locale_fr.dart                 # French localization
│   ├── locale_ja.dart                 # Japanese localization
│   ├── locale_ko.dart                 # Korean localization
│   └── locale_zh.dart                 # Chinese localization
├── models/
│   ├── chat_message.dart              # Chat message model
│   ├── chat_session.dart              # Chat session model
│   ├── flashcard.dart                 # Flashcard with SM-2 fields + grouping
│   ├── quiz.dart                      # Quiz state model
│   ├── quiz_question.dart             # Quiz question model
│   └── study_plan.dart                # Spaced repetition schedule model
├── screens/
│   ├── capture_screen.dart            # Camera / OCR feature
│   ├── chat_history_screen.dart       # Chat session management
│   ├── chat_screen.dart               # Main chat UI + voice input
│   ├── deck_study_screen.dart         # Card flip study session
│   ├── flashcard_screen.dart          # Deck gallery with fan piles
│   ├── home_screen.dart               # Main dashboard
│   ├── onboarding_screen.dart         # First-launch setup + model download
│   ├── paper_screen.dart              # Document/exam paper analysis
│   ├── quiz_screen.dart               # Interactive quiz UI
│   ├── review_screen.dart             # Scheduled review dashboard
│   └── settings_screen.dart           # Settings with sub-pages
├── services/
│   ├── flashcard_generator.dart       # AI-powered flashcard creation
│   ├── local_gemma_service.dart       # On-device Gemma 4 via flutter_gemma
│   ├── model_download_service.dart    # Model download + mirror support
│   ├── notification_service.dart      # Study reminders
│   ├── ollama_service.dart            # HTTP client for Ollama API
│   ├── quiz_generator.dart            # AI-powered quiz generation
│   ├── smart_router.dart              # Smart model selection logic
│   ├── storage_service.dart           # Local file/DB storage operations
│   └── study_tools.dart               # Core study algorithms (SM-2, etc.)
├── stores/
│   ├── chat_store.dart                # Chat session persistence
│   ├── connection_store.dart          # Connection state management
│   ├── flashcard_store.dart           # Flashcard persistence + groups
│   ├── locale_store.dart              # Language preferences
│   └── theme_store.dart               # Theme + font size preferences
└── widgets/
    ├── animated_avatar.dart           # AI/User animated profile picture
    ├── chat_session_tile.dart         # Chat history list item
    ├── color_scheme_picker.dart       # Theme color selector
    ├── connection_indicator.dart      # Connection status pill
    ├── download_progress_widget.dart  # Model download status UI
    ├── flashcard_widget.dart          # Individual flashcard UI
    ├── loading_indicator.dart         # Custom loading animation
    ├── message_bubble.dart            # Chat message bubble
    ├── model_badge.dart               # Model source indicator (Edge/Laptop)
    ├── neumorphic_button.dart         # Neumorphic button widget
    ├── neumorphic_container.dart      # Neumorphic card widget
    ├── quick_action_chips.dart        # Suggested prompt chips
    └── quiz_option_tile.dart          # Quiz multiple choice button

👤 About the Developer

Sheng Wei — AI major at Gansu Political Science and Law University (GSUPL) in China. A Solo developer.

Previous Projects: InSeeVision (Gemma 3 accessibility project).


📄 License

This project is licensed under the Apache License 2.0 — see the LICENSE file for details.

The Gemma 4 model is provided by Google under the Gemma Terms of Use.


Built with ❤️ for the Gemma 4 Good Hackathon 2026
Contact: yepinglin20@gmail.com | 201180946@qq.com