flutter_jigsaw_puzzle 0.1.0 flutter_jigsaw_puzzle: ^0.1.0 copied to clipboard
A simple Jigsaw Puzzle lib built with Flutter.
flutter_jigsaw_puzzle #
A Flutter jigsaw puzzle view that supports custom grids of varying sizes.
Features #
- Create a jigsaw puzzle from any
AssetImage
- Configurable grid size (2x2, 3x3, 4x4, 5x5, 6x6, ...)
- Separate callbacks for when each block gets snapped and for when the puzzle is completed
Getting started #
In the pubspec.yaml
of your flutter project, add the following dependency:
dependencies:
...
flutter_jigsaw_puzzle: <latest_version>
In your library add the following import:
import 'package:flutter_jigsaw_puzzle/flutter_jigsaw_puzzle.dart';
For help getting started with Flutter, view the online documentation.
Example #
3x3 #
5x5 #
10x10 #
final puzzleKey = GlobalKey<JigsawWidgetState>();
Column(
children: [
ElevatedButton(
onPressed: () async {
await puzzleKey.currentState.generate();
},
child: const Text('Generate'),
),
JigsawPuzzle(
gridSize: 10,
image: const AssetImage('assets/Jigsaw.jpg'),
onFinished: () {
// ignore: avoid_print
print('finished!');
},
snapSensitivity: .5, // Between 0 and 1
puzzleKey: puzzleKey,
onBlockSuccess: () {
// ignore: avoid_print
print('block success!');
},
)
],
),
You can find a working example in the Example project.
Changelog #
Please see the Changelog page to know what's recently changed.
Contributions #
Feel free to contribute to this project.
If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue.
If you fixed a bug or implemented a new feature, please send a pull request.
TODO #
- Tests
- Animations