Monday, 12 August 2019

Thanos snap effect in Flutter



snappable

Thanos snap effect in Flutter.

Examples







Getting Started

Import it

import 'package:snappable/snappable.dart';
Dart

Wrap any widget in Snappable

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

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();
  }
}
Dart
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'),
    );
  }
}
Dart
Undo by tapping again.

GitHub

Thanos snap effect in Flutter — Read More
Latest commit to the master branch on 8-9-2019
Download as zip