snappable
thanos snap effect in flutter.
examples for snap effect
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.
Comments are closed.