Error while rendering model viewer widget inside overlay widget

40 Views Asked by At

I am trying to display a 3d model using modelviewer_plus package in an overlay window using flutter_overlay_window 0.4.3, 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!

0

There are 0 best solutions below