m-r-davari / flutter_3d_controller

A Flutter package for rendering interactive 3D models in different formats(glb, gltf, fbx, obj), with ability to control animations, textures and camera.
https://pub.dev/packages/flutter_3d_controller
MIT License
78 stars 8 forks source link

View Application Directory Models #7

Closed zynzszyn521 closed 2 months ago

zynzszyn521 commented 3 months ago

I want to download models from the network and preview them after saving them in the application's directory. Is this approach feasible? I noticed that in your example, you passed a static file path; can it instead reference files within the application's directory?

m-r-davari commented 2 months ago

this package support loading models from URL, just pass the URL instead of static path.

zynzszyn521 commented 2 months ago

this package support loading models from URL, just pass the URL instead of static path.

but my models in ftp server,there have no nginx or any other proxy site, so i must download it and save to local directory ,can you help me

m-r-davari commented 2 months ago

In that case you have two choice, first download the model and create file from it then take it's temporary path. second download the model and save it to local storage and then take the path of saved model and pass it to package, your use case will need more than just model viewer library, for example you can use Dio package for downloading your models.

zynzszyn521 commented 2 months ago

在这种情况下,您有两种选择,首先下载模型并从中创建文件,然后采用其临时路径。其次下载模型并将其保存到本地存储,然后获取保存模型的路径并将其传递给包,您的用例需要的不仅仅是模型查看器库,例如您可以使用 Dio 包来下载您的模型。

my code it's below ,but it's not working

Directory appDocDir = await getApplicationDocumentsDirectory();
String  filePath = '${appDocDir.path}/local.glb';
Flutter3DViewer(
        controller: controller.three3Dcontroller,
        src: filePath,
         )
m-r-davari commented 2 months ago

As your issue is not about the package and its about your use case maybe it needs more research, I have no more Idea right now, if you found way to solve share it please share, thanks.