Git Product home page Git Product logo

arkit_flutter_plugin's Introduction

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. For some features iOS 12 is required.

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:flutter/material.dart';
import 'package:arkit_plugin/arkit_plugin.dart';
import 'package:vector_math/vector_math_64.dart';

void main() => runApp(MaterialApp(home: 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) => Scaffold(
      appBar: AppBar(title: const Text('ARKit in Flutter')),
      body: ARKitSceneView(onARKitViewCreated: onARKitViewCreated));

  void onARKitViewCreated(ARKitController arkitController) {
    this.arkitController = arkitController;
    final node = ARKitNode(
        geometry: ARKitSphere(radius: 0.1), position: Vector3(0, 0, -0.5));
    this.arkitController.add(node);
  }
}

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. Some samples rely on this Earth image

Name Description Link Demo
Hello World The simplest scene with different geometries. code twitter
Earth Sphere with an image texture and rotation animation. code twitter
Tap Sphere which handles tap event. code twitter
Plane Detection Detects horizontal plane. code twitter
Distance tracking Detects horizontal plane and track distance on it. code twitter
Measure Measures distances code twitter
Physics A sphere and a plane with dynamic and static physics code twitter
Image Detection Detects an earth image and puts a 3D object near it. code twitter
Custom Light Hello World scene with a custom light spot. code
Light Estimation Estimates and applies the light around you. code twitter
Custom Object Place custom object on plane. code twitter
Occlusion Spheres which are not visible after horizontal and vertical planes. code twitter
Manipulation Custom objects with pinch and rotation events. code twitter
Face Tracking Face mask sample. code twitter
Panorama 360 photo. code twitter
Custom Animation Custom object animation. Port of https://github.com/eh3rrera/ARKitAnimation code twitter
Widget Projection Flutter widgets in AR code twitter

UX advice

You might want to check the device capabilities before establishing an AR session. To do that the device_info plugin will be in hand. Check the documentation about AR functionality you want to add and implement some fallback logic for users with older OSes.

Contributing

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

arkit_flutter_plugin's People

Contributors

olexale avatar topazoo avatar

Stargazers

Creatica.digital avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.