Initial commit

This commit is contained in:
BahrudinAyub 2025-03-20 15:08:12 +07:00
commit 357bdfe60d
153 changed files with 7354 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

43
.gitignore vendored Normal file
View File

@ -0,0 +1,43 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release

45
.metadata Normal file
View File

@ -0,0 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: "80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819"
channel: "stable"
project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
- platform: android
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
- platform: ios
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
- platform: linux
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
- platform: macos
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
- platform: web
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
- platform: windows
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 BahrudinAyub
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# harvest_guard_app
A new Flutter project.

1
analysis_options.yaml Normal file
View File

@ -0,0 +1 @@
include: package:flutter_lints/flutter.yaml

13
android/.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/to/reference-keystore
key.properties
**/*.keystore
**/*.jks

46
android/app/build.gradle Normal file
View File

@ -0,0 +1,46 @@
plugins {
id "com.android.application"
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}
android {
namespace "com.example.harvest_guard_app"
compileSdkVersion 34
defaultConfig {
applicationId "com.example.harvest_guard_app"
minSdkVersion 26 // Updated from 21 to 26 as required by tflite_flutter
targetSdkVersion 34
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
}
}
// Add this section if you're facing abiFilter issues with TFLite
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
}
flutter {
source "../.."
}

View File

@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

View File

@ -0,0 +1,53 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="harvest_guard_app"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:enableOnBackInvokedCallback="true">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Add the UCropActivity for image_cropper plugin -->
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
</queries>
</manifest>

View File

@ -0,0 +1,5 @@
package com.example.harvest_guard_app
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity()

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

18
android/build.gradle Normal file
View File

@ -0,0 +1,18 @@
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = "../build"
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(":app")
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}

View File

@ -0,0 +1,3 @@
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true

View File

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip

25
android/settings.gradle Normal file
View File

@ -0,0 +1,25 @@
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.9.22" apply false
}
include ":app"

BIN
assets/images/avatar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

BIN
assets/images/plant.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

4
assets/label.txt Normal file
View File

@ -0,0 +1,4 @@
0 bacterial_leaf_blight
1 brown_spot
2 healty
3 hispa

Binary file not shown.

34
ios/.gitignore vendored Normal file
View File

@ -0,0 +1,34 @@
**/dgph
*.mode1v3
*.mode2v3
*.moved-aside
*.pbxuser
*.perspectivev3
**/*sync/
.sconsign.dblite
.tags*
**/.vagrant/
**/DerivedData/
Icon?
**/Pods/
**/.symlinks/
profile
xcuserdata
**/.generated/
Flutter/App.framework
Flutter/Flutter.framework
Flutter/Flutter.podspec
Flutter/Generated.xcconfig
Flutter/ephemeral/
Flutter/app.flx
Flutter/app.zip
Flutter/flutter_assets/
Flutter/flutter_export_environment.sh
ServiceDefinitions.json
Runner/GeneratedPluginRegistrant.*
# Exceptions to above rules.
!default.mode1v3
!default.mode2v3
!default.pbxuser
!default.perspectivev3

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>12.0</string>
</dict>
</plist>

View File

@ -0,0 +1 @@
#include "Generated.xcconfig"

View File

@ -0,0 +1 @@
#include "Generated.xcconfig"

View File

@ -0,0 +1,616 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
proxyType = 1;
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
remoteInfo = Runner;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
331C8082294A63A400263BE5 /* RunnerTests */ = {
isa = PBXGroup;
children = (
331C807B294A618700263BE5 /* RunnerTests.swift */,
);
path = RunnerTests;
sourceTree = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
9740EEB31CF90195004384FC /* Generated.xcconfig */,
);
name = Flutter;
sourceTree = "<group>";
};
97C146E51CF9000F007C117D = {
isa = PBXGroup;
children = (
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
331C8082294A63A400263BE5 /* RunnerTests */,
);
sourceTree = "<group>";
};
97C146EF1CF9000F007C117D /* Products */ = {
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
331C8081294A63A400263BE5 /* RunnerTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C147021CF9000F007C117D /* Info.plist */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
);
path = Runner;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
331C8080294A63A400263BE5 /* RunnerTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
buildPhases = (
331C807D294A63A400263BE5 /* Sources */,
331C807F294A63A400263BE5 /* Resources */,
);
buildRules = (
);
dependencies = (
331C8086294A63A400263BE5 /* PBXTargetDependency */,
);
name = RunnerTests;
productName = RunnerTests;
productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
97C146ED1CF9000F007C117D /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
);
buildRules = (
);
dependencies = (
);
name = Runner;
productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
331C8080294A63A400263BE5 = {
CreatedOnToolsVersion = 14.0;
TestTargetID = 97C146ED1CF9000F007C117D;
};
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 1100;
};
};
};
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
331C8080294A63A400263BE5 /* RunnerTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
331C807F294A63A400263BE5 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
97C146EC1CF9000F007C117D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
331C807D294A63A400263BE5 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
97C146EA1CF9000F007C117D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
331C8086294A63A400263BE5 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 97C146ED1CF9000F007C117D /* Runner */;
targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C146FB1CF9000F007C117D /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C147001CF9000F007C117D /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
249021D3217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Profile;
};
249021D4217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.harvestGuardApp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Profile;
};
331C8088294A63A400263BE5 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.harvestGuardApp.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
};
name = Debug;
};
331C8089294A63A400263BE5 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.harvestGuardApp.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
};
name = Release;
};
331C808A294A63A400263BE5 /* Profile */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.harvestGuardApp.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
};
name = Profile;
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
97C147061CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.harvestGuardApp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
};
97C147071CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.harvestGuardApp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
331C8088294A63A400263BE5 /* Debug */,
331C8089294A63A400263BE5 /* Release */,
331C808A294A63A400263BE5 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147031CF9000F007C117D /* Debug */,
97C147041CF9000F007C117D /* Release */,
249021D3217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147061CF9000F007C117D /* Debug */,
97C147071CF9000F007C117D /* Release */,
249021D4217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "331C8080294A63A400263BE5"
BuildableName = "RunnerTests.xctest"
BlueprintName = "RunnerTests"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>

View File

@ -0,0 +1,13 @@
import Flutter
import UIKit
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}

View File

@ -0,0 +1,122 @@
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

View File

@ -0,0 +1,5 @@
# Launch Screen Assets
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="168" height="185"/>
</resources>
</document>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Flutter View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>

49
ios/Runner/Info.plist Normal file
View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Harvest Guard App</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>harvest_guard_app</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1 @@
#import "GeneratedPluginRegistrant.h"

View File

@ -0,0 +1,12 @@
import Flutter
import UIKit
import XCTest
class RunnerTests: XCTestCase {
func testExample() {
// If you add code to the Runner application, consider adding tests here.
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
}
}

View File

@ -0,0 +1,235 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
// Base class untuk semua halaman penyakit
abstract class BaseDiseaseDetailPage extends StatelessWidget {
final String title;
final String description;
final List<String> treatments;
final List<String> preventions;
const BaseDiseaseDetailPage({
required this.title,
required this.description,
required this.treatments,
required this.preventions,
});
@override
Widget build(BuildContext context) {
// Dapatkan argumen dari navigasi
final args = Get.arguments as Map<String, dynamic>;
final prediction = args['prediction'] as Map<String, dynamic>;
final imagePath = args['imagePath'] as String?;
final confidence = (prediction['confidence'] as double) * 100;
return Scaffold(
appBar: AppBar(
title: Text(title),
),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Tampilkan gambar jika tersedia dengan design yang lebih baik
if (imagePath != null)
Container(
width: double.infinity,
height: 250,
decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: Colors.grey.shade300, width: 1)),
),
child: Stack(
children: [
Center(
child: Image.file(
File(imagePath),
fit: BoxFit.cover,
width: double.infinity,
height: 250,
),
),
Positioned(
right: 10,
bottom: 10,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.7),
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.photo_camera, color: Colors.white, size: 16),
SizedBox(width: 4),
Text(
'Hasil Scan',
style: TextStyle(
color: Colors.white,
fontSize: 12,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
],
),
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Header dengan nama penyakit dan tingkat keyakinan
Row(
children: [
Expanded(
child: Text(
prediction['disease'] as String,
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold
),
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: confidence > 80 ? Colors.green : Colors.orange,
borderRadius: BorderRadius.circular(20),
),
child: Text(
'${confidence.toStringAsFixed(1)}%',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
],
),
SizedBox(height: 16),
// Deskripsi penyakit
Text(
'Deskripsi',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold
),
),
SizedBox(height: 8),
Text(description),
SizedBox(height: 24),
// Cara penanganan
if (treatments.isNotEmpty) ...[
Text(
'Penanganan',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold
),
),
SizedBox(height: 8),
...treatments.map((treatment) => Padding(
padding: EdgeInsets.only(bottom: 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(Icons.check_circle, color: Colors.green),
SizedBox(width: 8),
Expanded(child: Text(treatment)),
],
),
)).toList(),
SizedBox(height: 24),
],
// Cara pencegahan
Text(
'Pencegahan',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold
),
),
SizedBox(height: 8),
...preventions.map((prevention) => Padding(
padding: EdgeInsets.only(bottom: 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(Icons.shield, color: Colors.blue),
SizedBox(width: 8),
Expanded(child: Text(prevention)),
],
),
)).toList(),
SizedBox(height: 24),
// Tombol untuk membagikan hasil atau mencari informasi lebih lanjut
Row(
children: [
Expanded(
child: ElevatedButton.icon(
icon: Icon(Icons.share),
label: Text('Bagikan Hasil'),
style: ElevatedButton.styleFrom(
padding: EdgeInsets.symmetric(vertical: 12),
),
onPressed: () {
// TODO: Implementasi fungsi berbagi
Get.snackbar(
'Bagikan',
'Fitur berbagi akan segera tersedia',
snackPosition: SnackPosition.BOTTOM,
);
},
),
),
SizedBox(width: 12),
Expanded(
child: OutlinedButton.icon(
icon: Icon(Icons.info_outline),
label: Text('Info Lanjut'),
style: OutlinedButton.styleFrom(
padding: EdgeInsets.symmetric(vertical: 12),
),
onPressed: () {
// TODO: Implementasi fungsi info lanjut
Get.snackbar(
'Info Lanjut',
'Fitur informasi lanjutan akan segera tersedia',
snackPosition: SnackPosition.BOTTOM,
);
},
),
),
],
),
],
),
),
],
),
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.camera_alt),
onPressed: () {
// Kembali ke halaman scan
Get.until((route) => route.settings.name == '/');
},
tooltip: 'Scan Baru',
),
);
}
}

View File

@ -0,0 +1,24 @@
import 'package:flutter/material.dart';
import 'package:harvest_guard_app/components/abstract_class.dart';
class HawarDaunPage extends BaseDiseaseDetailPage {
HawarDaunPage() : super(
title: 'Hawar Daun Bakteri',
description: 'Hawar daun bakteri (BLB) adalah penyakit yang disebabkan oleh bakteri Xanthomonas oryzae. Penyakit ini ditandai dengan bercak-bercak berwarna kuning hingga putih yang mengikuti pembuluh daun, dan selanjutnya dapat menyebabkan daun menjadi kering dan mati. Penyakit ini dapat menyebar dengan cepat terutama pada kondisi basah dan lembab.',
treatments: [
'Aplikasikan bakterisida yang direkomendasikan sesuai dosis yang tepat',
'Keringkan sawah secara berkala untuk mengurangi kelembaban',
'Pangkas dan buang bagian tanaman yang terinfeksi parah',
'Jaga jarak tanam yang cukup untuk mengurangi kelembaban mikro',
'Gunakan pupuk nitrogen dengan dosis yang seimbang'
],
preventions: [
'Tanam varietas padi yang tahan terhadap hawar daun bakteri',
'Gunakan benih bebas patogen dan berkualitas',
'Hindari penggunaan pupuk nitrogen berlebihan',
'Lakukan rotasi tanaman',
'Bersihkan area sekitar tanaman dari gulma yang dapat menjadi inang alternatif'
],
);
}

View File

@ -0,0 +1,24 @@
import 'package:flutter/material.dart';
import 'package:harvest_guard_app/components/abstract_class.dart';
class BercakCoklatPage extends BaseDiseaseDetailPage {
BercakCoklatPage() : super(
title: 'Bercak Coklat',
description: 'Bercak coklat (Brown Spot) adalah penyakit yang disebabkan oleh jamur Bipolaris oryzae. Penyakit ini ditandai dengan bercak-bercak berbentuk oval dengan warna coklat tua dan biasanya memiliki tepi berwarna kuning. Penyakit ini sering terjadi pada tanaman yang kekurangan nutrisi atau mengalami stres, dan dapat menyebabkan penurunan hasil panen yang signifikan.',
treatments: [
'Aplikasikan fungisida yang sesuai berdasarkan rekomendasi ahli',
'Perbaiki drainase untuk mengurangi kelembaban berlebih',
'Buang bagian tanaman yang terinfeksi',
'Lakukan pemupukan seimbang untuk memperbaiki kondisi tanaman',
'Kelola air dengan baik untuk mengurangi kelembaban lingkungan'
],
preventions: [
'Gunakan benih sehat dan berkualitas',
'Lakukan perlakuan benih dengan fungisida sebelum tanam',
'Jaga keseimbangan nutrisi dalam tanah, terutama kalium',
'Tanam varietas yang tahan terhadap penyakit bercak coklat',
'Hindari kepadatan tanaman yang terlalu tinggi'
],
);
}

View File

@ -0,0 +1,18 @@
import 'package:flutter/material.dart';
import 'package:harvest_guard_app/components/abstract_class.dart';
class SehatPage extends BaseDiseaseDetailPage {
SehatPage() : super(
title: 'Tanaman Sehat',
description: 'Tanaman padi Anda tampak sehat dan tidak terdeteksi adanya penyakit. Tanaman padi yang sehat memiliki daun berwarna hijau cerah, batang yang kuat, dan tidak ada tanda-tanda bercak, klorosis (menguning), atau kerusakan lainnya. Tanaman yang sehat akan memberikan hasil panen yang optimal.',
treatments: [], // Tidak perlu penanganan khusus
preventions: [
'Lanjutkan praktik pertanian yang baik',
'Pantau tanaman secara teratur untuk deteksi dini penyakit',
'Jaga keseimbangan nutrisi tanaman melalui pemupukan yang tepat',
'Kelola air dengan baik untuk mendukung pertumbuhan optimal',
'Kendalikan gulma dan hama secara berkala'
],
);
}

View File

@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
import 'package:harvest_guard_app/components/abstract_class.dart';
class HispaPage extends BaseDiseaseDetailPage {
HispaPage() : super(
title: 'Hispa',
description: 'Hispa adalah serangan hama yang disebabkan oleh kumbang Dicladispa armigera. Hama ini menyerang daun padi dan menyebabkan bercak-bercak putih, transparan hingga kering pada daun. Larva dari kumbang ini menggali di dalam jaringan daun, sementara kumbang dewasa mengikis permukaan daun. Serangan parah dapat mengurangi fotosintesis dan menurunkan hasil panen.',
treatments: [
'Aplikasikan insektisida yang direkomendasikan sesuai dengan tingkat serangan',
'Kumpulkan dan musnahkan daun yang terserang parah',
'Kurangi penggunaan pupuk nitrogen berlebihan yang dapat menarik hama',
'Gunakan pengendalian hayati seperti predator alami jika memungkinkan',
'Lakukan penyemprotan pada pagi atau sore hari untuk efektivitas maksimal'
],
preventions: [
'Tanam varietas padi yang tahan terhadap serangan hispa',
'Kelola air dengan baik, termasuk pengeringan berkala',
'Pantau tanaman secara rutin untuk deteksi dini',
'Jaga kebersihan area sekitar sawah dari gulma',
'Terapkan sistem tanam terpadu (IPM) untuk pengendalian hama'
],
);
}

