first commit

This commit is contained in:
johanindra 2026-05-22 18:50:58 +07:00
commit c3591bbd52
172 changed files with 9270 additions and 0 deletions

45
.gitignore vendored Normal file
View File

@ -0,0 +1,45 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
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-dependencies
.pub-cache/
.pub/
/build/
/coverage/
# 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: "8b872868494e429d94fa06dca855c306438b22c0"
channel: "stable"
project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 8b872868494e429d94fa06dca855c306438b22c0
base_revision: 8b872868494e429d94fa06dca855c306438b22c0
- platform: android
create_revision: 8b872868494e429d94fa06dca855c306438b22c0
base_revision: 8b872868494e429d94fa06dca855c306438b22c0
- platform: ios
create_revision: 8b872868494e429d94fa06dca855c306438b22c0
base_revision: 8b872868494e429d94fa06dca855c306438b22c0
- platform: linux
create_revision: 8b872868494e429d94fa06dca855c306438b22c0
base_revision: 8b872868494e429d94fa06dca855c306438b22c0
- platform: macos
create_revision: 8b872868494e429d94fa06dca855c306438b22c0
base_revision: 8b872868494e429d94fa06dca855c306438b22c0
- platform: web
create_revision: 8b872868494e429d94fa06dca855c306438b22c0
base_revision: 8b872868494e429d94fa06dca855c306438b22c0
- platform: windows
create_revision: 8b872868494e429d94fa06dca855c306438b22c0
base_revision: 8b872868494e429d94fa06dca855c306438b22c0
# 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'

16
README.md Normal file
View File

@ -0,0 +1,16 @@
# coffescan
A new Flutter project.
## Getting Started
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

28
analysis_options.yaml Normal file
View File

@ -0,0 +1,28 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

14
android/.gitignore vendored Normal file
View File

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

View File

@ -0,0 +1,64 @@
import java.util.Properties
import java.io.FileInputStream
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")
}
val keystoreProperties = Properties()
val keystorePropertiesFile = rootProject.file("key.properties")
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}
android {
namespace = "com.example.coffescan"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
aaptOptions {
noCompress("tflite")
noCompress("lite")
}
signingConfigs {
create("release") {
keyAlias = keystoreProperties["keyAlias"] as String
keyPassword = keystoreProperties["keyPassword"] as String
storeFile = file(keystoreProperties["storeFile"] as String)
storePassword = keystoreProperties["storePassword"] as String
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.coffescan"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = 26
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}
buildTypes {
release {
signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = false
isShrinkResources = false
}
}
}
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,48 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:label="CoffeeScan"
android:name="${applicationName}"
android:icon="@mipmap/launcher_icon">
<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>
<!-- 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.coffescan
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: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 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>

24
android/build.gradle.kts Normal file
View File

@ -0,0 +1,24 @@
allprojects {
repositories {
google()
mavenCentral()
}
}
val newBuildDir: Directory =
rootProject.layout.buildDirectory
.dir("../../build")
.get()
rootProject.layout.buildDirectory.value(newBuildDir)
subprojects {
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
project.layout.buildDirectory.value(newSubprojectBuildDir)
}
subprojects {
project.evaluationDependsOn(":app")
}
tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}

View File

@ -0,0 +1,2 @@
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=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-8.14-all.zip

View File

@ -0,0 +1,26 @@
pluginManagement {
val flutterSdkPath =
run {
val properties = java.util.Properties()
file("local.properties").inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
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 "8.11.1" apply false
id("org.jetbrains.kotlin.android") version "2.2.20" apply false
}
include(":app")

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
assets/images/bean.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

BIN
assets/images/roasting.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

6
assets/model/label.txt Normal file
View File

@ -0,0 +1,6 @@
Arabika Dark
Arabika Light
Arabika Medium
Robusta Dark
Robusta Light
Robusta Medium

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>13.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 = 13.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.coffescan;
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.coffescan.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.coffescan.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.coffescan.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 = AppIcon;
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 = 13.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 = AppIcon;
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 = 13.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.coffescan;
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.coffescan;
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,101 @@
<?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"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
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"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
enableGPUValidationMode = "1"
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: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 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>CoffeeScan</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>CoffeeScan</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.
}
}

26
lib/main.dart Normal file
View File

@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
import 'routes/app_routes.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'CoffeeScan AI',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFF6F4E37)),
useMaterial3: true,
),
// Menggunakan rute awal dan daftar rute yang sudah kita buat
initialRoute: AppRoutes.splash1,
routes: AppRoutes.getRoutes(),
);
}
}

View File

@ -0,0 +1,15 @@
class PredictionResult {
final String jenisKopi;
final String tingkatRoasting;
final double akurasi;
final List<Map<String, dynamic>> top3Predictions;
final bool isValid;
PredictionResult({
required this.jenisKopi,
required this.tingkatRoasting,
required this.akurasi,
required this.top3Predictions,
required this.isValid,
});
}

View File

@ -0,0 +1,21 @@
import 'package:flutter/material.dart';
import '../screen/splashscreen/splash_screen-1.dart';
import '../screen/splashscreen/splash_screen-2.dart';
import '../widgets/bottom_nav.dart';
import '../screen/home/detail_screen.dart';
class AppRoutes {
static const String splash1 = '/';
static const String splash2 = '/splash2';
static const String mainNav = '/main';
static const String detail = '/detail';
static Map<String, WidgetBuilder> getRoutes() {
return {
splash1: (context) => const SplashMain(),
splash2: (context) => const SplashTwo(),
mainNav: (context) => const MainNavigation(),
detail: (context) => const DetailKopiScreen(),
};
}
}

View File

@ -0,0 +1,362 @@
import 'package:flutter/material.dart';
import '../../widgets/color.dart';
import '../../routes/app_routes.dart';
class BerandaScreen extends StatelessWidget {
final VoidCallback? onCobaSekarang;
const BerandaScreen({super.key, this.onCobaSekarang});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.background,
appBar: AppBar(
backgroundColor: AppColors.cardWhite,
surfaceTintColor: Colors.transparent,
elevation: 1,
title: Row(
children: [
Image.asset(
'assets/images/Logo_Coffee_Scan.png',
width: 30,
errorBuilder: (c, e, s) =>
const Icon(Icons.coffee, color: AppColors.brownMain),
),
const SizedBox(width: 10),
RichText(
text: TextSpan(
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 20,
fontWeight: FontWeight.w900,
),
children: const [
TextSpan(
text: 'Coffee',
style: TextStyle(color: AppColors.brownMain),
),
TextSpan(
text: 'Scan',
style: TextStyle(color: AppColors.greenMain),
),
],
),
),
],
),
),
body: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.fromLTRB(20, 24, 20, 170),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildHeroCard(),
const SizedBox(height: 35),
_buildSectionHeader(Icons.analytics_rounded, "Performa Model"),
const SizedBox(height: 16),
Row(
children: [
_buildStatCard("91.70%", "Accuracy Train"),
const SizedBox(width: 12),
_buildStatCard("88.22%", "Accuracy Valid"),
const SizedBox(width: 12),
_buildStatCard("89.76%", "Accuracy Test"),
],
),
const SizedBox(height: 35),
_buildSectionHeader(
Icons.local_fire_department_rounded,
"Biji Kopi Arabika",
),
const SizedBox(height: 16),
Row(
children: [
_buildCoffeeItem(context, "Arabika Light", "Arabika_light.png"),
const SizedBox(width: 12),
_buildCoffeeItem(
context,
"Arabika Medium",
"Arabika_medium.png",
),
const SizedBox(width: 12),
_buildCoffeeItem(context, "Arabika Dark", "Arabika_dark.png"),
],
),
const SizedBox(height: 35),
_buildSectionHeader(
Icons.local_fire_department_rounded,
"Biji Kopi Robusta",
),
const SizedBox(height: 16),
Row(
children: [
_buildCoffeeItem(context, "Robusta Light", "Robusta_light.png"),
const SizedBox(width: 12),
_buildCoffeeItem(
context,
"Robusta Medium",
"Robusta_medium.png",
),
const SizedBox(width: 12),
_buildCoffeeItem(context, "Robusta Dark", "Robusta_dark.png"),
],
),
],
),
),
);
}
Widget _buildSectionHeader(IconData icon, String title) {
return Row(
children: [
Icon(icon, color: AppColors.brownMain, size: 20),
const SizedBox(width: 8),
Text(
title,
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 18,
fontWeight: FontWeight.w800,
color: AppColors.textDark,
letterSpacing: -0.5,
),
),
],
);
}
Widget _buildHeroCard() {
return Container(
width: double.infinity,
decoration: BoxDecoration(
gradient: const LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Color(0xFF4E342E), AppColors.heroCokelat, Color(0xFF8D6E63)],
stops: [0.0, 0.4, 1.0],
),
borderRadius: BorderRadius.circular(28),
boxShadow: [
BoxShadow(
color: AppColors.heroCokelat.withOpacity(0.3),
blurRadius: 25,
offset: const Offset(0, 15),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(28),
child: Stack(
children: [
Positioned(
right: -50,
bottom: -50,
child: CircleAvatar(
radius: 100,
backgroundColor: Colors.white.withOpacity(0.03),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 22, vertical: 28),
child: Row(
children: [
Expanded(
flex: 3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Kenali 3 tingkat roasting biji kopi robusta dan arabika dengan cepat!",
style: TextStyle(
fontFamily: 'Montserrat',
color: Colors.white,
fontWeight: FontWeight.w800,
fontSize: 15,
height: 1.4,
),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: onCobaSekarang,
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.buttonCream,
foregroundColor: AppColors.textDark,
elevation: 0,
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 12,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Coba Sekarang",
style: TextStyle(
fontFamily: 'Montserrat',
fontWeight: FontWeight.w700,
fontSize: 11,
),
),
const SizedBox(width: 8),
const Icon(Icons.arrow_forward_rounded, size: 14),
],
),
),
],
),
),
const SizedBox(width: 15),
Expanded(
flex: 2,
child: Container(
height: 100,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 15,
offset: const Offset(0, 8),
),
],
),
padding: const EdgeInsets.all(12),
child: Image.asset(
'assets/images/bean.png',
fit: BoxFit.contain,
),
),
),
],
),
),
],
),
),
);
}
Widget _buildStatCard(String value, String label) {
return Expanded(
child: Container(
height: 110,
decoration: BoxDecoration(
color: AppColors.cardWhite,
borderRadius: BorderRadius.circular(24),
border: Border.all(color: Colors.black.withOpacity(0.04)),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.03),
blurRadius: 15,
offset: const Offset(0, 8),
),
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
value,
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 17,
fontWeight: FontWeight.w700,
color: AppColors.greenMain,
),
),
const SizedBox(height: 4),
Text(
label,
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 10,
color: AppColors.textDark.withOpacity(0.5),
fontWeight: FontWeight.w600,
),
),
],
),
),
);
}
Widget _buildCoffeeItem(
BuildContext context,
String title,
String imagePath,
) {
return Expanded(
child: Container(
height: 120,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.04),
blurRadius: 15,
offset: const Offset(0, 8),
),
],
),
child: Material(
color: AppColors.cardWhite,
borderRadius: BorderRadius.circular(24),
child: InkWell(
onTap: () {
Navigator.pushNamed(
context,
AppRoutes.detail,
arguments: {
'title': title,
'imagePath': 'assets/images/$imagePath',
},
);
},
borderRadius: BorderRadius.circular(24),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Hero(
tag: title,
child: Image.asset(
'assets/images/$imagePath',
height: 48,
fit: BoxFit.contain,
errorBuilder: (c, e, s) => const Icon(Icons.coffee),
),
),
const SizedBox(height: 10),
Text(
title.split(" ").last,
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 11,
fontWeight: FontWeight.w700,
color: AppColors.textDark,
),
),
Text(
title.split(" ").first,
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 8,
fontWeight: FontWeight.w500,
color: AppColors.textDark.withOpacity(0.4),
),
),
],
),
),
),
),
);
}
}

