Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple to: Adv/Infinite PageView #23

Open
jtkeyva opened this issue Sep 29, 2022 · 3 comments
Open

Decouple to: Adv/Infinite PageView #23

jtkeyva opened this issue Sep 29, 2022 · 3 comments

Comments

@jtkeyva
Copy link
Contributor

jtkeyva commented Sep 29, 2022

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/

@jtkeyva jtkeyva changed the title Decouple to: Infinite Video PageView Decouple to: Adv/Infinite PageView Sep 29, 2022
@ertgrulll
Copy link
Owner

ertgrulll commented Sep 30, 2022

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.

  • Use interceptor:
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;
});

  • Use AdvStory.player to create a specific size story view with rounded edges:
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('😎'),
              );
            },
          );
        },
      ),
    ),
  ),
),
  • Also you can create your own tray view when AdvStory.player used:
final _controller = AdvStoryPlayerController();

...

StoryButtonThatOpensView(
  onTap: () {
    _controller.open(StoryPosition(2, 2));
  }
),
StoryButtonThatClosesView(
  onTap: () {
    _controller.close();
  }
),

@ertgrulll
Copy link
Owner

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

@jtkeyva
Copy link
Contributor Author

jtkeyva commented Sep 30, 2022

Thank you very much :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants