snappable_thanos 0.0.4 copy "snappable_thanos: ^0.0.4" to clipboard
snappable_thanos: ^0.0.4 copied to clipboard

Package for Thanos's Snap Effect. Use it to turn your Widgets into dust. For fun only!

snappable_thanos #

Thanos's Snap 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_thanos/snappable_thanos.dart';
copied to clipboard

Wrap any widget in Snappable #

@override
Widget build(BuildContext context) {
  return Snappable(
    child: Text('This will be snapped'),
  );
}
copied to clipboard

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();
  }
}
copied to clipboard

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'),
    );
  }
}
copied to clipboard

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'),
    );
  }
}
copied to clipboard
62
likes
140
points
93
downloads

Publisher

unverified uploader

Weekly Downloads

2024.10.02 - 2025.04.16

Package for Thanos's Snap Effect. Use it to turn your Widgets into dust. For fun only!

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, image

More

Packages that depend on snappable_thanos