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

Invalid file path for libcolorx-loader.so Error while rendering model viewer widget inside overlay. #78

Closed
Arvind0005 opened this issue Aug 11, 2023 · 2 comments

Comments

@Arvind0005
Copy link

Hello!, I am trying to display a 3d model using modelviewer_plus package in an overlay window, when i display it in a seperate page it renders perfectly, but when i try to display it inside the overlay window it throws an error Invalid file path for libcolorx-loader.so
this is how i implemented my project.
in main file:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await initAppService();
  runApp(const MyApp());
}

@pragma("vm:entry-point")
void overlayMain() {
  runApp(const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: MyOverlayContent()
  ));
}

MyApp() runs homepage as home widget,this is how i call overlay in homepage:

Column(
        children: [
          ElevatedButton(onPressed: () async {
            await FlutterOverlayWindow.showOverlay(height: 600,width: 600,enableDrag: true);
          }, child: Text("start overlay")),
          ElevatedButton(onPressed: () async {
            status = await FlutterOverlayWindow.requestPermission();
            if(!status!)
              await FlutterOverlayWindow.requestPermission();
          }, child: Text("request permission")),

and this is MyOverlayContent() page code:

class _MyOverlayContentState extends State<MyOverlayContent> {
  @override
  void initState() {
    super.initState();
  }
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 300,
      color: Colors.deepOrange,
      child: ListView(
          children: [
            SizedBox(
              height: 100,
            ),
            Container(
              color: Colors.blue,
              height: 100,
              child: const ModelViewer(
                animationName: 'Taunt',
                backgroundColor: Colors.transparent,
                src: 'assets/DamagedHelmet.glb', // a bundled asset file
                alt: "A 3D model of an astronaut",
                ar: true,
                autoPlay: true,
                animationCrossfadeDuration: 400,
                arModes: ["webxr", "scene-viewer"],
                autoRotate: false,
                cameraControls: true,
                disableZoom: false,
              ),
            ),
            ElevatedButton(onPressed: () async {
              await FlutterOverlayWindow.closeOverlay();
            }, child: Text("start background service "))
          ],
        ),
    );
  }
}

can someone specify what am i doing wrong, thanks in advance!

@X-SLAYER
Copy link
Owner

I think that trying to use this package in an overlay window suggests a problem related to loading native libraries within the context of an overlay window this error is likely due to the way overlay windows handle or access resources and native libraries differently compared to standard Flutter app contexts

@X-SLAYER
Copy link
Owner

Did you try to load a model from network URL ?

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