|
1 | 1 | # Contributing to termchat-mobile |
2 | 2 |
|
3 | | -Thank you for your interest in contributing to `termchat-mobile`! |
| 3 | +Thank you for your interest in contributing to termchat-mobile! |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | + |
| 7 | +- [Code of Conduct](#code-of-conduct) |
| 8 | +- [Getting Started](#getting-started) |
| 9 | +- [Development Setup](#development-setup) |
| 10 | +- [Project Structure](#project-structure) |
| 11 | +- [Making Changes](#making-changes) |
| 12 | +- [Style Guidelines](#style-guidelines) |
| 13 | +- [Testing](#testing) |
| 14 | +- [Pull Request Process](#pull-request-process) |
| 15 | +- [Questions?](#questions) |
| 16 | + |
| 17 | +## Code of Conduct |
| 18 | + |
| 19 | +This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). By participating, you are expected to uphold this code. |
4 | 20 |
|
5 | 21 | ## Getting Started |
6 | 22 |
|
7 | | -1. **Open an Issue:** Before submitting a Pull Request, please open a corresponding issue to discuss your proposed changes, bug fix, or feature. |
8 | | -2. **Fork the repository** on GitHub. |
9 | | -3. **Clone your fork** to your local machine. |
10 | | -4. **Create a new branch** for your feature or bug fix (`git checkout -b feature/amazing-feature`). |
| 23 | +1. **Open an Issue** — Before submitting a Pull Request, please open a corresponding issue to discuss your proposed changes. |
| 24 | +2. **Fork the repository** on GitHub. |
| 25 | +3. **Clone your fork** to your local machine. |
| 26 | +4. **Create a new branch** — Use a descriptive name like `feat/amazing-feature` or `fix/bug-description`. |
11 | 27 |
|
12 | | -## Development |
| 28 | +## Development Setup |
13 | 29 |
|
14 | | -- This project is built with **Flutter**. |
15 | | -- We use **BLoC** for state management (`flutter_bloc`). |
16 | | -- Please ensure all new code is covered by tests in the `test/` directory. |
17 | | -- Run tests before submitting your PR: `flutter test`. |
18 | | -- Run code generation if you've changed models: `flutter pub run build_runner build --delete-conflicting-outputs`. |
| 30 | +### Prerequisites |
19 | 31 |
|
20 | | -## Pull Requests |
| 32 | +- **Flutter** (stable channel) — [Install](https://docs.flutter.dev/get-started/install) |
| 33 | +- **Dart** (bundled with Flutter) |
| 34 | +- **Android Studio / Xcode** — for running on device/emulator |
21 | 35 |
|
22 | | -1. Ensure your code follows the existing style and conventions. |
23 | | -2. Reference the issue number in your PR description. |
24 | | -3. Provide a clear, concise description of your changes. |
25 | | -4. Wait for feedback and address any requested changes. |
| 36 | +### Setup |
26 | 37 |
|
27 | | -## Code of Conduct |
| 38 | +```bash |
| 39 | +# Get dependencies |
| 40 | +flutter pub get |
| 41 | + |
| 42 | +# Run code generation (if you changed models or DI) |
| 43 | +flutter pub run build_runner build --delete-conflicting-outputs |
| 44 | + |
| 45 | +# Run the app |
| 46 | +flutter run |
| 47 | +``` |
| 48 | + |
| 49 | +## Project Structure |
| 50 | + |
| 51 | +``` |
| 52 | +lib/ |
| 53 | + core/ — Theme, router, constants, shared widgets |
| 54 | + data/ — Backend DTOs (JSON models) |
| 55 | + features/ — Feature modules, each with: |
| 56 | + <feature>/ |
| 57 | + bloc/ — BLoC events, states, and logic |
| 58 | + pages/ — UI screens |
| 59 | + widgets/ — Reusable widgets for this feature |
| 60 | + repositories/ — Data access layer |
| 61 | + di/ — Dependency injection (GetIt + Injectable) |
| 62 | +``` |
| 63 | + |
| 64 | +Each feature is organized around the BLoC pattern: Event → BLoC → State → UI. |
| 65 | + |
| 66 | +## Making Changes |
| 67 | + |
| 68 | +### What to Work On |
| 69 | + |
| 70 | +Check [open issues](https://github.com/ishaan-jindal/termchat-mobile/issues) for `good first issue` or `help wanted` labels. |
| 71 | + |
| 72 | +### Commit Messages |
| 73 | + |
| 74 | +Write clear, concise commit messages: |
| 75 | + |
| 76 | +``` |
| 77 | +feat: add copy room code button to chat top bar |
| 78 | +fix: handle WebSocket reconnection timeout |
| 79 | +refactor: extract notification helper |
| 80 | +``` |
| 81 | + |
| 82 | +## Style Guidelines |
| 83 | + |
| 84 | +- Run `flutter analyze` and fix all warnings before committing. |
| 85 | +- Follow the [Flutter style guide](https://docs.flutter.dev/style-guide). |
| 86 | +- Use `snake_case` for file and directory names. |
| 87 | +- Use `lowerCamelCase` for variables, methods, and parameters. |
| 88 | +- Use `UpperCamelCase` for types and classes. |
| 89 | +- Keep widgets focused — extract reusable widgets when a build method exceeds ~100 lines. |
| 90 | +- Prefer `const` constructors where possible. |
| 91 | +- Use `@injectable` / `@lazySingleton` for services registered with GetIt. |
| 92 | + |
| 93 | +## Testing |
| 94 | + |
| 95 | +```bash |
| 96 | +# Run all tests |
| 97 | +flutter test |
| 98 | + |
| 99 | +# Run tests for a specific feature |
| 100 | +flutter test test/features/chat/ |
| 101 | + |
| 102 | +# Run with coverage |
| 103 | +flutter test --coverage |
| 104 | +genhtml coverage/lcov.info -o coverage/html |
| 105 | +``` |
| 106 | + |
| 107 | +We use `mocktail` for mocking. See existing test files in `test/` for patterns. |
| 108 | + |
| 109 | +## Pull Request Process |
| 110 | + |
| 111 | +1. Ensure your code passes `flutter analyze` with no warnings. |
| 112 | +2. Run `flutter test` and ensure all tests pass. Add tests for new functionality. |
| 113 | +3. If you changed models or DI, run code generation and commit the generated files. |
| 114 | +4. Reference the issue number in your PR description (e.g., `Fixes #123`). |
| 115 | +5. Provide a clear, concise description of your changes. |
| 116 | +6. Wait for feedback and address any requested changes. |
| 117 | + |
| 118 | +## Questions? |
28 | 119 |
|
29 | | -Please be respectful and follow community guidelines in all interactions. |
| 120 | +Open a [discussion](https://github.com/ishaan-jindal/termchat-mobile/discussions) or ask in the issue you're working on. |
0 commit comments