flutter_3d_controller 0.0.2 copy "flutter_3d_controller: ^0.0.2" to clipboard
flutter_3d_controller: ^0.0.2 copied to clipboard

retracted

A Flutter package for rendering interactive 3D models in the GLB and glTF formats with ability to control camera and animations.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_3d_controller/flutter_3d_controller.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter 3D controller example'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  Flutter3DController controller = Flutter3DController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      floatingActionButton: Column(
        mainAxisAlignment: MainAxisAlignment.end,
        mainAxisSize: MainAxisSize.min,
        children: [
          FloatingActionButton.small(
            onPressed: (){
              controller.playAnimation();
            },
            child: const Icon(Icons.play_arrow),
          ),
          const SizedBox(height: 4,),
          FloatingActionButton.small(
            onPressed: (){
              controller.pauseAnimation();
            },
            child: const Icon(Icons.pause),
          ),
          const SizedBox(height: 4,),
          FloatingActionButton.small(
            onPressed: ()async{
              final result = await controller.getAvailableAnimations();
              print('Animations : $result -- Length : ${result.length}' );
            },
            child: const Icon(Icons.format_list_bulleted_outlined),
          ),
          const SizedBox(height: 4,),
          FloatingActionButton.small(
            onPressed: (){
              controller.setCameraOrbit(20, 20, 5);
            },
            child: const Icon(Icons.camera_alt),
          )
        ],
      ),
      body: Container(
        color: Colors.blueAccent,
        width: MediaQuery.of(context).size.width,
        height: MediaQuery.of(context).size.height,
        child: Flutter3DViewer(
          controller: controller,
          src: 'assets/dancing_girl.glb',
        ),
      ),
    );
  }
}
228
likes
0
pub points
93%
popularity

Publisher

verified publishermobilesoft98.dev

A Flutter package for rendering interactive 3D models in the GLB and glTF formats with ability to control camera and animations.

Repository (GitHub)
View/report issues

Topics

#model #models3d #models-3d #glb #animation-3d

License

unknown (license)

Dependencies

android_intent_plus, flutter, path, url_launcher, webview_flutter, webview_flutter_android, webview_flutter_wkwebview

More

Packages that depend on flutter_3d_controller