Skip to content

Commit 4de3bf5

Browse files
FarazFaraz
Faraz
authored and
Faraz
committed
Merge branch 'dev'
2 parents 7c3442b + f0b2c66 commit 4de3bf5

27 files changed

+343
-136
lines changed

.flutter-plugins-dependencies

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_inappwebview_ios","path":"/Users/faraz/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.1.2/","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_inappwebview_android","path":"/Users/faraz/.pub-cache/hosted/pub.dev/flutter_inappwebview_android-1.1.3/","native_build":true,"dependencies":[]}],"macos":[{"name":"flutter_inappwebview_macos","path":"/Users/faraz/.pub-cache/hosted/pub.dev/flutter_inappwebview_macos-1.1.2/","native_build":true,"dependencies":[]}],"linux":[],"windows":[{"name":"flutter_inappwebview_windows","path":"/Users/faraz/.pub-cache/hosted/pub.dev/flutter_inappwebview_windows-0.6.0/","native_build":true,"dependencies":[]}],"web":[{"name":"flutter_inappwebview_web","path":"/Users/faraz/.pub-cache/hosted/pub.dev/flutter_inappwebview_web-1.1.2/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_inappwebview","dependencies":["flutter_inappwebview_android","flutter_inappwebview_ios","flutter_inappwebview_macos","flutter_inappwebview_web","flutter_inappwebview_windows"]},{"name":"flutter_inappwebview_android","dependencies":[]},{"name":"flutter_inappwebview_ios","dependencies":[]},{"name":"flutter_inappwebview_macos","dependencies":[]},{"name":"flutter_inappwebview_web","dependencies":[]},{"name":"flutter_inappwebview_windows","dependencies":[]}],"date_created":"2025-01-08 19:22:57.405422","version":"3.27.1","swift_package_manager_enabled":false}
1+
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_inappwebview_ios","path":"/Users/faraz/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.1.2/","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_inappwebview_android","path":"/Users/faraz/.pub-cache/hosted/pub.dev/flutter_inappwebview_android-1.1.3/","native_build":true,"dependencies":[]}],"macos":[{"name":"flutter_inappwebview_macos","path":"/Users/faraz/.pub-cache/hosted/pub.dev/flutter_inappwebview_macos-1.1.2/","native_build":true,"dependencies":[]}],"linux":[],"windows":[{"name":"flutter_inappwebview_windows","path":"/Users/faraz/.pub-cache/hosted/pub.dev/flutter_inappwebview_windows-0.6.0/","native_build":true,"dependencies":[]}],"web":[{"name":"flutter_inappwebview_web","path":"/Users/faraz/.pub-cache/hosted/pub.dev/flutter_inappwebview_web-1.1.2/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_inappwebview","dependencies":["flutter_inappwebview_android","flutter_inappwebview_ios","flutter_inappwebview_macos","flutter_inappwebview_web","flutter_inappwebview_windows"]},{"name":"flutter_inappwebview_android","dependencies":[]},{"name":"flutter_inappwebview_ios","dependencies":[]},{"name":"flutter_inappwebview_macos","dependencies":[]},{"name":"flutter_inappwebview_web","dependencies":[]},{"name":"flutter_inappwebview_windows","dependencies":[]}],"date_created":"2025-03-10 21:29:04.223404","version":"3.27.1","swift_package_manager_enabled":false}

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## v2.2.0
2+
3+
### Features
4+
* macOS support (Beta)
5+
* Play animation with loop count
6+
7+
### Fixes
8+
* Fix minimum version of Flutter SDK
9+
10+
11+
112
## v2.1.0
213

314
### Features

README.md

Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Notably, when testing **other available packages**, users may experience **gestu
1212

1313
## Features
1414

15-
- Mobile and Web stable version (support **glb**, **gltf** and **obj** format)
15+
- Mobile and Web **stable** version (fully support **glb**, **gltf** and **obj** format)
16+
- macOS **beta** version 🆕
1617
- Load 3D model from assets
1718
- Load 3D model from URL
1819
- Change 3D models by setState
@@ -22,6 +23,7 @@ Notably, when testing **other available packages**, users may experience **gestu
2223
- Load **obj** 3D models with textures and **mtl** files
2324
- Scale and camera properties for obj 3D models
2425
- Play animation
26+
- Play animation with loop count 🆕
2527
- Switch between animations
2628
- Pause animation
2729
- Reset animation
@@ -38,21 +40,26 @@ Notably, when testing **other available packages**, users may experience **gestu
3840

