Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion sky/sdk/example/widgets/piano.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class PianoApp extends App {
}
mediaService.close();
// Are we leaking all the player connections?
scheduleBuild();
}

Widget build() {
Expand Down
13 changes: 10 additions & 3 deletions sky/sdk/lib/widgets/animated_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,29 @@ abstract class AnimatedComponent extends StatefulComponent {

final List<AnimationPerformance> _watchedPerformances = new List<AnimationPerformance>();

void _performanceChanged() {
setState(() {
// We don't actually have any state to change, per se,
// we just know that we have in fact changed state.
});
}

void watch(AnimationPerformance performance) {
assert(!_watchedPerformances.contains(performance));
_watchedPerformances.add(performance);
if (mounted)
performance.addListener(scheduleBuild);
performance.addListener(_performanceChanged);
}

void didMount() {
for (AnimationPerformance performance in _watchedPerformances)
performance.addListener(scheduleBuild);
performance.addListener(_performanceChanged);
super.didMount();
}

void didUnmount() {
for (AnimationPerformance performance in _watchedPerformances)
performance.removeListener(scheduleBuild);
performance.removeListener(_performanceChanged);
super.didUnmount();
}

Expand Down
8 changes: 4 additions & 4 deletions sky/sdk/lib/widgets/widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ abstract class Component extends Widget {
}
void _dependenciesChanged() {
// called by Inherited.sync()
scheduleBuild();
_scheduleBuild();
}

// order corresponds to _build_ order, not depth in the tree.
Expand Down Expand Up @@ -585,7 +585,7 @@ abstract class Component extends Widget {
_sync(null, _slot);
}

void scheduleBuild() {
void _scheduleBuild() {
if (_isBuilding || _dirty || !_mounted)
return;
_dirty = true;
Expand Down Expand Up @@ -662,7 +662,7 @@ abstract class StatefulComponent extends Component {
void setState(void fn()) {
assert(!_disqualifiedFromEverAppearingAgain);
fn();
scheduleBuild();
_scheduleBuild();
}
}

Expand Down Expand Up @@ -1190,7 +1190,7 @@ void runApp(App app, { RenderView renderViewOverride, bool enableProfilingLoop:
_container = new AppContainer(app);
if (enableProfilingLoop) {
new Timer.periodic(const Duration(milliseconds: 20), (_) {
app.scheduleBuild();
app._scheduleBuild();
});
}
}
Expand Down