1
0
mirror of https://github.com/flutter/samples.git synced 2026-04-02 01:32:58 +00:00

slide_puzzle: use pkg:provider

This commit is contained in:
Kevin Moore
2019-05-23 18:05:12 -07:00
parent 051f5bec29
commit 0e50bbd6c9
10 changed files with 206 additions and 214 deletions

View File

@@ -12,7 +12,7 @@ class ThemeSimple extends SharedTheme {
@override
String get name => 'Simple';
ThemeSimple(AppState proxy) : super(proxy);
const ThemeSimple();
@override
Color get puzzleThemeBackground => Colors.white;
@@ -24,7 +24,8 @@ class ThemeSimple extends SharedTheme {
Color get puzzleAccentColor => _accentBlue;
@override
RoundedRectangleBorder get puzzleBorder => const RoundedRectangleBorder(
RoundedRectangleBorder puzzleBorder(bool small) =>
const RoundedRectangleBorder(
side: BorderSide(color: Colors.black26, width: 1),
borderRadius: BorderRadius.all(
Radius.circular(4),
@@ -32,9 +33,9 @@ class ThemeSimple extends SharedTheme {
);
@override
Widget tileButton(int i) {
if (i == puzzle.tileCount) {
assert(puzzle.solved);
Widget tileButton(int i, AppState appState, bool small) {
if (i == appState.puzzle.tileCount) {
assert(appState.puzzle.solved);
return const Center(
child: Icon(
Icons.thumb_up,
@@ -44,7 +45,7 @@ class ThemeSimple extends SharedTheme {
);
}
final correctPosition = puzzle.isCorrectPosition(i);
final correctPosition = appState.puzzle.isCorrectPosition(i);
final content = createInk(
Center(
@@ -60,6 +61,8 @@ class ThemeSimple extends SharedTheme {
);
return createButton(
appState,
small,
i,
content,
color: const Color.fromARGB(255, 13, 87, 155),