View File

@ -0,0 +1,306 @@
import 'package:flutter/material.dart';
import '../../widgets/color.dart';
class DetailKopiScreen extends StatelessWidget {
// Constructor dikosongkan karena data diambil dari ModalRoute arguments
const DetailKopiScreen({super.key});
@override
Widget build(BuildContext context) {
// MENGAMBIL DATA DARI NAVIGASI
final args =
ModalRoute.of(context)!.settings.arguments as Map<String, dynamic>;
final String title = args['title'] ?? 'Detail Kopi';
// final String imagePath = args['imagePath'] ?? '';
final bool isArabika = title.contains("Arabika");
final String level = title.split(" ").last;
return Scaffold(
backgroundColor: AppColors.background,
body: CustomScrollView(
physics: const BouncingScrollPhysics(),
slivers: [
// HEADER DENGAN GAMBAR ROASTING (.JPG)
SliverAppBar(
expandedHeight: 350,
pinned: true,
stretch: true,
backgroundColor: AppColors.brownMain,
leading: Padding(
padding: const EdgeInsets.all(8.0),
child: CircleAvatar(
backgroundColor: Colors.black.withOpacity(0.3),
child: IconButton(
icon: const Icon(
Icons.arrow_back_ios_new,
size: 18,
color: Colors.white,
),
onPressed: () => Navigator.pop(context),
),
),
),
flexibleSpace: FlexibleSpaceBar(
stretchModes: const [StretchMode.zoomBackground],
background: Stack(
fit: StackFit.expand,
children: [
Image.asset(
'assets/images/roasting.jpg',
fit: BoxFit.cover,
errorBuilder: (c, e, s) =>
Container(color: AppColors.heroCokelat),
),
const DecoratedBox(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Colors.transparent, Colors.black54],
),
),
),
Positioned(
bottom: 40,
left: 20,
right: 20,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildBadge(isArabika ? "Arabika" : "Robusta"),
const SizedBox(height: 10),
Text(
title,
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 28,
fontWeight: FontWeight.w700,
color: Colors.white,
shadows: [
Shadow(blurRadius: 10, color: Colors.black),
],
),
),
],
),
),
],
),
),
),
// KONTEN UTAMA
SliverToBoxAdapter(
child: Container(
transform: Matrix4.translationValues(0, -20, 0),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 30),
decoration: const BoxDecoration(
color: AppColors.background,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// STATS CARD (SUHU, RASA, CRACK)
_buildQuickStats(level),
const SizedBox(height: 35),
_buildSectionTitle(Icons.info_outline, "Mengenal Kopi"),
_buildParagraph(
"Kopi merupakan salah satu produk perdagangan dalam sektor pertanian yang memiliki potensi untuk meningkatkan pendapatan negara serta keuntungan bagi para petani dan pengusaha. Keberadaan kopi di Indonesia dimulai pada tahun 1960-an. Kopi termasuk dalam keluarga Rubiaceae dari genus Coffea. Jenis kopi yang dominan ditanam di Indonesia adalah kopi robusta dan arabika.",
),
const SizedBox(height: 25),
_buildSectionTitle(
Icons.grain,
"Karakteristik ${isArabika ? 'Arabika' : 'Robusta'}",
),
_buildParagraph(
isArabika
? "Kopi Arabika dikenal sebagai jenis kopi dengan cita rasa yang unggul dan kandungan kafein yang lebih rendah dibandingkan kopi Robusta. Aroma dari kopi arabika cenderung memiliki rasa yang lebih asam dan menyerupai citrus serta buah-buahan."
: "Kopi Robusta merupakan varietas yang paling banyak dibudidayakan di Indonesia. Biji kopi robusta memberikan aroma yang mirip dengan kacang sebelum mengalami proses sangrai. Kualitasnya sangat dipengaruhi oleh metode pengolahan dan lokasi penanaman.",
),
const SizedBox(height: 30),
_buildSectionTitle(
Icons.local_fire_department,
"Profil Roasting $level",
),
const SizedBox(height: 12),
_buildHighlightBox(_getRoastingFullDescription(level)),
const SizedBox(height: 50),
],
),
),
),
],
),
);
}
// --- WIDGET HELPER ---
Widget _buildBadge(String label) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 6),
decoration: BoxDecoration(
color: AppColors.greenMain,
borderRadius: BorderRadius.circular(10),
),
child: Text(
label.toUpperCase(),
style: TextStyle(
fontFamily: 'Montserrat',
color: Colors.white,
fontWeight: FontWeight.w700,
fontSize: 10,
),
),
);
}
Widget _buildQuickStats(String level) {
String temp;
String rasa;
String crack;
if (level == "Light") {
temp = "180-205°C";
rasa = "Asam Tinggi";
crack = "1st Crack";
} else if (level == "Medium") {
temp = "210-220°C";
rasa = "Seimbang";
crack = "1st Crack";
} else {
temp = "240°C";
rasa = "Pahit Tinggi";
crack = "2nd Crack";
}
return Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 15),
],
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
_statItem(Icons.thermostat_rounded, "Suhu", temp),
_statDivider(),
_statItem(Icons.opacity_rounded, "Rasa", rasa),
_statDivider(),
_statItem(Icons.timer_rounded, "Crack", crack),
],
),
);
}
Widget _statItem(IconData icon, String label, String value) {
return Column(
children: [
Icon(icon, color: AppColors.brownMain, size: 24),
const SizedBox(height: 8),
Text(
label,
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 10,
color: Colors.grey,
),
),
Text(
value,
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 11,
fontWeight: FontWeight.w700,
color: AppColors.textDark,
),
),
],
);
}
Widget _statDivider() =>
Container(height: 30, width: 1, color: Colors.black12);
Widget _buildSectionTitle(IconData icon, String title) {
return Padding(
padding: const EdgeInsets.only(bottom: 12),
child: Row(
children: [
Icon(icon, color: AppColors.brownMain, size: 20),
const SizedBox(width: 8),
Text(
title,
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 18,
fontWeight: FontWeight.w700,
color: AppColors.textDark,
),
),
],
),
);
}
Widget _buildParagraph(String text) {
return Text(
text,
textAlign: TextAlign.justify,
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 14,
color: Colors.black54,
height: 1.7,
),
);
}
Widget _buildHighlightBox(String text) {
return Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: AppColors.brownMain.withOpacity(0.05),
borderRadius: BorderRadius.circular(20),
border: Border.all(color: AppColors.brownMain.withOpacity(0.1)),
),
child: Text(
text,
textAlign: TextAlign.justify,
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 14,
color: AppColors.textDark,
height: 1.8,
fontWeight: FontWeight.w500,
),
),
);
}
String _getRoastingFullDescription(String level) {
if (level == "Light") {
return "Tahap roasting dengan tingkat kematangan paling rendah. Kopi menghasilkan cita rasa asam yang dominan, warna cokelat terang, serta tekstur biji kering. Suhu berada pada kisaran 180°C - 205°C, diakhiri dengan terjadinya first crack. Memiliki kandungan kafein dan keasaman (acidity) sangat tinggi.";
} else if (level == "Medium") {
return "Level yang paling populer karena menghasilkan cita rasa manis dengan aroma kuat dan harum. Biji berwarna lebih gelap dan mulai tampak berminyak seiring proses karbonisasi gula. Suhu berada pada kisaran 210°C - 220°C, setelah melewati first crack namun belum mencapai second crack.";
} else {
return "Tahap kematangan paling tinggi, ditandai warna biji sangat gelap dan berminyak. Profil rasa dominan pahit (bitterness) serta mengurangi karakteristik asli biji kopi. Suhu mencapai kisaran 240°C setelah menyelesaikan second crack. Memiliki karakter body yang lebih kental.";
}
}
}

