@@ -32,6 +32,8 @@ class MyHomePage extends StatefulWidget {
32
32
33
33
class _MyHomePageState extends State <MyHomePage > {
34
34
Flutter3DController controller = Flutter3DController ();
35
+ Flutter3DController controller2 = Flutter3DController ();
36
+
35
37
String ? chosenAnimation;
36
38
String ? chosenTexture;
37
39
@@ -56,12 +58,24 @@ class _MyHomePageState extends State<MyHomePage> {
56
58
floatingActionButton: Column (
57
59
mainAxisAlignment: MainAxisAlignment .end,
58
60
mainAxisSize: MainAxisSize .min,
61
+ crossAxisAlignment: CrossAxisAlignment .end,
59
62
children: [
60
- IconButton (
61
- onPressed: () {
62
- controller.playAnimation ();
63
- },
64
- icon: const Icon (Icons .play_arrow),
63
+ Row (
64
+ mainAxisAlignment: MainAxisAlignment .end,
65
+ children: [
66
+ IconButton (
67
+ onPressed: () {
68
+ controller.playAnimation ();
69
+ },
70
+ icon: const Icon (Icons .play_arrow),
71
+ ),
72
+ IconButton (
73
+ onPressed: () {
74
+ controller2.playAnimation ();
75
+ },
76
+ icon: const Icon (Icons .play_arrow_outlined),
77
+ ),
78
+ ],
65
79
),
66
80
const SizedBox (
67
81
height: 4 ,
@@ -153,18 +167,8 @@ class _MyHomePageState extends State<MyHomePage> {
153
167
children: [
154
168
Flexible (
155
169
flex: 1 ,
156
- child: Flutter3DViewer .obj (
157
- src: 'assets/flutter_dash.obj' ,
158
- //src: 'https://raw.githubusercontent.com/m-r-davari/content-holder/refs/heads/master/flutter_3d_controller/flutter_dash_model/flutter_dash.obj',
159
- scale: 5 ,
160
- // Initial scale of obj model
161
- cameraX: 0 ,
162
- // Initial cameraX position of obj model
163
- cameraY: 0 ,
164
- //Initial cameraY position of obj model
165
- cameraZ: 10 ,
166
- //Initial cameraZ position of obj model
167
- //This callBack will return the loading progress value between 0 and 1.0
170
+ child: Flutter3DViewer (
171
+ src: 'assets/sheen_chair.glb' ,
168
172
onProgress: (double progressValue) {
169
173
debugPrint ('model loading progress : $progressValue ' );
170
174
},
@@ -205,7 +209,40 @@ class _MyHomePageState extends State<MyHomePage> {
205
209
//You can have full control of 3d model animations, textures and camera
206
210
controller: controller,
207
211
src:
208
- 'assets/business_man.glb' , //3D model with different animations
212
+ 'assets/business_man.glb' , //3D model with different animations
213
+ //src: 'assets/sheen_chair.glb', //3D model with different textures
214
+ //src: 'https://modelviewer.dev/shared-assets/models/Astronaut.glb', // 3D model from URL
215
+ ),
216
+ )
217
+ ,
218
+ Flexible (
219
+ flex: 1 ,
220
+ child: Flutter3DViewer (
221
+ //If you pass 'true' the flutter_3d_controller will add gesture interceptor layer
222
+ //to prevent gesture recognizers from malfunctioning on iOS and some Android devices.
223
+ // the default value is true
224
+ activeGestureInterceptor: true ,
225
+ //If you don't pass progressBarColor, the color of defaultLoadingProgressBar will be grey.
226
+ //You can set your custom color or use [Colors.transparent] for hiding loadingProgressBar.
227
+ progressBarColor: Colors .orange,
228
+ //You can disable viewer touch response by setting 'enableTouch' to 'false'
229
+ enableTouch: true ,
230
+ //This callBack will return the loading progress value between 0 and 1.0
231
+ onProgress: (double progressValue) {
232
+ debugPrint ('model loading progress : $progressValue ' );
233
+ },
234
+ //This callBack will call after model loaded successfully and will return model address
235
+ onLoad: (String modelAddress) {
236
+ debugPrint ('model loaded : $modelAddress ' );
237
+ },
238
+ //this callBack will call when model failed to load and will return failure error
239
+ onError: (String error) {
240
+ debugPrint ('model failed to load : $error ' );
241
+ },
242
+ //You can have full control of 3d model animations, textures and camera
243
+ controller: controller2,
244
+ src:
245
+ 'assets/business_woman.glb' , //3D model with different animations
209
246
//src: 'assets/sheen_chair.glb', //3D model with different textures
210
247
//src: 'https://modelviewer.dev/shared-assets/models/Astronaut.glb', // 3D model from URL
211
248
),
0 commit comments