advstory icon indicating copy to clipboard operation
advstory copied to clipboard

Custom Gestures

Open jtkeyva opened this issue 2 years ago • 5 comments

Is your feature request related to a problem? Please describe. Using a predefined set of gestures is limiting.

Describe the solution you'd like Put gesture options inside AdvStory() so you can do whatever you want with any gesture. Ex: Swiping up opens a page or double tap runs a function etc.

Describe alternatives you've considered Disable AdvStory gestures alltogether and wrap in a gestureDetector()

Additional context Not quite sure how to call your functions inside a custom wrapped GestureDetector(). Perhaps some documentation?

Awesome job on performance! It runs great!

jtkeyva avatar May 31 '22 22:05 jtkeyva

Hi, thanks for your nice comments. I think changing this will make harder to use AdvStory. Fortunately, this feature can be "hacked" without changing the package. I did not limit the header and footer field sizes. You can use GestureDetector as footer. An example:

footer: GestureDetector(
  onLongPressDown: (details) => print("long press"),
  onLongPressCancel: () => print("long press cancel"),
  onLongPressUp: () => print("long press up"),
  onLongPress: () => print("long press"),
  onTapUp: (details) => print("tap up"),
  onVerticalDragEnd: (details) => print("vertical drag end"),
  // Prevent hits from passing to the AdvStory in transparent areas.
  child: AbsorbPointer(
    child: SizedBox(
      width: MediaQuery.of(context).size.width,
      height: MediaQuery.of(context).size.height,
      child: Align(
        alignment: Alignment.bottomCenter,
	child: Container(
	  width: MediaQuery.of(context).size.width,
	  height: 50,
	  color: Colors.orange,
        ),
      ),
    ),
  ),
)

This way you have to trigger the actions that are in the default story flow yourself. You can use AdvStoryController to trigger actions.

ertgrulll avatar Jun 01 '22 00:06 ertgrulll

Not quite sure how to call your functions inside a custom wrapped GestureDetector(). Perhaps some documentation?

To see the controller usage you can check here and the link at the bottom of this page

ertgrulll avatar Jun 01 '22 00:06 ertgrulll

Awesome! I want to add slow motion and swipe up to react/respond gestures. I'll see what I can do.

Would it be much work to essentially clone the Footer and call it CustomGesture or Overlay and make it an option along with Header and Footer? That way, you don't have to "hack" anything and you can also use the header/footer to place tappable links etc without fuss on top of the Gesture arena.

jtkeyva avatar Jun 01 '22 22:06 jtkeyva

You're right, I'll add that to the roadmap as a priority. For now, you can use the hack way as a workaround.

ertgrulll avatar Jun 02 '22 02:06 ertgrulll

Awesome!

jtkeyva avatar Jun 02 '22 18:06 jtkeyva