View File

@ -0,0 +1,588 @@
import 'dart:io';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:tflite_flutter/tflite_flutter.dart';
import 'package:image/image.dart' as img;
import 'package:google_fonts/google_fonts.dart';
import '../../widgets/color.dart';
class KlasifikasiScreen extends StatefulWidget {
const KlasifikasiScreen({super.key});
@override
State<KlasifikasiScreen> createState() => _KlasifikasiScreenState();
}
class _KlasifikasiScreenState extends State<KlasifikasiScreen> {
File? _image;
Interpreter? _interpreter;
List<String>? _labels;
bool _isProcessing = false;
String _jenisKopi = "";
String _tingkatRoasting = "";
double _akurasi = 0.0;
List<Map<String, dynamic>> _top3Predictions = [];
bool _isValidCoffee = true;
@override
void initState() {
super.initState();
_loadModel();
}
Future<void> _loadModel() async {
try {
_interpreter = await Interpreter.fromAsset(
'assets/model/best_model_epoch15.tflite',
);
_labels = [
"Arabika Dark",
"Arabika Light",
"Arabika Medium",
"Robusta Dark",
"Robusta Light",
"Robusta Medium",
];
} catch (e) {
debugPrint("Gagal memuat model: $e");
}
}
// FUNGSI BARU: Mengecek apakah gambar terlalu gelap atau terlalu polos (hitam/putih saja)
bool _isImageValid(img.Image image) {
double totalBrightness = 0;
List<int> pixels = image.getBytes();
// Hitung rata-rata kecerahan (Luminance)
for (int i = 0; i < pixels.length; i += 4) {
int r = pixels[i];
int g = pixels[i + 1];
int b = pixels[i + 2];
totalBrightness += (0.299 * r + 0.587 * g + 0.114 * b);
}
double avgBrightness = totalBrightness / (image.width * image.height);
// Jika rata-rata kecerahan < 30 (terlalu gelap/hitam) atau > 245 (terlalu putih)
if (avgBrightness < 30 || avgBrightness > 245) {
return false;
}
return true;
}
Future<void> _pickImage(ImageSource source) async {
final picker = ImagePicker();
final pickedFile = await picker.pickImage(source: source);
if (pickedFile != null) {
setState(() {
_image = File(pickedFile.path);
_isProcessing = true;
_jenisKopi = "";
_isValidCoffee = true;
});
_classifyImage(_image!);
}
}
Future<void> _classifyImage(File image) async {
if (_interpreter == null) return;
var imageBytes = await image.readAsBytes();
var decodedImage = img.decodeImage(imageBytes);
if (decodedImage == null) return;
// 1. CEK VALIDASI AWAL (Mencegah foto hitam/polos diproses model)
if (!_isImageValid(decodedImage)) {
setState(() {
_isValidCoffee = false;
_jenisKopi = "Invalid";
_isProcessing = false;
});
return;
}
var resized = img.copyResize(decodedImage, width: 224, height: 224);
var input = List.generate(
1,
(i) => List.generate(
224,
(j) => List.generate(224, (k) => List.generate(3, (l) => 0.0)),
),
);
for (var y = 0; y < 224; y++) {
for (var x = 0; x < 224; x++) {
var pixel = resized.getPixel(x, y);
input[0][y][x][0] = pixel.r.toDouble();
input[0][y][x][1] = pixel.g.toDouble();
input[0][y][x][2] = pixel.b.toDouble();
}
}
var output = List.filled(1 * 6, 0.0).reshape([1, 6]);
_interpreter!.run(input, output);
List<double> results = List<double>.from(output[0]);
List<Map<String, dynamic>> tempPredictions = [];
for (int i = 0; i < _labels!.length; i++) {
tempPredictions.add({"label": _labels![i], "score": results[i]});
}
tempPredictions.sort((a, b) => b['score'].compareTo(a['score']));
setState(() {
_top3Predictions = tempPredictions.take(3).toList();
double confidence = _top3Predictions[0]['score'];
// 2. CEK THRESHOLD (Mencegah objek luar kopi yang mirip tetap terdeteksi)
// Naikkan ke 0.85 agar lebih ketat
if (confidence < 0.85) {
_isValidCoffee = false;
_jenisKopi = "Unknown";
} else {
_isValidCoffee = true;
String bestMatch = _top3Predictions[0]['label'];
List<String> splitLabel = bestMatch.split(" ");
_jenisKopi = splitLabel[0];
_tingkatRoasting = splitLabel.length > 1 ? splitLabel[1] : "";
_akurasi = confidence * 100;
}
_isProcessing = false;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.background,
appBar: AppBar(
backgroundColor: AppColors.cardWhite,
surfaceTintColor: Colors.transparent,
elevation: 0,
title: Row(
children: [
Image.asset(
'assets/images/Logo_Coffee_Scan.png',
width: 30,
errorBuilder: (c, e, s) =>
const Icon(Icons.coffee, color: AppColors.brownMain),
),
const SizedBox(width: 10),
RichText(
text: TextSpan(
style: GoogleFonts.montserrat(
fontSize: 20,
fontWeight: FontWeight.bold,
),
children: const [
TextSpan(
text: 'Coffee',
style: TextStyle(color: AppColors.brownMain),
),
TextSpan(
text: 'Scan',
style: TextStyle(color: AppColors.greenMain),
),
],
),
),
],
),
),
body: SafeArea(
bottom: false,
child: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.only(
left: 16,
right: 16,
top: 16,
bottom: 180,
),
child: Column(
children: [
_buildInputCard(),
const SizedBox(height: 25),
if (_isProcessing)
const Center(
child: CircularProgressIndicator(color: AppColors.brownMain),
),
if (!_isProcessing && _jenisKopi.isNotEmpty)
_isValidCoffee
? _buildResultSection()
: _buildInvalidObjectCard(),
],
),
),
),
);
}
Widget _buildInputCard() {
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: AppColors.heroCokelat,
borderRadius: BorderRadius.circular(25),
),
child: Row(
children: [
Container(
width: 110,
height: 110,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: _image == null
? const Icon(Icons.image_search, size: 40, color: Colors.grey)
: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Image.file(_image!, fit: BoxFit.cover),
),
),
const SizedBox(width: 15),
Expanded(
child: Column(
children: [
_buildActionButton(
Icons.camera_alt_rounded,
"Buka Kamera",
() => _pickImage(ImageSource.camera),
),
const SizedBox(height: 12),
_buildActionButton(
Icons.photo_library_rounded,
"Unggah File",
() => _pickImage(ImageSource.gallery),
),
],
),
),
],
),
);
}
Widget _buildActionButton(IconData icon, String label, VoidCallback onTap) {
return ElevatedButton.icon(
onPressed: onTap,
icon: Icon(icon, size: 18),
label: Text(
label,
style: GoogleFonts.montserrat(
fontSize: 12,
fontWeight: FontWeight.bold,
),
),
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.buttonCream,
foregroundColor: AppColors.textDark,
elevation: 0,
minimumSize: const Size(double.infinity, 45),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
),
);
}
Widget _buildInvalidObjectCard() {
return Container(
padding: const EdgeInsets.all(25),
decoration: BoxDecoration(
color: Colors.red[50],
borderRadius: BorderRadius.circular(25),
border: Border.all(color: Colors.red.shade200),
),
child: Column(
children: [
const Icon(Icons.warning_amber_rounded, color: Colors.red, size: 60),
const SizedBox(height: 15),
Text(
"Objek Tidak Valid",
style: GoogleFonts.montserrat(
fontWeight: FontWeight.bold,
fontSize: 18,
color: Colors.red[900],
),
),
const SizedBox(height: 10),
Text(
"Gambar terlalu gelap, polos, atau bukan biji kopi yang dikenali. Silakan gunakan foto yang lebih jelas.",
textAlign: TextAlign.center,
style: GoogleFonts.montserrat(fontSize: 13, color: Colors.red[700]),
),
],
),
);
}
Widget _buildResultSection() {
return Column(
children: [
const Icon(Icons.check_circle, color: AppColors.greenSuccess, size: 70),
const SizedBox(height: 8),
Text(
"Hasil Klasifikasi",
style: GoogleFonts.montserrat(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 25),
Row(
children: [
_buildDetailBox(
"Jenis Biji Kopi",
_jenisKopi,
Icons.coffee_rounded,
),
const SizedBox(width: 12),
_buildDetailBox(
"Tingkat Roasting",
_tingkatRoasting,
Icons.local_fire_department_rounded,
),
],
),
const SizedBox(height: 20),
_buildAccuracyMainCard(),
const SizedBox(height: 20),
_buildTop3AnalisisCard(),
],
);
}
Widget _buildAccuracyMainCard() {
return Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: AppColors.greenLight,
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Akurasi Prediksi",
style: GoogleFonts.montserrat(
color: AppColors.greenSuccess,
fontWeight: FontWeight.bold,
),
),
Text(
"${_akurasi.toStringAsFixed(0)}%",
style: GoogleFonts.montserrat(
fontSize: 32,
fontWeight: FontWeight.bold,
color: AppColors.greenSuccess,
),
),
],
),
const Icon(
Icons.analytics_rounded,
color: AppColors.greenSuccess,
size: 50,
),
],
),
);
}
Widget _buildTop3AnalisisCard() {
List<Map<String, dynamic>> filteredPredictions = _top3Predictions
.where((pred) => (pred['score'] * 100) >= 0.1)
.toList();
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(25),
boxShadow: [
BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 15),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Analisis Kemungkinan",
style: GoogleFonts.montserrat(
fontWeight: FontWeight.bold,
fontSize: 14,
),
),
const SizedBox(height: 25),
Row(
children: [
SizedBox(
width: 120,
height: 120,
child: Stack(
alignment: Alignment.center,
children: [
SizedBox(
width: 120,
height: 120,
child: CircularProgressIndicator(
value: 1.0,
strokeWidth: 12,
color: Colors.grey[100],
),
),
if (filteredPredictions.length > 2)
SizedBox(
width: 120,
height: 120,
child: CircularProgressIndicator(
value: filteredPredictions[2]['score'],
strokeWidth: 12,
strokeCap: StrokeCap.round,
color: AppColors.rank3,
),
),
if (filteredPredictions.length > 1)
SizedBox(
width: 120,
height: 120,
child: CircularProgressIndicator(
value: filteredPredictions[1]['score'],
strokeWidth: 12,
strokeCap: StrokeCap.round,
color: AppColors.rank2,
),
),
SizedBox(
width: 120,
height: 120,
child: CircularProgressIndicator(
value: filteredPredictions[0]['score'],
strokeWidth: 12,
strokeCap: StrokeCap.round,
color: AppColors.rank1,
),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"${_akurasi.toStringAsFixed(0)}%",
style: GoogleFonts.montserrat(
fontWeight: FontWeight.bold,
fontSize: 18,
color: AppColors.rank1,
),
),
Text(
"Match",
style: GoogleFonts.montserrat(
fontSize: 9,
color: AppColors.textGrey,
fontWeight: FontWeight.w500,
),
),
],
),
],
),
),
const SizedBox(width: 15),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(filteredPredictions.length, (index) {
Color itemColor = index == 0
? AppColors.rank1
: (index == 1 ? AppColors.rank2 : AppColors.rank3);
return _buildTop3Item(
filteredPredictions[index],
itemColor,
index == 0,
);
}),
),
),
],
),
],
),
);
}
Widget _buildTop3Item(Map<String, dynamic> pred, Color color, bool isTop) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 5),
child: Row(
children: [
Container(
width: 8,
height: 8,
decoration: BoxDecoration(color: color, shape: BoxShape.circle),
),
const SizedBox(width: 8),
Expanded(
child: Text(
pred['label'],
maxLines: 1,
style: GoogleFonts.montserrat(
fontSize: 11,
color: isTop ? AppColors.textDark : AppColors.textGrey,
fontWeight: isTop ? FontWeight.bold : FontWeight.w500,
),
),
),
const SizedBox(width: 4),
Text(
"${(pred['score'] * 100).toStringAsFixed(1)}%",
style: GoogleFonts.montserrat(
fontSize: 11,
fontWeight: FontWeight.bold,
color: color,
),
),
],
),
);
}
Widget _buildDetailBox(String title, String value, IconData icon) {
return Expanded(
child: Container(
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 10),
decoration: BoxDecoration(
color: AppColors.buttonCream.withOpacity(0.4),
borderRadius: BorderRadius.circular(20),
),
child: Column(
children: [
Icon(icon, color: AppColors.brownMain, size: 28),
const SizedBox(height: 8),
Text(
title,
style: GoogleFonts.montserrat(
fontSize: 10,
color: AppColors.textGrey,
fontWeight: FontWeight.w600,
),
),
Text(
value,
textAlign: TextAlign.center,
style: GoogleFonts.montserrat(
fontSize: 14,
fontWeight: FontWeight.bold,
color: AppColors.brownMain,
),
),
],
),
),
);
}
}