3941
<!--
4042
## Todo (Next Versions)
41-
- Change model source with setState
4243
- Support fbx format
4344
-->
4445

45-
## Samples
46+
## Compatibility
47+
48+
- Android
49+
- iOS
50+
- Web
51+
- macOS (Beta)
52+
- Windows (Coming Soon)
53+
54+
## Mobile & Web Samples
4655

4756
<img src="https://raw.githubusercontent.com/m-r-davari/content-holder/refs/heads/master/flutter_3d_controller/scrs_gifs_v2/male_scr.gif" alt="Model1" width="19%"/> <img src="https://raw.githubusercontent.com/m-r-davari/content-holder/refs/heads/master/flutter_3d_controller/scrs_gifs_v2/lambo_scr.gif" alt="Model2" width="19%"/> <img src="https://raw.githubusercontent.com/m-r-davari/content-holder/refs/heads/master/flutter_3d_controller/scrs_gifs_v2/dog_scr.gif" alt="Model3" width="19%"/> <img src="https://raw.githubusercontent.com/m-r-davari/content-holder/refs/heads/master/flutter_3d_controller/scrs_gifs_v2/chair_scr.gif" alt="Model3" width="19%"/> <img src="https://raw.githubusercontent.com/m-r-davari/content-holder/refs/heads/master/flutter_3d_controller/scrs_gifs_v2/dash_scr.gif" alt="Model3" width="19%"/>
4857
<img src="https://raw.githubusercontent.com/m-r-davari/content-holder/refs/heads/master/flutter_3d_controller/scrs_gifs_v2/female_scr.gif" alt="Model1" width="19%"/> <img src="https://raw.githubusercontent.com/m-r-davari/content-holder/refs/heads/master/flutter_3d_controller/scrs_gifs_v2/bird_scr.gif" alt="Model2" width="19%"/> <img src="https://raw.githubusercontent.com/m-r-davari/content-holder/refs/heads/master/flutter_3d_controller/scrs_gifs_v2/male2_scr.gif" alt="Model3" width="19%"/> <img src="https://raw.githubusercontent.com/m-r-davari/content-holder/refs/heads/master/flutter_3d_controller/scrs_gifs_v2/donut_scr.gif" alt="Model3" width="19%"/> <img src="https://raw.githubusercontent.com/m-r-davari/content-holder/refs/heads/master/flutter_3d_controller/scrs_gifs_v2/multi_scr.gif" alt="Model3" width="19%"/>
4958

59+
## Desktop(macOS) Samples
5060

51-
## Compatibility
61+
<img src="https://raw.githubusercontent.com/m-r-davari/content-holder/refs/heads/master/flutter_3d_controller/macos_model_sc.png" alt="macOS_Model1" width="48.25%"/> <img src="https://raw.githubusercontent.com/m-r-davari/content-holder/refs/heads/master/flutter_3d_controller/macos_model_sc2.png" alt="macOS_Model2" width="48.25%"/>
5262

53-
- Android
54-
- iOS
55-
- Web
5663

5764
## Notes
5865

