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:sky' as sky; | 5 import 'dart:sky' as sky; |
6 import 'dart:math'; | 6 import 'dart:math'; |
7 | 7 |
8 import 'package:sky/rendering/flex.dart'; | 8 import 'package:sky/rendering/flex.dart'; |
9 import 'package:sky/widgets/basic.dart'; | 9 import 'package:sky/widgets/basic.dart'; |
10 import 'package:sky/widgets/scaffold.dart'; | 10 import 'package:sky/widgets/scaffold.dart'; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 return new ToolBar( | 164 return new ToolBar( |
165 // FIXME: Strange to have the toolbar be tapable. | 165 // FIXME: Strange to have the toolbar be tapable. |
166 center: new Listener( | 166 center: new Listener( |
167 onPointerDown: handleBannerPointerDown, | 167 onPointerDown: handleBannerPointerDown, |
168 child: new Text(banner, style: Theme.of(this.app).text.title) | 168 child: new Text(banner, style: Theme.of(this.app).text.title) |
169 ) | 169 ) |
170 ); | 170 ); |
171 } | 171 } |
172 | 172 |
173 Widget buildUI() { | 173 Widget buildUI() { |
| 174 // FIXME: We need to build the board before we build the toolbar because |
| 175 // we compute the win state during build step. |
| 176 Widget board = buildBoard(); |
174 return new Scaffold( | 177 return new Scaffold( |
175 toolbar: buildToolBar(), | 178 toolbar: buildToolBar(), |
176 body: new Container( | 179 body: new Container( |
177 child: new Center(child: buildBoard()), | 180 child: new Center(child: board), |
178 decoration: new BoxDecoration(backgroundColor: colors.Grey[50]) | 181 decoration: new BoxDecoration(backgroundColor: colors.Grey[50]) |
179 ) | 182 ) |
180 ); | 183 ); |
181 } | 184 } |
182 | 185 |
183 void handleBannerPointerDown(sky.PointerEvent event) { | 186 void handleBannerPointerDown(sky.PointerEvent event) { |
184 initialize(); | 187 initialize(); |
185 app.setState((){}); | 188 app.setState((){}); |
186 } | 189 } |
187 | 190 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 } | 364 } |
362 | 365 |
363 Widget build() { | 366 Widget build() { |
364 return game.buildUI(); | 367 return game.buildUI(); |
365 } | 368 } |
366 } | 369 } |
367 | 370 |
368 void main() { | 371 void main() { |
369 runApp(new MineDiggerApp()); | 372 runApp(new MineDiggerApp()); |
370 } | 373 } |
OLD | NEW |