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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 setState(() { | 67 setState(() { |
68 var ring = (sectors.child as RenderSectorRing); | 68 var ring = (sectors.child as RenderSectorRing); |
69 SectorDimensions currentSize = ring.getIntrinsicDimensions(const SectorCon
straints(), ring.deltaRadius); | 69 SectorDimensions currentSize = ring.getIntrinsicDimensions(const SectorCon
straints(), ring.deltaRadius); |
70 enabledAdd = currentSize.deltaTheta < kTwoPi; | 70 enabledAdd = currentSize.deltaTheta < kTwoPi; |
71 enabledRemove = ring.firstChild != null; | 71 enabledRemove = ring.firstChild != null; |
72 }); | 72 }); |
73 } | 73 } |
74 | 74 |
75 Widget build() { | 75 Widget build() { |
76 return new Theme( | 76 return new Theme( |
77 data: new ThemeData.light(primary: colors.Blue, darkToolbar: true), | 77 data: new ThemeData.light(), |
78 child: new Scaffold( | 78 child: new Scaffold( |
79 toolbar: new ToolBar( | 79 toolbar: new ToolBar( |
80 center: new Text('Sector Layout in a Widget Tree')), | 80 center: new Text('Sector Layout in a Widget Tree')), |
81 body: new Material( | 81 body: new Material( |
82 color: colors.Grey[50], | 82 type: MaterialType.canvas, |
83 edge: MaterialEdge.canvas, | |
84 child: new Flex([ | 83 child: new Flex([ |
85 new Container( | 84 new Container( |
86 padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0)
, | 85 padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0)
, |
87 child: new Flex([ | 86 child: new Flex([ |
88 new RaisedButton( | 87 new RaisedButton( |
89 enabled: enabledAdd, | 88 enabled: enabledAdd, |
90 child: new ShrinkWrapWidth( | 89 child: new ShrinkWrapWidth( |
91 child: new Flex([ | 90 child: new Flex([ |
92 new Container( | 91 new Container( |
93 padding: new EdgeDims.all(4.0), | 92 padding: new EdgeDims.all(4.0), |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 136 } |
138 } | 137 } |
139 | 138 |
140 void main() { | 139 void main() { |
141 runApp(new SectorApp()); | 140 runApp(new SectorApp()); |
142 SkyBinding.instance.onFrame = () { | 141 SkyBinding.instance.onFrame = () { |
143 // uncomment this for debugging: | 142 // uncomment this for debugging: |
144 // SkyBinding.instance.debugDumpRenderTree(); | 143 // SkyBinding.instance.debugDumpRenderTree(); |
145 }; | 144 }; |
146 } | 145 } |
OLD | NEW |