View File

@ -0,0 +1,21 @@
import 'package:flutter/material.dart';
import 'package:harvest_guard_app/components/abstract_class.dart';
class TidakTeridentifikasiPage extends BaseDiseaseDetailPage {
TidakTeridentifikasiPage() : super(
title: 'Tidak Teridentifikasi',
description: 'Model tidak dapat mengidentifikasi jenis penyakit pada gambar. Hal ini dapat terjadi karena beberapa alasan, seperti gambar kurang jelas, gejala belum terlihat jelas, atau mungkin penyakit tersebut tidak termasuk dalam kategori yang dikenali oleh model.',
treatments: [
'Konsultasikan dengan ahli pertanian atau penyuluh pertanian setempat',
'Ambil gambar ulang dengan kualitas yang lebih baik dan pencahayaan yang cukup',
'Lakukan pengamatan lebih dekat terhadap gejala yang muncul',
'Jika memungkinkan, bawa sampel tanaman ke laboratorium untuk analisis lebih lanjut'
],
preventions: [
'Lakukan pemantauan rutin pada tanaman',
'Terapkan praktik pertanian yang baik dan seimbang',
'Jaga kebersihan lingkungan pertanaman',
'Lakukan rotasi tanaman untuk memutus siklus patogen'
],
);
}

View File

@ -0,0 +1,278 @@
// File: lib/components/scan_history_card.dart
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:harvest_guard_app/data/scan_history_model.dart';
import 'package:intl/intl.dart';
import 'package:harvest_guard_app/dashboard/dashboard_controller.dart';
class ScanHistoryCard extends StatelessWidget {
final String imagePath;
final String diseaseResult;
final DateTime timestamp;
final double confidence;
final VoidCallback? onTap;
final String? diseaseId;
final ScanHistory? scanHistoryItem; // Tambahkan parameter untuk item ScanHistory
const ScanHistoryCard({
Key? key,
required this.imagePath,
required this.diseaseResult,
required this.timestamp,
required this.confidence,
this.onTap,
this.diseaseId,
this.scanHistoryItem, // Parameter opsional untuk item yang akan dihapus
}) : super(key: key);
void _navigateToDetailPage() {
// Jika ada onTap callback yang diberikan, gunakan itu
if (onTap != null) {
onTap!();
return;
}
// Tentukan routeName berdasarkan diseaseResult
String routeName;
switch (diseaseResult) {
case 'Hawar Daun Bakteri':
routeName = '/hawar-daun';
break;
case 'Bercak Coklat':
routeName = '/bercak-coklat';
break;
case 'Sehat':
routeName = '/sehat';
break;
case 'Hispa':
routeName = '/hispa';
break;
default:
routeName = '/tidak-teridentifikasi';
break;
}
// Siapkan data prediction untuk dikirim ke halaman detail
final prediction = {
'disease': diseaseResult,
'confidence': confidence,
'diseaseId': diseaseId ?? diseaseResult.toLowerCase().replaceAll(' ', '_'),
'routeName': routeName,
};
// Navigasi ke halaman detail dengan argumen
Get.toNamed(routeName, arguments: {
'prediction': prediction,
'imagePath': imagePath,
});
}
// Fungsi untuk menghapus riwayat
void _deleteHistoryItem() {
if (scanHistoryItem == null) {
print('Tidak dapat menghapus: scanHistoryItem is null');
return;
}
// Tampilkan dialog konfirmasi
Get.dialog(
AlertDialog(
title: const Text('Konfirmasi'),
content: const Text('Apakah Anda yakin ingin menghapus riwayat pemeriksaan ini?'),
actions: [
TextButton(
onPressed: () => Get.back(), // Tutup dialog
child: const Text('Batal'),
),
TextButton(
onPressed: () {
// Tutup dialog
Get.back();
// Dapatkan controller dan hapus riwayat
final dashboardController = Get.find<DashboardController>();
dashboardController.modelController.deleteScanHistory(scanHistoryItem!);
// Tampilkan pesan
Get.snackbar(
'Berhasil',
'Riwayat pemeriksaan telah dihapus',
snackPosition: SnackPosition.BOTTOM,
backgroundColor: Colors.green.withOpacity(0.7),
colorText: Colors.white,
);
},
child: const Text('Hapus', style: TextStyle(color: Colors.red)),
),
],
),
);
}
@override
Widget build(BuildContext context) {
// Format the date and time
final dateFormat = DateFormat('dd MMM yyyy');
final timeFormat = DateFormat('HH:mm');
final date = dateFormat.format(timestamp);
final time = timeFormat.format(timestamp);
// Get status color based on disease result
Color statusColor = Colors.green;
if (diseaseResult != 'Sehat') {
statusColor = Colors.red;
}
return Card(
margin: const EdgeInsets.only(bottom: 16.0),
elevation: 2.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0),
),
child: InkWell(
onTap: _navigateToDetailPage,
borderRadius: BorderRadius.circular(12.0),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
children: [
Row(
children: [
// Image thumbnail
ClipRRect(
borderRadius: BorderRadius.circular(8.0),
child: Image.file(
File(imagePath),
width: 80.0,
height: 80.0,
fit: BoxFit.cover,
),
),
const SizedBox(width: 16.0),
// Details
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// Disease result
Expanded(
child: Text(
diseaseResult,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16.0,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
// Status indicator
Container(
padding: const EdgeInsets.symmetric(
horizontal: 8.0,
vertical: 4.0,
),
decoration: BoxDecoration(
color: statusColor.withOpacity(0.2),
borderRadius: BorderRadius.circular(4.0),
),
child: Text(
diseaseResult == 'Sehat' ? 'Sehat' : 'Terinfeksi',
style: TextStyle(
color: statusColor,
fontSize: 12.0,
fontWeight: FontWeight.w500,
),
),
),
],
),
const SizedBox(height: 8.0),
// Confidence
Text(
'Keyakinan: ${(confidence * 100).toStringAsFixed(1)}%',
style: TextStyle(
color: Colors.grey[600],
fontSize: 14.0,
),
),
const SizedBox(height: 4.0),
// Date and time
Row(
children: [
Icon(
Icons.calendar_today,
size: 14.0,
color: Colors.grey[500],
),
const SizedBox(width: 4.0),
Text(
date,
style: TextStyle(
color: Colors.grey[500],
fontSize: 12.0,
),
),
const SizedBox(width: 8.0),
Icon(
Icons.access_time,
size: 14.0,
color: Colors.grey[500],
),
const SizedBox(width: 4.0),
Text(
time,
style: TextStyle(
color: Colors.grey[500],
fontSize: 12.0,
),
),
],
),
],
),
),
],
),
// Tombol hapus - hanya ditampilkan jika scanHistoryItem tersedia
if (scanHistoryItem != null)
Padding(
padding: const EdgeInsets.only(top: 12.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton.icon(
onPressed: _deleteHistoryItem,
icon: const Icon(Icons.delete, color: Colors.red, size: 18),
label: const Text(
'Hapus',
style: TextStyle(
color: Colors.red,
fontSize: 14.0,
),
),
style: TextButton.styleFrom(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
side: const BorderSide(color: Colors.red, width: 1),
),
),
),
],
),
),
],
),
),
),
);
}
}

View File

