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

Precache file to improve speed #48

Open
hiru-vn opened this issue Jan 5, 2025 · 1 comment
Open

Precache file to improve speed #48

hiru-vn opened this issue Jan 5, 2025 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@hiru-vn
Copy link

hiru-vn commented Jan 5, 2025

Thank you for the awsome package!

When trying to create a list of characters from links and display them carousel slider, or a grid list, Flutter3DViewer take a bit of time when scrolling, it also reload the old file after user scroll back.

Similar to precacheImage can we use it for Flutter3DController so it will download the 3d model from the URL locally to improve loading time?

    _avatars = _assets
        .map((e) => Flutter3DViewer(
              progressBarColor: Colors.transparent,
              src: e,
            ))
        .toList();
CarouselSlider.builder(
  disableGesture: true,
  options: CarouselOptions(
    viewportFraction: 0.55,
    height: context.width * 0.7,
    initialPage: 0,
    enableInfiniteScroll: true,
    reverse: false,
    autoPlay: false,
    autoPlayCurve: Curves.fastOutSlowIn,
    enlargeCenterPage: true,
    scrollDirection: Axis.horizontal,
    onPageChanged: (index, reason) {
      setState(() {
        selectedAvatar = index;
      });
    },
  ),
  itemCount: _assets.length,
  itemBuilder: (BuildContext context,
          int itemIndex, int pageViewIndex) =>
      IgnorePointer(
    ignoring: true,
    child:  Center(
          child: _avatars[itemIndex],
    ),
  ),
)),
                            
@m-r-davari
Copy link
Owner

m-r-davari commented Jan 5, 2025

Hi,
The use case you mentioned is not related to package it self, the widget of the package will keep the 3d model data until it get dispose from flutter widget tree, you need to keep alive your state in your project to prevent your loaded widget from being disposed... search for keep alive use case in flutter, check this link for example. about the performance, Im working to improve it on next version and about caching I will take look to do it if its possible how ever 3d models are way different from caching images.

@m-r-davari m-r-davari added the question Further information is requested label Jan 5, 2025
@m-r-davari m-r-davari self-assigned this Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants