Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vaetas/pressable
Add various touch effects to your widgets. Supports ripple, scale, opacity, fill, and custom builder.
https://github.com/vaetas/pressable
dart flutter
Last synced: 3 days ago
JSON representation
Add various touch effects to your widgets. Supports ripple, scale, opacity, fill, and custom builder.
- Host: GitHub
- URL: https://github.com/vaetas/pressable
- Owner: vaetas
- License: mit
- Created: 2021-06-17T09:36:37.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-15T17:33:04.000Z (21 days ago)
- Last Synced: 2024-12-15T17:47:13.462Z (21 days ago)
- Topics: dart, flutter
- Language: Dart
- Homepage: https://pub.dev/packages/pressable
- Size: 192 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Pressable
Quickly add tap effects to your widgets.
## Usage
```dart
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.```dart
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.
```dart
final widget = Pressable.platform(
onPressed: () {},
ios: const PressableTheme.opacity(),
android: const PressableTheme.ripple(),
child: const ExampleButton(title: 'Platform'),
);
```