@ -0,0 +1,82 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:harvest_guard_app/components/scan_history_card.dart';
import 'package:harvest_guard_app/dashboard/dashboard_controller.dart';
class ScanHistoryScreen extends GetView<DashboardController> {
const ScanHistoryScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Riwayat Pemeriksaan'),
backgroundColor: Colors.green,
foregroundColor: Colors.white,
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Obx(() {
final scanHistory = controller.modelController.scanHistoryList;
if (scanHistory.isEmpty) {
return const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.history,
size: 64.0,
color: Colors.grey,
),
SizedBox(height: 16.0),
Text(
'Belum ada riwayat pemeriksaan',
style: TextStyle(
fontSize: 16.0,
color: Colors.grey,
),
),
SizedBox(height: 8.0),
Text(
'Lakukan pemeriksaan untuk melihat riwayat',
style: TextStyle(
fontSize: 14.0,
color: Colors.grey,
),
),
],
),
);
}
return ListView.builder(
itemCount: scanHistory.length,
itemBuilder: (context, index) {
final item = scanHistory[index];
// Menggunakan ScanHistoryCard dengan parameter scanHistoryItem
return ScanHistoryCard(
imagePath: item.imagePath,
diseaseResult: item.diseaseResult,
timestamp: item.timestamp,
confidence: item.confidence,
diseaseId: item.diseaseId,
scanHistoryItem: item, // Menambahkan item untuk fungsi hapus
);
},
);
}),
),
floatingActionButton: FloatingActionButton(
onPressed: controller.startScanning,
backgroundColor: Colors.green,
child: const Icon(
Icons.add_a_photo,
color: Colors.white,
),
tooltip: 'Periksa Baru',
),
);
}
}

View File

@ -0,0 +1,90 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:harvest_guard_app/routes/app_routes.dart';
class SplashScreen extends StatefulWidget {
const SplashScreen({super.key});
@override
State<SplashScreen> createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> {
@override
void initState() {
super.initState();
// Tunggu selama 3 detik kemudian navigasi ke Dashboard dengan AppRoutes
Future.delayed(const Duration(seconds: 3), () {
Get.offNamed(
AppRoutes.dashboard); // Menggunakan konstanta route dari AppRoutes
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: SafeArea(
child: Column(
children: [
// Spacer untuk menjaga tampilan di tengah
const Spacer(flex: 2),
// Logo tanaman menggunakan Image.asset
Center(
child: Column(
children: [
Image.asset(
'assets/images/plant.png',
height: 60,
width: 60,
),
const SizedBox(height: 20),
// Teks Harvest - Guard
const Text(
'Harvest - Guard',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
],
),
),
// Spacer untuk mendorong "Developed by" ke bagian bawah
const Spacer(flex: 3),
// Teks "Developed by"
const Padding(
padding: EdgeInsets.only(bottom: 8.0),
child: Text(
'Developed by',
style: TextStyle(
fontSize: 14,
color: Colors.black,
),
),
),
// Nama developer
const Padding(
padding: EdgeInsets.only(bottom: 32.0),
child: Text(
'Bahrudin Ayub',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
],
),
),
);
}
}

View File

@ -0,0 +1,9 @@
import 'package:get/get.dart';
import 'dashboard_controller.dart';
class DashboardBinding extends Bindings {
@override
void dependencies() {
Get.put(DashboardController());
}
}

View File

@ -0,0 +1,34 @@
import 'package:get/get.dart';
import 'package:harvest_guard_app/periksa/model_controller.dart';
import 'package:harvest_guard_app/routes/app_routes.dart';
class DashboardController extends GetxController {
// User name state
var userName = "Petani".obs;
// Reference to ModelController for scan history
late final ModelController modelController;
@override
void onInit() {
super.onInit();
// Get ModelController instance
if (!Get.isRegistered<ModelController>()) {
Get.put(ModelController());
}
modelController = Get.find<ModelController>();
}
// Fungsi untuk memulai pemindaian dan navigasi ke PeriksaScreen
void startScanning() {
// Navigasi ke PeriksaScreen menggunakan AppRoutes
Get.toNamed(AppRoutes.periksa);
}
// Navigate to scan history detail screen
void navigateToScanHistoryDetail() {
Get.toNamed(AppRoutes.scanHistory);
}
}

View File

@ -0,0 +1,158 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:harvest_guard_app/components/scan_history_card.dart';
import 'package:harvest_guard_app/dashboard/dashboard_controller.dart';
import 'package:intl/intl.dart';
class DashboardScreen extends GetView<DashboardController> {
const DashboardScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Header dengan greeting dan avatar
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// Greeting text dengan nama user
Obx(() => Text(
'Hallo, ${controller.userName.value}',
style: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
)),
// Avatar image
Container(
width: 60,
height: 60,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFFFFD966),
),
child: ClipOval(
child: Image.asset(
'assets/images/avatar.png',
fit: BoxFit.cover,
),
),
),
],
),
const SizedBox(height: 50),
// Periksa kesehatan text
const Text(
'Periksa kesehatan padimu sekarang!',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 16),
// Periksa kesehatan card - hanya navigasi ke PeriksaScreen
GestureDetector(
onTap: controller.startScanning,
child: Image.asset(
'assets/images/main_button.png',
fit: BoxFit.contain,
),
),
const SizedBox(height: 20),
// Riwayat kesehatan section
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'Riwayat kesehatan',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
),
),
// Selengkapnya text button
GestureDetector(
onTap: controller.navigateToScanHistoryDetail,
child: const Text(
'Selengkapnya',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.blue,
),
),
),
],
),
const SizedBox(height: 16),
// Riwayat scan list
Expanded(
child: Obx(() {
final scanHistory = controller.modelController.scanHistoryList;
if (scanHistory.isEmpty) {
return const Center(
child: Text(
'Belum ada riwayat pemeriksaan',
style: TextStyle(
fontSize: 16,
color: Colors.grey,
),
),
);
}
// Tampilkan 3 history terbaru saja
final recentHistory = scanHistory.length > 3
? scanHistory.sublist(0, 3)
: scanHistory;
return ListView.builder(
itemCount: recentHistory.length,
itemBuilder: (context, index) {
final item = recentHistory[index];
return ScanHistoryCard(
imagePath: item.imagePath,
diseaseResult: item.diseaseResult,
timestamp: item.timestamp,
confidence: item.confidence,
diseaseId: item.diseaseId,
scanHistoryItem: item, // Menambahkan item scan history untuk fungsi hapus
);
},
);
}),
),
],
),
),
),
floatingActionButton: FloatingActionButton(
onPressed: controller.startScanning,
backgroundColor: Colors.green,
child: const Icon(
Icons.camera_alt,
color: Colors.white,
),
tooltip: 'Periksa Baru',
),
);
}
}

View File

@ -0,0 +1,30 @@
import 'package:hive/hive.dart';
import 'dart:io';
part 'scan_history_model.g.dart'; // Ini wajib ada
@HiveType(typeId: 1)
class ScanHistory extends HiveObject {
@HiveField(0)
final String imagePath;
@HiveField(1)
final String diseaseResult;
@HiveField(2)
final DateTime timestamp;
@HiveField(3)
final double confidence;
@HiveField(4)
final String diseaseId;
ScanHistory({
required this.imagePath,
required this.diseaseResult,
required this.timestamp,
required this.confidence,
required this.diseaseId,
});
}

View File

@ -0,0 +1,53 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'scan_history_model.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class ScanHistoryAdapter extends TypeAdapter<ScanHistory> {
@override
final int typeId = 1;
@override
ScanHistory read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return ScanHistory(
imagePath: fields[0] as String,
diseaseResult: fields[1] as String,
timestamp: fields[2] as DateTime,
confidence: fields[3] as double,
diseaseId: fields[4] as String,
);
}
@override
void write(BinaryWriter writer, ScanHistory obj) {
writer
..writeByte(5)
..writeByte(0)
..write(obj.imagePath)
..writeByte(1)
..write(obj.diseaseResult)
..writeByte(2)
..write(obj.timestamp)
..writeByte(3)
..write(obj.confidence)
..writeByte(4)
..write(obj.diseaseId);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is ScanHistoryAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}

38
lib/main.dart Normal file
View File

@ -0,0 +1,38 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:harvest_guard_app/data/scan_history_model.dart';
import 'package:harvest_guard_app/routes/app_routes.dart';
import 'package:hive/hive.dart';
import 'package:hive_flutter/adapters.dart';
Future<void> main() async {
runApp(const MainApp());
WidgetsFlutterBinding.ensureInitialized();
// Initialize Hive
await Hive.initFlutter();
// Register adapters
Hive.registerAdapter(ScanHistoryAdapter());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
return GetMaterialApp(
debugShowCheckedModeBanner: false,
title: 'Harvest Guard',
theme: ThemeData(
primarySwatch: Colors.green,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
initialRoute: AppRoutes.splash,
getPages: AppRoutes.pages,
);
}
}

