A new Flutter project.
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
Your current Flutter application combines UI, business logic, and data fetching within widgets, which can become difficult to manage. A more robust approach is a Feature-Driven Clean Architecture combined with the BLoC (Business Logic Component) pattern for state management. This architecture separates concerns into distinct layers, making the app easier to test, debug, and scale.
face_generation, settings, dataset_export) rather than by type (e.g., widgets, blocs, repositories). This makes it easier to find and work on all the code related to a specific feature.Presentation Layer (UI)
material.dart, cupertino.dart).HomePage).CharacteristicSelector, CustomButton).Domain Layer (Business Logic)
ManipulatedDimension, FaceManipulationRequest).GenerateFaceImagesUseCase. It orchestrates the flow of data between the Presentation and Data layers.Data Layer (Data Sources)
ApiService for network requests).lib/
├── app/
│ ├── app.dart # Main app widget, theme, routes
│ └── di/ # Dependency Injection setup
│ └── service_locator.dart
│
├── core/
│ ├── error/ # Failure/Exception classes
│ │ ├── exceptions.dart
│ │ └── failures.dart
│ ├── usecases/ # Base use case class
│ │ └── usecase.dart
│ └── constants/ # App-wide constants (e.g., distributions.dart)
│ └── distributions.dart
│
├── features/
│ └── face_generation/
│ ├── data/
│ │ ├── datasources/
│ │ │ └── face_manipulation_api_datasource.dart # (was api_service.dart)
│ │ └── repositories/
│ │ └── face_manipulation_repository_impl.dart
│ │
│ ├── domain/
│ │ ├── entities/
│ │ │ ├── manipulated_dimension.dart
│ │ │ └── face_manipulation_request.dart
│ │ ├── repositories/
│ │ │ └── face_manipulation_repository.dart # Abstract class
│ │ └── usecases/
│ │ └── generate_face_images.dart
│ │
│ └── presentation/
│ ├── bloc/
│ │ ├── face_manipulation_bloc.dart
│ │ ├── face_manipulation_event.dart
│ │ └── face_manipulation_state.dart
│ │
│ ├── pages/
│ │ └── home_page.dart
│ └── widgets/
│ ├── characteristic_selector.dart
│ ├── custom_button.dart
│ ├── distribution_range_selector.dart
│ └── ... # other widgets
│
└── main.dart # App entry point
Either, to handle success and failure states gracefully from the Data layer up to the Presentation layer.http): A more powerful HTTP client that supports interceptors, global configuration, and more.To guide AI-assisted development toward this architecture, add rules under .cursor/rules/ that enforce:
A new Flutter project.
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
Your current Flutter application combines UI, business logic, and data fetching within widgets, which can become difficult to manage. A more robust approach is a Feature-Driven Clean Architecture combined with the BLoC (Business Logic Component) pattern for state management. This architecture separates concerns into distinct layers, making the app easier to test, debug, and scale.
face_generation, settings, dataset_export) rather than by type (e.g., widgets, blocs, repositories). This makes it easier to find and work on all the code related to a specific feature.Presentation Layer (UI)
material.dart, cupertino.dart).HomePage).CharacteristicSelector, CustomButton).Domain Layer (Business Logic)
ManipulatedDimension, FaceManipulationRequest).GenerateFaceImagesUseCase. It orchestrates the flow of data between the Presentation and Data layers.Data Layer (Data Sources)
ApiService for network requests).lib/
├── app/
│ ├── app.dart # Main app widget, theme, routes
│ └── di/ # Dependency Injection setup
│ └── service_locator.dart
│
├── core/
│ ├── error/ # Failure/Exception classes
│ │ ├── exceptions.dart
│ │ └── failures.dart
│ ├── usecases/ # Base use case class
│ │ └── usecase.dart
│ └── constants/ # App-wide constants (e.g., distributions.dart)
│ └── distributions.dart
│
├── features/
│ └── face_generation/
│ ├── data/
│ │ ├── datasources/
│ │ │ └── face_manipulation_api_datasource.dart # (was api_service.dart)
│ │ └── repositories/
│ │ └── face_manipulation_repository_impl.dart
│ │
│ ├── domain/
│ │ ├── entities/
│ │ │ ├── manipulated_dimension.dart
│ │ │ └── face_manipulation_request.dart
│ │ ├── repositories/
│ │ │ └── face_manipulation_repository.dart # Abstract class
│ │ └── usecases/
│ │ └── generate_face_images.dart
│ │
│ └── presentation/
│ ├── bloc/
│ │ ├── face_manipulation_bloc.dart
│ │ ├── face_manipulation_event.dart
│ │ └── face_manipulation_state.dart
│ │
│ ├── pages/
│ │ └── home_page.dart
│ └── widgets/
│ ├── characteristic_selector.dart
│ ├── custom_button.dart
│ ├── distribution_range_selector.dart
│ └── ... # other widgets
│
└── main.dart # App entry point
Either, to handle success and failure states gracefully from the Data layer up to the Presentation layer.http): A more powerful HTTP client that supports interceptors, global configuration, and more.To guide AI-assisted development toward this architecture, add rules under .cursor/rules/ that enforce: