I have a problem loadng a model-viewer Screen. It shouldn't be trivial. This is my main.dart , and I try to load InfoPage();
import 'package:flutter/material.dart';
import 'package:test/screens/info_page.dart';
import 'package:test/screens/monument_list.dart';
import 'package:test/screens/home_page.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'OpenWorld',
theme: ThemeData(
primarySwatch: Colors.deepPurple,
),
initialRoute: '/',
routes: {
// When navigating to the "/" route, build the FirstScreen widget.
'/': (context) => const MyHomePage(title: 'Home',),
// When navigating to the "/second" route, build the SecondScreen widget.
'/list': (context) => const MonumentList(),
'/viewer': (context) => const InfoPage(title: 'Viewer'),
},
);
}
}
It should load after pressing this tile
But whenever I pess it and it takes me to '/viewer' VS code pops this part of focus_manager.dart
That's the infoPage:
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
// ignore: import_of_legacy_library_into_null_safe
import 'package:model_viewer/model_viewer.dart';
import 'package:test/widgets/my_drawer.dart';
class InfoPage extends StatelessWidget {
const InfoPage({Key? key, required this.title}) : super(key: key);
// ignore: prefer_typing_uninitialized_variables
final title;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("Model Viewer")),
body: ModelViewer(
src: 'assets/models/Astronaut.glb',
alt: "A 3D model of an astronaut",
ar: true,
autoRotate: true,
cameraControls: true,
),
drawer: MyDrawer(title: title),
);
}
}
I have the installed all the packages and dependencies as flutter instructs. The Debug Console shows nothing... Please help me!
This is new! UPDATE 8th December 2021 I get this error:
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/platform_dispatcher.dart 1003:13 invoke
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/platform_dispatcher.dart 157:5 invokeOnDrawFrame
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine.dart 440:45<fn>
The following UnsupportedError was thrown building WebView(dirty, state:
_WebViewState#92ba1):
Unsupported operation: Trying to use the default webview implementation for
TargetPlatform.windows
but there isn't a default one
The relevant error-causing widget was:
WebView
WebView:file:///C:/Users/PCcosmos/OneDrive/Documents/flutter/.pub-cache/hosted/pub.dartla ng.org/model_viewer-0.8.1/lib/src/model_viewer.dart:121:12
When the exception was thrown, this was the stack:
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 251:49 throw_
packages/webview_flutter/webview_flutter.dart 189:11
get platform
packages/webview_flutter/webview_flutter.dart 344:29
buil
d