View File

@ -0,0 +1,373 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:tflite_flutter/tflite_flutter.dart';
import 'package:image/image.dart' as img;
import 'package:google_fonts/google_fonts.dart';
import '../../widgets/color.dart';
class KlasifikasiScreen extends StatefulWidget {
const KlasifikasiScreen({super.key});
@override
State<KlasifikasiScreen> createState() => _KlasifikasiScreenState();
}
class _KlasifikasiScreenState extends State<KlasifikasiScreen> {
File? _image;
Interpreter? _interpreter;
List<String>? _labels;
bool _isProcessing = false;
String _jenisKopi = "";
String _tingkatRoasting = "";
double _akurasi = 0.0;
List<Map<String, dynamic>> _top3Predictions = [];
// Variabel untuk validasi apakah gambar benar-benar kopi
bool _isValidCoffee = true;
@override
void initState() {
super.initState();
_loadModel();
}
Future<void> _loadModel() async {
try {
_interpreter = await Interpreter.fromAsset(
'assets/model/best_model_epoch15.tflite',
);
_labels = [
"Arabika Dark",
"Arabika Light",
"Arabika Medium",
"Robusta Dark",
"Robusta Light",
"Robusta Medium",
];
} catch (e) {
debugPrint("Gagal memuat model: $e");
}
}
Future<void> _pickImage(ImageSource source) async {
final picker = ImagePicker();
final pickedFile = await picker.pickImage(source: source);
if (pickedFile != null) {
setState(() {
_image = File(pickedFile.path);
_isProcessing = true;
_jenisKopi = "";
_isValidCoffee = true;
});
_classifyImage(_image!);
}
}
Future<void> _classifyImage(File image) async {
if (_interpreter == null) return;
var imageBytes = await image.readAsBytes();
var decodedImage = img.decodeImage(imageBytes);
var resized = img.copyResize(decodedImage!, width: 224, height: 224);
var input = List.generate(
1,
(i) => List.generate(
224,
(j) => List.generate(224, (k) => List.generate(3, (l) => 0.0)),
),
);
for (var y = 0; y < 224; y++) {
for (var x = 0; x < 224; x++) {
var pixel = resized.getPixel(x, y);
input[0][y][x][0] = pixel.r.toDouble();
input[0][y][x][1] = pixel.g.toDouble();
input[0][y][x][2] = pixel.b.toDouble();
}
}
var output = List.filled(1 * 6, 0.0).reshape([1, 6]);
_interpreter!.run(input, output);
List<double> results = List<double>.from(output[0]);
List<Map<String, dynamic>> tempPredictions = [];
for (int i = 0; i < _labels!.length; i++) {
tempPredictions.add({"label": _labels![i], "score": results[i]});
}
tempPredictions.sort((a, b) => b['score'].compareTo(a['score']));
setState(() {
_top3Predictions = tempPredictions.take(3).toList();
double confidence = _top3Predictions[0]['score'];
// LOGIKA VALIDASI: Jika skor tertinggi < 70%, dianggap bukan kopi
if (confidence < 0.70) {
_isValidCoffee = false;
_jenisKopi = "Unknown";
} else {
_isValidCoffee = true;
String bestMatch = _top3Predictions[0]['label'];
List<String> splitLabel = bestMatch.split(" ");
_jenisKopi = splitLabel[0];
_tingkatRoasting = splitLabel.length > 1 ? splitLabel[1] : "";
_akurasi = confidence * 100;
}
_isProcessing = false;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.background,
appBar: AppBar(
backgroundColor: AppColors.cardWhite,
surfaceTintColor: Colors.transparent,
elevation: 0,
title: Row(
children: [
Image.asset(
'assets/images/Logo_Coffee_Scan.png',
width: 30,
errorBuilder: (c, e, s) => const Icon(Icons.coffee, color: AppColors.brownMain),
),
const SizedBox(width: 10),
RichText(
text: TextSpan(
style: GoogleFonts.montserrat(fontSize: 20, fontWeight: FontWeight.bold),
children: const [
TextSpan(text: 'Coffee', style: TextStyle(color: AppColors.brownMain)),
TextSpan(text: 'Scan', style: TextStyle(color: AppColors.greenMain)),
],
),
),
],
),
),
body: SafeArea(
bottom: false,
child: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 180),
child: Column(
children: [
_buildInputCard(),
const SizedBox(height: 25),
if (_isProcessing)
const Center(child: CircularProgressIndicator(color: AppColors.brownMain)),
if (!_isProcessing && _jenisKopi.isNotEmpty)
_isValidCoffee ? _buildResultSection() : _buildInvalidObjectCard(),
],
),
),
),
);
}
Widget _buildInputCard() {
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: AppColors.heroCokelat,
borderRadius: BorderRadius.circular(25),
),
child: Row(
children: [
Container(
width: 110,
height: 110,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: _image == null
? const Icon(Icons.image_search, size: 40, color: Colors.grey)
: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Image.file(_image!, fit: BoxFit.cover),
),
),
const SizedBox(width: 15),
Expanded(
child: Column(
children: [
_buildActionButton(Icons.camera_alt_rounded, "Buka Kamera", () => _pickImage(ImageSource.camera)),
const SizedBox(height: 12),
_buildActionButton(Icons.photo_library_rounded, "Unggah File", () => _pickImage(ImageSource.gallery)),
],
),
),
],
),
);
}
Widget _buildActionButton(IconData icon, String label, VoidCallback onTap) {
return ElevatedButton.icon(
onPressed: onTap,
icon: Icon(icon, size: 18),
label: Text(label, style: GoogleFonts.montserrat(fontSize: 12, fontWeight: FontWeight.bold)),
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.buttonCream,
foregroundColor: AppColors.textDark,
elevation: 0,
minimumSize: const Size(double.infinity, 45),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
),
);
}
// Tampilan jika yang diinput bukan biji kopi
Widget _buildInvalidObjectCard() {
return Container(
padding: const EdgeInsets.all(25),
decoration: BoxDecoration(
color: Colors.red[50],
borderRadius: BorderRadius.circular(25),
border: Border.all(color: Colors.red.shade200),
),
child: Column(
children: [
const Icon(Icons.warning_amber_rounded, color: Colors.red, size: 60),
const SizedBox(height: 15),
Text(
"Objek Tidak Dikenali",
style: GoogleFonts.montserrat(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.red[900]),
),
const SizedBox(height: 10),
Text(
"Gambar yang Anda masukkan tidak terdeteksi sebagai biji kopi Arabika atau Robusta. Silakan coba lagi.",
textAlign: TextAlign.center,
style: GoogleFonts.montserrat(fontSize: 13, color: Colors.red[700]),
),
],
),
);
}
Widget _buildResultSection() {
return Column(
children: [
const Icon(Icons.check_circle, color: AppColors.greenSuccess, size: 70),
const SizedBox(height: 8),
Text("Hasil Klasifikasi", style: GoogleFonts.montserrat(fontSize: 20, fontWeight: FontWeight.bold)),
const SizedBox(height: 25),
Row(
children: [
_buildDetailBox("Jenis Biji Kopi", _jenisKopi, Icons.coffee_rounded),
const SizedBox(width: 12),
_buildDetailBox("Tingkat Roasting", _tingkatRoasting, Icons.local_fire_department_rounded),
],
),
const SizedBox(height: 20),
_buildAccuracyMainCard(),
const SizedBox(height: 20),
_buildTop3AnalisisCard(),
],
);
}
Widget _buildAccuracyMainCard() {
return Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(color: AppColors.greenLight, borderRadius: BorderRadius.circular(20)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Akurasi Prediksi", style: GoogleFonts.montserrat(color: AppColors.greenSuccess, fontWeight: FontWeight.bold)),
Text("${_akurasi.toStringAsFixed(0)}%", style: GoogleFonts.montserrat(fontSize: 32, fontWeight: FontWeight.bold, color: AppColors.greenSuccess)),
],
),
const Icon(Icons.analytics_rounded, color: AppColors.greenSuccess, size: 50),
],
),
);
}
Widget _buildTop3AnalisisCard() {
List<Map<String, dynamic>> filteredPredictions = _top3Predictions.where((pred) => (pred['score'] * 100) >= 0.1).toList();
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(25), boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 15)]),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Analisis Kemungkinan", style: GoogleFonts.montserrat(fontWeight: FontWeight.bold, fontSize: 14)),
const SizedBox(height: 25),
Row(
children: [
SizedBox(
width: 120, height: 120,
child: Stack(
alignment: Alignment.center,
children: [
SizedBox(width: 120, height: 120, child: CircularProgressIndicator(value: 1.0, strokeWidth: 12, color: Colors.grey[100])),
if (filteredPredictions.length > 2) SizedBox(width: 120, height: 120, child: CircularProgressIndicator(value: filteredPredictions[2]['score'], strokeWidth: 12, strokeCap: StrokeCap.round, color: AppColors.rank3)),
if (filteredPredictions.length > 1) SizedBox(width: 120, height: 120, child: CircularProgressIndicator(value: filteredPredictions[1]['score'], strokeWidth: 12, strokeCap: StrokeCap.round, color: AppColors.rank2)),
SizedBox(width: 120, height: 120, child: CircularProgressIndicator(value: filteredPredictions[0]['score'], strokeWidth: 12, strokeCap: StrokeCap.round, color: AppColors.rank1)),
Column(mainAxisAlignment: MainAxisAlignment.center, children: [
Text("${_akurasi.toStringAsFixed(0)}%", style: GoogleFonts.montserrat(fontWeight: FontWeight.bold, fontSize: 18, color: AppColors.rank1)),
Text("Match", style: GoogleFonts.montserrat(fontSize: 9, color: AppColors.textGrey, fontWeight: FontWeight.w500)),
]),
],
),
),
const SizedBox(width: 15),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(filteredPredictions.length, (index) {
Color itemColor = index == 0 ? AppColors.rank1 : (index == 1 ? AppColors.rank2 : AppColors.rank3);
return _buildTop3Item(filteredPredictions[index], itemColor, index == 0);
}),
),
),
],
),
],
),
);
}
Widget _buildTop3Item(Map<String, dynamic> pred, Color color, bool isTop) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 5),
child: Row(
children: [
Container(width: 8, height: 8, decoration: BoxDecoration(color: color, shape: BoxShape.circle)),
const SizedBox(width: 8),
Expanded(child: Text(pred['label'], maxLines: 1, style: GoogleFonts.montserrat(fontSize: 11, color: isTop ? AppColors.textDark : AppColors.textGrey, fontWeight: isTop ? FontWeight.bold : FontWeight.w500))),
const SizedBox(width: 4),
Text("${(pred['score'] * 100).toStringAsFixed(1)}%", style: GoogleFonts.montserrat(fontSize: 11, fontWeight: FontWeight.bold, color: color)),
],
),
);
}
Widget _buildDetailBox(String title, String value, IconData icon) {
return Expanded(
child: Container(
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 10),
decoration: BoxDecoration(color: AppColors.buttonCream.withOpacity(0.4), borderRadius: BorderRadius.circular(20)),
child: Column(
children: [
Icon(icon, color: AppColors.brownMain, size: 28),
const SizedBox(height: 8),
Text(title, style: GoogleFonts.montserrat(fontSize: 10, color: AppColors.textGrey, fontWeight: FontWeight.w600)),
Text(value, textAlign: TextAlign.center, style: GoogleFonts.montserrat(fontSize: 14, fontWeight: FontWeight.bold, color: AppColors.brownMain)),
],
),
),
);
}
}

