How timerunis/cloudreve_app works
Main Components
• Frontend/UI Layer: Represented mainly by the lib/page and lib/widget directories. This layer contains the various screens (login page, main page, preview pages) and reusable widgets (e.g., the drawer, theme change button, user cart).
• Controller / Business Logic: The lib/controller.dart acts as the bridge between the UI and the underlying data services or API calls.
• Data Models (Entities): Found in lib/entity (e.g., file.dart, group.dart, user.dart). These model the core data structures needed for interacting with Cloudreve.
• API & Utility Services: The lib/common folder (with files like api.dart, constants.dart, and util.dart) is responsible for making network calls and holding app-wide configuration or helper functions.
• Internationalization & Localization: The lib/generated and lib/l10n directories handle internationalization (i18n) and localization resources, enabling the app to support multiple languages.
• External Systems: While not part of the in-app code, the connection to the Cloudreve backend should be shown as an external service the app communicates with.
Relationships and Interactions
• The UI layer (pages and widgets) sends user events and requests to the Controller.
• The Controller or business logic layer processes these actions and interacts with the API module (from lib/common/api.dart) to fetch or send data.
• Data received from the API is mapped into Entities (models) located in lib/entity, which then update the UI.
• The app uses utility functions and constants from lib/common to maintain consistency and reduce duplication.
• The i18n and theme switching functionalities are integrated into the UI components to provide responsiveness to user preferences.
• For platform-specific functions (Android, iOS, Windows, macOS, Linux, web), the platform directories serve as native wrappers or integrations that run the Flutter code.
Architectural Patterns and Design Principles
• The project loosely follows an MVC or MVVM pattern, splitting responsibilities between the UI (View), Controller (Business Logic), and Model (Entity).
• Clear separation of concerns is visible, making it easier to maintain and extend.
• The design also leverages Flutter’s cross-platform capabilities and includes integration points for native platform code.