update slide_puzzle

pull/420/head
John Ryan 5 years ago
parent ef0114c210
commit 3f1e2877b8

@ -0,0 +1,21 @@
import 'dart:math' show Point;
enum PuzzleEvent { click, random, reset, noop }
abstract class PuzzleProxy {
int get width;
int get height;
int get length;
bool get solved;
void clickOrShake(int tileValue);
int get tileCount;
Point<double> location(int index);
bool isCorrectPosition(int value);
}

@ -0,0 +1,2 @@
export 'package:flutter/material.dart';
export 'package:flutter/scheduler.dart' show Ticker;

@ -0,0 +1,13 @@
import 'package:flutter/foundation.dart';
abstract class PuzzleControls implements Listenable {
void reset();
int get clickCount;
int get incorrectTiles;
bool get autoPlay;
void Function(bool newValue) get setAutoPlayFunction;
}

@ -0,0 +1,9 @@
import 'theme_plaster.dart';
import 'theme_seattle.dart';
import 'theme_simple.dart';
const themes = [
ThemeSimple(),
ThemeSeattle(),
ThemePlaster(),
];

@ -0,0 +1,88 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class ValueTabController<T> extends StatefulWidget {
/// Creates a default tab controller for the given [child] widget.
const ValueTabController({
Key key,
@required this.child,
@required this.values,
}) : super(key: key);
/// The widget below this widget in the tree.
///
/// Typically a [Scaffold] whose [AppBar] includes a [TabBar].
///
/// {@macro flutter.widgets.child}
final Widget child;
final List<T> values;
/// The closest instance of this class that encloses the given context.
///
/// Typical usage:
///
/// ```dart
/// TabController controller = DefaultTabBarController.of(context);
/// ```
static TabController of(BuildContext context) {
final scope = context.inheritFromWidgetOfExactType(_ValueTabControllerScope)
as _ValueTabControllerScope;
return scope?.controller;
}
@override
_ValueTabControllerState<T> createState() => _ValueTabControllerState<T>();
}
class _ValueTabControllerState<T> extends State<ValueTabController<T>>
with SingleTickerProviderStateMixin {
final _notifier = ValueNotifier<T>(null);
TabController _controller;
@override
void initState() {
super.initState();
_controller = TabController(
vsync: this,
length: widget.values.length,
initialIndex: 0,
);
_notifier.value = widget.values.first;
_controller.addListener(() {
_notifier.value = widget.values[_controller.index];
});
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) => _ValueTabControllerScope(
controller: _controller,
enabled: TickerMode.of(context),
child: ValueListenableProvider.value(
valueListenable: _notifier,
child: widget.child,
),
);
}
class _ValueTabControllerScope extends InheritedWidget {
const _ValueTabControllerScope(
{Key key, this.controller, this.enabled, Widget child})
: super(key: key, child: child);
final TabController controller;
final bool enabled;
@override
bool updateShouldNotify(_ValueTabControllerScope old) =>
enabled != old.enabled || controller != old.controller;
}

@ -1,13 +1,20 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
_fe_analyzer_shared:
dependency: transitive
description:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
analyzer: analyzer:
dependency: transitive dependency: transitive
description: description:
name: analyzer name: analyzer
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.36.4" version: "0.39.7"
archive: archive:
dependency: transitive dependency: transitive
description: description:
@ -88,13 +95,6 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
front_end:
dependency: transitive
description:
name: front_end
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.19"
glob: glob:
dependency: transitive dependency: transitive
description: description:
@ -115,21 +115,21 @@ packages:
name: http name: http
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.0+2" version: "0.12.0+4"
http_multi_server: http_multi_server:
dependency: transitive dependency: transitive
description: description:
name: http_multi_server name: http_multi_server
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.2.0"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
name: http_parser name: http_parser
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.3" version: "3.1.4"
image: image:
dependency: transitive dependency: transitive
description: description:
@ -143,7 +143,7 @@ packages:
name: io name: io
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.3" version: "0.3.4"
js: js:
dependency: transitive dependency: transitive
description: description:
@ -151,13 +151,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.1+1" version: "0.6.1+1"
kernel:
dependency: transitive
description:
name: kernel
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.19"
logging: logging:
dependency: transitive dependency: transitive
description: description:
@ -221,13 +214,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.9.3" version: "1.9.3"
package_resolver:
dependency: transitive
description:
name: package_resolver
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.10"
path: path:
dependency: transitive dependency: transitive
description: description:
@ -241,7 +227,7 @@ packages:
name: pedantic name: pedantic
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0+1" version: "1.9.0"
petitparser: petitparser:
dependency: transitive dependency: transitive
description: description:
@ -269,7 +255,7 @@ packages:
name: pub_semver name: pub_semver
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.4.2" version: "1.4.4"
quiver: quiver:
dependency: transitive dependency: transitive
description: description:
@ -290,7 +276,7 @@ packages:
name: shelf_packages_handler name: shelf_packages_handler
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.4" version: "2.0.0"
shelf_static: shelf_static:
dependency: transitive dependency: transitive
description: description:
@ -323,7 +309,7 @@ packages:
name: source_maps name: source_maps
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.10.8" version: "0.10.9"
source_span: source_span:
dependency: transitive dependency: transitive
description: description:
@ -407,7 +393,7 @@ packages:
name: watcher name: watcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.9.7+12" version: "0.9.7+15"
web_socket_channel: web_socket_channel:
dependency: transitive dependency: transitive
description: description:

Loading…
Cancel
Save