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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user