View File

@ -0,0 +1,396 @@
import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'package:get/get.dart';
import 'package:harvest_guard_app/data/scan_history_model.dart';
import 'package:tflite_flutter/tflite_flutter.dart';
import 'package:image/image.dart' as img;
import 'package:hive/hive.dart';
import 'package:path_provider/path_provider.dart';
class ModelController extends GetxController {
Interpreter? _interpreter;
// Status model
RxBool isModelLoaded = false.obs;
RxString modelError = "".obs;
// Scan history box reference
late Box<ScanHistory> scanHistoryBox;
RxList<ScanHistory> scanHistoryList = <ScanHistory>[].obs;
@override
void onInit() {
super.onInit();
initHive();
loadModel();
}
// Initialize Hive and open box
Future<void> initHive() async {
try {
final appDir = await getApplicationDocumentsDirectory();
Hive.init(appDir.path);
// Register the ScanHistory adapter if not already registered
if (!Hive.isAdapterRegistered(1)) {
Hive.registerAdapter(ScanHistoryAdapter());
}
// Open the scan history box
scanHistoryBox = await Hive.openBox<ScanHistory>('scan_history');
// Load scan history into observable list
loadScanHistory();
print('Hive initialized successfully');
} catch (e) {
print('Failed to initialize Hive: ${e.toString()}');
Get.snackbar(
'Error',
'Failed to initialize local storage: ${e.toString()}',
snackPosition: SnackPosition.BOTTOM,
backgroundColor: Colors.red,
colorText: Colors.white,
);
}
}
// Load scan history from Hive box
void loadScanHistory() {
scanHistoryList.value = scanHistoryBox.values.toList();
// Sort by timestamp (newest first)
scanHistoryList.sort((a, b) => b.timestamp.compareTo(a.timestamp));
}
// Save scan result to Hive
Future<void> saveScanResult(File imageFile, Map<String, dynamic> prediction) async {
try {
// Create a copy of the image in app's document directory for persistence
final appDir = await getApplicationDocumentsDirectory();
final fileName = 'scan_${DateTime.now().millisecondsSinceEpoch}.jpg';
final savedImagePath = '${appDir.path}/$fileName';
// Copy image file
final savedImageFile = await imageFile.copy(savedImagePath);
// Create scan history entry
final scanHistory = ScanHistory(
imagePath: savedImageFile.path,
diseaseResult: prediction['disease'],
timestamp: DateTime.now(),
confidence: prediction['confidence'],
diseaseId: prediction['diseaseId'],
);
// Save to Hive box
await scanHistoryBox.add(scanHistory);
// Refresh the list
loadScanHistory();
print('Scan result saved successfully');
} catch (e) {
print('Failed to save scan result: ${e.toString()}');
Get.snackbar(
'Error',
'Failed to save scan result: ${e.toString()}',
snackPosition: SnackPosition.BOTTOM,
backgroundColor: Colors.red,
colorText: Colors.white,
);
}
}
// Delete scan history item
Future<void> deleteScanHistory(ScanHistory history) async {
try {
// Delete the image file
final imageFile = File(history.imagePath);
if (await imageFile.exists()) {
await imageFile.delete();
}
// Delete from Hive
await history.delete();
// Refresh the list
loadScanHistory();
print('Scan history deleted successfully');
} catch (e) {
print('Failed to delete scan history: ${e.toString()}');
Get.snackbar(
'Error',
'Failed to delete scan history: ${e.toString()}',
snackPosition: SnackPosition.BOTTOM,
backgroundColor: Colors.red,
colorText: Colors.white,
);
}
}
// Fungsi untuk memuat model TensorFlow Lite
Future<void> loadModel() async {
print('Memulai pemuatan model...');
try {
// Cek apakah file model ada
final modelPath = 'assets/model/rice_disease_model.tflite';
final assetFile = await rootBundle.load(modelPath);
print('Model file ditemukan! Ukuran: ${assetFile.lengthInBytes} bytes');
// Opsi yang lebih permisif untuk model yang lebih baru
final interpreterOptions = InterpreterOptions()
..useNnApiForAndroid =
false // Matikan NNAPI untuk kecocokan yang lebih baik
..threads = 2; // Batasi thread untuk stabilitas
_interpreter = await Interpreter.fromAsset(
modelPath,
options: interpreterOptions,
);
// Cetak informasi tentang model
print('Model berhasil dimuat!');
print(
'Input Tensor Shapes: ${_interpreter!.getInputTensors().map((t) => t.shape).toList()}');
print(
'Output Tensor Shapes: ${_interpreter!.getOutputTensors().map((t) => t.shape).toList()}');
isModelLoaded.value = true;
} catch (e) {
modelError.value = e.toString();
print('Gagal memuat model: ${e.toString()}');
// Coba cara alternatif loading model
try {
print('Mencoba cara alternatif loading model...');
final modelPath = 'assets/model/rice_disease_model.tflite';
// Coba dengan opsi yang lebih permisif
final interpreterOptions = InterpreterOptions()
..useNnApiForAndroid = false
..threads = 1;
// Baca file model sebagai ByteData dan konversi ke Uint8List
final byteData = await rootBundle.load(modelPath);
print(
'Model file loaded as ByteData, size: ${byteData.lengthInBytes} bytes');
// Konversi ByteData ke Uint8List yang dibutuhkan oleh Interpreter.fromBuffer
final buffer = byteData.buffer;
final uint8List = Uint8List.view(
buffer, byteData.offsetInBytes, byteData.lengthInBytes);
_interpreter = await Interpreter.fromBuffer(
uint8List,
options: interpreterOptions,
);
print('Model berhasil dimuat dengan cara alternatif!');
isModelLoaded.value = true;
} catch (e2) {
print('Tetap gagal memuat model: ${e2.toString()}');
modelError.value += "\n\nPercobaan kedua: ${e2.toString()}";
Get.snackbar(
'Error',
'Gagal memuat model: ${e.toString()}',
snackPosition: SnackPosition.BOTTOM,
backgroundColor: Colors.red,
colorText: Colors.white,
duration: Duration(seconds: 5),
);
}
}
}
Future<Map<String, Object>> analyzeImage(File imageFile) async {
if (_interpreter == null || !isModelLoaded.value) {
print('Model tidak dimuat, coba dimuat ulang...');
await loadModel();
if (_interpreter == null) {
print('Gagal memuat model, tidak bisa melanjutkan analisis');
return {
'status': 'error',
'message':
'Model tidak dapat dimuat. Detail error:\n${modelError.value}'
};
}
}
print('Memulai analisis gambar...');
try {
final processedImage = await loadAndPreprocessImage(imageFile);
print('Ukuran tensor input: ${processedImage.runtimeType}');
// Siapkan tensor output berdasarkan bentuk model
var outputShape = _interpreter!.getOutputTensors().first.shape;
print('Bentuk tensor output: $outputShape');
var output = List<double>.filled(outputShape.reduce((a, b) => a * b), 0.0)
.reshape(outputShape);
print('Tensor output dibuat, ukuran: ${output.length}');
// Jalankan model
print('Menjalankan inferensi...');
_interpreter?.run(processedImage, output);
print('Analisis selesai, hasil prediksi: ${output[0]}');
// Ambil kelas dengan nilai tertinggi sebagai hasil prediksi
// Eksplisit mengkonversi output ke List<double> untuk memastikan tipe data yang benar
List<double> outputList = List<double>.from(output[0]);
// Temukan indeks dengan nilai tertinggi
int predictedClass = findMaxIndex(outputList);
print(
'Predicted class index: $predictedClass with confidence: ${outputList[predictedClass]}');
// Dapatkan hasil prediksi
final predictionResult =
getDiseasePrediction(predictedClass, outputList[predictedClass]);
// Save scan result to Hive
await saveScanResult(imageFile, predictionResult);
return {'status': 'success', 'result': predictionResult};
} catch (e) {
print('Gagal menganalisis gambar: ${e.toString()}');
return {'status': 'error', 'message': 'Gagal menganalisis gambar: $e'};
}
}
// Fungsi pembantu untuk menemukan indeks dengan nilai tertinggi
int findMaxIndex(List<double> list) {
double maxValue = list[0];
int maxIndex = 0;
for (int i = 1; i < list.length; i++) {
if (list[i] > maxValue) {
maxValue = list[i];
maxIndex = i;
}
}
return maxIndex;
}
// Mendapatkan prediksi penyakit berdasarkan indeks kelas
Map<String, dynamic> getDiseasePrediction(
int predictedClass, double confidence) {
String diseaseResult = '';
String routeName = '';
String diseaseId = '';
// Gunakan class mapping yang benar berdasarkan data yang Anda berikan
switch (predictedClass) {
case 0:
diseaseResult = 'Hawar Daun Bakteri';
routeName = '/hawar-daun';
diseaseId = 'hawar_daun';
break;
case 1:
diseaseResult = 'Bercak Coklat';
routeName = '/bercak-coklat';
diseaseId = 'bercak_coklat';
break;
case 2:
diseaseResult = 'Sehat';
routeName = '/sehat';
diseaseId = 'sehat';
break;
case 3:
diseaseResult = 'Hispa';
routeName = '/hispa';
diseaseId = 'hispa';
break;
default:
diseaseResult = 'Tidak Teridentifikasi';
routeName = '/tidak-teridentifikasi';
diseaseId = 'tidak_teridentifikasi';
break;
}
return {
'disease': diseaseResult,
'confidence': confidence,
'routeName': routeName,
'diseaseId': diseaseId
};
}
Future<dynamic> loadAndPreprocessImage(File image) async {
print('Memuat dan memproses gambar...');
final imageInput = await loadImage(image);
final imagePreprocessed = preprocessImage(imageInput);
print('Gambar berhasil diproses');
return imagePreprocessed;
}
Future<img.Image> loadImage(File imageFile) async {
print('Membaca gambar dari file...');
final bytes = await imageFile.readAsBytes();
final image = img.decodeImage(Uint8List.fromList(bytes));
if (image == null) {
print('Gagal membaca gambar');
throw Exception('Gagal membaca gambar');
}
print('Gambar berhasil dibaca');
return image;
}
// Modified preprocessing function to add batch dimension
List<List<List<List<double>>>> preprocessImage(img.Image imageInput) {
print('Memulai preprocessing gambar...');
// Resize gambar ke ukuran 224x224 (sesuai kebutuhan model)
img.Image resizedImage =
img.copyResize(imageInput, width: 224, height: 224);
// Buat tensor 4D [batch, height, width, channel] dengan batch = 1
List<List<List<List<double>>>> normalized = [
List.generate(
resizedImage.height,
(y) => List.generate(
resizedImage.width,
(x) {
// Ambil pixel di posisi (x,y)
final pixel = resizedImage.getPixel(x, y);
// Ekstrak nilai RGB menggunakan properti langsung dari objek pixel
final double rNorm = pixel.r / 255.0;
final double gNorm = pixel.g / 255.0;
final double bNorm = pixel.b / 255.0;
// Return [r, g, b] untuk setiap pixel
return [rNorm, gNorm, bNorm];
},
),
)
];
print(
'Preprocessing selesai, dimensi output: 1x${normalized[0].length}x${normalized[0][0].length}x${normalized[0][0][0].length}');
return normalized;
}
@override
void onClose() {
if (_interpreter != null) {
try {
_interpreter!.close();
print('Interpreter berhasil ditutup');
} catch (e) {
print('Error saat menutup interpreter: $e');
}
}
// Close Hive box
scanHistoryBox.close();
super.onClose();
}
}

