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

Decouple to: Adv/Infinite PageView #23

Open jtkeyva opened 1 year ago

jtkeyva commented 1 year ago

Is your feature request related to a problem? Please describe. Advstory is the best performing video playback package i've used. Preloading and caching second to none. Only issue is that you are kinda forced into the story format and into an opinionated way of navigating and gestures.

Describe the solution you'd like A simple PageView solution that preloads & caches videos. Then the developers can do whatever they want from that point on. Video playback is a huge pain point in flutter and Advstory solves it but kinda forces you into a certain format.

Describe alternatives you've considered Hacking advstory. Starting from the ground up.

Additional context There's a huge community need and you would be a great help. Please check out this thread dedicated to it: https://www.reddit.com/r/FlutterDev/comments/xpwtdr/coming_together_to_work_on_common_issues_every/

There's always a lot of questions on reddit about this...but no solid solution. https://www.reddit.com/r/FlutterDev/comments/xou6uu/building_a_videodriven_social_app_with_flutter/

ertgrulll commented 1 year ago

Hi JT, I created this package due to other's performance issues. This is a complete story view solution. But you can also control almost anything, including gestures. Try set the interceptor to control navigation between stories or contents, or create a story view using AdvStory.player to change the position, size, shape or anything else you want. You can also create your own contents for more customization, this package is really flexible.

final _controller = AdvStoryController();

...

_controller.setInterceptor((event) {
  if (event == StoryEvent.nextContent) {
    // User tapped right %23 of screen, prevent content skip and print a log message instead for an example.
    // Or skip to another story, another content etc.
    return () => log(
      'StoryEvent.nextContent blocked and printed this log instead.',
     );
  }

  // Continue default flow for other events.
  return null;
});

final _controller = AdvStoryPlayerController();

...

ClipRRect(
  borderRadius: BorderRadius.circular(20),
  child: SizedBox(
    width: MediaQuery.of(context).size.width * .5,
    height: MediaQuery.of(context).size.height * .5,
    child: AdvStory.player(
      storyCount: profilePics.length,
      controller: _controller,
      style: const AdvStoryStyle(
        indicatorStyle: IndicatorStyle(
          padding: EdgeInsets.all(8),
        ),
      ),
      storyBuilder: (storyIndex) => Story(
        contentCount: 3,
        contentBuilder: (contentIndex) {
          return SimpleCustomContent(
            builder: (context) {
              return Container(
                color: Colors.blueAccent,
                alignment: Alignment.center,
                child: const Text('😎'),
              );
            },
          );
        },
      ),
    ),
  ),
),
final _controller = AdvStoryPlayerController();

...

StoryButtonThatOpensView(
  onTap: () {
    _controller.open(StoryPosition(2, 2));
  }
),
StoryButtonThatClosesView(
  onTap: () {
    _controller.close();
  }
),
ertgrulll commented 1 year ago

Seems like I need to update docs for use-cases.

jtkeyva commented 1 year ago

Thank you very much :)