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

Add various touch effects to your widgets. Supports ripple, scale, opacity, fill, and custom builder.

Pressable #

Quickly add tap effects to your widgets.

Work in progress. Widgets may change at any time.

Usage #

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.

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.

Pressable.platform(
  onPressed: () {},
  ios: const PressableTheme.opacity(),
  android: const PressableTheme.ripple(),
  child: const ExampleButton(title: 'Platform'),
),
4
likes
140
pub points
59%
popularity

Publisher

verified publishervojtech.net

Add various touch effects to your widgets. Supports ripple, scale, opacity, fill, and custom builder.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, freezed_annotation

More

Packages that depend on pressable