pressable 0.7.0 copy "pressable: ^0.7.0" to clipboard
pressable: ^0.7.0 copied to clipboard

Touch effects to your widgets for ripple, scale, opacity, fill, and custom effects.

Pressable #

Quickly add tap effects to your widgets.

Usage #

final widget = Pressable.opacity(
  onPressed: () {
    print('Opacity pressed');
  },
  child: const ExampleButton(title: 'Opacity'),
);

Supported effects:

  • Ripple (InkWell)
  • Scale
  • Opacity
  • Fill
  • Custom builder

Default Theme #

You can use DefaultPressableTheme InheritedWidget to provide default PressableTheme to its Widget subtree.

final widget = DefaultPressableTheme(
  fillTheme: PressableFillTheme(
    fillColor: Colors.green.withOpacity(0.2),
  ),
  child: Pressable.fill(
    onPressed: () {},
    child: const ExampleButton(title: 'Default theme'),
  ),
);

Platform-specific Pressable Theme #

To specify theme for each platform use Pressable.platform() constructor.

final widget = Pressable.platform(
  onPressed: () {},
  ios: const PressableTheme.opacity(),
  android: const PressableTheme.ripple(),
  child: const ExampleButton(title: 'Platform'),
);
4
likes
160
points
382
downloads

Publisher

verified publishervojtech.net

Weekly Downloads

Touch effects to your widgets for ripple, scale, opacity, fill, and custom effects.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, freezed_annotation

More

Packages that depend on pressable