Thank you for your interest in contributing to the OpenCode Flutter Client! This document provides guidelines and information for contributors.
By participating in this project, you agree to abide by our Code of Conduct. Please be respectful and constructive in all interactions.
- Flutter SDK: Version 3.5.4 or higher
- Dart SDK: Included with Flutter
- Git: For version control
- IDE: VS Code, Android Studio, or IntelliJ with Flutter plugins
-
Fork and Clone:
git clone https://github.com/YOUR_USERNAME/opencode-flutter-client.git cd opencode-flutter-client -
Install Dependencies:
flutter pub get
-
Verify Setup:
flutter doctor flutter analyze flutter test -
Run the App:
flutter run
main: Production-ready codedevelop: Integration branch for featuresfeature/feature-name: Individual feature branchesbugfix/bug-description: Bug fix brancheshotfix/critical-fix: Critical production fixes
-
Create a Feature Branch:
git checkout -b feature/your-feature-name
-
Make Your Changes:
- Follow the coding standards below
- Write tests for new functionality
- Update documentation as needed
-
Test Your Changes:
flutter analyze flutter test flutter run # Manual testing
-
Commit Your Changes:
git add . git commit -m "feat: add your feature description"
-
Push and Create PR:
git push origin feature/your-feature-name
- Follow Effective Dart guidelines
- Use
flutter analyzeto check code quality - Format code with
dart format - Use meaningful variable and function names
- Add documentation comments for public APIs
// Good: Clear, descriptive naming
class ChatMessageWidget extends StatelessWidget {
const ChatMessageWidget({
super.key,
required this.message,
required this.isUser,
});
final String message;
final bool isUser;
@override
Widget build(BuildContext context) {
return Container(
// Implementation
);
}
}- BLoC Pattern: Use for state management
- Repository Pattern: For data access
- Dependency Injection: Use Provider for DI
- Clean Architecture: Separate concerns properly
lib/
├── blocs/ # BLoC state management
├── models/ # Data models
├── services/ # API and business services
├── screens/ # UI screens
├── widgets/ # Reusable UI components
├── utils/ # Utility functions
├── config/ # Configuration files
└── main.dart # App entry point
- Unit Tests: Test individual functions and classes
- Widget Tests: Test UI components
- Integration Tests: Test complete user flows
// Example unit test
import 'package:flutter_test/flutter_test.dart';
import 'package:opencode_flutter_client/models/message.dart';
void main() {
group('Message Model', () {
test('should create message from JSON', () {
// Arrange
final json = {'content': 'Hello', 'isUser': true};
// Act
final message = Message.fromJson(json);
// Assert
expect(message.content, 'Hello');
expect(message.isUser, true);
});
});
}# Run all tests
flutter test
# Run specific test file
flutter test test/models/message_test.dart
# Run with coverage
flutter test --coverage- Code follows style guidelines
- All tests pass (
flutter test) - Code analysis passes (
flutter analyze) - Documentation is updated
- Self-review completed
When creating a PR, please include:
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Unit tests added/updated
- [ ] Widget tests added/updated
- [ ] Manual testing completed
## Screenshots (if applicable)
Add screenshots for UI changes
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Tests pass
- [ ] Documentation updated- Automated Checks: CI/CD runs tests and analysis
- Code Review: Maintainers review code quality
- Testing: Manual testing if needed
- Approval: At least one maintainer approval required
- Merge: Squash and merge to main branch
Use the bug report template and include:
- Flutter/Dart version
- Device/OS information
- Steps to reproduce
- Expected vs actual behavior
- Screenshots/logs if applicable
Use the feature request template and include:
- Problem description
- Proposed solution
- Alternative solutions considered
- Additional context
# Enable debug mode
flutter run --debug
# Hot reload during development
# Press 'r' in terminal or use IDE hot reload
# Debug with DevTools
flutter run --debug
# Then open DevTools in browser- Use
constconstructors where possible - Avoid rebuilding widgets unnecessarily
- Use
ListView.builderfor large lists - Profile with Flutter Inspector
// BLoC usage
class ChatScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<ChatBloc, ChatState>(
builder: (context, state) {
if (state is ChatLoading) {
return CircularProgressIndicator();
}
// Handle other states
},
);
}
}
// Service injection
class ChatService {
final HttpClient _httpClient;
ChatService({required HttpClient httpClient})
: _httpClient = httpClient;
}We follow Semantic Versioning:
MAJOR.MINOR.PATCH- Major: Breaking changes
- Minor: New features (backward compatible)
- Patch: Bug fixes (backward compatible)
- Version updated in
pubspec.yaml - CHANGELOG.md updated
- All tests passing
- Documentation updated
- Release notes prepared
- GitHub Discussions: For questions and ideas
- Issues: For bug reports and feature requests
- Pull Requests: For code contributions
- Create an issue for bugs or feature requests
- Start a discussion for questions or ideas
- Mention maintainers in PRs for review
Contributors will be recognized in:
- README.md contributors section
- Release notes
- GitHub contributors page
Thank you for contributing to OpenCode Flutter Client! 🚀