ertgrulll / advstory

An advanced, complete story viewer for Flutter. Has support for images, videos, custom widget contents, gestures, interceptors, listeners, manipulators and much more.
https://advstory.sourcekod.com
MIT License
41 stars 33 forks source link

Custom Gestures #4

Open jtkeyva opened 2 years ago

jtkeyva commented 2 years ago

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!

ertgrulll commented 2 years ago

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 commented 2 years ago

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

jtkeyva commented 2 years ago

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.

ertgrulll commented 2 years ago

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

jtkeyva commented 2 years ago

Awesome!