agent-flutter 0.1.24 → 0.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-flutter",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "Portable Flutter skill/rule pack initializer for multiple AI IDEs.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -51,6 +51,9 @@ If any item is missing, stop implementation and request contract clarification f
51
51
  - UI/domain-only models: `lib/src/core/model/`
52
52
  - Never pass raw `Map<String, dynamic>` across UI layers for non-trivial APIs.
53
53
  - Reuse-first: check existing models before creating new ones.
54
+ - Required API fields must not silently fallback to fake defaults in `fromJson`.
55
+ - Nullable/non-nullable and enum values must match backend contract explicitly.
56
+ - Date/number parsing must be guarded (safe parse/cast), not optimistic cast.
54
57
 
55
58
  ### D. Repository Boundary
56
59
  - All remote calls must be wrapped by repository classes in `lib/src/core/repository/`.
@@ -83,6 +86,11 @@ If any item is missing, stop implementation and request contract clarification f
83
86
  - Prefer typed fields and safe nullability.
84
87
  - Add parser methods (`fromJson/toJson`) consistently.
85
88
  - Apply reuse/evolution checklist from [dart-model-reuse](../skills/dart-model-reuse/SKILL.md).
89
+ - Validate model correctness against contract:
90
+ - Required/optional fields match schema.
91
+ - Enum/status values are constrained.
92
+ - No hidden fallback defaults for required fields.
93
+ - Update `spec/model-registry.md` for any model additions/changes.
86
94
 
87
95
  ### Step 4: Implement Repository Method
88
96
  - Repository extends/reuses `Api`.
@@ -107,6 +115,7 @@ If any item is missing, stop implementation and request contract clarification f
107
115
  - UI reads bloc state and renders loading/error/success.
108
116
  - No API parsing logic in widget tree.
109
117
  - All strings shown from API errors must pass localization policy in [getx-localization-standard](../skills/getx-localization-standard/SKILL.md).
118
+ - UI should consume repository-mapped typed models only (not raw response JSON/map).
110
119
 
111
120
  ## 5. Minimal Reference Pattern
112
121
 
