Open KhaiHOK38 opened 1 year ago
You can use Slidable.of(context)?.close()
to close it. Make sure you use the context beneath the SlidableAction action, for example:
SlidableAction(
autoClose: false,
onPressed: (BuildContext context) async {
final slidableController = Slidable.of(context);
await showDialog<String>(
context: context,
builder: (BuildContext slContext) =>
CancelBookingConfirmationDialog(
onConfirm: () {
print(">Confirm booking!");
},
onCancel: () {
// Close slidable control
slidableController?.close();
},
),
);
},
backgroundColor: ColorTheme.rufous,
foregroundColor: Colors.white,
label: t.app.cancelBooking,
),
You can use CustomSlidableAction instead of SlideableAction
Slidable( enabled: isEnableSlidable, closeOnScroll: isCloseSlid, key: const ValueKey(0), endActionPane: ActionPane( dragDismissible: isCloseSlid, motion: const BehindMotion(), children: actionButton( status: widget.leaveRequest.status, leaveRequest: widget.leaveRequest, context: context), ), child: LeaveCardWidget( leaveRequest: widget.leaveRequest, isHaveAction: isEnableSlidable, ), ),