GithubHelp home page GithubHelp logo

akaboshinit / flutter_jigsaw_puzzle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from o-compilador/flutter_jigsaw_puzzle

0.0 0.0 0.0 402 KB

A simple Flutter Jigsaw Puzzle view

License: MIT License

Objective-C 0.15% Kotlin 0.52% Dart 93.28% Swift 1.56% HTML 4.49%

flutter_jigsaw_puzzle's Introduction

flutter_jigsaw_puzzle

Geneate a jigsaw puzzle of any size from a ImageProvider.

5x5.mp4

Features

  • Create a jigsaw puzzle from any ImageProvider
  • 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

3x3.mp4

5x5

5x5.mp4

10x10

10x10.mp4
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

flutter_jigsaw_puzzle's People

Contributors

edunuzzi avatar rhinori avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.