Skip to content

Commit

Permalink
feat: Update OptimusSlidableAction (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
witwash authored Jan 22, 2024
1 parent 0e779e6 commit 7d960dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions optimus/lib/src/slidable/slide_action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ class OptimusSlideAction extends StatelessWidget {
super.key,
required this.child,
required this.color,
required this.onTap,
this.onTap,
});

final Widget child;
final Color color;
final VoidCallback onTap;
final VoidCallback? onTap;

@override
Widget build(BuildContext context) => CustomSlidableAction(
backgroundColor: color,
onPressed: (_) => onTap(),
onPressed: onTap == null ? null : (_) => onTap?.call(),
child: child,
);
}
5 changes: 2 additions & 3 deletions storybook/lib/stories/slidable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ class _Content extends StatelessWidget {
Widget build(BuildContext context) => ListView.builder(
itemBuilder: (context, i) => OptimusSlidable(
actionsWidth: actionsWidth,
actions: [
actions: const [
OptimusSlideAction(
color: Colors.red,
onTap: () {},
child: const Icon(Icons.delete, color: Colors.white),
child: Icon(Icons.delete, color: Colors.white),
),
],
child: ListTile(
Expand Down

0 comments on commit 7d960dc

Please sign in to comment.