View File

@ -0,0 +1,9 @@
import 'package:get/get.dart';
import 'periksa_controller.dart';
class PeriksaBinding extends Bindings {
@override
void dependencies() {
Get.put(PeriksaController());
}
}

View File

@ -0,0 +1,226 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:image_cropper/image_cropper.dart';
import 'package:image_picker/image_picker.dart';
import 'model_controller.dart';
class PeriksaController extends GetxController {
Rx<File?> selectedImage = Rx<File?>(null);
Rx<CroppedFile?> croppedFile = Rx<CroppedFile?>(null);
final ImagePicker _picker = ImagePicker();
// Referensi ke controller model
late final ModelController modelController;
@override
void onInit() {
super.onInit();
// Cek apakah ModelController sudah terdaftar
if (!Get.isRegistered<ModelController>()) {
// Jika belum, daftarkan ModelController
Get.put(ModelController());
}
// Dapatkan reference ke ModelController
modelController = Get.find<ModelController>();
}
Future<void> takePhoto() async {
try {
print('Mengambil foto...');
final XFile? photo = await _picker.pickImage(source: ImageSource.camera);
if (photo != null) {
selectedImage.value = File(photo.path);
print('Foto berhasil diambil!');
await cropImage();
}
} catch (e) {
print('Gagal mengambil foto: ${e.toString()}');
Get.snackbar(
'Error',
'Gagal mengambil foto: ${e.toString()}',
snackPosition: SnackPosition.BOTTOM,
backgroundColor: Colors.red,
colorText: Colors.white,
);
}
}
Future<void> pickFromGallery() async {
try {
print('Memilih gambar dari galeri...');
final XFile? image = await _picker.pickImage(source: ImageSource.gallery);
if (image != null) {
selectedImage.value = File(image.path);
print('Gambar berhasil dipilih!');
await cropImage();
}
} catch (e) {
print('Gagal memilih gambar: ${e.toString()}');
Get.snackbar(
'Error',
'Gagal memilih gambar: ${e.toString()}',
snackPosition: SnackPosition.BOTTOM,
backgroundColor: Colors.red,
colorText: Colors.white,
);
}
}
Future<void> cropImage() async {
if (selectedImage.value != null) {
try {
print('Memotong gambar...');
final croppedImage = await ImageCropper().cropImage(
sourcePath: selectedImage.value!.path,
compressFormat: ImageCompressFormat.jpg,
compressQuality: 90,
uiSettings: [
AndroidUiSettings(
toolbarTitle: 'Potong Gambar',
toolbarColor: Colors.green,
toolbarWidgetColor: Colors.white,
initAspectRatio: CropAspectRatioPreset.original,
lockAspectRatio: false,
aspectRatioPresets: [
CropAspectRatioPreset.original,
CropAspectRatioPreset.square,
CropAspectRatioPreset.ratio4x3,
CropAspectRatioPreset.ratio16x9,
],
),
IOSUiSettings(
title: 'Potong Gambar',
aspectRatioPresets: [
CropAspectRatioPreset.original,
CropAspectRatioPreset.square,
CropAspectRatioPreset.ratio4x3,
CropAspectRatioPreset.ratio16x9,
],
),
WebUiSettings(
context: Get.context!,
presentStyle: WebPresentStyle.dialog,
size: const CropperSize(
width: 520,
height: 520,
),
),
],
);
if (croppedImage != null) {
croppedFile.value = croppedImage;
selectedImage.value = File(croppedImage.path);
print('Gambar berhasil dipotong!');
await processImageAnalysis();
}
} catch (e) {
print('Gagal memotong gambar: ${e.toString()}');
Get.snackbar(
'Error',
'Gagal memotong gambar: ${e.toString()}',
snackPosition: SnackPosition.BOTTOM,
backgroundColor: Colors.red,
colorText: Colors.white,
);
}
}
}
Future<void> processImageAnalysis() async {
if (selectedImage.value == null) {
print('Gambar tidak dipilih');
Get.snackbar(
'Error',
'Silahkan pilih gambar terlebih dahulu',
snackPosition: SnackPosition.BOTTOM,
backgroundColor: Colors.red,
colorText: Colors.white,
);
return;
}
print('Memulai analisis gambar...');
Get.dialog(
const Center(child: CircularProgressIndicator()),
barrierDismissible: false,
);
// Gunakan controller model untuk analisis
final result = await modelController.analyzeImage(selectedImage.value!);
// Tutup dialog loading
Get.back();
if (result['status'] == 'error') {
// Tampilkan dialog error
Get.dialog(
AlertDialog(
title: const Text('Error'),
content: Text(result['message'] as String),
actions: [
TextButton(
onPressed: () => Get.back(),
child: const Text('OK'),
),
],
),
);
} else {
// Tampilkan hasil analisis
final prediction = result['result'] as Map<String, dynamic>;
showResultDialog(prediction);
}
}
void showResultDialog(Map<String, dynamic> prediction) {
// Tampilkan dialog singkat dengan hasil prediksi
Get.dialog(
AlertDialog(
title: const Text('Hasil Analisis'),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Prediksi: ${prediction['disease']}',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16)),
const SizedBox(height: 12),
Text(
'Tingkat keyakinan: ${(prediction['confidence'] * 100).toStringAsFixed(2)}%',
style: TextStyle(fontSize: 14, color: Colors.grey[600])),
],
),
actions: [
TextButton(
onPressed: () => Get.back(),
child: const Text('Tutup'),
),
TextButton(
onPressed: () {
// Tutup dialog
Get.back();
// Arahkan ke halaman detail berdasarkan hasil prediksi
navigateToDetailPage(prediction);
},
child: const Text('Lihat Detail'),
),
],
),
);
}
void navigateToDetailPage(Map<String, dynamic> prediction) {
// Ambil routeName dari hasil prediksi
final String routeName = prediction['routeName'] as String;
// Navigasi ke halaman yang sesuai dengan argumen
Get.toNamed(routeName, arguments: {
'prediction': prediction,
'imagePath': selectedImage.value?.path
});
}
}