@@ -78,6 +85,13 @@ controller.playAnimation();
7885
//If you pass null and your model has at least 1 animation it will play first animation.
7986
controller.playAnimation(animationName: chosenAnimation);
8087
88+
//If you pass loopCount > 0, the animation will repeat for the specified number of times.
89+
//To play the animation only once, set loopCount to 1.
90+
controller.playAnimation(loopCount: 1);
91+
92+
//The loopCount argument can also be used with a specific animation.
93+
controller.playAnimation(loopCount: 2, animationName: chosenAnimation);
94+
8195
//It will pause the animation at current frame.
8296
controller.pauseAnimation();
8397
@@ -177,7 +191,7 @@ Flutter3DViewer.obj(
177191

178192
```yaml
179193
dependencies:
180-
flutter_3d_controller: ^2.1.0
194+
flutter_3d_controller: ^2.2.0
181195
```
182196
183197
### `AndroidManifest.xml` (Android only)
@@ -230,27 +244,39 @@ Modify the `<head>` tag of your `web/index.html` to load the JavaScript, like so
230244
</head>
231245
```
232246

247+
### `Outgoing Connections(Client)` (macOS only)
233248

234-
## Frequently Asked Questions
235-
- **The 3D model could not load** : First check the example, if models in examples loads, may be there is problem with your model or your model path.
236-
- **The animation list could not be retrieved** : Check if there are any special characters in the animation names that might cause a JSON encoding error.
237-
- **The 3D model could not load from url** : It might be due to [CORS] security restrictions. The server hosting the model file *must* send appropriate CORS response headers for viewer to be able to load the file. See [google/model-viewer#1015](https://github.com/google/model-viewer/issues/1015)
249+
For loading 3D models in *macOS* you need to configure the macOS App Sandbox by *enabling* the `Outgoing Connections (Client)` option in your `MacOS` XCode Project, under `Runner > Signing & Capabilities`.
238250

239-
## Not working with a url on a real iOS device?
251+
<img src="https://raw.githubusercontent.com/m-r-davari/content-holder/refs/heads/master/flutter_3d_controller/macos_runner_config_sc.png" alt="macOS_runner_sc" width="60%"/>
240252

241-
**Problem Description** : If you're having trouble loading 3D models from a URL on a real iOS device, **Lockdown Mode** might be the cause. Lockdown Mode is a security feature in iOS that restricts certain functionalities like network requests or loading embedded content to protect user data.
253+
### `AppDelegate.html` (macOS only)
242254

243-
### How to Disable Lockdown Mode
244-
Follow these steps to disable Lockdown Mode on your device:
255+
Add the following codes to your macOS `AppDelegate` file to support transparent background for *flutter_3d_controller*
245256

246-
1. Open the **Settings** app on your iPhone.
247-
2. Scroll down and select **Privacy and Security**.
248-
3. Tap on **Lockdown Mode**.
249-
4. Select **Turn Off Lockdown Mode**. You may need to enter your password to confirm.
250-
5. After disabling Lockdown Mode, return to the app and try loading the 3D model again.
257+
```swift
258+
import flutter_inappwebview_macos
251259
252-
---
260+
extension InAppWebView {
261+
@objc public override func viewDidMoveToWindow() {
262+
super.viewDidMoveToWindow()
263+
264+
if window != nil {
265+
print("InAppWebView moved to window, enforcing transparency")
266+
self.setValue(false, forKey: "opaque")
267+
self.setValue(false, forKey: "drawsBackground")
268+
self.layer?.backgroundColor = NSColor.clear.cgColor
269+
}
270+
}
271+
}
272+
```
273+
274+
## Frequently Asked Questions
275+
- **Desktop(macOS) rare issues** : You may experience unexpected issues in desktop(macOS) beta version.
276+
- **The 3D model could not load** : First check the example, if models in examples loads, may be there is problem with your model or your model path.
277+
- **The animation list could not be retrieved** : Check if there are any special characters in the animation names that might cause a JSON encoding error.
278+
- **The 3D model could not load from url** : It might be due to [CORS] security restrictions. The server hosting the model file *must* send appropriate CORS response headers for viewer to be able to load the file. See [google/model-viewer#1015](https://github.com/google/model-viewer/issues/1015)
253279

254-
## More Info
255280

281+
## More Info
256282
This package uses Google's [model-viewer](https://modelviewer.dev) to render 3D models and it may have some issue in rendering some models/textures, the core of package (Model Viewer) will change in future to support all type of 3D models.

example/android/app/build.gradle

Lines changed: 19 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,44 @@
1-
def localProperties = new Properties()
2-
def localPropertiesFile = rootProject.file('local.properties')
3-
if (localPropertiesFile.exists()) {
4-
localPropertiesFile.withReader('UTF-8') { reader ->
5-
localProperties.load(reader)
6-
}
7-
}
8-
9-
def flutterRoot = localProperties.getProperty('flutter.sdk')
10-
if (flutterRoot == null) {
11-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12-
}
13-
14-
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15-
if (flutterVersionCode == null) {
16-
flutterVersionCode = '1'
17-
}
18-
19-
def flutterVersionName = localProperties.getProperty('flutter.versionName')
20-
if (flutterVersionName == null) {
21-
flutterVersionName = '1.0'
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
5+
id "dev.flutter.flutter-gradle-plugin"
226
}
237

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27-
288
android {
29-
namespace "com.mrdavari.example"
30-
compileSdkVersion flutter.compileSdkVersion
31-
ndkVersion flutter.ndkVersion
9+
namespace = "com.mrdavari.example"
10+
compileSdk = flutter.compileSdkVersion
11+
ndkVersion = flutter.ndkVersion
3212

3313
compileOptions {
34-
sourceCompatibility JavaVersion.VERSION_1_8
35-
targetCompatibility JavaVersion.VERSION_1_8
14+
sourceCompatibility = JavaVersion.VERSION_1_8
15+
targetCompatibility = JavaVersion.VERSION_1_8
3616
}
3717

3818
kotlinOptions {
39-
jvmTarget = '1.8'
40-
}
41-
42-
sourceSets {
43-
main.java.srcDirs += 'src/main/kotlin'
19+
jvmTarget = JavaVersion.VERSION_1_8
4420
}
4521

4622
defaultConfig {
4723
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
48-
applicationId "com.mrdavari.example"
24+
applicationId = "com.mrdavari.example"
4925
// You can update the following values to match your application needs.
50-
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
51-
minSdkVersion 21//flutter.minSdkVersion
52-
targetSdkVersion flutter.targetSdkVersion
53-
versionCode flutterVersionCode.toInteger()
54-
versionName flutterVersionName
26+
// For more information, see: https://flutter.dev/to/review-gradle-config.
27+
minSdk = flutter.minSdkVersion
28+
targetSdk = flutter.targetSdkVersion
29+
versionCode = flutter.versionCode
30+
versionName = flutter.versionName
5531
}
5632

5733
buildTypes {
5834
release {
5935
// TODO: Add your own signing config for the release build.
6036
// Signing with the debug keys for now, so `flutter run --release` works.
61-
signingConfig signingConfigs.debug
37+
signingConfig = signingConfigs.debug
6238
}
6339
}
6440
}
6541

6642
flutter {
67-
source '../..'
68-
}
69-
70-
dependencies {
71-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
43+
source = "../.."
7244
}

example/android/build.gradle

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,16 @@
1-
buildscript {
2-
ext.kotlin_version = '1.7.10'
3-
repositories {
4-
google()
5-
mavenCentral()
6-
}
7-
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:8.1.0'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
}
12-
}
13-
141
allprojects {
152
repositories {
163
google()
174
mavenCentral()
185
}
196
}
207

21-
rootProject.buildDir = '../build'
8+
rootProject.buildDir = "../build"
229
subprojects {
2310
project.buildDir = "${rootProject.buildDir}/${project.name}"
2411
}
2512
subprojects {
26-
project.evaluationDependsOn(':app')
13+
project.evaluationDependsOn(":app")
2714
}
2815

2916
tasks.register("clean", Delete) {

example/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
org.gradle.jvmargs=-Xmx1536M
1+
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
22
android.useAndroidX=true
33
android.enableJetifier=true

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip

example/android/settings.gradle

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
include ':app'
1+
pluginManagement {
2+
def flutterSdkPath = {
3+
def properties = new Properties()
4+
file("local.properties").withInputStream { properties.load(it) }
5+
def flutterSdkPath = properties.getProperty("flutter.sdk")
6+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7+
return flutterSdkPath
8+
}()
29

3-
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
511

6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
17+
}
818

9-
def flutterSdkPath = properties.getProperty("flutter.sdk")
10-
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11-
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
19+
plugins {
20+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21+
id "com.android.application" version "8.1.0" apply false
22+
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
23+
}
24+
25+
include ":app"

example/lib/main.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ class _MyHomePageState extends State<MyHomePage> {
9696
'Animations : $availableAnimations --- Length : ${availableAnimations.length}');
9797
chosenAnimation = await showPickerDialog(
9898
'Animations', availableAnimations, chosenAnimation);
99-
controller.playAnimation(animationName: chosenAnimation);
99+
//Play animation with loop count
100+
controller.playAnimation(
101+
animationName: chosenAnimation,
102+
loopCount: 2,
103+
);
100104
},
101105
icon: const Icon(Icons.format_list_bulleted_outlined),
102106
),

example/macos/Podfile.lock

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
PODS:
2+
- flutter_inappwebview_macos (0.0.1):
3+
- FlutterMacOS
4+
- OrderedSet (~> 6.0.3)
5+
- FlutterMacOS (1.0.0)
6+
- OrderedSet (6.0.3)
7+
8+
DEPENDENCIES:
9+
- flutter_inappwebview_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_inappwebview_macos/macos`)
10+
- FlutterMacOS (from `Flutter/ephemeral`)
11+
12+
SPEC REPOS:
13+
trunk:
14+
- OrderedSet
15+
16+
EXTERNAL SOURCES:
17+
flutter_inappwebview_macos:
18+
:path: Flutter/ephemeral/.symlinks/plugins/flutter_inappwebview_macos/macos
19+
FlutterMacOS:
20+
:path: Flutter/ephemeral
21+
22+
SPEC CHECKSUMS:
23+
flutter_inappwebview_macos: bdf207b8f4ebd58e86ae06cd96b147de99a67c9b
24+
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
25+
OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94
26+
27+
PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367
28+
29+
COCOAPODS: 1.15.2

0 commit comments

Comments
 (0)