PoC on type definition change#43
Open
aydinguven-leancode wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Updates AdvancedFieldBuilder to preserve and pass the concrete controller subtype into the builder callback (instead of passing AdvancedFieldState<T, E>), and migrates internal examples/tests to the new API.
Changes:
- Refactors
AdvancedFieldBuilderto be generic on controller typeCand rebuild viaListenableBuilder. - Updates widget examples to use
AdvancedFieldBuilderand read state viafield.value. - Updates the
AdvancedFieldBuilderwidget test to the new builder signature.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/src/field/field_builder_test.dart | Migrates widget test to new AdvancedFieldBuilder<C> signature and state access via field.value. |
| lib/src/field/builder/advanced_field_builder.dart | Changes AdvancedFieldBuilder API to pass the controller subtype into the builder; swaps to ListenableBuilder. |
| example/lib/widgets/form_text_field.dart | Migrates example text fields from ValueListenableBuilder to AdvancedFieldBuilder. |
| example/lib/widgets/form_switch_field.dart | Migrates example switch field from ValueListenableBuilder to AdvancedFieldBuilder. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+4
to
+15
| /// Builder signature for [AdvancedFieldBuilder]. Receives the field controller | ||
| /// itself (with its concrete subtype preserved) so subclass-specific API like | ||
| /// `textController` or `focusNode` is reachable without a cast or context lookup. | ||
| typedef AdvancedFieldWidgetBuilder< | ||
| C extends AdvancedFieldController<Object?, Object>> | ||
| = Widget Function(BuildContext context, C field, Widget? child); | ||
|
|
||
| /// Rebuilds whenever [field] notifies. Hands the controller back to [builder] | ||
| /// with its exact subclass type, so subclass-specific methods are available at | ||
| /// the call site without a closure capture or cast. | ||
| class AdvancedFieldBuilder<C extends AdvancedFieldController<Object?, Object>> | ||
| extends StatelessWidget { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.