model_viewer 0.3.0
model_viewer: ^0.3.0 copied to clipboard
A Flutter widget for rendering interactive 3D models in the glTF and GLB formats.
3D Model Viewer for Flutter #
This is a Flutter widget for rendering interactive 3D models in the glTF and GLB formats.
Prerequisites #
Installation #
dependencies:
model_viewer: ^0.3.0
Examples #
Importing the library #
import 'package:model_viewer/model_viewer.dart';
Creating a ModelViewer widget #
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text("Model Viewer")),
body: ModelViewer(
src: 'https://modelviewer.dev/shared-assets/models/Astronaut.glb',
alt: "A 3D model of an astronaut",
ar: true,
autoRotate: true,
cameraControls: true,
),
),
);
}
}
Screenshot #
![Screenshot of astronaut model](https://raw.githubusercontent.com/drydart/model_viewer.dart/master/example/flutter_01.png)