1
0
mirror of https://github.com/flutter/samples.git synced 2026-05-06 06:56:34 +00:00

More state cleanup

This commit is contained in:
Kevin Moore
2019-05-25 16:22:29 -07:00
parent 62ffd22505
commit cb5036305e
10 changed files with 134 additions and 107 deletions

View File

@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'app_state.dart';
import 'core/puzzle_proxy.dart';
import 'flutter.dart';
import 'shared_theme.dart';
@@ -37,14 +37,14 @@ class ThemePlaster extends SharedTheme {
);
@override
Widget tileButton(int i, AppState appState, bool small) {
final correctColumn = i % appState.puzzle.width;
final correctRow = i ~/ appState.puzzle.width;
Widget tileButton(int i, PuzzleProxy puzzle, bool small) {
final correctColumn = i % puzzle.width;
final correctRow = i ~/ puzzle.width;
final primary = (correctColumn + correctRow).isEven;
if (i == appState.puzzle.tileCount) {
assert(appState.puzzle.solved);
if (i == puzzle.tileCount) {
assert(puzzle.solved);
return Center(
child: Icon(
Icons.thumb_up,
@@ -64,7 +64,7 @@ class ThemePlaster extends SharedTheme {
);
return createButton(
appState,
puzzle,
small,
i,
content,