View File

@ -0,0 +1,643 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:tflite_flutter/tflite_flutter.dart';
import 'package:image/image.dart' as img;
import 'package:google_fonts/google_fonts.dart';
import '../../widgets/color.dart';
import 'package:flutter/services.dart';
class KlasifikasiScreen extends StatefulWidget {
const KlasifikasiScreen({super.key});
@override
State<KlasifikasiScreen> createState() => _KlasifikasiScreenState();
}
class _KlasifikasiScreenState extends State<KlasifikasiScreen> {
File? _image;
Interpreter? _interpreter;
List<String>? _labels;
bool _isProcessing = false;
String _jenisKopi = "";
String _tingkatRoasting = "";
double _akurasi = 0.0;
List<Map<String, dynamic>> _top3Predictions = [];
bool _isValidCoffee = true;
@override
void initState() {
super.initState();
_loadModel();
}
Future<void> _loadModel() async {
try {
_interpreter = await Interpreter.fromAsset(
'assets/model/best_model_epoch15.tflite',
);
final labelData = await rootBundle.loadString('assets/model/label.txt');
_labels = labelData
.split('\n')
.where((label) => label.trim().isNotEmpty)
.toList();
} catch (e) {
debugPrint("Gagal memuat model atau label: $e");
}
}
// VALIDASI TEKSTUR & WARNA (Fokus area tengah 50%)
bool _checkImageAuthenticity(img.Image image) {
int rSum = 0, gSum = 0, bSum = 0;
int sampleStep = 10;
int count = 0;
int startX = (image.width * 0.25).toInt();
int startY = (image.height * 0.25).toInt();
int endX = (image.width * 0.75).toInt();
int endY = (image.height * 0.75).toInt();
for (int y = startY; y < endY; y += sampleStep) {
for (int x = startX; x < endX; x += sampleStep) {
var pixel = image.getPixel(x, y);
rSum += pixel.r.toInt();
gSum += pixel.g.toInt();
bSum += pixel.b.toInt();
count++;
}
}
if (count == 0) return false;
double avgR = rSum / count;
double avgG = gSum / count;
double avgB = bSum / count;
double brightness = (0.299 * avgR + 0.587 * avgG + 0.114 * avgB);
// Kriteria warna biji kopi (Cokelat/Gelap)
if (brightness < 20 || brightness > 235) return false;
if (avgG > avgR * 1.3 || avgB > avgR * 1.3) return false;
return true;
}
Future<void> _pickImage(ImageSource source) async {
final picker = ImagePicker();
final pickedFile = await picker.pickImage(
source: source,
imageQuality: 100,
);
if (pickedFile != null) {
setState(() {
_image = File(pickedFile.path);
_isProcessing = true;
_jenisKopi = "";
_isValidCoffee = true;
});
_classifyImage(_image!);
}
}
Future<void> _classifyImage(File image) async {
if (_interpreter == null) return;
final bytes = await image.readAsBytes();
final decodedImage = img.decodeImage(bytes);
if (decodedImage == null) return;
// 1. Validasi Keaslian
if (!_checkImageAuthenticity(decodedImage)) {
setState(() {
_isValidCoffee = false;
_jenisKopi = "Invalid";
_isProcessing = false;
});
return;
}
// 2. PEMBENARAN: Auto Center Crop
int size = decodedImage.width < decodedImage.height
? decodedImage.width
: decodedImage.height;
var cropped = img.copyCrop(
decodedImage,
x: (decodedImage.width - size) ~/ 2,
y: (decodedImage.height - size) ~/ 2,
width: size,
height: size,
);
// 3. Resize ke 224x224
var resized = img.copyResize(cropped, width: 224, height: 224);
// 4. Input Tensor
var input = List.generate(
1,
(i) => List.generate(
224,
(j) => List.generate(224, (k) => List.generate(3, (l) => 0.0)),
),
);
for (var y = 0; y < 224; y++) {
for (var x = 0; x < 224; x++) {
var p = resized.getPixel(x, y);
input[0][y][x][0] = p.r.toDouble();
input[0][y][x][1] = p.g.toDouble();
input[0][y][x][2] = p.b.toDouble();
}
}
// 5. Inference
var output = List.filled(1 * 6, 0.0).reshape([1, 6]);
_interpreter!.run(input, output);
List<double> results = List<double>.from(output[0]);
List<Map<String, dynamic>> temp = [];
for (int i = 0; i < _labels!.length; i++) {
temp.add({"label": _labels![i], "score": results[i]});
}
temp.sort((a, b) => b['score'].compareTo(a['score']));
setState(() {
_top3Predictions = temp.take(3).toList();
double topScore = _top3Predictions[0]['score'];
if (topScore < 0.70) {
_isValidCoffee = false;
_jenisKopi = "Unknown";
} else {
_isValidCoffee = true;
List<String> split = _top3Predictions[0]['label'].split(" ");
_jenisKopi = split[0];
_tingkatRoasting = split.length > 1 ? split.sublist(1).join(" ") : "";
_akurasi = topScore * 100;
}
_isProcessing = false;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.background,
appBar: AppBar(
backgroundColor: AppColors.cardWhite,
elevation: 0,
title: Row(
children: [
Image.asset(
'assets/images/Logo_Coffee_Scan.png',
width: 30,
errorBuilder: (c, e, s) =>
const Icon(Icons.coffee, color: AppColors.brownMain),
),
const SizedBox(width: 10),
RichText(
text: TextSpan(
style: GoogleFonts.montserrat(
fontSize: 20,
fontWeight: FontWeight.w800,
),
children: const [
TextSpan(
text: 'Coffee',
style: TextStyle(color: AppColors.brownMain),
),
TextSpan(
text: 'Scan',
style: TextStyle(color: AppColors.greenMain),
),
],
),
),
],
),
),
body: SafeArea(
child: SingleChildScrollView(
padding: const EdgeInsets.only(
left: 16,
right: 16,
top: 16,
bottom: 100,
),
child: Column(
children: [
_buildInputCard(),
const SizedBox(height: 25),
if (_isProcessing)
const Center(
child: CircularProgressIndicator(color: AppColors.brownMain),
),
if (!_isProcessing && _jenisKopi.isNotEmpty)
_isValidCoffee ? _buildResultSection() : _buildInvalidCard(),
],
),
),
),
);
}
Widget _buildInputCard() {
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: AppColors.heroCokelat,
borderRadius: BorderRadius.circular(25),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Stack(
alignment: Alignment.center,
children: [
Container(
width: 135,
height: 135,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: _image == null
? const Icon(
Icons.image_search,
size: 50,
color: Colors.grey,
)
: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Image.file(_image!, fit: BoxFit.cover),
),
),
if (_image == null)
Container(
width: 100,
height: 100,
decoration: BoxDecoration(
border: Border.all(
color: Colors.white.withOpacity(0.5),
width: 2,
),
borderRadius: BorderRadius.circular(15),
),
),
],
),
const SizedBox(width: 16),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Posisikan biji kopi di tengah bingkai kotak agar hasil lebih akurat",
style: GoogleFonts.montserrat(
fontSize: 8,
fontWeight: FontWeight.w500,
color: Colors.white,
height: 1.2,
),
),
const SizedBox(height: 10),
_buildActionButton(
Icons.camera_alt_rounded,
"Buka Kamera",
() => _pickImage(ImageSource.camera),
),
const SizedBox(height: 8),
_buildActionButton(
Icons.photo_library_rounded,
"Unggah File",
() => _pickImage(ImageSource.gallery),
),
],
),
),
],
),
);
}
Widget _buildActionButton(IconData icon, String label, VoidCallback onTap) {
return ElevatedButton.icon(
onPressed: onTap,
icon: Icon(icon, size: 18, color: Colors.black),
label: Text(
label,
style: GoogleFonts.montserrat(
fontSize: 12,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFFF5E6CA),
elevation: 0,
minimumSize: const Size(double.infinity, 38),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
),
);
}
Widget _buildInvalidCard() {
return Container(
padding: const EdgeInsets.all(25),
decoration: BoxDecoration(
color: Colors.red[50],
borderRadius: BorderRadius.circular(25),
border: Border.all(color: Colors.red.shade200),
),
child: Column(
children: [
const Icon(Icons.block_flipped, color: Colors.red, size: 60),
const SizedBox(height: 15),
Text(
"Objek Tidak Dikenali",
style: GoogleFonts.montserrat(
fontWeight: FontWeight.bold,
fontSize: 18,
color: Colors.red[900],
),
),
const SizedBox(height: 10),
Text(
"Pastikan objek berada di tengah kotak dan memiliki pencahayaan yang cukup.",
textAlign: TextAlign.center,
style: GoogleFonts.montserrat(fontSize: 13, color: Colors.red[700]),
),
],
),
);
}
Widget _buildResultSection() {
return Column(
children: [
const Icon(Icons.check_circle, color: AppColors.greenSuccess, size: 70),
const SizedBox(height: 8),
Text(
"Hasil Klasifikasi",
style: GoogleFonts.montserrat(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 25),
Row(
children: [
_buildDetailBox(
"Jenis Biji Kopi",
_jenisKopi,
Icons.coffee_rounded,
),
const SizedBox(width: 12),
_buildDetailBox(
"Tingkat Roasting",
_tingkatRoasting,
Icons.local_fire_department_rounded,
),
],
),
const SizedBox(height: 20),
_buildAccuracyMainCard(),
const SizedBox(height: 20),
_buildTop3AnalisisCard(),
],
);
}
Widget _buildAccuracyMainCard() {
return Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: AppColors.greenLight,
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Akurasi Prediksi",
style: GoogleFonts.montserrat(
color: AppColors.greenSuccess,
fontWeight: FontWeight.bold,
),
),
Text(
"${_akurasi.toStringAsFixed(2)}%",
style: GoogleFonts.montserrat(
fontSize: 32,
fontWeight: FontWeight.bold,
color: AppColors.greenSuccess,
),
),
],
),
const Icon(
Icons.analytics_rounded,
color: AppColors.greenSuccess,
size: 50,
),
],
),
);
}
Widget _buildTop3AnalisisCard() {
List<Map<String, dynamic>> filtered = _top3Predictions
.where((pred) => (pred['score'] * 100) >= 0.1)
.toList();
double s1 = filtered.isNotEmpty ? filtered[0]['score'] : 0.0;
double s2 = filtered.length > 1 ? filtered[1]['score'] : 0.0;
double s3 = filtered.length > 2 ? filtered[2]['score'] : 0.0;
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(25),
boxShadow: [
BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 15),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Analisis Kemungkinan",
style: GoogleFonts.montserrat(
fontWeight: FontWeight.bold,
fontSize: 14,
),
),
const SizedBox(height: 25),
Row(
children: [
SizedBox(
width: 120,
height: 120,
child: Stack(
alignment: Alignment.center,
children: [
SizedBox(
width: 120,
height: 120,
child: CircularProgressIndicator(
value: 1.0,
strokeWidth: 12,
color: Colors.grey[100],
),
),
if (filtered.length > 2)
SizedBox(
width: 120,
height: 120,
child: CircularProgressIndicator(
value: s1 + s2 + s3,
strokeWidth: 12,
strokeCap: StrokeCap.round,
color: AppColors.rank3,
),
),
if (filtered.length > 1)
SizedBox(
width: 120,
height: 120,
child: CircularProgressIndicator(
value: s1 + s2,
strokeWidth: 12,
strokeCap: StrokeCap.round,
color: AppColors.rank2,
),
),
SizedBox(
width: 120,
height: 120,
child: CircularProgressIndicator(
value: s1,
strokeWidth: 12,
strokeCap: StrokeCap.round,
color: AppColors.rank1,
),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"${(s1 * 100).toStringAsFixed(2)}%",
style: GoogleFonts.montserrat(
fontWeight: FontWeight.bold,
fontSize: 18,
color: AppColors.rank1,
),
),
Text(
"Match",
style: GoogleFonts.montserrat(
fontSize: 9,
color: AppColors.textGrey,
),
),
],
),
],
),
),
const SizedBox(width: 15),
Expanded(
child: Column(
children: List.generate(filtered.length, (index) {
Color c = index == 0
? AppColors.rank1
: (index == 1 ? AppColors.rank2 : AppColors.rank3);
return _buildTop3Item(filtered[index], c, index == 0);
}),
),
),
],
),
],
),
);
}
Widget _buildTop3Item(Map<String, dynamic> pred, Color color, bool isTop) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 5),
child: Row(
children: [
Container(
width: 8,
height: 8,
decoration: BoxDecoration(color: color, shape: BoxShape.circle),
),
const SizedBox(width: 8),
Expanded(
child: Text(
pred['label'],
maxLines: 1,
style: GoogleFonts.montserrat(
fontSize: 11,
color: isTop ? AppColors.textDark : AppColors.textGrey,
fontWeight: isTop ? FontWeight.bold : FontWeight.w500,
),
),
),
const SizedBox(width: 4),
Text(
"${(pred['score'] * 100).toStringAsFixed(2)}%",
style: GoogleFonts.montserrat(
fontSize: 11,
fontWeight: FontWeight.bold,
color: color,
),
),
],
),
);
}
Widget _buildDetailBox(String t, String v, IconData i) {
return Expanded(
child: Container(
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 10),
decoration: BoxDecoration(
color: AppColors.buttonCream.withOpacity(0.4),
borderRadius: BorderRadius.circular(20),
),
child: Column(
children: [
Icon(i, color: AppColors.brownMain, size: 28),
const SizedBox(height: 8),
Text(
t,
style: GoogleFonts.montserrat(
fontSize: 10,
color: AppColors.textGrey,
fontWeight: FontWeight.w600,
),
),
Text(
v,
textAlign: TextAlign.center,
style: GoogleFonts.montserrat(
fontSize: 14,
fontWeight: FontWeight.bold,
color: AppColors.brownMain,
),
),
],
),
),
);
}
}

