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

Package for Thanos's Snap Effect.

snappable #

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/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'),
    );
  }
}
46
likes
0
pub points
75%
popularity

Publisher

unverified uploader

Package for Thanos's Snap Effect.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, image

More

Packages that depend on snappable_thanos