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 {
List
<
Widget
>
children
;
Function
onPressed
;
void
sync
Field
s
(
DialogMenuItem
source
)
{
void
sync
ConstructorArgument
s
(
DialogMenuItem
source
)
{
children
=
source
.
children
;
onPressed
=
source
.
onPressed
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
Widget
buildContent
()
{
...
...
@@ -73,7 +73,7 @@ class FeedFragment extends StatefulComponent {
super
.
initState
();
}
void
sync
Field
s
(
FeedFragment
source
)
{
void
sync
ConstructorArgument
s
(
FeedFragment
source
)
{
navigator
=
source
.
navigator
;
userData
=
source
.
userData
;
onItemCreated
=
source
.
onItemCreated
;
...
...
@@ -298,7 +298,7 @@ class AddItemDialog extends StatefulComponent {
Navigator
navigator
;
void
sync
Field
s
(
AddItemDialog
source
)
{
void
sync
ConstructorArgument
s
(
AddItemDialog
source
)
{
this
.
navigator
=
source
.
navigator
;
}
...
...
examples/fitness/lib/meal.dart
View file @
b61fe238
...
...
@@ -49,7 +49,7 @@ class MealFragment extends StatefulComponent {
Navigator
navigator
;
FitnessItemHandler
onCreated
;
void
sync
Field
s
(
MealFragment
source
)
{
void
sync
ConstructorArgument
s
(
MealFragment
source
)
{
navigator
=
source
.
navigator
;
onCreated
=
source
.
onCreated
;
}
...
...
examples/fitness/lib/measurement.dart
View file @
b61fe238
...
...
@@ -60,7 +60,7 @@ class MeasurementFragment extends StatefulComponent {
Navigator
navigator
;
FitnessItemHandler
onCreated
;
void
sync
Field
s
(
MeasurementFragment
source
)
{
void
sync
ConstructorArgument
s
(
MeasurementFragment
source
)
{
navigator
=
source
.
navigator
;
onCreated
=
source
.
onCreated
;
}
...
...
examples/fitness/lib/settings.dart
View file @
b61fe238
...
...
@@ -17,7 +17,7 @@ class SettingsFragment extends StatefulComponent {
UserData
userData
;
SettingsUpdater
updater
;
void
sync
Field
s
(
SettingsFragment
source
)
{
void
sync
ConstructorArgument
s
(
SettingsFragment
source
)
{
navigator
=
source
.
navigator
;
userData
=
source
.
userData
;
updater
=
source
.
updater
;
...
...
examples/stocks/lib/stock_home.dart
View file @
b61fe238
...
...
@@ -17,7 +17,7 @@ class StockHome extends StatefulComponent {
StockMode
stockMode
;
ModeUpdater
modeUpdater
;
void
sync
Field
s
(
StockHome
source
)
{
void
sync
ConstructorArgument
s
(
StockHome
source
)
{
navigator
=
source
.
navigator
;
stocks
=
source
.
stocks
;
stockMode
=
source
.
stockMode
;
...
...
examples/stocks/lib/stock_settings.dart
View file @
b61fe238
...
...
@@ -18,7 +18,7 @@ class StockSettings extends StatefulComponent {
BackupMode
backup
;
SettingsUpdater
updater
;
void
sync
Field
s
(
StockSettings
source
)
{
void
sync
ConstructorArgument
s
(
StockSettings
source
)
{
navigator
=
source
.
navigator
;
optimism
=
source
.
optimism
;
backup
=
source
.
backup
;
...
...
examples/widgets/drag_and_drop.dart
View file @
b61fe238
...
...
@@ -19,7 +19,7 @@ class DragData {
class
ExampleDragTarget
extends
StatefulComponent
{
String
_text
=
'ready'
;
void
sync
Field
s
(
ExampleDragTarget
source
)
{
void
sync
ConstructorArgument
s
(
ExampleDragTarget
source
)
{
}
void
_handleAccept
(
DragData
data
)
{
...
...
packages/flutter/lib/editing/editable_text.dart
View file @
b61fe238
...
...
@@ -29,7 +29,7 @@ class EditableText extends StatefulComponent {
TextStyle
style
;
Color
cursorColor
;
void
sync
Field
s
(
EditableText
source
)
{
void
sync
ConstructorArgument
s
(
EditableText
source
)
{
value
=
source
.
value
;
focused
=
source
.
focused
;
style
=
source
.
style
;
...
...
packages/flutter/lib/editing/input.dart
View file @
b61fe238
...
...
@@ -44,7 +44,7 @@ class Input extends StatefulComponent {
super
.
initState
();
}
void
sync
Field
s
(
Input
source
)
{
void
sync
ConstructorArgument
s
(
Input
source
)
{
placeholder
=
source
.
placeholder
;
onChanged
=
source
.
onChanged
;
keyboardType
=
source
.
keyboardType
;
...
...
packages/flutter/lib/widgets/README.md
View file @
b61fe238
...
...
@@ -267,7 +267,7 @@ class MyDialog extends StatefulComponent {
});
}
void
sync
Field
s
(
MyDialog
source
)
{
void
sync
ConstructorArgument
s
(
MyDialog
source
)
{
onDismissed
=
source
.
onDismissed
;
}
...
...
@@ -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
the changed state.
*
`MyDialog`
implements the
`sync
Fields`
member function. To understand
`syncFields`
, we'll need to dive a bit deeper into how the
`build`
function
is used by the framework.
*
`MyDialog`
implements the
`sync
ConstructorArguments`
member function. To
understand
`syncConstructorArguments`
, we'll need to dive a bit deeper into
how the
`build`
function
is used by the framework.
A component's
`build`
function returns a tree of widgets that represent a
"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:
hierchy. Old _stateful_ components, however, cannot simply be discarded
because they contain state that needs to be preserved. Instead, the old
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
its
`build`
function.
`sync
ConstructorArguments`
with the new instance of the component created by
the parent in
its
`build`
function.
Without
`sync
Fields`
, the new values the parent component passed to the
`MyDialog`
constructor in the parent's
`build`
function would be lost because
they would be stored only as member variables on the new instance of the
component, which is not retained in the component hiearchy. Therefore, the
`syncFields`
function in a component should update
`this`
to account for the
new values the parent passed to
`source`
because
`source`
is the authorative
source of those values.
Without
`sync
ConstructorArguments`
, the new values the parent component
passed to the
`MyDialog`
constructor in the parent's
`build`
function would
be lost because they would be stored only as member variables on the new
instance of the component, which is not retained in the component hiearchy.
Therefore, the
`syncConstructorArguments`
function in a component should
update
`this`
to account for the new values the parent passed to
`source`
because
`source`
is the authorative
source of those values.
By convention, components typically store the values they receive from their
parents in public member variables and their own internal state in private
member variables. Therefore, a typical
`sync
Fields`
implementation will copy
the public, but not the private, member variables from
`source`
. When
f
ollowing this convention, there is no need to copy over the private memb
er
variables because those represent the internal state of the object and
`this`
is the authoritative source of that state.
member variables. Therefore, a typical
`sync
ConstructorArguments`
implementation will copy the public, but not the private, member variables
f
rom
`source`
. When following this convention, there is no need to copy ov
er
the private member variables because those represent the internal state of
the object and
`this`
is the authoritative source of that state.
When implementing a
`StatefulComponent`
, make sure to call
`super.syncFields(source)`
from within your
`syncFields()`
method,
unless you are extending
`StatefulComponent`
directly.
`super.syncConstructorArguments(source)`
from within your
`syncConstructorArguments()`
method, unless you are extending
`StatefulComponent`
directly.
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
...
...
@@ -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
time the parent rebuilds even though the framework mounts only the first
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
instance of the component can incorporate the values passed by the parent to the
component's constructor.)
framework passes them to the original instance in
`sync
ConstructorArguments`
so
that the first instance of the component can incorporate the values passed by
the parent to the
component's constructor.)
Components often override
`didUnmount`
to release resources or to cancel
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 {
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
>();
...
...
packages/flutter/lib/widgets/animated_container.dart
View file @
b61fe238
...
...
@@ -57,7 +57,7 @@ class AnimatedMatrix4Value extends AnimatedValue<Matrix4> {
abstract
class
AnimationBehavior
{
void
initFields
(
AnimatedContainer
original
);
void
sync
Field
s
(
AnimatedContainer
original
,
AnimatedContainer
updated
);
void
sync
ConstructorArgument
s
(
AnimatedContainer
original
,
AnimatedContainer
updated
);
}
class
ImplicitlyAnimatedValue
<
T
>
{
...
...
@@ -97,7 +97,7 @@ abstract class ImplicitlyAnimatedFieldBehavior<T> extends AnimationBehavior {
_updateField
(
original
,
getter
(
original
));
}
void
sync
Field
s
(
AnimatedContainer
original
,
AnimatedContainer
updated
)
{
void
sync
ConstructorArgument
s
(
AnimatedContainer
original
,
AnimatedContainer
updated
)
{
_updateField
(
original
,
getter
(
updated
));
}
...
...
@@ -213,10 +213,10 @@ class AnimatedContainer extends AnimatedComponent {
i
.
initFields
(
this
);
}
void
sync
Field
s
(
AnimatedContainer
updated
)
{
void
sync
ConstructorArgument
s
(
AnimatedContainer
updated
)
{
child
=
updated
.
child
;
for
(
AnimationBehavior
i
in
behavior
)
i
.
sync
Field
s
(
this
,
updated
);
i
.
sync
ConstructorArgument
s
(
this
,
updated
);
}
Widget
build
()
{
...
...
packages/flutter/lib/widgets/basic.dart
View file @
b61fe238
...
...
@@ -622,7 +622,7 @@ class ImageListener extends StatefulComponent {
image
.
removeListener
(
_handleImageChanged
);
}
void
sync
Field
s
(
ImageListener
source
)
{
void
sync
ConstructorArgument
s
(
ImageListener
source
)
{
final
bool
needToUpdateListeners
=
(
image
!=
source
.
image
)
&&
mounted
;
if
(
needToUpdateListeners
)
image
.
removeListener
(
_handleImageChanged
);
...
...
packages/flutter/lib/widgets/button_base.dart
View file @
b61fe238
...
...
@@ -10,7 +10,7 @@ abstract class ButtonBase extends StatefulComponent {
bool
highlight
;
void
sync
Field
s
(
ButtonBase
source
)
{
void
sync
ConstructorArgument
s
(
ButtonBase
source
)
{
highlight
=
source
.
highlight
;
}
...
...
packages/flutter/lib/widgets/dismissable.dart
View file @
b61fe238
...
...
@@ -52,7 +52,7 @@ class Dismissable extends StatefulComponent {
_startResizePerformance
();
}
void
sync
Field
s
(
Dismissable
source
)
{
void
sync
ConstructorArgument
s
(
Dismissable
source
)
{
child
=
source
.
child
;
onResized
=
source
.
onResized
;
onDismissed
=
source
.
onDismissed
;
...
...
packages/flutter/lib/widgets/drag_target.dart
View file @
b61fe238
...
...
@@ -28,7 +28,7 @@ class DragTarget<T> extends StatefulComponent {
final
List
<
T
>
_candidateData
=
new
List
<
T
>();
final
List
<
dynamic
>
_rejectedData
=
new
List
<
dynamic
>();
void
sync
Field
s
(
DragTarget
source
)
{
void
sync
ConstructorArgument
s
(
DragTarget
source
)
{
builder
=
source
.
builder
;
onWillAccept
=
source
.
onWillAccept
;
onAccept
=
source
.
onAccept
;
...
...
packages/flutter/lib/widgets/drawer.dart
View file @
b61fe238
...
...
@@ -75,7 +75,7 @@ class Drawer extends StatefulComponent {
}
}
void
sync
Field
s
(
Drawer
source
)
{
void
sync
ConstructorArgument
s
(
Drawer
source
)
{
children
=
source
.
children
;
level
=
source
.
level
;
navigator
=
source
.
navigator
;
...
...
packages/flutter/lib/widgets/drawer_item.dart
View file @
b61fe238
...
...
@@ -25,12 +25,12 @@ class DrawerItem extends ButtonBase {
OnPressedFunction
onPressed
;
bool
selected
;
void
sync
Field
s
(
DrawerItem
source
)
{
void
sync
ConstructorArgument
s
(
DrawerItem
source
)
{
icon
=
source
.
icon
;
children
=
source
.
children
;
onPressed
=
source
.
onPressed
;
selected
=
source
.
selected
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
TextStyle
_getTextStyle
(
ThemeData
themeData
)
{
...
...
packages/flutter/lib/widgets/floating_action_button.dart
View file @
b61fe238
...
...
@@ -26,8 +26,8 @@ class FloatingActionButton extends ButtonBase {
Color
backgroundColor
;
Function
onPressed
;
void
sync
Field
s
(
FloatingActionButton
source
)
{
super
.
sync
Field
s
(
source
);
void
sync
ConstructorArgument
s
(
FloatingActionButton
source
)
{
super
.
sync
ConstructorArgument
s
(
source
);
child
=
source
.
child
;
backgroundColor
=
source
.
backgroundColor
;
onPressed
=
source
.
onPressed
;
...
...
packages/flutter/lib/widgets/focus.dart
View file @
b61fe238
...
...
@@ -78,7 +78,7 @@ class Focus extends StatefulComponent {
bool
autofocus
;
Widget
child
;
void
sync
Field
s
(
Focus
source
)
{
void
sync
ConstructorArgument
s
(
Focus
source
)
{
autofocus
=
source
.
autofocus
;
child
=
source
.
child
;
}
...
...
packages/flutter/lib/widgets/framework.dart
View file @
b61fe238
...
...
@@ -257,7 +257,7 @@ abstract class Widget {
// Subclasses which implements Nodes that become stateful may return true
// if the node has become stateful and should be retained.
// This is called immediately before _sync().
// Component.retainStatefulNodeIfPossible() calls sync
Field
s().
// Component.retainStatefulNodeIfPossible() calls sync
ConstructorArgument
s().
bool
retainStatefulNodeIfPossible
(
Widget
newNode
)
=>
false
;
void
_sync
(
Widget
old
,
dynamic
slot
);
...
...
@@ -737,7 +737,7 @@ abstract class StatefulComponent extends Component {
_isStateInitialized
=
true
;
}
if
(
old
!=
null
)
sync
Field
s
(
old
);
sync
ConstructorArgument
s
(
old
);
super
.
_sync
(
old
,
slot
);
}
...
...
@@ -748,9 +748,9 @@ abstract class StatefulComponent extends Component {
// This is called by _sync(). Derived classes should override this
// 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.
void
sync
Field
s
(
Component
source
);
void
sync
ConstructorArgument
s
(
Component
source
);
Widget
syncChild
(
Widget
node
,
Widget
oldNode
,
dynamic
slot
)
{
assert
(!
_disqualifiedFromEverAppearingAgain
);
...
...
@@ -1262,7 +1262,7 @@ abstract class App extends StatefulComponent {
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
// Call super.onBack() to finish the activity
...
...
@@ -1278,7 +1278,7 @@ abstract class AbstractWidgetRoot extends StatefulComponent {
_scheduleComponentForRender
(
this
);
}
void
sync
Field
s
(
AbstractWidgetRoot
source
)
{
void
sync
ConstructorArgument
s
(
AbstractWidgetRoot
source
)
{
assert
(
false
);
// 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 {
bool
enabled
;
Function
onPressed
;
void
sync
Field
s
(
MaterialButton
source
)
{
void
sync
ConstructorArgument
s
(
MaterialButton
source
)
{
child
=
source
.
child
;
enabled
=
source
.
enabled
;
onPressed
=
source
.
onPressed
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
Color
get
color
;
...
...
packages/flutter/lib/widgets/mimic.dart
View file @
b61fe238
...
...
@@ -20,7 +20,7 @@ class Mimic extends StatefulComponent {
_requestToStartMimic
();
}
void
sync
Field
s
(
Mimic
source
)
{
void
sync
ConstructorArgument
s
(
Mimic
source
)
{
callback
=
source
.
callback
;
if
(
original
!=
source
.
original
)
{
_stopMimic
();
...
...
@@ -87,7 +87,7 @@ class Mimicable extends StatefulComponent {
Mimic
_mimic
;
bool
_didStartMimic
=
false
;
void
sync
Field
s
(
Mimicable
source
)
{
void
sync
ConstructorArgument
s
(
Mimicable
source
)
{
child
=
source
.
child
;
}
...
...
packages/flutter/lib/widgets/mimic_overlay.dart
View file @
b61fe238
...
...
@@ -25,7 +25,7 @@ class MimicOverlay extends AnimatedComponent {
Curve
curve
;
Rect
targetRect
;
void
sync
Field
s
(
MimicOverlay
source
)
{
void
sync
ConstructorArgument
s
(
MimicOverlay
source
)
{
children
=
source
.
children
;
duration
=
source
.
duration
;
...
...
packages/flutter/lib/widgets/navigator.dart
View file @
b61fe238
...
...
@@ -138,7 +138,7 @@ class Navigator extends StatefulComponent {
NavigationState
state
;
void
sync
Field
s
(
Navigator
source
)
{
void
sync
ConstructorArgument
s
(
Navigator
source
)
{
state
=
source
.
state
;
}
...
...
packages/flutter/lib/widgets/popup_menu.dart
View file @
b61fe238
...
...
@@ -58,7 +58,7 @@ class PopupMenu extends StatefulComponent {
_open
();
}
void
sync
Field
s
(
PopupMenu
source
)
{
void
sync
ConstructorArgument
s
(
PopupMenu
source
)
{
if
(!
showing
&&
source
.
showing
)
_open
();
showing
=
source
.
showing
;
...
...
packages/flutter/lib/widgets/progress_indicator.dart
View file @
b61fe238
...
...
@@ -38,7 +38,7 @@ abstract class ProgressIndicator extends StatefulComponent {
..
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
;
bufferValue
=
source
.
bufferValue
;
}
...
...
packages/flutter/lib/widgets/radio.dart
View file @
b61fe238
...
...
@@ -27,11 +27,11 @@ class Radio extends ButtonBase {
Object
groupValue
;
RadioValueChanged
onChanged
;
void
sync
Field
s
(
Radio
source
)
{
void
sync
ConstructorArgument
s
(
Radio
source
)
{
value
=
source
.
value
;
groupValue
=
source
.
groupValue
;
onChanged
=
source
.
onChanged
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
Color
get
color
{
...
...
packages/flutter/lib/widgets/scrollable.dart
View file @
b61fe238
...
...
@@ -55,7 +55,7 @@ abstract class Scrollable extends StatefulComponent {
});
}
void
sync
Field
s
(
Scrollable
source
)
{
void
sync
ConstructorArgument
s
(
Scrollable
source
)
{
scrollDirection
=
source
.
scrollDirection
;
}
...
...
@@ -266,9 +266,9 @@ class ScrollableViewport extends Scrollable {
Widget
child
;
void
sync
Field
s
(
ScrollableViewport
source
)
{
void
sync
ConstructorArgument
s
(
ScrollableViewport
source
)
{
child
=
source
.
child
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
ScrollBehavior
createScrollBehavior
()
=>
new
OverscrollWhenScrollableBehavior
();
...
...
@@ -357,7 +357,7 @@ abstract class ScrollableWidgetList extends Scrollable {
int
get
itemCount
;
int
_previousItemCount
;
void
sync
Field
s
(
ScrollableWidgetList
source
)
{
void
sync
ConstructorArgument
s
(
ScrollableWidgetList
source
)
{
bool
scrollBehaviorUpdateNeeded
=
padding
!=
source
.
padding
||
itemExtent
!=
source
.
itemExtent
||
...
...
@@ -365,7 +365,7 @@ abstract class ScrollableWidgetList extends Scrollable {
padding
=
source
.
padding
;
itemExtent
=
source
.
itemExtent
;
super
.
sync
Field
s
(
source
);
// update scrollDirection
super
.
sync
ConstructorArgument
s
(
source
);
// update scrollDirection
if
(
itemCount
!=
_previousItemCount
)
{
scrollBehaviorUpdateNeeded
=
true
;
...
...
@@ -508,10 +508,10 @@ class ScrollableList<T> extends ScrollableWidgetList {
List
<
T
>
items
;
ItemBuilder
<
T
>
itemBuilder
;
void
sync
Field
s
(
ScrollableList
<
T
>
source
)
{
void
sync
ConstructorArgument
s
(
ScrollableList
<
T
>
source
)
{
items
=
source
.
items
;
itemBuilder
=
source
.
itemBuilder
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
int
get
itemCount
=>
items
.
length
;
...
...
@@ -547,10 +547,10 @@ class PageableList<T> extends ScrollableList<T> {
Duration
duration
;
Curve
curve
;
void
sync
Field
s
(
PageableList
<
T
>
source
)
{
void
sync
ConstructorArgument
s
(
PageableList
<
T
>
source
)
{
duration
=
source
.
duration
;
curve
=
source
.
curve
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
double
_snapScrollOffset
(
double
newScrollOffset
)
{
...
...
@@ -617,7 +617,7 @@ class ScrollableMixedWidgetList extends Scrollable {
super
.
didUnmount
();
}
void
sync
Field
s
(
ScrollableMixedWidgetList
source
)
{
void
sync
ConstructorArgument
s
(
ScrollableMixedWidgetList
source
)
{
builder
=
source
.
builder
;
if
(
token
!=
source
.
token
)
_contentsChanged
=
true
;
...
...
@@ -629,7 +629,7 @@ class ScrollableMixedWidgetList extends Scrollable {
layoutState
=
source
.
layoutState
;
layoutState
.
addListener
(
_handleLayoutChanged
);
}
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
ScrollBehavior
createScrollBehavior
()
=>
new
OverscrollBehavior
();
...
...
packages/flutter/lib/widgets/tabs.dart
View file @
b61fe238
...
...
@@ -416,8 +416,8 @@ class TabBar extends Scrollable {
..
variable
=
new
AnimatedRect
(
null
,
curve:
ease
);
}
void
sync
Field
s
(
TabBar
source
)
{
super
.
sync
Field
s
(
source
);
void
sync
ConstructorArgument
s
(
TabBar
source
)
{
super
.
sync
ConstructorArgument
s
(
source
);
labels
=
source
.
labels
;
selectedIndex
=
source
.
selectedIndex
;
onChanged
=
source
.
onChanged
;
...
...
packages/flutter/lib/widgets/transitions.dart
View file @
b61fe238
...
...
@@ -42,14 +42,14 @@ class _AnchorTransition extends AnimatedComponent {
watch
(
transition
.
performance
);
}
void
sync
Field
s
(
_AnchorTransition
source
)
{
void
sync
ConstructorArgument
s
(
_AnchorTransition
source
)
{
if
(
transition
!=
null
&&
isWatching
(
transition
.
performance
))
unwatch
(
transition
.
performance
);
anchoredTo
=
source
.
anchoredTo
;
if
(
transition
!=
null
)
watch
(
transition
.
performance
);
child
=
source
.
child
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
Widget
build
()
{
...
...
@@ -95,7 +95,7 @@ abstract class TransitionBase extends AnimatedComponent {
_start
();
}
void
sync
Field
s
(
TransitionBase
source
)
{
void
sync
ConstructorArgument
s
(
TransitionBase
source
)
{
child
=
source
.
child
;
onCompleted
=
source
.
onCompleted
;
onDismissed
=
source
.
onDismissed
;
...
...
@@ -104,7 +104,7 @@ abstract class TransitionBase extends AnimatedComponent {
direction
=
source
.
direction
;
_start
();
}
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
void
_start
()
{
...
...
@@ -152,9 +152,9 @@ class SlideTransition extends TransitionBase {
AnimatedValue
<
Point
>
position
;
void
sync
Field
s
(
SlideTransition
source
)
{
void
sync
ConstructorArgument
s
(
SlideTransition
source
)
{
position
=
source
.
position
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
Widget
buildWithChild
(
Widget
child
)
{
...
...
@@ -187,9 +187,9 @@ class FadeTransition extends TransitionBase {
AnimatedValue
<
double
>
opacity
;
void
sync
Field
s
(
FadeTransition
source
)
{
void
sync
ConstructorArgument
s
(
FadeTransition
source
)
{
opacity
=
source
.
opacity
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
Widget
buildWithChild
(
Widget
child
)
{
...
...
@@ -220,9 +220,9 @@ class ColorTransition extends TransitionBase {
AnimatedColorValue
color
;
void
sync
Field
s
(
ColorTransition
source
)
{
void
sync
ConstructorArgument
s
(
ColorTransition
source
)
{
color
=
source
.
color
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
Widget
buildWithChild
(
Widget
child
)
{
...
...
@@ -258,10 +258,10 @@ class SquashTransition extends TransitionBase {
AnimatedValue
<
double
>
width
;
AnimatedValue
<
double
>
height
;
void
sync
Field
s
(
SquashTransition
source
)
{
void
sync
ConstructorArgument
s
(
SquashTransition
source
)
{
width
=
source
.
width
;
height
=
source
.
height
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
Widget
buildWithChild
(
Widget
child
)
{
...
...
@@ -299,10 +299,10 @@ class BuilderTransition extends TransitionBase {
List
<
AnimatedValue
>
variables
;
BuilderFunction
builder
;
void
sync
Field
s
(
BuilderTransition
source
)
{
void
sync
ConstructorArgument
s
(
BuilderTransition
source
)
{
variables
=
source
.
variables
;
builder
=
source
.
builder
;
super
.
sync
Field
s
(
source
);
super
.
sync
ConstructorArgument
s
(
source
);
}
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