A ChatGPT-style study assistant Flutter app that helps students capture book pages, extract text using OCR, and ask questions about the content.
Here’s a quick demo of the project in action:
- Ask a Question - Start a chat conversation
- Capture Page (Camera) - Take a photo and extract text using OCR
- Select from Gallery - Choose an existing image for text extraction
- Temporary Mode Toggle - Choose whether to save chats or use incognito mode
- Camera Integration - Capture book pages with camera or select from gallery
- OCR Text Extraction - Extract text from images using Google ML Kit
- AI Chat Interface - ChatGPT-style conversation UI powered by OpenAI API
- Chat Persistence - Save conversations with SQLite database
- Temporary Mode - Incognito-style chats that aren't saved
- Real-time messaging interface similar to ChatGPT
- Message history and persistence
- Copy messages to clipboard
- Delete individual chats
- Auto-generated chat titles
- Flutter SDK (latest stable version)
- Dart SDK
- Android Studio / VS Code with Flutter extensions
- OpenAI API key
-
Clone and setup:
cd /path/to/your/project flutter pub get -
Configure Gemini API:
- Open
lib/config/api_config.dart - Replace
YOUR_GEMINI_API_KEYwith your actual Gemini API key:
static const String geminiApiKey = 'your-actual-gemini-api-key-here';
- Open
-
Configure permissions (already done):
- Android: Camera, Internet, Storage permissions added to AndroidManifest.xml
- iOS: Camera and Photo Library usage descriptions added to Info.plist
- Go to Google AI Studio
- Sign up or log in to your Google account
- Navigate to API Keys section
- Create a new API key
- Copy the key and add it to the config file
flutter runFor specific platforms:
flutter run -d android # Android
flutter run -d ios # iOSlib/
├── main.dart # App entry point
├── models/ # Data models
│ ├── chat.dart # Chat model
│ └── chat_message.dart # Message model
├── providers/ # State management
│ └── chat_provider.dart # Main chat state provider
├── screens/ # UI screens
│ ├── home_page.dart # Main homepage
│ └── chat_screen.dart # Chat interface
├── services/ # External services
│ ├── camera_service.dart # Camera/gallery functionality
│ ├── database_service.dart # SQLite database operations
│ ├── ocr_service.dart # Text extraction from images
│ └── gemini_service.dart # Gemini API integration
└── widgets/ # Reusable UI components
└── message_bubble.dart # Chat message bubble widget
camera- Camera functionalityimage_picker- Image selection from gallerygoogle_ml_kit- OCR text recognitionhttp- HTTP requests for Gemini APIsqflite- Local SQLite databaseprovider- State managementshared_preferences- Simple data persistencepermission_handler- Runtime permissionsflutter_spinkit- Loading animations
- Open the app
- Tap "Ask a Question"
- Type your question and send
- Receive AI-powered responses
- Tap "Capture Page" or "Select from Gallery"
- Take a photo of a book page or select an existing image
- The app will extract text using OCR
- Ask questions about the extracted content
- Get contextual answers based on the text
- View chat history: Tap "Recent Chats" on homepage
- Delete chats: Use the options menu in chat or from chat list
- Temporary mode: Toggle on homepage to prevent saving chats
-
Camera not working:
- Ensure camera permissions are granted
- Check if device has a camera
- Restart the app
-
OCR not extracting text:
- Ensure image is clear and well-lit
- Text should be clearly visible
- Try capturing the image again
-
OpenAI API errors:
- Verify API key is correct and active
- Check internet connection
- Ensure you have API credits available
-
Database issues:
- Clear app data and restart
- Check device storage space
This is a study assistant app designed to help students learn more effectively by combining OCR technology with AI-powered conversations.
This project is for educational purposes. Please ensure you comply with OpenAI's usage policies when using their API.