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

Side by Side Diff: sky/tests/widgets/syncs1.dart

Issue 1182463006: Clean up how we remove nodes from the render tree, and make sure we reinsert them in the right plac… (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 unified diff | Download patch
« no previous file with comments | « sky/sdk/lib/widgets/widget.dart ('k') | sky/tests/widgets/syncs1-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 import 'dart:async';
6
7 import 'package:sky/widgets/basic.dart';
8 import 'package:sky/widgets/raised_button.dart';
9
10 import '../resources/display_list.dart';
11
12 class FiddleApp extends App {
13
14 bool arbitrarySetting = true;
15
16 void toggle() {
17 setState(() {
18 arbitrarySetting = !arbitrarySetting;
19 });
20 }
21
22 Widget buildFlex1() {
23 return new Flex([
24 new Flexible(child: new Container(
25 decoration: new BoxDecoration(
26 backgroundColor: const Color(0xFF00FFFF)
27 )
28 )),
29 new RaisedButton(child: new Text('TAP ME TO CHANGE THE BACKGROUND COLOUR') , onPressed: toggle)
30 ]);
31 }
32
33 Widget buildFlex2() {
34 return new Flex([
35 new Flexible(child: new Container(
36 key: 'something-else',
37 decoration: new BoxDecoration(
38 backgroundColor: const Color(0xEFFF9F00)
39 )
40 )),
41 new RaisedButton(child: new Text('PRESS ME TO CHANGE IT BACK'), onPressed: toggle)
42 ]);
43 }
44
45 Widget buildStack1() {
46 return new Stack([
47 new Positioned(child: new Container(
48 decoration: new BoxDecoration(
49 backgroundColor: const Color(0xFF00FFFF)
50 )
51 )),
52 new RaisedButton(child: new Text('TAP ME TO CHANGE THE BACKGROUND COLOUR') , onPressed: toggle)
53 ]);
54 }
55
56 Widget buildStack2() {
57 return new Stack([
58 new Positioned(child: new Container(
59 key: 'something-else',
60 decoration: new BoxDecoration(
61 backgroundColor: const Color(0xEFFF9F00)
62 )
63 )),
64 new RaisedButton(child: new Text('PRESS ME TO CHANGE IT BACK'), onPressed: toggle)
65 ]);
66 }
67
68 Widget build() {
69 return new Block([
70 new SizedBox(
71 key: 'flex-example',
72 height: 250.0,
73 child: arbitrarySetting ? buildFlex1() : buildFlex2()
74 ),
75 new SizedBox(
76 key: 'stack-example',
77 height: 250.0,
78 child: arbitrarySetting ? buildStack1() : buildStack2()
79 )
80 ]);
81 }
82 }
83
84 main() {
85 TestRenderView renderViewOverride = new TestRenderView();
86 FiddleApp app = new FiddleApp();
87 runApp(app, renderViewOverride: renderViewOverride);
88 new Future.microtask(() {
89 renderViewOverride.checkFrame();
90 app.toggle();
91 new Future.microtask(() {
92 renderViewOverride.checkFrame();
93 app.toggle();
94 new Future.microtask(() {
95 renderViewOverride.checkFrame();
96 renderViewOverride.endTest();
97 });
98 });
99 });
100 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/widgets/widget.dart ('k') | sky/tests/widgets/syncs1-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698