Closed manpowre closed 1 year ago
Did you test the code? You can create pull request
I made this code mentioned here. its just a dropdown changing the value/model in assets, and setting initstate. But the 3dviewer doesnt change.
as far as I could read webview needs a controller, and with that this viewer could get a reload model with a new src string.
I didn't have much time for this, so i create page with model argument, and go to that page again with link argument. That's the easiest way
I think its because the underlaying webview doesnt have a controller.
Could we mabye get reloadmodel function into this plugin? , and use a controller within the webview, I think that should do it.
I have testcode here, just add 2 .glb files to assets.:
import 'package:flutter/material.dart'; import 'package:babylonjs_viewer/babylonjs_viewer.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter DropDownButton', theme: ThemeData( primarySwatch: Colors.green, ), home: const MyHomePage(), debugShowCheckedModeBanner: false, ); } }
class MyHomePage extends StatefulWidget { const MyHomePage({Key? key}) : super(key: key);
@override _MyHomePageState createState() => _MyHomePageState(); }
class _MyHomePageState extends State {
String dropdownvalue = 'assets/test1.glb';
late BabylonJSViewer bsv;
@override void initState() {
}
var items2 = [ 'assets/test1.glb', 'assets/alpha-blend-litmus.glb', ];
@override Widget build(BuildContext context) { bsv = BabylonJSViewer( src: dropdownvalue, );
} }