Flutter - Slideble widget how to open and close programatically

Viewed 252

How can I open and close slideble widget programmatically when user navigates to the page.

I want to show user that the widget is slidable and has two options when user slides on the left. So when the page is opened I need slidable open and close automatically

Here is my source code:

  Slidable(
        endActionPane: ActionPane(
          extentRatio: 0.18,
          motion: const BehindMotion(),
          children: [
            Expanded(
              child: Column(
                children: [
                  Expanded(
                    child: InkWell(
                      onTap: () => Get.find<BookController>().saveBookMark(),
                      child: Container(
                        decoration: const BoxDecoration(
                            borderRadius: BorderRadius.only(
                              topRight: Radius.circular(10),
                            ),
                            color: AppColors.primary),
                        child: Center(
                          child: Icon(
                            isBookMarked ? Icons.bookmark : Icons.bookmark_outline_rounded,
                            color: Colors.white,
                          ),
                        ),
                      ),
                    ),
                  ),
                  const SizedBox(height: 2),
                  Expanded(
                    child: InkWell(
                      onTap: shareOnTap,
                      child: Container(
                        decoration: const BoxDecoration(borderRadius: BorderRadius.only(bottomRight: Radius.circular(10)), color: AppColors.primary),
                        child: const Center(
                          child: Icon(
                            Icons.share_outlined,
                            color: Colors.white,
                          ),
                        ),
                      ),
                    ),
                  ),
                ],
              ),
            )
          ],
        ),
        child: Container(
          padding: const EdgeInsets.symmetric(horizontal: 15),
          constraints: const BoxConstraints(minHeight: 100),
          decoration: BoxDecoration(
            color: Theme.of(context).canvasColor,
            borderRadius: BorderRadius.circular(10),
          ),
          child: Container()
        ),
      );
0 Answers
Related