letsar / flutter_slidable

A Flutter implementation of slidable list item with directional slide actions.
MIT License
2.72k stars 589 forks source link

Close Slide Out Menu Threshold #181

Closed deepbluish closed 2 years ago

deepbluish commented 3 years ago

I see that there are options for setting how far a user has to drag in order to open the slide out menu, yet there are no options for setting that same threshold for closing the menu. On a tablet, it's actually uncomfortable how far I have to slide to close the menu. This seems like this should have been an included feature. Is there a solution to this?

Thank you for your creativity.

letsar commented 3 years ago

This is something possible in the refactored code only. You can look at the work-in-progress branch (https://github.com/letsar/flutter_slidable/tree/feature/revival) if you want to test it.

With the new code you can set it this way:

Slidable(
  tag: '0',
  direction: direction,
  startActionPane: ActionPane(
    extentRatio: 0.5,
    openThreshold: 0.1, // A 10% sliding, will open the slidable
    closeThreshold: 0.4, // A 10% sliding (from the open state) will close the slidable 
    transition: SlidableBehindTransition(),
    children: [
      SlideAction(color: Colors.green, icon: Icons.share),
      SlideAction(color: Colors.amber, icon: Icons.delete),
    ],
  ),
  child: Tile(color: Colors.grey, text: 'hello'),
),
deepbluish commented 3 years ago

Thank you very much for your quick response. I will try this today!

letsar commented 3 years ago

:wink:, keep in mind that the refactored code is not yet documented nor tested. I hope to finish this in december. You can totally play with it and give your feedback but I advise you not to put it in production until I officially publish it.

normancarcamo commented 3 years ago

@letsar how is the progress of this? I agree with the OP. 😅

normancarcamo commented 3 years ago

@letsar do you have an example of how to use the branch? I get a weird error pointing to the branch on my puspec,yaml file.

Would you mind to tell me what I'm doing wrong here?

...
  graphql_flutter: ^3.1.0
  data_connection_checker: ^0.3.4
#  flutter_slidable: ^0.5.7
  flutter_slidable:
    git:
      url: git@github.com:letsar/flutter_slidable.git
      ref: feature/survival

  meta: ^1.2.0
  dartz: ^0.9.1
...

and this is the output:

/Users/ncardez/flutter/bin/flutter --no-color pub get
Running "flutter pub get" in mmc-mobile...                      

Git error. Command: `git rev-list --max-count=1 feature/survival`
stdout: 
stderr: fatal: ambiguous argument 'feature/survival': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
exit code: 128

pub get failed (server unavailable) -- attempting retry 1 in 1 second...
letsar commented 3 years ago

Can you try with the published 1.0 version?

letsar commented 2 years ago

This thread has been closed since there has not been any response for a while. If you are still experiencing a similar issue, please open a new bug.