ar_core 是一個 Flutter 插件,可在 iOS 和 Android 移動應用中實現增強現實(AR)功能,支援即時相機存取與 3D 物件放置。它讓開發者能透過簡單的 API 將 AR 經驗直接整合到其應用中。該插件利用各平台的原生 AR 能力,並設計為在各種裝置上順暢運作。雖然目前不支援 Web AR,但為在 Flutter 應用中建構互動式 AR 功能提供了穩固的基礎。
適用情境
建立互動式產品預覽
開發AR遊戲
透過3D模型增強教育應用程式
可視化建築設計
啟用虛擬試穿
主要特色
即時攝像頭整合
AR空間中的3D對象放置
跨平台支援(iOS 與 Android)
簡單的 Flutter API
原生AR框架利用
適合對象
移動AR應用開發者
教育技術項目
電子商務產品可視化
尋求AR功能的遊戲開發者
UX設計師探索沉浸式介面
使用建議
無 Web 平台支援
需要具備AR功能的設備
可用文件有限
依賴原生AR框架
可能需要為複雜場景進行額外設定
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
ar_core Flutter Package for Augmented Reality
ar_core is an augmented reality mobile application kit for mobile devices that enables the creation of augmented reality applications.
Many thanks to Arslan Raza for the ar_core, he served as a great basis and starting point for this project.
Features
Display live camera preview in a widget.
Custom Camera, Place anywhere on the Screen.
Choose Asset, Network or 3d objects in png.
Drag, Resize, Rotate, Zoom in and out objects.
Add access to the image stream from Dart.
Getting Started
Installing
Add the Flutter package to your project by running:
flutter pub add ar_core
Or manually add this to your pubspec.yaml file (and run flutter pub get):
dependencies:ar_core:^0.0.1
iOS
The camera plugin functionality works on iOS 10.0 or higher. If compiling for any version lower than 10.0,
make sure to programmatically check the version of iOS running on the device before using any camera plugin features.
The device_info_plus plugin, for example, can be used to check the iOS version.
Add two rows to the ios/Runner/Info.plist:
one with the key Privacy - Camera Usage Description and a usage description.
and one with the key Privacy - Microphone Usage Description and a usage description.
Or in text format add the key:
<key>NSCameraUsageDescription</key><string>Can I use the camera please?</string><key>NSMicrophoneUsageDescription</key><string>Can I use the mic please?</string>
Android
Change the minimum Android sdk version to 21 (or higher) in your android/app/build.gradle file.
minSdkVersion 21
It's important to note that the MediaRecorder class is not working properly on emulators, as stated in the documentation: https://developer.android.com/reference/android/media/MediaRecorder. Specifically, when recording a video with sound enabled and trying to play it back, the duration won't be correct and you will only see the first frame.
Importing
Add this to your code:
import'package:ar_core/ar_core.dart';
Usage or How to Use
Replace your Scaffold to Augmented(), and it will handle all your view. if you want to pass an image just pass an image as a constructor.