---
applyTo: '**/*.dart'
---

# Wox Flutter UI Development Guide

## Directory Structure

* [lib/api](mdc:wox/wox/wox.ui.flutter/lib/api): API-related code, responsible for communication with wox.core
* [lib/components](mdc:wox/wox/wox.ui.flutter/lib/components): Reusable UI components
* [lib/controllers](mdc:wox/wox/wox.ui.flutter/lib/controllers): Controllers, handling business logic
* [lib/entity](mdc:wox/wox/wox.ui.flutter/lib/entity): Data entity classes, corresponding to backend data structures
* [lib/enums](mdc:wox/wox/wox.ui.flutter/lib/enums): Enum definitions
* [lib/modules](mdc:wox/wox/wox.ui.flutter/lib/modules): Functional modules
* [lib/utils](mdc:wox/wox/wox.ui.flutter/lib/utils): Utility classes and helper functions
* [lib/main.dart](mdc:wox/wox/wox.ui.flutter/lib/main.dart): Application entry point

## Code Standards

* Prefer StatelessWidget over StatefulWidget unless state management is needed
* Use GetX for state management and routing
* Follow Material Design guidelines
* Use the theme system to ensure UI consistency and configurability
* Component interface design should be concise and clear, avoiding excessive parameters

## UI Development Principles

* Separate view logic from business logic; views should not directly manipulate data or perform complex calculations
* Controllers are responsible for handling business logic and state management
* Components should be reusable, avoiding code duplication
* Responsive design, supporting different screen sizes

## Communication with Backend

* All communication with the backend should be done through the API layer
* Use WebSocket for real-time communication
* Use HTTP for non-real-time requests
* Ensure handling of network errors and exceptional situations

