Refactor clock-in feature: Introduce validation pipeline and interaction strategies
- Added a validation pipeline for clock-in actions, including geofence, time window, and override notes validators. - Created a context class for passing validation data and results. - Implemented check-in interaction strategies for swipe and NFC methods, encapsulating their UI and behavior. - Removed redundant utility functions and centralized time formatting in a new utility file. - Enhanced the notification service to handle clock-in and clock-out notifications separately. - Updated the ClockInBloc to utilize the new validation and notification services. - Cleaned up the ClockInActionSection widget to use the new interaction strategies and removed unnecessary listeners.
This commit is contained in:
@@ -56,6 +56,15 @@ If any of these files are missing or unreadable, notify the user before proceedi
|
||||
- Use `UiColors`, `UiTypography`, `UiIcons`, `UiConstants` for all design values
|
||||
- Use `core_localization` for user-facing strings
|
||||
- Add concise `///` doc comments to every class, method, and field. Keep them short (1-2 lines) — just enough for another developer to understand the purpose without reading the implementation.
|
||||
- **Always specify explicit types** on every local variable, loop variable, and lambda parameter — never use `final x = ...` or `var x = ...` without the type. Example: `final String name = getName();` not `final name = getName();`. This is enforced by the `always_specify_types` lint rule.
|
||||
- **Always place constructors before fields and methods** in class declarations. The correct order is: constructor → fields → methods. This is enforced by the `sort_constructors_first` lint rule. Example:
|
||||
```dart
|
||||
class MyClass {
|
||||
const MyClass({required this.name});
|
||||
final String name;
|
||||
void doSomething() {}
|
||||
}
|
||||
```
|
||||
|
||||
## Standard Workflow
|
||||
|
||||
@@ -121,13 +130,19 @@ features/
|
||||
entities/ # Pure Dart classes
|
||||
repositories/ # Abstract interfaces
|
||||
usecases/ # Business logic lives HERE
|
||||
validators/ # Composable validation pipeline (optional)
|
||||
domain.dart # Barrel file
|
||||
data/
|
||||
models/ # With fromJson/toJson
|
||||
repositories/ # Concrete implementations
|
||||
data.dart # Barrel file
|
||||
presentation/
|
||||
bloc/ # Events, states, BLoC
|
||||
bloc/
|
||||
feature_bloc/ # Each BLoC in its own subfolder
|
||||
feature_bloc.dart
|
||||
feature_event.dart
|
||||
feature_state.dart
|
||||
strategies/ # Strategy pattern implementations (optional)
|
||||
screens/ # Full pages
|
||||
widgets/ # Reusable components
|
||||
presentation.dart # Barrel file
|
||||
|
||||
Reference in New Issue
Block a user