Commit b61fe238 authored by Adam Barth's avatar Adam Barth

Rename syncFields to syncConstructorArguments

parent dc7137b0
...@@ -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 syncFields(DialogMenuItem source) { void syncConstructorArguments(DialogMenuItem source) {
children = source.children; children = source.children;
onPressed = source.onPressed; onPressed = source.onPressed;
super.syncFields(source); super.syncConstructorArguments(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 syncFields(FeedFragment source) { void syncConstructorArguments(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 syncFields(AddItemDialog source) { void syncConstructorArguments(AddItemDialog source) {
this.navigator = source.navigator; this.navigator = source.navigator;
} }
......
...@@ -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 syncFields(MealFragment source) { void syncConstructorArguments(MealFragment source) {
navigator = source.navigator; navigator = source.navigator;
onCreated = source.onCreated; onCreated = source.onCreated;
} }
......
...@@ -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 syncFields(MeasurementFragment source) { void syncConstructorArguments(MeasurementFragment source) {
navigator = source.navigator; navigator = source.navigator;
onCreated = source.onCreated; onCreated = source.onCreated;
} }
......
...@@ -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 syncFields(SettingsFragment source) { void syncConstructorArguments(SettingsFragment source) {
navigator = source.navigator; navigator = source.navigator;
userData = source.userData; userData = source.userData;
updater = source.updater; updater = source.updater;
......
...@@ -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 syncFields(StockHome source) { void syncConstructorArguments(StockHome source) {
navigator = source.navigator; navigator = source.navigator;
stocks = source.stocks; stocks = source.stocks;
stockMode = source.stockMode; stockMode = source.stockMode;
......
...@@ -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 syncFields(StockSettings source) { void syncConstructorArguments(StockSettings source) {
navigator = source.navigator; navigator = source.navigator;
optimism = source.optimism; optimism = source.optimism;
backup = source.backup; backup = source.backup;
......
...@@ -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 syncFields(ExampleDragTarget source) { void syncConstructorArguments(ExampleDragTarget source) {
} }
void _handleAccept(DragData data) { void _handleAccept(DragData data) {
......
...@@ -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 syncFields(EditableText source) { void syncConstructorArguments(EditableText source) {
value = source.value; value = source.value;
focused = source.focused; focused = source.focused;
style = source.style; style = source.style;
......
...@@ -44,7 +44,7 @@ class Input extends StatefulComponent { ...@@ -44,7 +44,7 @@ class Input extends StatefulComponent {
super.initState(); super.initState();
} }
void syncFields(Input source) { void syncConstructorArguments(Input source) {
placeholder = source.placeholder; placeholder = source.placeholder;
onChanged = source.onChanged; onChanged = source.onChanged;
keyboardType = source.keyboardType; keyboardType = source.keyboardType;
......
...@@ -267,7 +267,7 @@ class MyDialog extends StatefulComponent { ...@@ -267,7 +267,7 @@ class MyDialog extends StatefulComponent {
}); });
} }
void syncFields(MyDialog source) { void syncConstructorArguments(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 `syncFields` member function. To understand * `MyDialog` implements the `syncConstructorArguments` 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
`syncFields` with the new instance of the component created by the parent in `syncConstructorArguments` with the new instance of the component created by
its `build` function. the parent in its `build` function.
Without `syncFields`, the new values the parent component passed to the Without `syncConstructorArguments`, 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 `syncFields` implementation will copy member variables. Therefore, a typical `syncConstructorArguments`
the public, but not the private, member variables from `source`. When implementation will copy the public, but not the private, member variables
following this convention, there is no need to copy over the private member from `source`. When following this convention, there is no need to copy over
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 `syncFields` so that the first framework passes them to the original instance in `syncConstructorArguments` 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
......
...@@ -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 syncFields(AnimatedComponent source) { } void syncConstructorArguments(AnimatedComponent source) { }
final List<AnimationPerformance> _watchedPerformances = new List<AnimationPerformance>(); final List<AnimationPerformance> _watchedPerformances = new List<AnimationPerformance>();
......
...@@ -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 syncFields(AnimatedContainer original, AnimatedContainer updated); void syncConstructorArguments(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 syncFields(AnimatedContainer original, AnimatedContainer updated) { void syncConstructorArguments(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 syncFields(AnimatedContainer updated) { void syncConstructorArguments(AnimatedContainer updated) {
child = updated.child; child = updated.child;
for (AnimationBehavior i in behavior) for (AnimationBehavior i in behavior)
i.syncFields(this, updated); i.syncConstructorArguments(this, updated);
} }
Widget build() { Widget build() {
......
...@@ -622,7 +622,7 @@ class ImageListener extends StatefulComponent { ...@@ -622,7 +622,7 @@ class ImageListener extends StatefulComponent {
image.removeListener(_handleImageChanged); image.removeListener(_handleImageChanged);
} }
void syncFields(ImageListener source) { void syncConstructorArguments(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);
......
...@@ -10,7 +10,7 @@ abstract class ButtonBase extends StatefulComponent { ...@@ -10,7 +10,7 @@ abstract class ButtonBase extends StatefulComponent {
bool highlight; bool highlight;
void syncFields(ButtonBase source) { void syncConstructorArguments(ButtonBase source) {
highlight = source.highlight; highlight = source.highlight;
} }
......
...@@ -52,7 +52,7 @@ class Dismissable extends StatefulComponent { ...@@ -52,7 +52,7 @@ class Dismissable extends StatefulComponent {
_startResizePerformance(); _startResizePerformance();
} }
void syncFields(Dismissable source) { void syncConstructorArguments(Dismissable source) {
child = source.child; child = source.child;
onResized = source.onResized; onResized = source.onResized;
onDismissed = source.onDismissed; onDismissed = source.onDismissed;
......
...@@ -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 syncFields(DragTarget source) { void syncConstructorArguments(DragTarget source) {
builder = source.builder; builder = source.builder;
onWillAccept = source.onWillAccept; onWillAccept = source.onWillAccept;
onAccept = source.onAccept; onAccept = source.onAccept;
......
...@@ -75,7 +75,7 @@ class Drawer extends StatefulComponent { ...@@ -75,7 +75,7 @@ class Drawer extends StatefulComponent {
} }
} }
void syncFields(Drawer source) { void syncConstructorArguments(Drawer source) {
children = source.children; children = source.children;
level = source.level; level = source.level;
navigator = source.navigator; navigator = source.navigator;
......
...@@ -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 syncFields(DrawerItem source) { void syncConstructorArguments(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.syncFields(source); super.syncConstructorArguments(source);
} }
TextStyle _getTextStyle(ThemeData themeData) { TextStyle _getTextStyle(ThemeData themeData) {
......
...@@ -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 syncFields(FloatingActionButton source) { void syncConstructorArguments(FloatingActionButton source) {
super.syncFields(source); super.syncConstructorArguments(source);
child = source.child; child = source.child;
backgroundColor = source.backgroundColor; backgroundColor = source.backgroundColor;
onPressed = source.onPressed; onPressed = source.onPressed;
......
...@@ -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 syncFields(Focus source) { void syncConstructorArguments(Focus source) {
autofocus = source.autofocus; autofocus = source.autofocus;
child = source.child; child = source.child;
} }
......
...@@ -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 syncFields(). // Component.retainStatefulNodeIfPossible() calls syncConstructorArguments().
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)
syncFields(old); syncConstructorArguments(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.syncFields(source) // passed to `source`. Make sure to call super.syncConstructorArguments(source)
// unless you are extending StatefulComponent directly. // unless you are extending StatefulComponent directly.
void syncFields(Component source); void syncConstructorArguments(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 syncFields(Component source) { } void syncConstructorArguments(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 syncFields(AbstractWidgetRoot source) { void syncConstructorArguments(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
} }
......
...@@ -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 syncFields(MaterialButton source) { void syncConstructorArguments(MaterialButton source) {
child = source.child; child = source.child;
enabled = source.enabled; enabled = source.enabled;
onPressed = source.onPressed; onPressed = source.onPressed;
super.syncFields(source); super.syncConstructorArguments(source);
} }
Color get color; Color get color;
......
...@@ -20,7 +20,7 @@ class Mimic extends StatefulComponent { ...@@ -20,7 +20,7 @@ class Mimic extends StatefulComponent {
_requestToStartMimic(); _requestToStartMimic();
} }
void syncFields(Mimic source) { void syncConstructorArguments(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 syncFields(Mimicable source) { void syncConstructorArguments(Mimicable source) {
child = source.child; child = source.child;
} }
......
...@@ -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 syncFields(MimicOverlay source) { void syncConstructorArguments(MimicOverlay source) {
children = source.children; children = source.children;
duration = source.duration; duration = source.duration;
......
...@@ -138,7 +138,7 @@ class Navigator extends StatefulComponent { ...@@ -138,7 +138,7 @@ class Navigator extends StatefulComponent {
NavigationState state; NavigationState state;
void syncFields(Navigator source) { void syncConstructorArguments(Navigator source) {
state = source.state; state = source.state;
} }
......
...@@ -58,7 +58,7 @@ class PopupMenu extends StatefulComponent { ...@@ -58,7 +58,7 @@ class PopupMenu extends StatefulComponent {
_open(); _open();
} }
void syncFields(PopupMenu source) { void syncConstructorArguments(PopupMenu source) {
if (!showing && source.showing) if (!showing && source.showing)
_open(); _open();
showing = source.showing; showing = source.showing;
......
...@@ -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 syncFields(ProgressIndicator source) { void syncConstructorArguments(ProgressIndicator source) {
value = source.value; value = source.value;
bufferValue = source.bufferValue; bufferValue = source.bufferValue;
} }
......
...@@ -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 syncFields(Radio source) { void syncConstructorArguments(Radio source) {
value = source.value; value = source.value;
groupValue = source.groupValue; groupValue = source.groupValue;
onChanged = source.onChanged; onChanged = source.onChanged;
super.syncFields(source); super.syncConstructorArguments(source);
} }
Color get color { Color get color {
......
...@@ -55,7 +55,7 @@ abstract class Scrollable extends StatefulComponent { ...@@ -55,7 +55,7 @@ abstract class Scrollable extends StatefulComponent {
}); });
} }
void syncFields(Scrollable source) { void syncConstructorArguments(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 syncFields(ScrollableViewport source) { void syncConstructorArguments(ScrollableViewport source) {
child = source.child; child = source.child;
super.syncFields(source); super.syncConstructorArguments(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 syncFields(ScrollableWidgetList source) { void syncConstructorArguments(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.syncFields(source); // update scrollDirection super.syncConstructorArguments(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 syncFields(ScrollableList<T> source) { void syncConstructorArguments(ScrollableList<T> source) {
items = source.items; items = source.items;
itemBuilder = source.itemBuilder; itemBuilder = source.itemBuilder;
super.syncFields(source); super.syncConstructorArguments(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 syncFields(PageableList<T> source) { void syncConstructorArguments(PageableList<T> source) {
duration = source.duration; duration = source.duration;
curve = source.curve; curve = source.curve;
super.syncFields(source); super.syncConstructorArguments(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 syncFields(ScrollableMixedWidgetList source) { void syncConstructorArguments(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.syncFields(source); super.syncConstructorArguments(source);
} }
ScrollBehavior createScrollBehavior() => new OverscrollBehavior(); ScrollBehavior createScrollBehavior() => new OverscrollBehavior();
......
...@@ -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 syncFields(TabBar source) { void syncConstructorArguments(TabBar source) {
super.syncFields(source); super.syncConstructorArguments(source);
labels = source.labels; labels = source.labels;
selectedIndex = source.selectedIndex; selectedIndex = source.selectedIndex;
onChanged = source.onChanged; onChanged = source.onChanged;
......
...@@ -42,14 +42,14 @@ class _AnchorTransition extends AnimatedComponent { ...@@ -42,14 +42,14 @@ class _AnchorTransition extends AnimatedComponent {
watch(transition.performance); watch(transition.performance);
} }
void syncFields(_AnchorTransition source) { void syncConstructorArguments(_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.syncFields(source); super.syncConstructorArguments(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 syncFields(TransitionBase source) { void syncConstructorArguments(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.syncFields(source); super.syncConstructorArguments(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 syncFields(SlideTransition source) { void syncConstructorArguments(SlideTransition source) {
position = source.position; position = source.position;
super.syncFields(source); super.syncConstructorArguments(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 syncFields(FadeTransition source) { void syncConstructorArguments(FadeTransition source) {
opacity = source.opacity; opacity = source.opacity;
super.syncFields(source); super.syncConstructorArguments(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 syncFields(ColorTransition source) { void syncConstructorArguments(ColorTransition source) {
color = source.color; color = source.color;
super.syncFields(source); super.syncConstructorArguments(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 syncFields(SquashTransition source) { void syncConstructorArguments(SquashTransition source) {
width = source.width; width = source.width;
height = source.height; height = source.height;
super.syncFields(source); super.syncConstructorArguments(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 syncFields(BuilderTransition source) { void syncConstructorArguments(BuilderTransition source) {
variables = source.variables; variables = source.variables;
builder = source.builder; builder = source.builder;
super.syncFields(source); super.syncConstructorArguments(source);
} }
Widget buildWithChild(Widget child) { Widget buildWithChild(Widget child) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment