From 41f34827008225c27dc7d5d2e5158c6eaf610fef Mon Sep 17 00:00:00 2001 From: jeanmartinpv Date: Tue, 1 Mar 2022 20:23:25 -0500 Subject: [PATCH 1/4] Updating deprecetd widget --- lib/src/slidable.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/slidable.dart b/lib/src/slidable.dart index 889e67a2..6dbec4c1 100644 --- a/lib/src/slidable.dart +++ b/lib/src/slidable.dart @@ -258,9 +258,9 @@ class _SlidableState extends State controller: controller, direction: widget.direction, dragStartBehavior: widget.dragStartBehavior, - child: SlidableNotificationSender( - tag: widget.groupTag, + child: SlidableAutoCloseNotificationSender( controller: controller, + groupTag: widget.groupTag, child: SlidableScrollingBehavior( controller: controller, closeOnScroll: widget.closeOnScroll, From d06776a3a1e47f2217a95176dd563b5d235635a2 Mon Sep 17 00:00:00 2001 From: jeanmartinpv Date: Tue, 1 Mar 2022 20:25:33 -0500 Subject: [PATCH 2/4] removing reference --- lib/src/slidable.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/src/slidable.dart b/lib/src/slidable.dart index 6dbec4c1..c0144292 100644 --- a/lib/src/slidable.dart +++ b/lib/src/slidable.dart @@ -1,7 +1,6 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_slidable/src/auto_close_behavior.dart'; -import 'package:flutter_slidable/src/notifications_old.dart'; import 'action_pane_configuration.dart'; import 'controller.dart'; From f14ef134f4e2873dc5223ea3c556fa371e21cac7 Mon Sep 17 00:00:00 2001 From: jeanmartinpv Date: Tue, 1 Mar 2022 20:28:57 -0500 Subject: [PATCH 3/4] Adding parameters to customize the background color and borders of the slidable --- lib/src/slidable.dart | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/lib/src/slidable.dart b/lib/src/slidable.dart index c0144292..31697827 100644 --- a/lib/src/slidable.dart +++ b/lib/src/slidable.dart @@ -27,6 +27,8 @@ class Slidable extends StatefulWidget { this.dragStartBehavior = DragStartBehavior.down, this.useTextDirection = true, required this.child, + this.backgroundColor, + this.borderRadius, }) : super(key: key); /// Whether this slidable is interactive. @@ -36,6 +38,14 @@ class Slidable extends StatefulWidget { /// Defaults to true. final bool enabled; + /// Defaults to [Colors.Transparent]. + /// {@endtemplate} + final Color? backgroundColor; + + /// Defaults to [BorderRadius.zero]. + /// {@endtemplate} + final BorderRadius? borderRadius; + /// Specifies to close this [Slidable] after the closest [Scrollable]'s /// position changed. /// @@ -236,20 +246,26 @@ class _SlidableState extends State ), ); - content = Stack( - children: [ - if (actionPane != null) - Positioned.fill( - child: ClipRect( - clipper: _SlidableClipper( - axis: widget.direction, - controller: controller, + content = ClipRRect( + borderRadius: widget.borderRadius ?? BorderRadius.zero, + child: Container( + color: widget.backgroundColor, + child: Stack( + children: [ + if (actionPane != null) + Positioned.fill( + child: ClipRect( + clipper: _SlidableClipper( + axis: widget.direction, + controller: controller, + ), + child: actionPane, + ), ), - child: actionPane, - ), - ), - content, - ], + content, + ], + ), + ), ); return SlidableGestureDetector( From cc91a13ec73fd464be38df7eec9f05e3ce071369 Mon Sep 17 00:00:00 2001 From: jeanmartinpv Date: Tue, 1 Mar 2022 20:31:57 -0500 Subject: [PATCH 4/4] Adding parameters to customize side and shape in Custom SlidableAction and SlidableAction --- lib/src/actions.dart | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/lib/src/actions.dart b/lib/src/actions.dart index 3890de2f..226a3b14 100644 --- a/lib/src/actions.dart +++ b/lib/src/actions.dart @@ -5,9 +5,11 @@ import 'slidable.dart'; /// Signature for [CustomSlidableAction.onPressed]. typedef SlidableActionCallback = void Function(BuildContext context); -const int _kFlex = 1; -const Color _kBackgroundColor = Colors.white; -const bool _kAutoClose = true; +const _kFlex = 1; +const _kBackgroundColor = Colors.white; +const _kAutoClose = true; +const _kborderSide = BorderSide.none; +const _kshape = RoundedRectangleBorder(); /// Represents an action of an [ActionPane]. class CustomSlidableAction extends StatelessWidget { @@ -23,6 +25,8 @@ class CustomSlidableAction extends StatelessWidget { this.backgroundColor = _kBackgroundColor, this.foregroundColor, this.autoClose = _kAutoClose, + this.side, + this.shape, required this.onPressed, required this.child, }) : assert(flex > 0), @@ -69,6 +73,14 @@ class CustomSlidableAction extends StatelessWidget { /// Typically the action's icon or label. final Widget child; + /// Defaults to [BorderSide.none]. + /// {@endtemplate} + final BorderSide? side; + + /// Defaults to [RoundedRectangleBorder]. + /// {@endtemplate} + final OutlinedBorder? shape; + @override Widget build(BuildContext context) { final effectiveForegroundColor = foregroundColor ?? @@ -86,8 +98,8 @@ class CustomSlidableAction extends StatelessWidget { backgroundColor: backgroundColor, primary: effectiveForegroundColor, onSurface: effectiveForegroundColor, - shape: const RoundedRectangleBorder(), - side: BorderSide.none, + shape: shape, + side: side, ), child: child, ), @@ -123,6 +135,8 @@ class SlidableAction extends StatelessWidget { this.icon, this.spacing = 4, this.label, + this.side = _kborderSide, + this.shape = _kshape, }) : assert(flex > 0), assert(icon != null || label != null), super(key: key); @@ -133,6 +147,12 @@ class SlidableAction extends StatelessWidget { /// {@macro slidable.actions.backgroundColor} final Color backgroundColor; + /// {@macro slidable.actions.side} + final BorderSide side; + + /// {@macro slidable.actions.shape} + final OutlinedBorder shape; + /// {@macro slidable.actions.foregroundColor} final Color? foregroundColor; @@ -197,6 +217,8 @@ class SlidableAction extends StatelessWidget { backgroundColor: backgroundColor, foregroundColor: foregroundColor, flex: flex, + side: side, + shape: shape, child: child, ); }