View File

@ -0,0 +1,136 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:harvest_guard_app/periksa/periksa_controller.dart';
class PeriksaScreen extends StatelessWidget {
const PeriksaScreen({super.key});
@override
Widget build(BuildContext context) {
final PeriksaController controller = Get.put(PeriksaController());
return Scaffold(
appBar: AppBar(
title: const Text('Periksa Kesehatan Padi'),
leading: IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () => Get.back(),
),
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 20),
// Judul utama
const Center(
child: Text(
'Periksa Kesehatan\nPadimu Sekarang',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 40),
// Subtitle
const Center(
child: Text(
'Foto di bagian daun padi',
style: TextStyle(
fontSize: 16,
color: Colors.black87,
),
),
),
const SizedBox(height: 20),
// Tombol Ambil Foto (lingkaran hijau)
GestureDetector(
onTap: () => controller.takePhoto(),
child: Container(
width: 150,
height: 150,
decoration: const BoxDecoration(
color: Colors.green,
shape: BoxShape.circle,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Ikon kamera dengan border putih
Container(
padding: const EdgeInsets.all(8),
child: const Icon(
Icons.center_focus_strong_outlined,
color: Colors.white,
size: 40,
),
),
const SizedBox(height: 5),
const Text(
'Ambil Foto',
style: TextStyle(
color: Colors.white,
fontSize: 16,
),
),
],
),
),
),
const SizedBox(height: 30),
const Text(
'atau',
style: TextStyle(
fontSize: 16,
color: Colors.black54,
),
),
const SizedBox(height: 20),
// Tombol Pilih dari Galeri
GestureDetector(
onTap: () => controller.pickFromGallery(),
child: Container(
width: double.infinity,
height: 60,
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.circular(10),
),
child: const Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'Pilih dari Galeri\n*JPG, JPEG, PNG',
style: TextStyle(
fontSize: 16,
color: Colors.black87,
),
),
const Icon(
Icons.insert_drive_file_outlined,
size: 30,
color: Colors.black87,
),
],
),
),
),
),
],
),
),
),
);
}
}

View File

@ -0,0 +1,80 @@
import 'package:get/get.dart';
import 'package:harvest_guard_app/components/bacterial_leaf_blight.dart';
import 'package:harvest_guard_app/components/brown_spot_result.dart';
import 'package:harvest_guard_app/components/healty_result.dart';
import 'package:harvest_guard_app/components/hispa_result.dart';
import 'package:harvest_guard_app/components/no_result.dart';
import 'package:harvest_guard_app/components/scan_history_screen.dart';
import 'package:harvest_guard_app/components/splashscreen.dart';
import 'package:harvest_guard_app/dashboard/dashboard_binding.dart';
import 'package:harvest_guard_app/dashboard/dashboard_page.dart';
import 'package:harvest_guard_app/periksa/periksa_binding.dart';
import 'package:harvest_guard_app/periksa/periksa_controller.dart';
import 'package:harvest_guard_app/periksa/periksa_page.dart';
class AppRoutes {
// Route names sebagai konstanta
static const String splash = '/';
static const String dashboard = '/dashboard';
static const String periksa = '/periksa';
static const String scanHistory = '/scan-history';
// Daftar route aplikasi
static final List<GetPage> pages = [
GetPage(
name: splash,
page: () => const SplashScreen(),
),
GetPage(
name: dashboard,
page: () => const DashboardScreen(),
binding: DashboardBinding(),
),
GetPage(
name: periksa,
page: () => const PeriksaScreen(),
binding: PeriksaBinding(),
),
GetPage(
name: '/hawar-daun',
page: () => HawarDaunPage(),
transition: Transition.rightToLeft,
transitionDuration: Duration(milliseconds: 300),
),
GetPage(
name: '/bercak-coklat',
page: () => BercakCoklatPage(),
transition: Transition.rightToLeft,
transitionDuration: Duration(milliseconds: 300),
),
GetPage(
name: '/sehat',
page: () => SehatPage(),
transition: Transition.rightToLeft,
transitionDuration: Duration(milliseconds: 300),
),
GetPage(
name: '/hispa',
page: () => HispaPage(),
transition: Transition.rightToLeft,
transitionDuration: Duration(milliseconds: 300),
),
GetPage(
name: '/tidak-teridentifikasi',
page: () => TidakTeridentifikasiPage(),
transition: Transition.rightToLeft,
transitionDuration: Duration(milliseconds: 300),
),
GetPage(
name: AppRoutes.periksa,
page: () => const PeriksaScreen(),
binding: BindingsBuilder(() {
Get.put(PeriksaController());
}),
),
GetPage(
name: AppRoutes.scanHistory,
page: () => const ScanHistoryScreen(),
),
];
}

1
linux/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
flutter/ephemeral

145
linux/CMakeLists.txt Normal file
View File

