OLD | NEW |
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 'dart:math' as math; | 5 import 'dart:math' as math; |
6 | 6 |
7 import 'package:sky/rendering/box.dart'; | 7 import 'package:sky/rendering/box.dart'; |
8 import 'package:sky/rendering/flex.dart'; | 8 import 'package:sky/rendering/flex.dart'; |
9 import 'package:sky/rendering/sky_binding.dart'; | 9 import 'package:sky/rendering/sky_binding.dart'; |
10 import 'package:sky/theme/colors.dart' as colors; | 10 import 'package:sky/theme/colors.dart' as colors; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 setState(() { | 70 setState(() { |
71 var ring = (sectors.child as RenderSectorRing); | 71 var ring = (sectors.child as RenderSectorRing); |
72 SectorDimensions currentSize = ring.getIntrinsicDimensions(const SectorCon
straints(), ring.deltaRadius); | 72 SectorDimensions currentSize = ring.getIntrinsicDimensions(const SectorCon
straints(), ring.deltaRadius); |
73 enabledAdd = currentSize.deltaTheta < kTwoPi; | 73 enabledAdd = currentSize.deltaTheta < kTwoPi; |
74 enabledRemove = ring.firstChild != null; | 74 enabledRemove = ring.firstChild != null; |
75 }); | 75 }); |
76 } | 76 } |
77 | 77 |
78 Widget build() { | 78 Widget build() { |
79 return new Theme( | 79 return new Theme( |
80 data: new ThemeData(color: colors.Blue, text: typography.white), | 80 data: new ThemeData.light(primary: colors.Blue, darkToolbar: true), |
81 child: new Scaffold( | 81 child: new Scaffold( |
82 toolbar: new ToolBar( | 82 toolbar: new ToolBar( |
83 center: new Text('Sector Layout in a Widget Tree', style: typography
.white.title)), | 83 center: new Text('Sector Layout in a Widget Tree')), |
84 body: new Material( | 84 body: new Material( |
85 edge: MaterialEdge.canvas, | 85 edge: MaterialEdge.canvas, |
86 child: new Flex([ | 86 child: new Flex([ |
87 new Container( | 87 new Container( |
88 padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0)
, | 88 padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0)
, |
89 child: new Flex([ | 89 child: new Flex([ |
90 new RaisedButton( | 90 new RaisedButton( |
91 enabled: enabledAdd, | 91 enabled: enabledAdd, |
92 child: new ShrinkWrapWidth( | 92 child: new ShrinkWrapWidth( |
93 child: new Flex([ | 93 child: new Flex([ |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
142 void main() { | 142 void main() { |
143 runApp(new SectorApp()); | 143 runApp(new SectorApp()); |
144 SkyBinding.instance.onFrame = () { | 144 SkyBinding.instance.onFrame = () { |
145 // uncomment this for debugging: | 145 // uncomment this for debugging: |
146 // SkyBinding.instance.debugDumpRenderTree(); | 146 // SkyBinding.instance.debugDumpRenderTree(); |
147 }; | 147 }; |
148 } | 148 } |
OLD | NEW |