arkit_plugin 0.1.0 copy "arkit_plugin: ^0.1.0" to clipboard
arkit_plugin: ^0.1.0 copied to clipboard

outdated

Flutter Plugin for ARKit - Apple's augmented reality (AR) development platform for iOS mobile devices.

arkit_flutter_plugin #

Codemagic build status flutter awesome pub package

Note: ARKit is only supported by mobile devices with A9 or later processors (iPhone 6s/7/SE/8/X, iPad 2017/Pro) on iOS 11 and newer.

Usage #

Depend on it #

Follow the installation instructions from Dart Packages site.

Update Info.plist #

The plugin use native view from ARKit, which is not yet supported by default. To make it work add the following code to Info.plist:

    <key>io.flutter.embedded_views_preview</key>
    <string>YES</string>

ARKit uses the device camera, so do not forget to provide the NSCameraUsageDescription. You may specify it in Info.plist like that:

    <key>NSCameraUsageDescription</key>
    <string>Describe why your app needs AR here.</string>

Write the app #

The simplest code example:

import 'package:arkit_plugin/arkit_position.dart';
import 'package:arkit_plugin/arkit_sphere.dart';
import 'package:flutter/material.dart';
import 'package:arkit_plugin/arkit_plugin.dart';
import 'package:vector_math/vector_math_64.dart';


void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  ARKitController arkitController;

  @override
  void dispose() {
    arkitController?.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) => MaterialApp(
        home: Scaffold(
            appBar: AppBar(
              title: const Text('ARKit in Flutter'),
            ),
            body: Container(
              child: ARKitSceneView(
                showStatistics: true,
                onARKitViewCreated: onARKitViewCreated,
              ),
            )),
      );

  void onARKitViewCreated(ARKitController arkitController) {
    this.arkitController = arkitController;
    this.arkitController.addSphere(ARKitSphere(
          position: Vector3(0, 0, -0.5),
          radius: 0.1,
        ));
  }
}

Result:

flutter

Examples #

I would highly recommend to review the sample from the Example folder. You may find a couple of samples in the Example folder of the plugin.

Name Description Link
Hello World The simplest scene with only 3 AR objects. code
Earth Sphere with an image texture and rotation animation. code
Tap Sphere which handles tap event. code
Plane Detection Detects horizontal plane. code
Distance tracking Detects horizontal plane and track distance on it. code
Physics A sphere and a plane with dynamic and static physics code
Image Detection Detects an earth image and puts a 3D object near it. code
Custom Light Hello World scene with a custom light spot. code
Light Estimation Estimates and applies the light around you. code

Contributing #

If you find a bug or would like to request a new feature, just open an issue. Your contributions are always welcome!

414
likes
0
pub points
92%
popularity

Publisher

verified publisherleushchenko.com

Flutter Plugin for ARKit - Apple's augmented reality (AR) development platform for iOS mobile devices.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, meta, vector_math

More

Packages that depend on arkit_plugin