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

Side by Side 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, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | sky/sdk/lib/painting/box_painter.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'package:sky/rendering/sky_binding.dart'; 5 import 'package:sky/rendering/sky_binding.dart';
6 import 'package:sky/theme/colors.dart' as colors; 6 import 'package:sky/theme/colors.dart' as colors;
7 import 'package:sky/theme/theme_data.dart'; 7 import 'package:sky/theme/theme_data.dart';
8 import 'package:sky/widgets/basic.dart'; 8 import 'package:sky/widgets/basic.dart';
9 import 'package:sky/widgets/navigator.dart'; 9 import 'package:sky/widgets/navigator.dart';
10 import 'package:sky/widgets/theme.dart'; 10 import 'package:sky/widgets/theme.dart';
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 final List<Stock> _stocks = []; 54 final List<Stock> _stocks = [];
55 void didMount() { 55 void didMount() {
56 super.didMount(); 56 super.didMount();
57 new StockDataFetcher((StockData data) { 57 new StockDataFetcher((StockData data) {
58 setState(() { 58 setState(() {
59 data.appendTo(_stocks); 59 data.appendTo(_stocks);
60 }); 60 });
61 }); 61 });
62 } 62 }
63 63
64 Widget build() { 64 Widget build() {
65 return new Theme( 65
66 data: new ThemeData.light( 66 ThemeData theme;
67 if (stockMode == StockMode.optimistic) {
68 theme = new ThemeData.light(
67 primary: colors.Purple, 69 primary: colors.Purple,
68 accent: colors.RedAccent, 70 accent: colors.RedAccent,
69 darkToolbar: true), 71 darkToolbar: true
70 child: new Navigator(_navigationState) 72 );
71 ); 73 } else {
72 } 74 theme = new ThemeData.dark(
75 primary: colors.Red,
76 accent: colors.PurpleAccent
77 );
78 }
79
80 return new Theme(
81 data: theme,
82 child: new Navigator(_navigationState)
83 );
84 }
73 } 85 }
74 86
75 void main() { 87 void main() {
76 print("starting stocks app!"); 88 print("starting stocks app!");
77 runApp(new StocksApp()); 89 runApp(new StocksApp(), enableProfilingLoop: true);
90 // set enableProfilingLoop to true to make the app rebuild continually every 2 0ms
78 SkyBinding.instance.onFrame = () { 91 SkyBinding.instance.onFrame = () {
79 // uncomment this for debugging: 92 // uncomment this to print the RenderObject tree every frame:
80 // SkyBinding.instance.debugDumpRenderTree(); 93 // SkyBinding.instance.debugDumpRenderTree();
81 }; 94 };
82 } 95 }
OLDNEW
« 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