Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
b61fe238
Commit
b61fe238
authored
Aug 22, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename syncFields to syncConstructorArguments
parent
dc7137b0
Changes
31
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
94 additions
and
93 deletions
+94
-93
feed.dart
examples/fitness/lib/feed.dart
+4
-4
meal.dart
examples/fitness/lib/meal.dart
+1
-1
measurement.dart
examples/fitness/lib/measurement.dart
+1
-1
settings.dart
examples/fitness/lib/settings.dart
+1
-1
stock_home.dart
examples/stocks/lib/stock_home.dart
+1
-1
stock_settings.dart
examples/stocks/lib/stock_settings.dart
+1
-1
drag_and_drop.dart
examples/widgets/drag_and_drop.dart
+1
-1
editable_text.dart
packages/flutter/lib/editing/editable_text.dart
+1
-1
input.dart
packages/flutter/lib/editing/input.dart
+1
-1
README.md
packages/flutter/lib/widgets/README.md
+24
-23
animated_component.dart
packages/flutter/lib/widgets/animated_component.dart
+1
-1
animated_container.dart
packages/flutter/lib/widgets/animated_container.dart
+4
-4
basic.dart
packages/flutter/lib/widgets/basic.dart
+1
-1
button_base.dart
packages/flutter/lib/widgets/button_base.dart
+1
-1
dismissable.dart
packages/flutter/lib/widgets/dismissable.dart
+1
-1
drag_target.dart
packages/flutter/lib/widgets/drag_target.dart
+1
-1
drawer.dart
packages/flutter/lib/widgets/drawer.dart
+1
-1
drawer_item.dart
packages/flutter/lib/widgets/drawer_item.dart
+2
-2
floating_action_button.dart
packages/flutter/lib/widgets/floating_action_button.dart
+2
-2
focus.dart
packages/flutter/lib/widgets/focus.dart
+1
-1
framework.dart
packages/flutter/lib/widgets/framework.dart
+6
-6
material_button.dart
packages/flutter/lib/widgets/material_button.dart
+2
-2
mimic.dart
packages/flutter/lib/widgets/mimic.dart
+2
-2
mimic_overlay.dart
packages/flutter/lib/widgets/mimic_overlay.dart
+1
-1
navigator.dart
packages/flutter/lib/widgets/navigator.dart
+1
-1
popup_menu.dart
packages/flutter/lib/widgets/popup_menu.dart
+1
-1
progress_indicator.dart
packages/flutter/lib/widgets/progress_indicator.dart
+1
-1
radio.dart
packages/flutter/lib/widgets/radio.dart
+2
-2
scrollable.dart
packages/flutter/lib/widgets/scrollable.dart
+11
-11
tabs.dart
packages/flutter/lib/widgets/tabs.dart
+2
-2
transitions.dart
packages/flutter/lib/widgets/transitions.dart
+14
-14
No files found.
examples/fitness/lib/feed.dart
View file @
b61fe238
...
@@ -32,10 +32,10 @@ class DialogMenuItem extends ButtonBase {
...
@@ -32,10 +32,10 @@ class DialogMenuItem extends ButtonBase {
List
<
Widget
>
children
;
List
<
Widget
>
children
;
Function
onPressed
;
Function
onPressed
;
void
sync
Field
s
(
DialogMenuItem
source
)
{
void
sync
ConstructorArgument
s
(
DialogMenuItem
source
)
{
children
=
source
.
children
;
children
=
source
.
children
;
onPressed
=
source
.
onPressed
;
onPressed
=
source
.
onPressed
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
}
Widget
buildContent
()
{
Widget
buildContent
()
{
...
@@ -73,7 +73,7 @@ class FeedFragment extends StatefulComponent {
...
@@ -73,7 +73,7 @@ class FeedFragment extends StatefulComponent {
super
.
initState
();
super
.
initState
();
}
}
void
sync
Field
s
(
FeedFragment
source
)
{
void
sync
ConstructorArgument
s
(
FeedFragment
source
)
{
navigator
=
source
.
navigator
;
navigator
=
source
.
navigator
;
userData
=
source
.
userData
;
userData
=
source
.
userData
;
onItemCreated
=
source
.
onItemCreated
;
onItemCreated
=
source
.
onItemCreated
;
...
@@ -298,7 +298,7 @@ class AddItemDialog extends StatefulComponent {
...
@@ -298,7 +298,7 @@ class AddItemDialog extends StatefulComponent {
Navigator
navigator
;
Navigator
navigator
;
void
sync
Field
s
(
AddItemDialog
source
)
{
void
sync
ConstructorArgument
s
(
AddItemDialog
source
)
{
this
.
navigator
=
source
.
navigator
;
this
.
navigator
=
source
.
navigator
;
}
}
...
...
examples/fitness/lib/meal.dart
View file @
b61fe238
...
@@ -49,7 +49,7 @@ class MealFragment extends StatefulComponent {
...
@@ -49,7 +49,7 @@ class MealFragment extends StatefulComponent {
Navigator
navigator
;
Navigator
navigator
;
FitnessItemHandler
onCreated
;
FitnessItemHandler
onCreated
;
void
sync
Field
s
(
MealFragment
source
)
{
void
sync
ConstructorArgument
s
(
MealFragment
source
)
{
navigator
=
source
.
navigator
;
navigator
=
source
.
navigator
;
onCreated
=
source
.
onCreated
;
onCreated
=
source
.
onCreated
;
}
}
...
...
examples/fitness/lib/measurement.dart
View file @
b61fe238
...
@@ -60,7 +60,7 @@ class MeasurementFragment extends StatefulComponent {
...
@@ -60,7 +60,7 @@ class MeasurementFragment extends StatefulComponent {
Navigator
navigator
;
Navigator
navigator
;
FitnessItemHandler
onCreated
;
FitnessItemHandler
onCreated
;
void
sync
Field
s
(
MeasurementFragment
source
)
{
void
sync
ConstructorArgument
s
(
MeasurementFragment
source
)
{
navigator
=
source
.
navigator
;
navigator
=
source
.
navigator
;
onCreated
=
source
.
onCreated
;
onCreated
=
source
.
onCreated
;
}
}
...
...
examples/fitness/lib/settings.dart
View file @
b61fe238
...
@@ -17,7 +17,7 @@ class SettingsFragment extends StatefulComponent {
...
@@ -17,7 +17,7 @@ class SettingsFragment extends StatefulComponent {
UserData
userData
;
UserData
userData
;
SettingsUpdater
updater
;
SettingsUpdater
updater
;
void
sync
Field
s
(
SettingsFragment
source
)
{
void
sync
ConstructorArgument
s
(
SettingsFragment
source
)
{
navigator
=
source
.
navigator
;
navigator
=
source
.
navigator
;
userData
=
source
.
userData
;
userData
=
source
.
userData
;
updater
=
source
.
updater
;
updater
=
source
.
updater
;
...
...
examples/stocks/lib/stock_home.dart
View file @
b61fe238
...
@@ -17,7 +17,7 @@ class StockHome extends StatefulComponent {
...
@@ -17,7 +17,7 @@ class StockHome extends StatefulComponent {
StockMode
stockMode
;
StockMode
stockMode
;
ModeUpdater
modeUpdater
;
ModeUpdater
modeUpdater
;
void
sync
Field
s
(
StockHome
source
)
{
void
sync
ConstructorArgument
s
(
StockHome
source
)
{
navigator
=
source
.
navigator
;
navigator
=
source
.
navigator
;
stocks
=
source
.
stocks
;
stocks
=
source
.
stocks
;
stockMode
=
source
.
stockMode
;
stockMode
=
source
.
stockMode
;
...
...
examples/stocks/lib/stock_settings.dart
View file @
b61fe238
...
@@ -18,7 +18,7 @@ class StockSettings extends StatefulComponent {
...
@@ -18,7 +18,7 @@ class StockSettings extends StatefulComponent {
BackupMode
backup
;
BackupMode
backup
;
SettingsUpdater
updater
;
SettingsUpdater
updater
;
void
sync
Field
s
(
StockSettings
source
)
{
void
sync
ConstructorArgument
s
(
StockSettings
source
)
{
navigator
=
source
.
navigator
;
navigator
=
source
.
navigator
;
optimism
=
source
.
optimism
;
optimism
=
source
.
optimism
;
backup
=
source
.
backup
;
backup
=
source
.
backup
;
...
...
examples/widgets/drag_and_drop.dart
View file @
b61fe238
...
@@ -19,7 +19,7 @@ class DragData {
...
@@ -19,7 +19,7 @@ class DragData {
class
ExampleDragTarget
extends
StatefulComponent
{
class
ExampleDragTarget
extends
StatefulComponent
{
String
_text
=
'ready'
;
String
_text
=
'ready'
;
void
sync
Field
s
(
ExampleDragTarget
source
)
{
void
sync
ConstructorArgument
s
(
ExampleDragTarget
source
)
{
}
}
void
_handleAccept
(
DragData
data
)
{
void
_handleAccept
(
DragData
data
)
{
...
...
packages/flutter/lib/editing/editable_text.dart
View file @
b61fe238
...
@@ -29,7 +29,7 @@ class EditableText extends StatefulComponent {
...
@@ -29,7 +29,7 @@ class EditableText extends StatefulComponent {
TextStyle
style
;
TextStyle
style
;
Color
cursorColor
;
Color
cursorColor
;
void
sync
Field
s
(
EditableText
source
)
{
void
sync
ConstructorArgument
s
(
EditableText
source
)
{
value
=
source
.
value
;
value
=
source
.
value
;
focused
=
source
.
focused
;
focused
=
source
.
focused
;
style
=
source
.
style
;
style
=
source
.
style
;
...
...
packages/flutter/lib/editing/input.dart
View file @
b61fe238
...
@@ -44,7 +44,7 @@ class Input extends StatefulComponent {
...
@@ -44,7 +44,7 @@ class Input extends StatefulComponent {
super
.
initState
();
super
.
initState
();
}
}
void
sync
Field
s
(
Input
source
)
{
void
sync
ConstructorArgument
s
(
Input
source
)
{
placeholder
=
source
.
placeholder
;
placeholder
=
source
.
placeholder
;
onChanged
=
source
.
onChanged
;
onChanged
=
source
.
onChanged
;
keyboardType
=
source
.
keyboardType
;
keyboardType
=
source
.
keyboardType
;
...
...
packages/flutter/lib/widgets/README.md
View file @
b61fe238
...
@@ -267,7 +267,7 @@ class MyDialog extends StatefulComponent {
...
@@ -267,7 +267,7 @@ class MyDialog extends StatefulComponent {
});
});
}
}
void
sync
Field
s
(
MyDialog
source
)
{
void
sync
ConstructorArgument
s
(
MyDialog
source
)
{
onDismissed
=
source
.
onDismissed
;
onDismissed
=
source
.
onDismissed
;
}
}
...
@@ -319,9 +319,9 @@ Let's walk through the differences in `MyDialog` caused by its being stateful:
...
@@ -319,9 +319,9 @@ Let's walk through the differences in `MyDialog` caused by its being stateful:
`build`
function, which means the user interface might not update to reflect
`build`
function, which means the user interface might not update to reflect
the changed state.
the changed state.
*
`MyDialog`
implements the
`sync
Fields`
member function. To understand
*
`MyDialog`
implements the
`sync
ConstructorArguments`
member function. To
`syncFields`
, we'll need to dive a bit deeper into how the
`build`
function
understand
`syncConstructorArguments`
, we'll need to dive a bit deeper into
is used by the framework.
how the
`build`
function
is used by the framework.
A component's
`build`
function returns a tree of widgets that represent a
A component's
`build`
function returns a tree of widgets that represent a
"virtual" description of its appearance. The first time the framework calls
"virtual" description of its appearance. The first time the framework calls
...
@@ -337,28 +337,29 @@ Let's walk through the differences in `MyDialog` caused by its being stateful:
...
@@ -337,28 +337,29 @@ Let's walk through the differences in `MyDialog` caused by its being stateful:
hierchy. Old _stateful_ components, however, cannot simply be discarded
hierchy. Old _stateful_ components, however, cannot simply be discarded
because they contain state that needs to be preserved. Instead, the old
because they contain state that needs to be preserved. Instead, the old
stateful components are retained in the widget hierarchy and asked to
stateful components are retained in the widget hierarchy and asked to
`sync
Fields`
with the new instance of the component created by the parent in
`sync
ConstructorArguments`
with the new instance of the component created by
its
`build`
function.
the parent in
its
`build`
function.
Without
`sync
Fields`
, the new values the parent component passed to the
Without
`sync
ConstructorArguments`
, the new values the parent component
`MyDialog`
constructor in the parent's
`build`
function would be lost because
passed to the
`MyDialog`
constructor in the parent's
`build`
function would
they would be stored only as member variables on the new instance of the
be lost because they would be stored only as member variables on the new
component, which is not retained in the component hiearchy. Therefore, the
instance of the component, which is not retained in the component hiearchy.
`syncFields`
function in a component should update
`this`
to account for the
Therefore, the
`syncConstructorArguments`
function in a component should
new values the parent passed to
`source`
because
`source`
is the authorative
update
`this`
to account for the new values the parent passed to
`source`
source of those values.
because
`source`
is the authorative
source of those values.
By convention, components typically store the values they receive from their
By convention, components typically store the values they receive from their
parents in public member variables and their own internal state in private
parents in public member variables and their own internal state in private
member variables. Therefore, a typical
`sync
Fields`
implementation will copy
member variables. Therefore, a typical
`sync
ConstructorArguments`
the public, but not the private, member variables from
`source`
. When
implementation will copy the public, but not the private, member variables
f
ollowing this convention, there is no need to copy over the private memb
er
f
rom
`source`
. When following this convention, there is no need to copy ov
er
variables because those represent the internal state of the object and
`this`
the private member variables because those represent the internal state of
is the authoritative source of that state.
the object and
`this`
is the authoritative source of that state.
When implementing a
`StatefulComponent`
, make sure to call
When implementing a
`StatefulComponent`
, make sure to call
`super.syncFields(source)`
from within your
`syncFields()`
method,
`super.syncConstructorArguments(source)`
from within your
unless you are extending
`StatefulComponent`
directly.
`syncConstructorArguments()`
method, unless you are extending
`StatefulComponent`
directly.
Finally, when the user taps on the "Save" button,
`MyDialog`
follows the same
Finally, when the user taps on the "Save" button,
`MyDialog`
follows the same
pattern as
`MyCheckbox`
and calls a function passed in by its parent component
pattern as
`MyCheckbox`
and calls a function passed in by its parent component
...
@@ -382,9 +383,9 @@ efficient (and less error-prone) than initializing that state during the
...
@@ -382,9 +383,9 @@ efficient (and less error-prone) than initializing that state during the
component's constructor because parent executes the component's constructor each
component's constructor because parent executes the component's constructor each
time the parent rebuilds even though the framework mounts only the first
time the parent rebuilds even though the framework mounts only the first
instance into the widget hierarchy. (Instead of mounting later instances, the
instance into the widget hierarchy. (Instead of mounting later instances, the
framework passes them to the original instance in
`sync
Fields`
so that the first
framework passes them to the original instance in
`sync
ConstructorArguments`
so
instance of the component can incorporate the values passed by the parent to the
that the first instance of the component can incorporate the values passed by
component's constructor.)
the parent to the
component's constructor.)
Components often override
`didUnmount`
to release resources or to cancel
Components often override
`didUnmount`
to release resources or to cancel
subscriptions to event streams from outside the widget hierachy. When overriding
subscriptions to event streams from outside the widget hierachy. When overriding
...
...
packages/flutter/lib/widgets/animated_component.dart
View file @
b61fe238
...
@@ -9,7 +9,7 @@ abstract class AnimatedComponent extends StatefulComponent {
...
@@ -9,7 +9,7 @@ abstract class AnimatedComponent extends StatefulComponent {
AnimatedComponent
({
Key
key
})
:
super
(
key:
key
);
AnimatedComponent
({
Key
key
})
:
super
(
key:
key
);
void
sync
Field
s
(
AnimatedComponent
source
)
{
}
void
sync
ConstructorArgument
s
(
AnimatedComponent
source
)
{
}
final
List
<
AnimationPerformance
>
_watchedPerformances
=
new
List
<
AnimationPerformance
>();
final
List
<
AnimationPerformance
>
_watchedPerformances
=
new
List
<
AnimationPerformance
>();
...
...
packages/flutter/lib/widgets/animated_container.dart
View file @
b61fe238
...
@@ -57,7 +57,7 @@ class AnimatedMatrix4Value extends AnimatedValue<Matrix4> {
...
@@ -57,7 +57,7 @@ class AnimatedMatrix4Value extends AnimatedValue<Matrix4> {
abstract
class
AnimationBehavior
{
abstract
class
AnimationBehavior
{
void
initFields
(
AnimatedContainer
original
);
void
initFields
(
AnimatedContainer
original
);
void
sync
Field
s
(
AnimatedContainer
original
,
AnimatedContainer
updated
);
void
sync
ConstructorArgument
s
(
AnimatedContainer
original
,
AnimatedContainer
updated
);
}
}
class
ImplicitlyAnimatedValue
<
T
>
{
class
ImplicitlyAnimatedValue
<
T
>
{
...
@@ -97,7 +97,7 @@ abstract class ImplicitlyAnimatedFieldBehavior<T> extends AnimationBehavior {
...
@@ -97,7 +97,7 @@ abstract class ImplicitlyAnimatedFieldBehavior<T> extends AnimationBehavior {
_updateField
(
original
,
getter
(
original
));
_updateField
(
original
,
getter
(
original
));
}
}
void
sync
Field
s
(
AnimatedContainer
original
,
AnimatedContainer
updated
)
{
void
sync
ConstructorArgument
s
(
AnimatedContainer
original
,
AnimatedContainer
updated
)
{
_updateField
(
original
,
getter
(
updated
));
_updateField
(
original
,
getter
(
updated
));
}
}
...
@@ -213,10 +213,10 @@ class AnimatedContainer extends AnimatedComponent {
...
@@ -213,10 +213,10 @@ class AnimatedContainer extends AnimatedComponent {
i
.
initFields
(
this
);
i
.
initFields
(
this
);
}
}
void
sync
Field
s
(
AnimatedContainer
updated
)
{
void
sync
ConstructorArgument
s
(
AnimatedContainer
updated
)
{
child
=
updated
.
child
;
child
=
updated
.
child
;
for
(
AnimationBehavior
i
in
behavior
)
for
(
AnimationBehavior
i
in
behavior
)
i
.
sync
Field
s
(
this
,
updated
);
i
.
sync
ConstructorArgument
s
(
this
,
updated
);
}
}
Widget
build
()
{
Widget
build
()
{
...
...
packages/flutter/lib/widgets/basic.dart
View file @
b61fe238
...
@@ -622,7 +622,7 @@ class ImageListener extends StatefulComponent {
...
@@ -622,7 +622,7 @@ class ImageListener extends StatefulComponent {
image
.
removeListener
(
_handleImageChanged
);
image
.
removeListener
(
_handleImageChanged
);
}
}
void
sync
Field
s
(
ImageListener
source
)
{
void
sync
ConstructorArgument
s
(
ImageListener
source
)
{
final
bool
needToUpdateListeners
=
(
image
!=
source
.
image
)
&&
mounted
;
final
bool
needToUpdateListeners
=
(
image
!=
source
.
image
)
&&
mounted
;
if
(
needToUpdateListeners
)
if
(
needToUpdateListeners
)
image
.
removeListener
(
_handleImageChanged
);
image
.
removeListener
(
_handleImageChanged
);
...
...
packages/flutter/lib/widgets/button_base.dart
View file @
b61fe238
...
@@ -10,7 +10,7 @@ abstract class ButtonBase extends StatefulComponent {
...
@@ -10,7 +10,7 @@ abstract class ButtonBase extends StatefulComponent {
bool
highlight
;
bool
highlight
;
void
sync
Field
s
(
ButtonBase
source
)
{
void
sync
ConstructorArgument
s
(
ButtonBase
source
)
{
highlight
=
source
.
highlight
;
highlight
=
source
.
highlight
;
}
}
...
...
packages/flutter/lib/widgets/dismissable.dart
View file @
b61fe238
...
@@ -52,7 +52,7 @@ class Dismissable extends StatefulComponent {
...
@@ -52,7 +52,7 @@ class Dismissable extends StatefulComponent {
_startResizePerformance
();
_startResizePerformance
();
}
}
void
sync
Field
s
(
Dismissable
source
)
{
void
sync
ConstructorArgument
s
(
Dismissable
source
)
{
child
=
source
.
child
;
child
=
source
.
child
;
onResized
=
source
.
onResized
;
onResized
=
source
.
onResized
;
onDismissed
=
source
.
onDismissed
;
onDismissed
=
source
.
onDismissed
;
...
...
packages/flutter/lib/widgets/drag_target.dart
View file @
b61fe238
...
@@ -28,7 +28,7 @@ class DragTarget<T> extends StatefulComponent {
...
@@ -28,7 +28,7 @@ class DragTarget<T> extends StatefulComponent {
final
List
<
T
>
_candidateData
=
new
List
<
T
>();
final
List
<
T
>
_candidateData
=
new
List
<
T
>();
final
List
<
dynamic
>
_rejectedData
=
new
List
<
dynamic
>();
final
List
<
dynamic
>
_rejectedData
=
new
List
<
dynamic
>();
void
sync
Field
s
(
DragTarget
source
)
{
void
sync
ConstructorArgument
s
(
DragTarget
source
)
{
builder
=
source
.
builder
;
builder
=
source
.
builder
;
onWillAccept
=
source
.
onWillAccept
;
onWillAccept
=
source
.
onWillAccept
;
onAccept
=
source
.
onAccept
;
onAccept
=
source
.
onAccept
;
...
...
packages/flutter/lib/widgets/drawer.dart
View file @
b61fe238
...
@@ -75,7 +75,7 @@ class Drawer extends StatefulComponent {
...
@@ -75,7 +75,7 @@ class Drawer extends StatefulComponent {
}
}
}
}
void
sync
Field
s
(
Drawer
source
)
{
void
sync
ConstructorArgument
s
(
Drawer
source
)
{
children
=
source
.
children
;
children
=
source
.
children
;
level
=
source
.
level
;
level
=
source
.
level
;
navigator
=
source
.
navigator
;
navigator
=
source
.
navigator
;
...
...
packages/flutter/lib/widgets/drawer_item.dart
View file @
b61fe238
...
@@ -25,12 +25,12 @@ class DrawerItem extends ButtonBase {
...
@@ -25,12 +25,12 @@ class DrawerItem extends ButtonBase {
OnPressedFunction
onPressed
;
OnPressedFunction
onPressed
;
bool
selected
;
bool
selected
;
void
sync
Field
s
(
DrawerItem
source
)
{
void
sync
ConstructorArgument
s
(
DrawerItem
source
)
{
icon
=
source
.
icon
;
icon
=
source
.
icon
;
children
=
source
.
children
;
children
=
source
.
children
;
onPressed
=
source
.
onPressed
;
onPressed
=
source
.
onPressed
;
selected
=
source
.
selected
;
selected
=
source
.
selected
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
}
TextStyle
_getTextStyle
(
ThemeData
themeData
)
{
TextStyle
_getTextStyle
(
ThemeData
themeData
)
{
...
...
packages/flutter/lib/widgets/floating_action_button.dart
View file @
b61fe238
...
@@ -26,8 +26,8 @@ class FloatingActionButton extends ButtonBase {
...
@@ -26,8 +26,8 @@ class FloatingActionButton extends ButtonBase {
Color
backgroundColor
;
Color
backgroundColor
;
Function
onPressed
;
Function
onPressed
;
void
sync
Field
s
(
FloatingActionButton
source
)
{
void
sync
ConstructorArgument
s
(
FloatingActionButton
source
)
{
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
child
=
source
.
child
;
child
=
source
.
child
;
backgroundColor
=
source
.
backgroundColor
;
backgroundColor
=
source
.
backgroundColor
;
onPressed
=
source
.
onPressed
;
onPressed
=
source
.
onPressed
;
...
...
packages/flutter/lib/widgets/focus.dart
View file @
b61fe238
...
@@ -78,7 +78,7 @@ class Focus extends StatefulComponent {
...
@@ -78,7 +78,7 @@ class Focus extends StatefulComponent {
bool
autofocus
;
bool
autofocus
;
Widget
child
;
Widget
child
;
void
sync
Field
s
(
Focus
source
)
{
void
sync
ConstructorArgument
s
(
Focus
source
)
{
autofocus
=
source
.
autofocus
;
autofocus
=
source
.
autofocus
;
child
=
source
.
child
;
child
=
source
.
child
;
}
}
...
...
packages/flutter/lib/widgets/framework.dart
View file @
b61fe238
...
@@ -257,7 +257,7 @@ abstract class Widget {
...
@@ -257,7 +257,7 @@ abstract class Widget {
// Subclasses which implements Nodes that become stateful may return true
// Subclasses which implements Nodes that become stateful may return true
// if the node has become stateful and should be retained.
// if the node has become stateful and should be retained.
// This is called immediately before _sync().
// This is called immediately before _sync().
// Component.retainStatefulNodeIfPossible() calls sync
Field
s().
// Component.retainStatefulNodeIfPossible() calls sync
ConstructorArgument
s().
bool
retainStatefulNodeIfPossible
(
Widget
newNode
)
=>
false
;
bool
retainStatefulNodeIfPossible
(
Widget
newNode
)
=>
false
;
void
_sync
(
Widget
old
,
dynamic
slot
);
void
_sync
(
Widget
old
,
dynamic
slot
);
...
@@ -737,7 +737,7 @@ abstract class StatefulComponent extends Component {
...
@@ -737,7 +737,7 @@ abstract class StatefulComponent extends Component {
_isStateInitialized
=
true
;
_isStateInitialized
=
true
;
}
}
if
(
old
!=
null
)
if
(
old
!=
null
)
sync
Field
s
(
old
);
sync
ConstructorArgument
s
(
old
);
super
.
_sync
(
old
,
slot
);
super
.
_sync
(
old
,
slot
);
}
}
...
@@ -748,9 +748,9 @@ abstract class StatefulComponent extends Component {
...
@@ -748,9 +748,9 @@ abstract class StatefulComponent extends Component {
// This is called by _sync(). Derived classes should override this
// This is called by _sync(). Derived classes should override this
// method to update `this` to account for the new values the parent
// method to update `this` to account for the new values the parent
// passed to `source`. Make sure to call super.sync
Field
s(source)
// passed to `source`. Make sure to call super.sync
ConstructorArgument
s(source)
// unless you are extending StatefulComponent directly.
// unless you are extending StatefulComponent directly.
void
sync
Field
s
(
Component
source
);
void
sync
ConstructorArgument
s
(
Component
source
);
Widget
syncChild
(
Widget
node
,
Widget
oldNode
,
dynamic
slot
)
{
Widget
syncChild
(
Widget
node
,
Widget
oldNode
,
dynamic
slot
)
{
assert
(!
_disqualifiedFromEverAppearingAgain
);
assert
(!
_disqualifiedFromEverAppearingAgain
);
...
@@ -1262,7 +1262,7 @@ abstract class App extends StatefulComponent {
...
@@ -1262,7 +1262,7 @@ abstract class App extends StatefulComponent {
SkyBinding
.
instance
.
removeEventListener
(
_handleEvent
);
SkyBinding
.
instance
.
removeEventListener
(
_handleEvent
);
}
}
void
sync
Field
s
(
Component
source
)
{
}
void
sync
ConstructorArgument
s
(
Component
source
)
{
}
// Override this to handle back button behavior in your app
// Override this to handle back button behavior in your app
// Call super.onBack() to finish the activity
// Call super.onBack() to finish the activity
...
@@ -1278,7 +1278,7 @@ abstract class AbstractWidgetRoot extends StatefulComponent {
...
@@ -1278,7 +1278,7 @@ abstract class AbstractWidgetRoot extends StatefulComponent {
_scheduleComponentForRender
(
this
);
_scheduleComponentForRender
(
this
);
}
}
void
sync
Field
s
(
AbstractWidgetRoot
source
)
{
void
sync
ConstructorArgument
s
(
AbstractWidgetRoot
source
)
{
assert
(
false
);
assert
(
false
);
// if we get here, it implies that we have a parent
// if we get here, it implies that we have a parent
}
}
...
...
packages/flutter/lib/widgets/material_button.dart
View file @
b61fe238
...
@@ -21,11 +21,11 @@ abstract class MaterialButton extends ButtonBase {
...
@@ -21,11 +21,11 @@ abstract class MaterialButton extends ButtonBase {
bool
enabled
;
bool
enabled
;
Function
onPressed
;
Function
onPressed
;
void
sync
Field
s
(
MaterialButton
source
)
{
void
sync
ConstructorArgument
s
(
MaterialButton
source
)
{
child
=
source
.
child
;
child
=
source
.
child
;
enabled
=
source
.
enabled
;
enabled
=
source
.
enabled
;
onPressed
=
source
.
onPressed
;
onPressed
=
source
.
onPressed
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
}
Color
get
color
;
Color
get
color
;
...
...
packages/flutter/lib/widgets/mimic.dart
View file @
b61fe238
...
@@ -20,7 +20,7 @@ class Mimic extends StatefulComponent {
...
@@ -20,7 +20,7 @@ class Mimic extends StatefulComponent {
_requestToStartMimic
();
_requestToStartMimic
();
}
}
void
sync
Field
s
(
Mimic
source
)
{
void
sync
ConstructorArgument
s
(
Mimic
source
)
{
callback
=
source
.
callback
;
callback
=
source
.
callback
;
if
(
original
!=
source
.
original
)
{
if
(
original
!=
source
.
original
)
{
_stopMimic
();
_stopMimic
();
...
@@ -87,7 +87,7 @@ class Mimicable extends StatefulComponent {
...
@@ -87,7 +87,7 @@ class Mimicable extends StatefulComponent {
Mimic
_mimic
;
Mimic
_mimic
;
bool
_didStartMimic
=
false
;
bool
_didStartMimic
=
false
;
void
sync
Field
s
(
Mimicable
source
)
{
void
sync
ConstructorArgument
s
(
Mimicable
source
)
{
child
=
source
.
child
;
child
=
source
.
child
;
}
}
...
...
packages/flutter/lib/widgets/mimic_overlay.dart
View file @
b61fe238
...
@@ -25,7 +25,7 @@ class MimicOverlay extends AnimatedComponent {
...
@@ -25,7 +25,7 @@ class MimicOverlay extends AnimatedComponent {
Curve
curve
;
Curve
curve
;
Rect
targetRect
;
Rect
targetRect
;
void
sync
Field
s
(
MimicOverlay
source
)
{
void
sync
ConstructorArgument
s
(
MimicOverlay
source
)
{
children
=
source
.
children
;
children
=
source
.
children
;
duration
=
source
.
duration
;
duration
=
source
.
duration
;
...
...
packages/flutter/lib/widgets/navigator.dart
View file @
b61fe238
...
@@ -138,7 +138,7 @@ class Navigator extends StatefulComponent {
...
@@ -138,7 +138,7 @@ class Navigator extends StatefulComponent {
NavigationState
state
;
NavigationState
state
;
void
sync
Field
s
(
Navigator
source
)
{
void
sync
ConstructorArgument
s
(
Navigator
source
)
{
state
=
source
.
state
;
state
=
source
.
state
;
}
}
...
...
packages/flutter/lib/widgets/popup_menu.dart
View file @
b61fe238
...
@@ -58,7 +58,7 @@ class PopupMenu extends StatefulComponent {
...
@@ -58,7 +58,7 @@ class PopupMenu extends StatefulComponent {
_open
();
_open
();
}
}
void
sync
Field
s
(
PopupMenu
source
)
{
void
sync
ConstructorArgument
s
(
PopupMenu
source
)
{
if
(!
showing
&&
source
.
showing
)
if
(!
showing
&&
source
.
showing
)
_open
();
_open
();
showing
=
source
.
showing
;
showing
=
source
.
showing
;
...
...
packages/flutter/lib/widgets/progress_indicator.dart
View file @
b61fe238
...
@@ -38,7 +38,7 @@ abstract class ProgressIndicator extends StatefulComponent {
...
@@ -38,7 +38,7 @@ abstract class ProgressIndicator extends StatefulComponent {
..
variable
=
new
AnimatedValue
<
double
>(
0.0
,
end:
1.0
,
curve:
ease
);
..
variable
=
new
AnimatedValue
<
double
>(
0.0
,
end:
1.0
,
curve:
ease
);
}
}
void
sync
Field
s
(
ProgressIndicator
source
)
{
void
sync
ConstructorArgument
s
(
ProgressIndicator
source
)
{
value
=
source
.
value
;
value
=
source
.
value
;
bufferValue
=
source
.
bufferValue
;
bufferValue
=
source
.
bufferValue
;
}
}
...
...
packages/flutter/lib/widgets/radio.dart
View file @
b61fe238
...
@@ -27,11 +27,11 @@ class Radio extends ButtonBase {
...
@@ -27,11 +27,11 @@ class Radio extends ButtonBase {
Object
groupValue
;
Object
groupValue
;
RadioValueChanged
onChanged
;
RadioValueChanged
onChanged
;
void
sync
Field
s
(
Radio
source
)
{
void
sync
ConstructorArgument
s
(
Radio
source
)
{
value
=
source
.
value
;
value
=
source
.
value
;
groupValue
=
source
.
groupValue
;
groupValue
=
source
.
groupValue
;
onChanged
=
source
.
onChanged
;
onChanged
=
source
.
onChanged
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
}
Color
get
color
{
Color
get
color
{
...
...
packages/flutter/lib/widgets/scrollable.dart
View file @
b61fe238
...
@@ -55,7 +55,7 @@ abstract class Scrollable extends StatefulComponent {
...
@@ -55,7 +55,7 @@ abstract class Scrollable extends StatefulComponent {
});
});
}
}
void
sync
Field
s
(
Scrollable
source
)
{
void
sync
ConstructorArgument
s
(
Scrollable
source
)
{
scrollDirection
=
source
.
scrollDirection
;
scrollDirection
=
source
.
scrollDirection
;
}
}
...
@@ -266,9 +266,9 @@ class ScrollableViewport extends Scrollable {
...
@@ -266,9 +266,9 @@ class ScrollableViewport extends Scrollable {
Widget
child
;
Widget
child
;
void
sync
Field
s
(
ScrollableViewport
source
)
{
void
sync
ConstructorArgument
s
(
ScrollableViewport
source
)
{
child
=
source
.
child
;
child
=
source
.
child
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
}
ScrollBehavior
createScrollBehavior
()
=>
new
OverscrollWhenScrollableBehavior
();
ScrollBehavior
createScrollBehavior
()
=>
new
OverscrollWhenScrollableBehavior
();
...
@@ -357,7 +357,7 @@ abstract class ScrollableWidgetList extends Scrollable {
...
@@ -357,7 +357,7 @@ abstract class ScrollableWidgetList extends Scrollable {
int
get
itemCount
;
int
get
itemCount
;
int
_previousItemCount
;
int
_previousItemCount
;
void
sync
Field
s
(
ScrollableWidgetList
source
)
{
void
sync
ConstructorArgument
s
(
ScrollableWidgetList
source
)
{
bool
scrollBehaviorUpdateNeeded
=
bool
scrollBehaviorUpdateNeeded
=
padding
!=
source
.
padding
||
padding
!=
source
.
padding
||
itemExtent
!=
source
.
itemExtent
||
itemExtent
!=
source
.
itemExtent
||
...
@@ -365,7 +365,7 @@ abstract class ScrollableWidgetList extends Scrollable {
...
@@ -365,7 +365,7 @@ abstract class ScrollableWidgetList extends Scrollable {
padding
=
source
.
padding
;
padding
=
source
.
padding
;
itemExtent
=
source
.
itemExtent
;
itemExtent
=
source
.
itemExtent
;
super
.
sync
Field
s
(
source
);
// update scrollDirection
super
.
sync
ConstructorArgument
s
(
source
);
// update scrollDirection
if
(
itemCount
!=
_previousItemCount
)
{
if
(
itemCount
!=
_previousItemCount
)
{
scrollBehaviorUpdateNeeded
=
true
;
scrollBehaviorUpdateNeeded
=
true
;
...
@@ -508,10 +508,10 @@ class ScrollableList<T> extends ScrollableWidgetList {
...
@@ -508,10 +508,10 @@ class ScrollableList<T> extends ScrollableWidgetList {
List
<
T
>
items
;
List
<
T
>
items
;
ItemBuilder
<
T
>
itemBuilder
;
ItemBuilder
<
T
>
itemBuilder
;
void
sync
Field
s
(
ScrollableList
<
T
>
source
)
{
void
sync
ConstructorArgument
s
(
ScrollableList
<
T
>
source
)
{
items
=
source
.
items
;
items
=
source
.
items
;
itemBuilder
=
source
.
itemBuilder
;
itemBuilder
=
source
.
itemBuilder
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
}
int
get
itemCount
=>
items
.
length
;
int
get
itemCount
=>
items
.
length
;
...
@@ -547,10 +547,10 @@ class PageableList<T> extends ScrollableList<T> {
...
@@ -547,10 +547,10 @@ class PageableList<T> extends ScrollableList<T> {
Duration
duration
;
Duration
duration
;
Curve
curve
;
Curve
curve
;
void
sync
Field
s
(
PageableList
<
T
>
source
)
{
void
sync
ConstructorArgument
s
(
PageableList
<
T
>
source
)
{
duration
=
source
.
duration
;
duration
=
source
.
duration
;
curve
=
source
.
curve
;
curve
=
source
.
curve
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
}
double
_snapScrollOffset
(
double
newScrollOffset
)
{
double
_snapScrollOffset
(
double
newScrollOffset
)
{
...
@@ -617,7 +617,7 @@ class ScrollableMixedWidgetList extends Scrollable {
...
@@ -617,7 +617,7 @@ class ScrollableMixedWidgetList extends Scrollable {
super
.
didUnmount
();
super
.
didUnmount
();
}
}
void
sync
Field
s
(
ScrollableMixedWidgetList
source
)
{
void
sync
ConstructorArgument
s
(
ScrollableMixedWidgetList
source
)
{
builder
=
source
.
builder
;
builder
=
source
.
builder
;
if
(
token
!=
source
.
token
)
if
(
token
!=
source
.
token
)
_contentsChanged
=
true
;
_contentsChanged
=
true
;
...
@@ -629,7 +629,7 @@ class ScrollableMixedWidgetList extends Scrollable {
...
@@ -629,7 +629,7 @@ class ScrollableMixedWidgetList extends Scrollable {
layoutState
=
source
.
layoutState
;
layoutState
=
source
.
layoutState
;
layoutState
.
addListener
(
_handleLayoutChanged
);
layoutState
.
addListener
(
_handleLayoutChanged
);
}
}
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
}
ScrollBehavior
createScrollBehavior
()
=>
new
OverscrollBehavior
();
ScrollBehavior
createScrollBehavior
()
=>
new
OverscrollBehavior
();
...
...
packages/flutter/lib/widgets/tabs.dart
View file @
b61fe238
...
@@ -416,8 +416,8 @@ class TabBar extends Scrollable {
...
@@ -416,8 +416,8 @@ class TabBar extends Scrollable {
..
variable
=
new
AnimatedRect
(
null
,
curve:
ease
);
..
variable
=
new
AnimatedRect
(
null
,
curve:
ease
);
}
}
void
sync
Field
s
(
TabBar
source
)
{
void
sync
ConstructorArgument
s
(
TabBar
source
)
{
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
labels
=
source
.
labels
;
labels
=
source
.
labels
;
selectedIndex
=
source
.
selectedIndex
;
selectedIndex
=
source
.
selectedIndex
;
onChanged
=
source
.
onChanged
;
onChanged
=
source
.
onChanged
;
...
...
packages/flutter/lib/widgets/transitions.dart
View file @
b61fe238
...
@@ -42,14 +42,14 @@ class _AnchorTransition extends AnimatedComponent {
...
@@ -42,14 +42,14 @@ class _AnchorTransition extends AnimatedComponent {
watch
(
transition
.
performance
);
watch
(
transition
.
performance
);
}
}
void
sync
Field
s
(
_AnchorTransition
source
)
{
void
sync
ConstructorArgument
s
(
_AnchorTransition
source
)
{
if
(
transition
!=
null
&&
isWatching
(
transition
.
performance
))
if
(
transition
!=
null
&&
isWatching
(
transition
.
performance
))
unwatch
(
transition
.
performance
);
unwatch
(
transition
.
performance
);
anchoredTo
=
source
.
anchoredTo
;
anchoredTo
=
source
.
anchoredTo
;
if
(
transition
!=
null
)
if
(
transition
!=
null
)
watch
(
transition
.
performance
);
watch
(
transition
.
performance
);
child
=
source
.
child
;
child
=
source
.
child
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
}
Widget
build
()
{
Widget
build
()
{
...
@@ -95,7 +95,7 @@ abstract class TransitionBase extends AnimatedComponent {
...
@@ -95,7 +95,7 @@ abstract class TransitionBase extends AnimatedComponent {
_start
();
_start
();
}
}
void
sync
Field
s
(
TransitionBase
source
)
{
void
sync
ConstructorArgument
s
(
TransitionBase
source
)
{
child
=
source
.
child
;
child
=
source
.
child
;
onCompleted
=
source
.
onCompleted
;
onCompleted
=
source
.
onCompleted
;
onDismissed
=
source
.
onDismissed
;
onDismissed
=
source
.
onDismissed
;
...
@@ -104,7 +104,7 @@ abstract class TransitionBase extends AnimatedComponent {
...
@@ -104,7 +104,7 @@ abstract class TransitionBase extends AnimatedComponent {
direction
=
source
.
direction
;
direction
=
source
.
direction
;
_start
();
_start
();
}
}
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
}
void
_start
()
{
void
_start
()
{
...
@@ -152,9 +152,9 @@ class SlideTransition extends TransitionBase {
...
@@ -152,9 +152,9 @@ class SlideTransition extends TransitionBase {
AnimatedValue
<
Point
>
position
;
AnimatedValue
<
Point
>
position
;
void
sync
Field
s
(
SlideTransition
source
)
{
void
sync
ConstructorArgument
s
(
SlideTransition
source
)
{
position
=
source
.
position
;
position
=
source
.
position
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
}
Widget
buildWithChild
(
Widget
child
)
{
Widget
buildWithChild
(
Widget
child
)
{
...
@@ -187,9 +187,9 @@ class FadeTransition extends TransitionBase {
...
@@ -187,9 +187,9 @@ class FadeTransition extends TransitionBase {
AnimatedValue
<
double
>
opacity
;
AnimatedValue
<
double
>
opacity
;
void
sync
Field
s
(
FadeTransition
source
)
{
void
sync
ConstructorArgument
s
(
FadeTransition
source
)
{
opacity
=
source
.
opacity
;
opacity
=
source
.
opacity
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
}
Widget
buildWithChild
(
Widget
child
)
{
Widget
buildWithChild
(
Widget
child
)
{
...
@@ -220,9 +220,9 @@ class ColorTransition extends TransitionBase {
...
@@ -220,9 +220,9 @@ class ColorTransition extends TransitionBase {
AnimatedColorValue
color
;
AnimatedColorValue
color
;
void
sync
Field
s
(
ColorTransition
source
)
{
void
sync
ConstructorArgument
s
(
ColorTransition
source
)
{
color
=
source
.
color
;
color
=
source
.
color
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
}
Widget
buildWithChild
(
Widget
child
)
{
Widget
buildWithChild
(
Widget
child
)
{
...
@@ -258,10 +258,10 @@ class SquashTransition extends TransitionBase {
...
@@ -258,10 +258,10 @@ class SquashTransition extends TransitionBase {
AnimatedValue
<
double
>
width
;
AnimatedValue
<
double
>
width
;
AnimatedValue
<
double
>
height
;
AnimatedValue
<
double
>
height
;
void
sync
Field
s
(
SquashTransition
source
)
{
void
sync
ConstructorArgument
s
(
SquashTransition
source
)
{
width
=
source
.
width
;
width
=
source
.
width
;
height
=
source
.
height
;
height
=
source
.
height
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
}
Widget
buildWithChild
(
Widget
child
)
{
Widget
buildWithChild
(
Widget
child
)
{
...
@@ -299,10 +299,10 @@ class BuilderTransition extends TransitionBase {
...
@@ -299,10 +299,10 @@ class BuilderTransition extends TransitionBase {
List
<
AnimatedValue
>
variables
;
List
<
AnimatedValue
>
variables
;
BuilderFunction
builder
;
BuilderFunction
builder
;
void
sync
Field
s
(
BuilderTransition
source
)
{
void
sync
ConstructorArgument
s
(
BuilderTransition
source
)
{
variables
=
source
.
variables
;
variables
=
source
.
variables
;
builder
=
source
.
builder
;
builder
=
source
.
builder
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
}
Widget
buildWithChild
(
Widget
child
)
{
Widget
buildWithChild
(
Widget
child
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment