flutter_armod_widget 1.0.0-alpha.1 copy "flutter_armod_widget: ^1.0.0-alpha.1" to clipboard
flutter_armod_widget: ^1.0.0-alpha.1 copied to clipboard

outdated

Flutter AR-MOD SDK widget for embedding AR(Augmented Reality) features in flutter.

Flutter-ARMOD-Widget #

Flutter AR-MOD widget for embedding AR features in flutter.

What is the ARMOD SDK? #

AR-MOD means to provide stable, flexible, convenient and fast AR technology empowerment for enterprises or individual developers with existing applications. In addition, it is also possible to build a brand new AR application for enterprises or individuals that do not use the application.

AR-MOD provides AR integration capabilities for enterprises or individuals. Users do not need to understand ARKit or ARCore or even rendering logic and information, but only need to focus on the realization of AR experience content.

Brain

https://user-images.githubusercontent.com/82647748/149473548-b8e5e432-7ace-4880-a28e-8d2e17f95b8a.mp4

In short, ARMOD's solution is an AR experience platform solution similar to Snapchat (Lens Studio) and Facebook (SparkAR)!

AR-MOD is a derivative framework based on Unity ARFoundation. MOD in AR-MOD means Modification in English, meaning: modification and module. This concept is widely used in games, corresponding to modifiable video games. Famous games such as Warcraft, Red Alert, Half-Life, CS, Victory Day and more!

We transplant the MOD concept into AR technology to give users more freedom to create the AR creative interactive experience content they need! In this process, users do not need to worry about AR-SDK algorithm and code implementation, but only need to devote themselves to the production of AR creative interactive experience content. With only a small amount of code, you can use all the capabilities of AR-MOD on the APP to create greater commercial value.

Getting Started #

  1. Install this plugin to your flutter project. If you do not know how to install the Flutter Package you can click here to see the document.

    Install Guid

    The AR-MOD SDK currently provides a plug-in package for Flutter. You can install it through flutter_armod_widget: ^VERSION in your flutter project pubspec.yaml !

    # Other config
    dependencies:
      flutter:
        sdk: flutter
      flutter_armod_widget: ^0.0.3
    # Other config
    
    
  2. Go to PhantomsXR github respository. Download and Unzip it.

  3. Choose iOS or Android platform from the options below to set.

    Android Setup
    1. Go to the location of your FLUTTER SDK PATH/.pub-cache/hosted/pub.dartlang.org/flutter_armod_widget-VERSION/ folder, then paste the libs to android platform folder.

      Maybe hide the pub-cache folder. You need to turn on the Show hidden folders option.

    2. Run Flutter pub get command in your termial.
    iOS Setup
    1. Create the ThirdParties folder to your XCode project.

    2. Import UnityFramework.framework to the folder(ThridParties).

    3. Add the Framewrok to Xcode -> Targets -> Your APP -> General -> Franework,Libraries, and Embedded Content area, And set the Embed mode to Embed & Sign.

    4. Execute the cd iOS command and run Pod install command in your termial.

    5. Double-Click to open the Runner.xcworkspace file. It will be launch the XCode app.

    6. If you're using Swift, open the ios/Runner/AppDelegate.swift file and change the following:

          import UIKit
          import Flutter
      +    import flutter_armod_widget
      
          @UIApplicationMain
          @objc class AppDelegate: FlutterAppDelegate {
              override func application(
                  _ application: UIApplication,
                  didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
              ) -> Bool {
      +           InitARMODIntegrationWithOptions(argc: CommandLine.argc, argv: CommandLine.unsafeArgv, launchOptions)
      +           let nativeCalls: AnyClass? = NSClassFromString("FrameworkLibAPI")
      +           nativeCalls?.registerAPIforNativeCalls(ARMODCallbackAPI())
                  GeneratedPluginRegistrant.register(with: self)
                  return super.application(application, didFinishLaunchingWithOptions: launchOptions)
              }
          }
      

      If you're using Objective-C, open the ios/Runner/main.m file and change the following:

      +    #import "flutter_armod_widget.swift.h"
      
          int main(int argc, char * argv[]) {
                @autoreleasepool {
      +             InitARMODIntegration(argc, argv);
      +             [NSClassFromString(@"FrameworkLibAPI") registerAPIforNativeCalls:[ARMODCallbackAPI alloc]];
                    return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
                }
          }
      
    7. Edit the info.plist

          <dict>
      +        <key>io.flutter.embedded_views_preview</key>
      +        <string>YES</string>
          </dict>
      
          <dict>
      +        <key>Privacy - Camera Usage Description</key>
      +        <string>$(PRODUCT_NAME) uses Cameras</string>
          </dict>
      
          <dict>
      +       <key>NSBonjourServices</key>
      +       <string>_dartobservatory._tcp</string>
          </dict>
      
    8. Add #import <UnityFramework/NativeCallProxy.h> to Runner-Bridging-Header.h file.

         #import "GeneratedPluginRegistrant.h"
      +   #import <UnityFramework/NativeCallProxy.h>
      
  4. Then write a new screen(Flutter) for AR-MOD

import 'dart:async';

import 'package:armod_flutter_store/src/model/data.dart';
import 'package:armod_flutter_store/src/themes/theme.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_armod_widget/flutter_armod_widget.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter/services.dart';

import '../config/phantomsxrConfig.dart';

class ARView extends StatefulWidget {
  ARView({Key? key}) : super(key: key);

  @override
  ARViewState createState() => ARViewState();
}

class ARViewState extends State<ARView> {
  late ARMODWidgetController _armodWidgetController;
  bool _onWillPop = false;
  bool _isClosedByBack = false;
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
    EasyLoading.dismiss();
  }

  Widget _appBar() {
    return SafeArea(
        top: true,
        child: GestureDetector(
          child: Container(
            padding: AppTheme.padding,
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                Container(
                  width: 25,
                  height: 25,
                  alignment: Alignment.center,
                  decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.all(Radius.circular(15)),
                  ),
                  child: Icon(Icons.close, color: Colors.black54, size: 20),
                )
              ],
            ),
          ),
          onTap: () async {
            await _onBackPressed();
          },
        ));
  }

  @override
  Widget build(BuildContext context) {
    return new WillPopScope(
      onWillPop: _onBackPressed,
      child: new Scaffold(
        body: Stack(
          children: [
            ARMODWidget(
              onARMODCreated: onARMODCreate,
              onARMODExit: onARMODExit,
              onARMODLaunch: onARMODLaunch,
              onAddLoadingOverlay: onAddLoadingOverlay,
              onDeviceNotSupport: onDeviceNotSupport,
              onNeedInstallARCoreService: onNeedInstallARCoreService,
              onOpenBuiltInBrowser: onOpenBuiltInBrowser,
              onPackageSizeMoreThanPresetSize: onPackageSizeMoreThanPresetSize,
              onRecognitionComplete: onRecognitionComplete,
              onRecognitionStart: onRecognitionStart,
              onRemoveLoadingOverlay: onRemoveLoadingOverlay,
              onSdkInitialized: onSdkInitialized,
              onThrowException: onThrowException,
              onTryAcquireInformation: onTryAcquireInformation,
              onUpdateLoadingProgress: onUpdateLoadingProgress,
              fullscreen: true,
            ),
            _appBar()
          ],
        ),
      ),
    );
  }

  ///Handling the back event
  Future<bool> _onBackPressed() async {
    //Close AR-MOD SDK
    _armodWidgetController.unloadAndHideARMOD();

    while (!_onWillPop) {
      //We need to delayed executed because release AR-MOD operation is async.
      //May need to wait one more frame
      await Future.delayed(Duration(milliseconds: 1));
    }
    _isClosedByBack = true;
    return _onWillPop;
  }

  showAlertDialog(BuildContext context, String title, String msg, bool close) {
    // set up the button
    Widget okButton = TextButton(
      child: Text("OK"),
      onPressed: () async {
        if (close) {
          //Dismiss loading ui
          EasyLoading.dismiss();

          //Dismiss alert
          Navigator.of(context, rootNavigator: true).pop();

          //Dismiss view
          await _onBackPressed();
        }
      },
    );

    // set up the AlertDialog
    AlertDialog alert = AlertDialog(
      title: Text(title),
      content: Text(msg),
      actions: [
        okButton,
      ],
    );

    // show the dialog
    showDialog(
      barrierDismissible: false,
      context: context,
      builder: (BuildContext context) {
        return alert;
      },
    );
  }

  Future<void> onARMODCreate(controller) async {
    this._armodWidgetController = controller;
    if (await _armodWidgetController.isLoaded() != false)
      _armodWidgetController.create();
  }

  void onARMODLaunch() {
    var orientationId =
        MediaQuery.of(context).orientation == Orientation.portrait ? '1' : '2';
    _armodWidgetController.setDeivcesOrientation(orientationId);

    _armodWidgetController.initARMOD('__CONFIGURES__JSON_');

    Future.delayed(
        Duration(milliseconds: 125),
        () => {
              _armodWidgetController.fetchProject(AppData.ar_experience_uid),
            });
  }

  void onThrowException(String errorMsg, int erorCode) {
    EasyLoading.dismiss();
    showAlertDialog(context, "(Error:$erorCode)", errorMsg, true);
  }

  void onARMODExit() {
    //Wait to release all asset
    Future.delayed(
        Duration(milliseconds: 500),
        () => {
              _onWillPop = true,

              //Close by AR-Experiences
              if (!_isClosedByBack) Navigator.of(context).pop(true),
            });
  }

  void onUpdateLoadingProgress(progress) {
    EasyLoading.showProgress(progress,
        status: '${(progress * 100).toStringAsFixed(0)}%');
  }

  Future<String> onTryAcquireInformation(String opTag) async {
    await Future.delayed(Duration(seconds: 3));
    return "onTryAcquireInformation_$opTag";
  }

  void onAddLoadingOverlay() {
    EasyLoading.instance
      ..indicatorType = EasyLoadingIndicatorType.fadingCircle
      ..maskColor = Colors.red.withOpacity(0.5)
      ..dismissOnTap = false;
  }

  void onRemoveLoadingOverlay() {
    EasyLoading.dismiss();
  }

  void onDeviceNotSupport() {
    showAlertDialog(
        context,
        "Device Not Supported",
        "Your device is not supoorted! \n Will downgrade to normal version",
        false);
  }

  void onRecognitionStart() {}

  void onNeedInstallARCoreService() {
    showAlertDialog(context, "ARCore Service Need",
        "You need to install the ARCore service!", false);
  }

  void onSdkInitialized() {}

  void onOpenBuiltInBrowser(url) {}

  void onPackageSizeMoreThanPresetSize(currentSize, presetSize) {}

  void onRecognitionComplete() {}
}

Enhance your world and applications #

ARMOD is a powerful AR solution designed for artists and developers to build augmented reality experiences for hundreds of millions of Unity users. With its suite of Unity-compatible features, including custom shaders and advanced tracking technology, the possibilities are endless.

2 3 4 5 6 7 8

Showcase #

https://user-images.githubusercontent.com/82647748/149483206-6efeea0f-f499-4890-9f7b-6a52a10ed45b.mp4

https://user-images.githubusercontent.com/82647748/149483972-a4daf76c-49f1-4c73-9a32-22d9ed9d6fb1.mp4

https://user-images.githubusercontent.com/82647748/149483586-bb43daec-92ab-4b8b-898e-277ecce1cd09.mp4

https://user-images.githubusercontent.com/82647748/149475501-5288969b-1c99-465b-b2a9-079212988074.mp4

AR-MOD Open Source Projects #

Welcome to provide your project information to show us.

Name URL
StackAR https://github.com/Phantomxm2021/ARMOD-StackAR
ARMOD-Unity-Demo-App https://github.com/Phantomxm2021/ARMOD-Unity-Demo-App
ARMOD-FlutterAppDemo https://github.com/Phantomxm2021/ARMOD-FlutterAppDemo
ARMOD-SurvivalShooterAR https://github.com/Phantomxm2021/ARMOD-SurvivalShooterAR
ARMOD-Java-Android-Demo https://github.com/Phantomxm2021/ARMOD-Java-Android-Demo
AARMOD-OC-Demo https://github.com/Phantomxm2021/ARMOD-OC-Demo
ARMOD-Tutorials https://github.com/Phantomxm2021/ARMOD-Tutorials
ARMOD-Examples https://github.com/Phantomxm2021/ARMOD-Examples

Main features of ARMOD #

AR Basic
  • Device tracking: track the device's position and orientation in physical space.
  • Plane detection: detect horizontal and vertical surfaces.
  • Point clouds, also known as feature points.
  • Anchor: an arbitrary position and orientation that the device tracks.
  • Light estimation: estimates for average color temperature and brightness in physical space.
  • Environment probe: a means for generating a cube map to represent a particular area of the physical environment.
  • Face tracking: detect and track human faces.
  • 2D image tracking: detect and track 2D images.
  • Human segmentation: determines a stencil texture and depth map of humans detected in the camera image.
  • Raycast: queries physical surroundings for detected planes and feature points.
  • Pass-through video: optimized rendering of mobile camera image onto touch screen as the background for AR content.
  • Session management: manipulation of the platform-level configuration automatically when AR Features are enable or disabled.
  • Occlusion: allows for occlusion of virtual content by detected environmental depth (environment occlusion) or by detected human depth (human occlusion).
ARCore ARKit Magic Leap HoloLens
Device tracking
Plane tracking
Point clouds
Anchors
Light estimation
Environment probes
Face tracking
2D Image tracking
3D Object tracking
Meshing
2D & 3D body tracking
Collaborative participants
Human segmentation
Raycast
Pass-through video
Session management
Occlusion
Multiplayer API Mirror is a high level Networking library for Unity, optimized for ease of use & probability of success.
  • Growing library of Script Templates to make learning and coding easier.
  • Remote Procedure calls and context control via Attributes.
  • More than a dozen built in Components.
  • Five flavors of Interest Management, and you can make your own custom version.
  • Support for Additive Scenes with Physics Isolation (battle instances, levels, etc.)
  • Several complete Examples included.
  • Constant improvements and enhancements every month.
  • Full time support available in our Discord.
  • Free and not ccu limit
ARCloud
  • Fast visual positioning, low system overhead
  • Positioning can be run offline on the device or online in the cloud
  • Plug-ins on iOS, Android and devices compatible with Huawei AR Engine
  • Immersal Cloud Service's REST API for any device
  • Pre-built applications are available on the App Store to map real-world locations
  • It can even map indoor and outdoor large urban areas
  • Very small map file format, extremely optimized
  • Private/public map with sharing options
  • Global map coordination supports WGS84 and ECEF
  • Use GPS coordinates to mark and search the map
  • Textured mesh of point cloud and available mapping space
  • Support multiple maps at the same time in the same space
  • Easy-to-use Unity example with templates for indoor navigation and more
  • Detailed documentation helps developers get started
  • Use the 3D map viewer to develop the portal
Unity Features
  • Unity Editor Support
  • Scriptable
  • Visual Scripting
  • Physics engine
  • Lights
  • Lightmap
  • Universal Render Pipeline
  • Custom Materials
  • Custom Shaders
  • UGUI
  • Sprite Atlas
  • Networking
  • Timeline
  • Animation and Animator
  • Custom onnx AI Models
  • iOS
  • Android
  • Hololens
  • Magicleap
  • Native Features
  • All Platform native features are supported, But need developers to develop and adapt by themselves
ARCMS Features
  • ARExperience management
  • ARShowcase management
  • Recommend the ARShowcase
  • Multiple APP support
  • Tags management
  • Authentication system
  • 10,000 http api requests per day/Application
  • Restful API Support
9
likes
0
pub points
23%
popularity

Publisher

unverified uploader

Flutter AR-MOD SDK widget for embedding AR(Augmented Reality) features in flutter.

Homepage

License

unknown (license)

Dependencies

flutter, flutter_plugin_android_lifecycle, plugin_platform_interface, stream_transform

More

Packages that depend on flutter_armod_widget