Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(831)

Unified Diff: sky/sdk/example/stocks/lib/main.dart

Issue 1215023002: Fix theme changing: turns out we were not reparenting stateful surviving nodes when their parents c… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sky/sdk/lib/painting/box_painter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/example/stocks/lib/main.dart
diff --git a/sky/sdk/example/stocks/lib/main.dart b/sky/sdk/example/stocks/lib/main.dart
index 9550265b164885ede172f307976940efceca5477..50790827b3753ccc180199d9904a8bf7bd687c0d 100644
--- a/sky/sdk/example/stocks/lib/main.dart
+++ b/sky/sdk/example/stocks/lib/main.dart
@@ -61,22 +61,35 @@ class StocksApp extends App {
});
}
- Widget build() {
- return new Theme(
- data: new ThemeData.light(
+ Widget build() {
+
+ ThemeData theme;
+ if (stockMode == StockMode.optimistic) {
+ theme = new ThemeData.light(
primary: colors.Purple,
accent: colors.RedAccent,
- darkToolbar: true),
- child: new Navigator(_navigationState)
- );
- }
+ darkToolbar: true
+ );
+ } else {
+ theme = new ThemeData.dark(
+ primary: colors.Red,
+ accent: colors.PurpleAccent
+ );
+ }
+
+ return new Theme(
+ data: theme,
+ child: new Navigator(_navigationState)
+ );
+ }
}
void main() {
print("starting stocks app!");
- runApp(new StocksApp());
+ runApp(new StocksApp(), enableProfilingLoop: true);
+ // set enableProfilingLoop to true to make the app rebuild continually every 20ms
SkyBinding.instance.onFrame = () {
- // uncomment this for debugging:
+ // uncomment this to print the RenderObject tree every frame:
// SkyBinding.instance.debugDumpRenderTree();
};
}
« no previous file with comments | « no previous file | sky/sdk/lib/painting/box_painter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698