-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[rfw] Add support for widget builders #5907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
93d0553
167861c
f42e136
0447cc3
1ef16c4
e932304
cefb096
8ed0a43
09cc332
4ff5572
6911f90
b2aad12
2d3b120
6584379
939a149
95158b9
a4934ff
c24389b
7cab0f2
41db095
d0f2f3a
93b6ac1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -439,6 +439,26 @@ class ConstructorCall extends BlobNode { | |
| String toString() => '$name($arguments)'; | ||
| } | ||
|
|
||
| /// Representation of functions that return widgets in Remote Flutter library blobs. | ||
tugorez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| class WidgetBuilderDeclaration extends BlobNode { | ||
| /// Creates a [WidgetBuilderDeclaration]. | ||
|
||
| const WidgetBuilderDeclaration(this.argumentName, this.widget); | ||
|
|
||
| /// The name associated with the passed [DynamicMap]. | ||
| final String argumentName; | ||
tugorez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /// The widget that will be returned when the builder is called. | ||
| /// | ||
| /// This is usually a [ConstructorCall], but may be a [Switch] (so long as | ||
| /// that [Switch] resolves to a [ConstructorCall]. Other values (or a [Switch] | ||
| /// that does not resolve to a constructor call) will result in an | ||
| /// [ErrorWidget] being used. | ||
| final BlobNode widget; | ||
|
|
||
| @override | ||
| String toString() => '($argumentName) => $widget'; | ||
| } | ||
|
|
||
| /// Base class for various kinds of references in the RFW data structures. | ||
| abstract class Reference extends BlobNode { | ||
| /// Abstract const constructor. This constructor enables subclasses to provide | ||
|
|
@@ -534,6 +554,31 @@ class DataReference extends Reference { | |
| String toString() => 'data.${parts.join(".")}'; | ||
| } | ||
|
|
||
| /// Reference to the [DynamicMap] passed into the widget builder. | ||
| /// | ||
| /// This class is used to represent references to a function argument. | ||
| /// In "(scope) => Container(width: scope.width)" this represents "scope.width". | ||
tugorez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// | ||
| /// See also: | ||
| /// | ||
| /// * [WidgetBuilderDeclaration] which represents a widget builder definition. | ||
tugorez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| class WidgetBuilderArgReference extends Reference { | ||
| /// Wraps the given [parts] associated to the [argumentName] as an [WidgetBuilderArgReference]. | ||
| /// | ||
| /// The parts must not be mutated after the object is created. | ||
| const WidgetBuilderArgReference(this.argumentName, super.parts); | ||
|
|
||
| /// References the function argument name. | ||
| final String argumentName; | ||
tugorez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| WidgetBuilderArgReference constructReference(List<Object> moreParts) { | ||
| return WidgetBuilderArgReference(argumentName, parts + moreParts); | ||
| } | ||
|
|
||
| @override | ||
| String toString() => '$argumentName.${parts.join('.')}'; | ||
| } | ||
|
|
||
| /// Unbound reference to a [Loop]. | ||
| class LoopReference extends Reference { | ||
| /// Wraps the given [loop] and [parts] as a [LoopReference]. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.