@ -0,0 +1,145 @@
# Project-level configuration.
cmake_minimum_required(VERSION 3.10)
project(runner LANGUAGES CXX)
# The name of the executable created for the application. Change this to change
# the on-disk name of your application.
set(BINARY_NAME "harvest_guard_app")
# The unique GTK application identifier for this application. See:
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
set(APPLICATION_ID "com.example.harvest_guard_app")
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.
cmake_policy(SET CMP0063 NEW)
# Load bundled libraries from the lib/ directory relative to the binary.
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
# Root filesystem for cross-building.
if(FLUTTER_TARGET_PLATFORM_SYSROOT)
set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endif()
# Define build configuration options.
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Debug" CACHE
STRING "Flutter build mode" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Profile" "Release")
endif()
# Compilation settings that should be applied to most targets.
#
# Be cautious about adding new options here, as plugins use this function by
# default. In most cases, you should add new options to specific targets instead
# of modifying this function.
function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_14)
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
endfunction()
# Flutter library and tool build rules.
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
add_subdirectory(${FLUTTER_MANAGED_DIR})
# System-level dependencies.
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
# Define the application target. To change its name, change BINARY_NAME above,
# not the value here, or `flutter run` will no longer work.
#
# Any new source files that you add to the application should be added here.
add_executable(${BINARY_NAME}
"main.cc"
"my_application.cc"
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
)
# Apply the standard set of build settings. This can be removed for applications
# that need different build settings.
apply_standard_settings(${BINARY_NAME})
# Add dependency libraries. Add any application-specific dependencies here.
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
# Run the Flutter tool portions of the build. This must not be removed.
add_dependencies(${BINARY_NAME} flutter_assemble)
# Only the install-generated bundle's copy of the executable will launch
# correctly, since the resources must in the right relative locations. To avoid
# people trying to run the unbundled copy, put it in a subdirectory instead of
# the default top-level location.
set_target_properties(${BINARY_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
)
# Generated plugin build rules, which manage building the plugins and adding
# them to the application.
include(flutter/generated_plugins.cmake)
# === Installation ===
# By default, "installing" just makes a relocatable bundle in the build
# directory.
set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
endif()
# Start with a clean build bundle directory every time.
install(CODE "
file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
" COMPONENT Runtime)
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
COMPONENT Runtime)
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
install(FILES "${bundled_library}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endforeach(bundled_library)
# Copy the native assets provided by the build.dart from all packages.
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/")
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
# Fully re-copy the assets directory on each build to avoid having stale files
# from a previous install.
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
install(CODE "
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
" COMPONENT Runtime)
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
# Install the AOT library on non-Debug builds only.
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endif()

View File

@ -0,0 +1,88 @@
# This file controls Flutter-level build steps. It should not be edited.
cmake_minimum_required(VERSION 3.10)
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
# Configuration provided via flutter tool.
include(${EPHEMERAL_DIR}/generated_config.cmake)
# TODO: Move the rest of this into files in ephemeral. See
# https://github.com/flutter/flutter/issues/57146.
# Serves the same purpose as list(TRANSFORM ... PREPEND ...),
# which isn't available in 3.10.
function(list_prepend LIST_NAME PREFIX)
set(NEW_LIST "")
foreach(element ${${LIST_NAME}})
list(APPEND NEW_LIST "${PREFIX}${element}")
endforeach(element)
set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
endfunction()
# === Flutter Library ===
# System-level dependencies.
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
# Published to parent scope for install step.
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
list(APPEND FLUTTER_LIBRARY_HEADERS
"fl_basic_message_channel.h"
"fl_binary_codec.h"
"fl_binary_messenger.h"
"fl_dart_project.h"
"fl_engine.h"
"fl_json_message_codec.h"
"fl_json_method_codec.h"
"fl_message_codec.h"
"fl_method_call.h"
"fl_method_channel.h"
"fl_method_codec.h"
"fl_method_response.h"
"fl_plugin_registrar.h"
"fl_plugin_registry.h"
"fl_standard_message_codec.h"
"fl_standard_method_codec.h"
"fl_string_codec.h"
"fl_value.h"
"fl_view.h"
"flutter_linux.h"
)
list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
add_library(flutter INTERFACE)
target_include_directories(flutter INTERFACE
"${EPHEMERAL_DIR}"
)
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
target_link_libraries(flutter INTERFACE
PkgConfig::GTK
PkgConfig::GLIB
PkgConfig::GIO
)
add_dependencies(flutter flutter_assemble)
# === Flutter tool backend ===
# _phony_ is a non-existent file to force this command to run every time,
# since currently there's no way to get a full input/output list from the
# flutter tool.
add_custom_command(
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/_phony_
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
"${FLUTTER_LIBRARY}"
${FLUTTER_LIBRARY_HEADERS}
)

View File

@ -0,0 +1,15 @@
//
// Generated file. Do not edit.
//
// clang-format off
#include "generated_plugin_registrant.h"
#include <file_selector_linux/file_selector_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
}

View File

@ -0,0 +1,15 @@
//
// Generated file. Do not edit.
//
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_
#include <flutter_linux/flutter_linux.h>
// Registers Flutter plugins.
void fl_register_plugins(FlPluginRegistry* registry);
#endif // GENERATED_PLUGIN_REGISTRANT_

View File

@ -0,0 +1,25 @@
#
# Generated file, do not edit.
#
list(APPEND FLUTTER_PLUGIN_LIST
file_selector_linux
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
tflite_flutter
)
set(PLUGIN_BUNDLED_LIBRARIES)
foreach(plugin ${FLUTTER_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)

6
linux/main.cc Normal file
View File

@ -0,0 +1,6 @@
#include "my_application.h"
int main(int argc, char** argv) {
g_autoptr(MyApplication) app = my_application_new();
return g_application_run(G_APPLICATION(app), argc, argv);
}

124
linux/my_application.cc Normal file
View File

@ -0,0 +1,124 @@
#include "my_application.h"
#include <flutter_linux/flutter_linux.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
#include "flutter/generated_plugin_registrant.h"
struct _MyApplication {
GtkApplication parent_instance;
char** dart_entrypoint_arguments;
};
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
// Implements GApplication::activate.
static void my_application_activate(GApplication* application) {
MyApplication* self = MY_APPLICATION(application);
GtkWindow* window =
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
// Use a header bar when running in GNOME as this is the common style used
// by applications and is the setup most users will be using (e.g. Ubuntu
// desktop).
// If running on X and not using GNOME then just use a traditional title bar
// in case the window manager does more exotic layout, e.g. tiling.
// If running on Wayland assume the header bar will work (may need changing
// if future cases occur).
gboolean use_header_bar = TRUE;
#ifdef GDK_WINDOWING_X11
GdkScreen* screen = gtk_window_get_screen(window);
if (GDK_IS_X11_SCREEN(screen)) {
const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
use_header_bar = FALSE;
}
}
#endif
if (use_header_bar) {
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
gtk_widget_show(GTK_WIDGET(header_bar));
gtk_header_bar_set_title(header_bar, "harvest_guard_app");
gtk_header_bar_set_show_close_button(header_bar, TRUE);
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
} else {
gtk_window_set_title(window, "harvest_guard_app");
}
gtk_window_set_default_size(window, 1280, 720);
gtk_widget_show(GTK_WIDGET(window));
g_autoptr(FlDartProject) project = fl_dart_project_new();
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
FlView* view = fl_view_new(project);
gtk_widget_show(GTK_WIDGET(view));
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
gtk_widget_grab_focus(GTK_WIDGET(view));
}
// Implements GApplication::local_command_line.
static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) {
MyApplication* self = MY_APPLICATION(application);
// Strip out the first argument as it is the binary name.
self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
g_autoptr(GError) error = nullptr;
if (!g_application_register(application, nullptr, &error)) {
g_warning("Failed to register: %s", error->message);
*exit_status = 1;
return TRUE;
}
g_application_activate(application);
*exit_status = 0;
return TRUE;
}
// Implements GApplication::startup.
static void my_application_startup(GApplication* application) {
//MyApplication* self = MY_APPLICATION(object);
// Perform any actions required at application startup.
G_APPLICATION_CLASS(my_application_parent_class)->startup(application);
}
// Implements GApplication::shutdown.
static void my_application_shutdown(GApplication* application) {
//MyApplication* self = MY_APPLICATION(object);
// Perform any actions required at application shutdown.
G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application);
}
// Implements GObject::dispose.
static void my_application_dispose(GObject* object) {
MyApplication* self = MY_APPLICATION(object);
g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
}
static void my_application_class_init(MyApplicationClass* klass) {
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
G_APPLICATION_CLASS(klass)->startup = my_application_startup;
G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown;
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
}
static void my_application_init(MyApplication* self) {}
MyApplication* my_application_new() {
return MY_APPLICATION(g_object_new(my_application_get_type(),
"application-id", APPLICATION_ID,
"flags", G_APPLICATION_NON_UNIQUE,
nullptr));
}

18
linux/my_application.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef FLUTTER_MY_APPLICATION_H_
#define FLUTTER_MY_APPLICATION_H_
#include <gtk/gtk.h>
G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
GtkApplication)
/**
* my_application_new:
*
* Creates a new Flutter-based application.
*
* Returns: a new #MyApplication.
*/
MyApplication* my_application_new();
#endif // FLUTTER_MY_APPLICATION_H_

7
macos/.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
# Flutter-related
**/Flutter/ephemeral/
**/Pods/
# Xcode-related
**/dgph
**/xcuserdata/

View File

@ -0,0 +1 @@
#include "ephemeral/Flutter-Generated.xcconfig"

Some files were not shown because too many files have changed in this diff Show More