Skip to content

Latest commit

 

History

History
115 lines (83 loc) · 3.6 KB

File metadata and controls

115 lines (83 loc) · 3.6 KB

Contributing to scrcpy_flutter

Thank you for your interest in contributing! This guide will help you get started.

Prerequisites

  • Flutter SDK 3.24+ (check .fvmrc for the pinned version)
  • Melos (dart pub global activate melos)
  • A physical Android device connected via USB (for scrcpy features)

Getting Started

# Clone the repo
git clone https://github.com/sunbird89629/scrcpy_flutter.git
cd scrcpy_flutter

# Install dependencies and link local packages
melos bootstrap

# Run codegen (freezed, json_serializable, slang)
melos run gen
melos run gen:i18n

Development

Running the apps

cd scrcpy_flutter && flutter run -d macos # Scrcpy Flutter client app
cd scrcpy_app && flutter run -d macos     # Scrcpy client app
cd scrcpy_plus && flutter run -d macos    # macOS menu-bar app

Common commands

melos run analyze       # Static analysis (fatal infos + warnings)
melos run format        # Check formatting
melos run format:fix    # Auto-fix formatting
melos run test          # Run all tests

Code generation

After modifying freezed models, JSON serializable classes, or i18n strings:

melos run gen           # Regenerate freezed/json_serializable
melos run gen:i18n      # Regenerate slang i18n strings

Project Structure

This is a Melos-managed monorepo. Lower layers must never import from upper layers.

packages/adb_tools ────────────────────┐
logger_utils (sibling repo) ───────────┤
scrcpy_view (widget/protocol)  ────────┼──> scrcpy_app / scrcpy_flutter / scrcpy_plus
                                        └──> scrcpy_mcp (MCP server)
Package Description
scrcpy_view Reusable Flutter widget + protocol library for Android screen mirroring
scrcpy_app Standalone scrcpy desktop client
scrcpy_flutter Scrcpy Flutter client (screen mirroring + MCP panel)
scrcpy_plus macOS menu-bar app for device management + scrcpy launcher
scrcpy_mcp MCP server wrapping scrcpy operations
packages/adb_tools ADB client (shell, forward, push, pair, connect) + binary manager

Code Style

  • Analysis rules: very_good_analysis (configured in root analysis_options.yaml)
  • Use initLogging() / hierarchical Logger from package:logger_utils — never print()
  • Follow existing patterns in the codebase; check neighboring files before introducing new ones

Testing

# Run all tests
melos run test

# Run tests for a specific package
cd packages/adb_tools && flutter test
  • Tests requiring a physical Android device go in *_real_device_test.dart
  • Use the ScrcpyAdb interface for testing without a real device
  • Never add the test package as a dev_dependency — it conflicts with flutter_test from the SDK

Submitting Changes

  1. Fork the repository
  2. Create a feature branch from main
  3. Make your changes
  4. Ensure melos run analyze and melos run test pass
  5. Commit with clear, descriptive messages
  6. Open a pull request

Reporting Issues

Use GitHub Issues to report bugs or request features. Include:

  • Steps to reproduce
  • Expected vs actual behavior
  • Flutter version (flutter --version)
  • macOS version
  • Android device model and OS version (if applicable)

License

By contributing, you agree that your contributions will be licensed under the Apache License 2.0.