1
0
mirror of https://github.com/flutter/samples.git synced 2026-04-29 02:56:02 +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

@@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'app_state.dart';
import 'core/puzzle_animator.dart';
import 'flutter.dart';
import 'shared_theme.dart';
import 'widgets/decoration_image_plus.dart';
@@ -11,7 +12,7 @@ class ThemeSeattle extends SharedTheme {
@override
String get name => 'Seattle';
ThemeSeattle(AppState proxy) : super(proxy);
const ThemeSeattle();
@override
Color get puzzleThemeBackground => const Color.fromARGB(153, 90, 135, 170);
@@ -23,18 +24,20 @@ class ThemeSeattle extends SharedTheme {
Color get puzzleAccentColor => const Color(0xff000579f);
@override
RoundedRectangleBorder get puzzleBorder => const RoundedRectangleBorder(
RoundedRectangleBorder puzzleBorder(bool small) =>
const RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(1),
),
);
@override
EdgeInsetsGeometry get tilePadding =>
EdgeInsetsGeometry tilePadding(PuzzleProxy puzzle) =>
puzzle.solved ? const EdgeInsets.all(1) : const EdgeInsets.all(4);
@override
Widget tileButton(int i) {
Widget tileButton(int i, AppState appState, bool small) {
final puzzle = appState.puzzle;
if (i == puzzle.tileCount && !puzzle.solved) {
assert(puzzle.solved);
}
@@ -69,6 +72,6 @@ class ThemeSeattle extends SharedTheme {
padding: EdgeInsets.all(small ? 20 : 32),
);
return createButton(i, content);
return createButton(appState, small, i, content);
}
}