Search categories, packages and repositories

GitHub repositoryMarcinusX/snappable

snappable

Thanos snap effect in Flutter

snappable project cover
Stars
339
Forks
34
Last push (UTC)
Oct 1, 2023
Project status
Active

Original README

English project snapshot. Visit GitHub for the latest content.

snappable

Thanos effect library in Flutter

Check out blog post describing the package on Fidev.

Examples

Example 1 Example 2 Example 3

Getting Started

Import it
import 'package:snappable/snappable.dart';
Wrap any widget in Snappable
@override
Widget build(BuildContext context) {
  return Snappable(
    child: Text('This will be snapped'),
  );
}
Snap with a Key

class MyWidget extends StatelessWidget {
  final key = GlobalKey<SnappableState>();
  @override
  Widget build(BuildContext context) {
    return Snappable(
      key: key,
      child: Text('This will be snapped'),
    );
  }
  
  void snap() {
    key.currentState.snap();
  }
}

Undo by currentState.reset().

or snap by tap

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Snappable(
      snapOntap: true,
      child: Text('This will be snapped'),
    );
  }
}

Undo by tapping again.

Callback for when the snap ends

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Snappable(
      onSnapped: () => print("Snapped!"),
      child: Text('This will be snapped'),
    );
  }
}
Marcin Szałek GitHub avatar
GitHub author

Marcin Szałek ↗

Flutter & AI Engineer

@cheddar-meLodz, Poland
LanguagesDartRubyObjective-CJava

Packages published by this repository

Dependencies used

Dependency list 3 items

  • flutter{"sdk":"flutter"}
  • image^2.1.4
  • flutter_testDevelopment{"sdk":"flutter"}

How do I choose a repository?

Start with your use case, compare repository activity, and check the original project before adopting it.

  1. Search by repository name, owner or description, then narrow the results by topic.
  2. Compare stars, forks and recent pushes. Stars show community interest, not a guarantee of quality.
  3. Read the README, license and issues on GitHub before using a project.

Sources and maintenance

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