# rmtPocketWatcher Flutter App

A cross-platform Flutter application for tracking Star Citizen AUEC prices.

## Setup Requirements

### Windows Desktop Development

You need Visual Studio 2022 with specific components. Run the Visual Studio Installer and ensure you have:

1. **Desktop development with C++** workload
2. **MSVC v143 - VS 2022 C++ x64/x86 build tools** (latest version)
3. **Windows 11 SDK** (10.0.22621.0 or later)
4. **CMake tools for Visual Studio**

### Quick Fix for Visual Studio Components

1. Open **Visual Studio Installer**
2. Click **Modify** on Visual Studio Community 2022
3. Go to **Workloads** tab
4. Check **Desktop development with C++**
5. Go to **Individual components** tab
6. Ensure these are checked:
   - MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest)
   - Windows 11 SDK (10.0.22621.0)
   - CMake tools for Visual Studio
7. Click **Modify** and wait for installation

## Development Commands

```bash
# Install dependencies
flutter pub get

# Check setup
flutter doctor

# Run on Windows (after fixing VS components)
flutter run -d windows

# Build for Windows
flutter build windows

# Run on web (works without C++ components)
flutter run -d chrome
```

## Project Structure

```
lib/
├── main.dart                    # App entry point
├── models/
│   └── price_data.dart         # Data models
├── providers/
│   └── price_provider.dart     # State management
├── screens/
│   └── home_screen.dart        # Main dashboard
├── services/
│   ├── api_service.dart        # REST API
│   ├── websocket_service.dart  # WebSocket
│   └── storage_service.dart    # Local storage
└── widgets/
    ├── alerts_panel.dart       # Price alerts
    ├── price_chart.dart        # Charts
    ├── price_stats_card.dart   # Stats cards
    └── vendor_table.dart       # Vendor table
```

## Features

- **Real-time price tracking** via WebSocket
- **Bloomberg-style dashboard** with stats cards
- **Interactive price charts** with fl_chart
- **Price alerts** with local notifications
- **Vendor comparison table** with sorting
- **Cross-platform support** (Windows, macOS, Linux, Android, iOS)

## Backend Integration

The app connects to the existing TypeScript backend:
- **API**: `http://localhost:3000`
- **WebSocket**: `ws://localhost:3000/ws/index`

Configure in `.env` file:
```env
API_URL=http://localhost:3000
WS_URL=ws://localhost:3000/ws/index
```

## Troubleshooting

### "Visual Studio is missing necessary components"
- Install the C++ workload and components listed above
- Restart your terminal after installation
- Run `flutter doctor` to verify

### "Unable to find directory entry in pubspec.yaml"
- Ensure the `assets/` directory exists
- Run `flutter clean && flutter pub get`

### WebSocket connection issues
- Ensure backend is running on port 3000
- Check firewall settings
- Verify `.env` configuration

## Mobile Support

The same codebase works on mobile with responsive design:
- **Desktop**: Multi-column layout
- **Mobile**: Single-column scrollable layout
- **Responsive charts** and tables

```bash
# Run on Android (requires Android Studio)
flutter run -d android

# Run on iOS (requires Xcode on macOS)
flutter run -d ios
```