Flutter AI Chat
A modern, cross-platform AI chat interface built with Flutter that supports streaming responses and conversation management.
Features
- π€ AI Chat Interface - Chat with AI models using OpenAI API
- π± Cross-Platform Support - Works on iOS, Android, Web, Windows, macOS, and Linux
- π Streaming Responses - Real-time AI responses with streaming support
- π¬ Conversation Management - Create, manage, and organize chat conversations
- π¨ Modern UI/UX - Beautiful Material Design 3 interface with light/dark themes
- π± Responsive Design - Adapts to different screen sizes and orientations
- π Secure - Secure API key management and data handling
- β‘ WASM Compatible - WebAssembly support for web platform
- π§ͺ High Quality - Analyzed with Pana, Flutter analyze, and Dart analysis
Screenshots
Screenshots will be added here
Platform Support
Platform | Status | Notes |
---|---|---|
iOS | β Supported | iPhone and iPad |
Android | β Supported | Phone and Tablet |
Web | β Supported | Chrome, Firefox, Safari, Edge |
Windows | β Supported | Desktop |
macOS | β Supported | Desktop |
Linux | β Supported | Desktop |
Getting Started
Prerequisites
- Flutter SDK: ^3.16.0
- Dart SDK: ^3.2.0
- OpenAI API Key (for AI functionality)
Installation
- Clone the repository:
git clone https://github.com/Dhia-Bechattaoui/flutter_ai_chat.git
cd flutter_ai_chat
- Install dependencies:
flutter pub get
-
Configure your OpenAI API key:
- Create a
.env
file in the root directory - Add your API key:
OPENAI_API_KEY=your_api_key_here
- Create a
-
Run the app:
flutter run
Web Deployment
For web deployment with WASM support:
flutter build web --web-renderer canvaskit
Configuration
Environment Variables
Create a .env
file in the root directory:
OPENAI_API_KEY=your_openai_api_key_here
API Configuration
The app is configured to use OpenAI's GPT models by default. You can modify the configuration in lib/services/ai_service.dart
.
Architecture
The project follows a clean architecture pattern with the following structure:
lib/
βββ main.dart # App entry point
βββ models/ # Data models
β βββ chat_message.dart # Chat message model
β βββ conversation.dart # Conversation model
βββ providers/ # State management
β βββ chat_provider.dart # Chat state provider
βββ screens/ # UI screens
β βββ chat_screen.dart # Main chat interface
βββ services/ # Business logic
β βββ ai_service.dart # AI API service
βββ utils/ # Utilities
β βββ theme.dart # App theme configuration
βββ widgets/ # Reusable widgets
βββ chat_input_widget.dart
βββ chat_message_widget.dart
βββ sidebar_widget.dart
Dependencies
Core Dependencies
flutter
- Flutter SDKprovider
- State managementhttp
- HTTP client for API callsshared_preferences
- Local storageflutter_markdown
- Markdown rendering
Development Dependencies
flutter_lints
- Code quality rulesflutter_test
- Testing frameworkmockito
- Mocking for testsdartdoc
- Documentation generation
Quality Assurance
This project maintains high code quality standards:
- β Pana Analysis - Full score compliance
- β Flutter Analyze - No analysis issues
- β Dart Analysis - Clean code standards
- β Linting - Strict linting rules
- β Testing - Comprehensive test coverage
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
Testing
Run the test suite:
flutter test
Run with coverage:
flutter test --coverage
Building for Production
Android
flutter build apk --release
iOS
flutter build ios --release
Web
flutter build web --release --web-renderer canvaskit
Desktop
flutter build windows --release
flutter build macos --release
flutter build linux --release
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Flutter team for the amazing framework
- OpenAI for providing the AI API
- Material Design team for the design system
- All contributors and supporters
Support
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Contact the maintainer: Dhia-Bechattaoui
Roadmap
Made with β€οΈ using Flutter