View File

@ -0,0 +1,694 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import '../../widgets/color.dart';
import '../../services/classifier_service.dart';
import '../../models/prediction_result.dart';
class KlasifikasiScreen extends StatefulWidget {
const KlasifikasiScreen({super.key});
@override
State<KlasifikasiScreen> createState() => _KlasifikasiScreenState();
}
class _KlasifikasiScreenState extends State<KlasifikasiScreen> {
File? _image;
bool _isProcessing = false;
PredictionResult? _result;
final ClassifierService _classifierService = ClassifierService();
@override
void initState() {
super.initState();
_initModel();
}
Future<void> _initModel() async {
await _classifierService.loadModel();
}
// ini hasil foto asli tanpa preprocessing
Future<void> _pickImage(ImageSource source) async {
final picker = ImagePicker();
final pickedFile = await picker.pickImage(
source: source,
imageQuality: 100,
);
if (pickedFile != null) {
setState(() {
_isProcessing = true;
_result = null;
});
try {
File original = File(pickedFile.path);
// 1. Preprocessing untuk UI (Zoom 80% & Square Crop)
// Gambar ini yang akan disimpan di variabel _image untuk ditampilkan di widget
File processed = await _classifierService.preprocessImageForDisplay(
original,
);
setState(() {
_image = processed;
});
// 2. Klasifikasi menggunakan file yang sudah di-crop/resize
final result = await _classifierService.classify(processed);
setState(() {
_result = result;
_isProcessing = false;
});
} catch (e) {
print("Error during image processing: $e");
setState(() => _isProcessing = false);
}
}
}
// ini kalau mau preprocessing gambar untuk ditampilkan di UI, biar sama dengan yang dianalisis model
// Future<void> _pickImage(ImageSource source) async {
// final picker = ImagePicker();
// final pickedFile = await picker.pickImage(
// source: source,
// imageQuality: 100,
// );
// if (pickedFile != null) {
// File original = File(pickedFile.path);
// /// preprocessing supaya gambar yang tampil = gambar yang dianalisis model
// File processed = await _classifierService.preprocessImageForDisplay(
// original,
// );
// setState(() {
// _image = processed;
// _isProcessing = true;
// _result = null;
// });
// final result = await _classifierService.classify(processed);
// setState(() {
// _result = result;
// _isProcessing = false;
// });
// }
// }
// fungsi untuk menampilkan dialog instruksi sebelum membuka kamera
// void _showCameraInstructions(BuildContext context) {
// showDialog(
// context: context,
// builder: (BuildContext context) {
// return Dialog(
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(25),
// ),
// child: Container(
// padding: const EdgeInsets.all(20),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(25),
// ),
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// // Icon Header yang menarik
// Container(
// padding: const EdgeInsets.all(15),
// decoration: BoxDecoration(
// color: AppColors.heroCokelat.withOpacity(0.2),
// shape: BoxShape.circle,
// ),
// child: const Icon(
// Icons.center_focus_strong_rounded,
// color: AppColors.brownMain,
// size: 40,
// ),
// ),
// const SizedBox(height: 20),
// Text(
// "Instruksi Pengambilan",
// style: GoogleFonts.montserrat(
// fontSize: 18,
// fontWeight: FontWeight.bold,
// color: AppColors.brownMain,
// ),
// ),
// const SizedBox(height: 15),
// // Point-point instruksi
// _buildInstructionRow(
// Icons.center_focus_weak,
// "Pastikan biji kopi berada tepat di tengah bingkai.",
// ),
// const SizedBox(height: 10),
// _buildInstructionRow(
// Icons.lightbulb_outline,
// "Gunakan pencahayaan yang cukup agar tekstur terlihat jelas.",
// ),
// const SizedBox(height: 10),
// _buildInstructionRow(
// Icons.stay_primary_portrait,
// "Pegang ponsel dengan stabil agar foto tidak buram (blur).",
// ),
// const SizedBox(height: 25),
// // Tombol Mengerti
// SizedBox(
// width: double.infinity,
// child: ElevatedButton(
// onPressed: () {
// Navigator.pop(context); // Tutup dialog
// _pickImage(ImageSource.camera); // Lanjut buka kamera
// },
// style: ElevatedButton.styleFrom(
// backgroundColor: AppColors.brownMain,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(15),
// ),
// padding: const EdgeInsets.symmetric(vertical: 12),
// ),
// child: Text(
// "Saya Mengerti",
// style: GoogleFonts.montserrat(
// color: Colors.white,
// fontWeight: FontWeight.bold,
// ),
// ),
// ),
// ),
// ],
// ),
// ),
// );
// },
// );
// }
// // Widget pendukung untuk baris teks instruksi
// Widget _buildInstructionRow(IconData icon, String text) {
// return Row(
// children: [
// Icon(icon, size: 20, color: AppColors.greenMain),
// const SizedBox(width: 12),
// Expanded(
// child: Text(
// text,
// style: GoogleFonts.montserrat(
// fontSize: 12,
// color: AppColors.textDark,
// height: 1.4,
// ),
// ),
// ),
// ],
// );
// }
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.background,
appBar: _buildAppBar(),
body: SafeArea(
child: SingleChildScrollView(
padding: const EdgeInsets.only(
left: 16,
right: 16,
top: 16,
bottom: 50,
),
child: Column(
children: [
_buildInputCard(),
const SizedBox(height: 25),
if (_isProcessing)
const Center(
child: CircularProgressIndicator(color: AppColors.brownMain),
),
if (!_isProcessing && _result != null)
_result!.isValid ? _buildResultSection() : _buildInvalidCard(),
],
),
),
),
);
}
PreferredSizeWidget _buildAppBar() {
return AppBar(
backgroundColor: AppColors.cardWhite,
elevation: 0,
title: Row(
children: [
Image.asset(
'assets/images/Logo_Coffee_Scan.png',
width: 30,
errorBuilder: (c, e, s) =>
const Icon(Icons.coffee, color: AppColors.brownMain),
),
const SizedBox(width: 10),
RichText(
text: TextSpan(
style: const TextStyle(
fontFamily: 'Montserrat',
fontSize: 20,
fontWeight: FontWeight.w900,
),
children: const [
TextSpan(
text: 'Coffee',
style: TextStyle(color: AppColors.brownMain),
),
TextSpan(
text: 'Scan',
style: TextStyle(color: AppColors.greenMain),
),
],
),
),
],
),
);
}
Widget _buildInputCard() {
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: AppColors.heroCokelat,
borderRadius: BorderRadius.circular(25),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Stack(
alignment: Alignment.center,
children: [
Container(
width: 135,
height: 135,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: _image == null
? const Icon(
Icons.image_search,
size: 50,
color: Colors.grey,
)
: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Image.file(_image!, fit: BoxFit.cover),
),
),
if (_image == null)
Container(
width: 100,
height: 100,
decoration: BoxDecoration(
border: Border.all(
color: Colors.white.withOpacity(0.5),
width: 2,
),
borderRadius: BorderRadius.circular(15),
),
),
],
),
const SizedBox(width: 16),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Posisikan biji kopi di tengah bingkai kotak agar hasil lebih akurat",
style: const TextStyle(
fontFamily: 'Montserrat',
fontSize: 8,
fontWeight: FontWeight.w500,
color: Colors.white,
height: 1.2,
),
),
const SizedBox(height: 10),
_buildActionButton(
Icons.camera_alt_rounded,
"Buka Kamera",
() => _pickImage(ImageSource.camera),
),
// _buildActionButton(
// Icons.camera_alt_rounded,
// "Buka Kamera",
// () => _showCameraInstructions(
// context,
// ),
// ),
const SizedBox(height: 8),
_buildActionButton(
Icons.photo_library_rounded,
"Unggah File",
() => _pickImage(ImageSource.gallery),
),
],
),
),
],
),
);
}
Widget _buildActionButton(IconData icon, String label, VoidCallback onTap) {
return ElevatedButton.icon(
onPressed: onTap,
icon: Icon(icon, size: 18, color: Colors.black),
label: Text(
label,
style: const TextStyle(
fontFamily: 'Montserrat',
fontSize: 12,
fontWeight: FontWeight.w700,
color: Colors.black,
),
),
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFFF5E6CA),
elevation: 0,
minimumSize: const Size(double.infinity, 38),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
),
);
}
Widget _buildInvalidCard() {
return Container(
padding: const EdgeInsets.all(25),
decoration: BoxDecoration(
color: Colors.red[50],
borderRadius: BorderRadius.circular(25),
border: Border.all(color: Colors.red.shade200),
),
child: Column(
children: [
const Icon(Icons.block_flipped, color: Colors.red, size: 60),
const SizedBox(height: 15),
Text(
"Objek Tidak Dikenali",
style: TextStyle(
fontFamily: 'Montserrat',
fontWeight: FontWeight.w700,
fontSize: 18,
color: Colors.red[900],
),
),
const SizedBox(height: 10),
Text(
"Pastikan objek berada di tengah kotak dan memiliki pencahayaan yang cukup.",
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 13,
color: Colors.red[700],
),
),
],
),
);
}
Widget _buildResultSection() {
return Column(
children: [
const Icon(Icons.check_circle, color: AppColors.greenSuccess, size: 70),
const SizedBox(height: 8),
Text(
"Hasil Klasifikasi",
style: const TextStyle(
fontFamily: 'Montserrat',
fontSize: 20,
fontWeight: FontWeight.w700,
),
),
const SizedBox(height: 25),
Row(
children: [
_buildDetailBox(
"Jenis Biji Kopi",
_result!.jenisKopi,
Icons.coffee_rounded,
),
const SizedBox(width: 12),
_buildDetailBox(
"Tingkat Roasting",
_result!.tingkatRoasting,
Icons.local_fire_department_rounded,
),
],
),
const SizedBox(height: 20),
_buildAccuracyMainCard(),
const SizedBox(height: 20),
_buildTop3AnalisisCard(),
],
);
}
Widget _buildAccuracyMainCard() {
return Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: AppColors.greenLight,
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Akurasi Prediksi",
style: const TextStyle(
fontFamily: 'Montserrat',
fontWeight: FontWeight.w700,
color: AppColors.greenSuccess,
),
),
Text(
"${_result!.akurasi.toStringAsFixed(2)}%",
style: const TextStyle(
fontFamily: 'Montserrat',
fontSize: 32,
fontWeight: FontWeight.w700,
color: AppColors.greenSuccess,
),
),
],
),
const Icon(
Icons.analytics_rounded,
color: AppColors.greenSuccess,
size: 50,
),
],
),
);
}
Widget _buildTop3AnalisisCard() {
List<Map<String, dynamic>> filtered = _result!.top3Predictions
.where((pred) => (pred['score'] * 100) >= 0.1)
.toList();
double s1 = filtered.isNotEmpty ? filtered[0]['score'] : 0.0;
double s2 = filtered.length > 1 ? filtered[1]['score'] : 0.0;
double s3 = filtered.length > 2 ? filtered[2]['score'] : 0.0;
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(25),
boxShadow: [
BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 15),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Analisis Kemungkinan",
style: const TextStyle(
fontFamily: 'Montserrat',
fontWeight: FontWeight.w700,
fontSize: 14,
),
),
const SizedBox(height: 25),
Row(
children: [
SizedBox(
width: 120,
height: 120,
child: Stack(
alignment: Alignment.center,
children: [
SizedBox(
width: 120,
height: 120,
child: CircularProgressIndicator(
value: 1.0,
strokeWidth: 12,
color: Colors.grey[100],
),
),
if (filtered.length > 2)
SizedBox(
width: 120,
height: 120,
child: CircularProgressIndicator(
value: s1 + s2 + s3,
strokeWidth: 12,
strokeCap: StrokeCap.round,
color: AppColors.rank3,
),
),
if (filtered.length > 1)
SizedBox(
width: 120,
height: 120,
child: CircularProgressIndicator(
value: s1 + s2,
strokeWidth: 12,
strokeCap: StrokeCap.round,
color: AppColors.rank2,
),
),
SizedBox(
width: 120,
height: 120,
child: CircularProgressIndicator(
value: s1,
strokeWidth: 12,
strokeCap: StrokeCap.round,
color: AppColors.rank1,
),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"${(s1 * 100).toStringAsFixed(2)}%",
style: const TextStyle(
fontFamily: 'Montserrat',
fontWeight: FontWeight.w700,
fontSize: 18,
color: AppColors.rank1,
),
),
],
),
],
),
),
const SizedBox(width: 15),
Expanded(
child: Column(
children: List.generate(filtered.length, (index) {
Color c = index == 0
? AppColors.rank1
: (index == 1 ? AppColors.rank2 : AppColors.rank3);
return _buildTop3Item(filtered[index], c, index == 0);
}),
),
),
],
),
],
),
);
}
Widget _buildTop3Item(Map<String, dynamic> pred, Color color, bool isTop) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 5),
child: Row(
children: [
Container(
width: 8,
height: 8,
decoration: BoxDecoration(color: color, shape: BoxShape.circle),
),
const SizedBox(width: 8),
Expanded(
child: Text(
pred['label'],
maxLines: 1,
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 11,
color: isTop ? AppColors.textDark : AppColors.textGrey,
fontWeight: isTop ? FontWeight.w700 : FontWeight.w500,
),
),
),
const SizedBox(width: 4),
Text(
"${(pred['score'] * 100).toStringAsFixed(2)}%",
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 11,
fontWeight: FontWeight.w700,
color: color,
),
),
],
),
);
}
Widget _buildDetailBox(String t, String v, IconData i) {
return Expanded(
child: Container(
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 10),
decoration: BoxDecoration(
color: AppColors.buttonCream.withOpacity(0.4),
borderRadius: BorderRadius.circular(20),
),
child: Column(
children: [
Icon(i, color: AppColors.brownMain, size: 28),
const SizedBox(height: 8),
Text(
t,
style: const TextStyle(
fontFamily: 'Montserrat',
fontSize: 10,
color: AppColors.textGrey,
fontWeight: FontWeight.w600,
),
),
Text(
v,
textAlign: TextAlign.center,
style: const TextStyle(
fontFamily: 'Montserrat',
fontSize: 14,
fontWeight: FontWeight.w700,
color: AppColors.brownMain,
),
),
],
),
),
);
}
}

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