@@ -137,6 +146,9 @@ class FeatureRepository extends Api {
137
146
  ## 7. Verification Checklist Before PR
138
147
  - [ ] Endpoint added in `api_url.dart` and consumed from repository only.
139
148
  - [ ] Request/response models are separated and typed.
149
+ - [ ] Model correctness validated against API contract (required/nullable/enum/date/number).
150
+ - [ ] No hidden fallback defaults for required contract fields in `fromJson`.
151
+ - [ ] UI/Bloc consumes typed models only (no raw JSON/map parsing).
140
152
  - [ ] Bloc uses `PageState` lifecycle correctly.
141
153
  - [ ] All displayed text/error is localized via `LocaleKey`.
142
154
  - [ ] Flavor run verified at least on staging command.
@@ -14,6 +14,14 @@ alwaysApply: false
14
14
  - **Shadows**: Normalize `BoxShadow` closest to CSS box-shadow; do not change blur/spread arbitrarily.
15
15
  - **Backgrounds**: Use `DecorationImage` + appropriate `BoxFit` (cover/contain) and correct alignment.
16
16
 
17
+ ### **UI Correctness Gate (Priority P1)**
18
+ - Every new/updated screen must pass visual + behavioral correctness, not only "looks similar".
19
+ - Required state coverage for each screen: `loading`, `success`, `empty`, `error` (and `permission/unauthorized` if applicable).
20
+ - Required responsive check: at least widths `320`, `390`, `430`.
21
+ - Required accessibility check: text scale `1.0` and `1.3` without overflow/clipping.
22
+ - No layout overflow warnings are allowed in debug console.
23
+ - Tap targets should remain usable (recommended minimum 44x44 when interactive).
24
+
17
25
  ### **Overrides (Per-Component)**
18
26
  - App* widgets must allow overriding tokens: `size`, `radius`, `padding/margin`, `backgroundColor`, `textStyle`, `iconSize`, `constraints`.
19
27
  - Defaults must come from tokens (`AppStyles`, `AppColors`, `AppDimensions`) and act only as fallbacks; do not hardcode.
@@ -91,6 +99,16 @@ alwaysApply: false
91
99
  - **No dynamic data in UI**: Pages/components MUST receive typed models via constructor/BLoC state; do not hardcode demo lists in widgets.
92
100
  - **Demo/Mock Data Location**: Keep all demo/sample data in `lib/src/utils/app_demo_data.dart` only. Import from there when previewing or testing UI.
93
101
  - **Reuse-first**: Before creating a new model, check the [Model Registry](../../spec/model-registry.md) and follow [Dart Model Reuse Skill](../skills/dart-model-reuse/SKILL.md). Prefer extending existing models (optional fields) or composition over duplication.
102
+ - **Model Correctness Gate (Priority P1)**:
103
+ - Each model class must state purpose/source in class doc (Request/Response/UI).
104
+ - Do not use `dynamic`/`Object?` for API payload fields unless contract truly allows unknown schema.
105
+ - Required contract fields must not silently fallback to fake defaults (`''`, `0`, `false`) in `fromJson`.
106
+ - Nullable/non-nullable must match backend contract.
107
+ - Date/number parsing must use guarded conversion (`DateTime.tryParse`, safe numeric casting).
108
+ - UI layer must consume typed UI/domain model only, not raw response map/json.
109
+ - **Mapper Boundary (Required)**:
110
+ - If API response shape differs from UI needs, map in repository or mapper layer (`lib/src/core/mapper/`).
111
+ - Widgets and page blocs must not parse JSON directly.
94
112
 
95
113
  ### **E. Composition & State**
96
114
  - **State**: Default to `StatelessWidget`. Use `StatefulWidget` only for local UI logic (animations, focus).
@@ -147,6 +165,7 @@ Follow these steps when creating a new UI screen:
147
165
  - Check Figma/Design.
148
166
  - Identify reusable components -> Are they in `lib/src/ui/widgets`?
149
167
  - Identify unique components -> Plan to put them in `components/`.
168
+ - Define UI state matrix before coding: loading/success/empty/error + action states (enabled/disabled).
150
169
 
151
170
  ### **Step 2: Scaffolding**
152
171
  - Create the folder structure (See [Lib Src Architecture Skill](../skills/flutter-standard-lib-src-architecture/SKILL.md)):
@@ -157,6 +176,11 @@ Follow these steps when creating a new UI screen:
157
176
  ### **Step 3: Data Modeling (If API involved)**
158
177
  - Create Request model in `lib/src/core/model/request/`.
159
178
  - Create Response model in `lib/src/core/model/response/`.
179
+ - Validate each model against API contract before UI wiring:
180
+ - Required vs nullable fields are correct.
181
+ - Enum/status values are represented safely (enum or controlled constants).
182
+ - No silent fallback for required fields.
183
+ - Update `spec/model-registry.md` when adding/changing model.
160
184
 
161
185
  ### **Step 4: Logic & Binding**
162
186
  - Create the Controller/Bloc in `interactor/` (See [Bloc Skill](../skills/flutter-bloc-state-management/SKILL.md)).
@@ -174,9 +198,13 @@ Follow these steps when creating a new UI screen:
174
198
  - Use `AppColors` / `AppStyles`.
175
199
  - Use `App*` widgets.
176
200
  - Use `LocaleKey.my_key.tr` for text.
177
- - **Radius & Icon**:
201
+ - **Radius & Icon**:
178
202
  - If Figma requires radius = 14, **must** use `BorderRadius.circular(14)` at the corresponding component.
179
203
  - Icon 24×24; if framed, use container 40×40/44×44 per Figma.
204
+ - **Behavioral Correctness (STRICT)**:
205
+ - Implement and render all required states from Step 1 (loading/success/empty/error...).
206
+ - Avoid overflow on small width and long localization strings.
207
+ - UI must not depend on mock constants inside widget tree for production flow.
180
208
  - **Documentation Comments (STRICT)**:
181
209
  - Add top-of-class `///` description for every Page and Component, summarizing its purpose and main actions.
182
210
  - Generator reads these docs to build `spec/ui-workflow.md` (run `dart run tool/generate_ui_workflow_spec.dart`).
@@ -190,7 +218,7 @@ Follow these steps when creating a new UI screen:
190
218
  ```
191
219
 
192
220
  ### **Step 7: Component Extraction**
193
- - **Rule**: If a widget block is > 50 lines or reused twice, extract it to `components/` (See [Idiomatic Flutter Skill](../skills/idiomatic-flutter/SKILL.md)).
221
+ - **Rule**: If a widget block is > 50 lines or reused twice, extract it to `components/` (See [Flutter UI Widgets Skill](../skills/flutter-ui-widgets/SKILL.md)).
194
222
  - Keep the main `build()` method clean and readable.
195
223
 
196
224
  ### **Step 8: Route Registration (Choose One)**
@@ -257,6 +285,14 @@ Follow these steps when creating a new UI screen:
257
285
  - [ ] Page broken down into `components/`?
258
286
  - [ ] Logic separated into `interactor/`?
259
287
  - [ ] **Data Models Separated?** (Request/Response in `core/model/`)
288
+ - [ ] **Model Correctness Gate passed?** (required/nullable/enum/date/number mapping validated)
289
+ - [ ] **No hidden fallback defaults for required fields?** (`fromJson` does not hide bad contract)
290
+ - [ ] **Mapper Boundary respected?** (UI/Bloc does not parse raw JSON/Map)
291
+ - [ ] **Model Registry Updated?** (`spec/model-registry.md` reflects new/changed models)
292
+ - [ ] **UI Correctness Gate passed?** (loading/success/empty/error implemented and verified)
293
+ - [ ] **Responsive check passed?** (320/390/430 widths)
294
+ - [ ] **Accessibility text scale check passed?** (`1.0` and `1.3` no overflow/clipping)
295
+ - [ ] **No debug overflow/error logs from layout?**
260
296
  - [ ] File naming matches `<feature>_<type>.dart`?
261
297
  - [ ] **Route Registered?**
262
298
  - [ ] If Full Screen: Added to `AppPages`?