Laravel / Website

This commit is contained in:
rmyrv 2025-07-25 14:55:43 +07:00
commit 793014673e
153 changed files with 9819 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
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release

45
.metadata Normal file
View File

@ -0,0 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: "35c388afb57ef061d06a39b537336c87e0e3d1b1"
channel: "stable"
project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
- platform: android
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
- platform: ios
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
- platform: linux
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
- platform: macos
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
- platform: web
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
- platform: windows
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
# 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'

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"cmake.sourceDirectory": "C:/Users/Romi/Documents/TA/mobileabsen/linux"
}

View File

@ -1,3 +1,4 @@
<<<<<<< HEAD
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p> <p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
<p align="center"> <p align="center">
@ -64,3 +65,21 @@ If you discover a security vulnerability within Laravel, please send an e-mail t
## License ## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
=======
# absen
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.
>>>>>>> 0bca8018d7bd57cb04c32d73a05331ed49b9f6fa

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,69 @@
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.absen"
compileSdk = flutter.compileSdkVersion
ndkVersion = "26.3.11579264"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.absen"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}
signingConfigs {
create("release") {
keyAlias = keystoreProperties["keyAlias"] as String
keyPassword = keystoreProperties["keyPassword"] as String
storeFile = keystoreProperties["storeFile"]?.let { file(it) }
storePassword = keystoreProperties["storePassword"] as String
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
// signingConfig = signingConfigs.getByName("debug")
signingConfig = signingConfigs.getByName("release")
}
}
}
flutter {
source = "../.."
}
dependencies {
// ...
implementation("com.google.android.material:material:1.8.0")
// ...
}

View File

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

View File

@ -0,0 +1,53 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Izin yang dibutuhkan -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.CAMERA"/>
<application
android:name="${applicationName}"
android:label="Abensiku"
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true"
android:networkSecurityConfig="@xml/network_security_config">
<!-- Google Maps API key harus di sini -->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCj4UPomrFAUt61rUNOus0Rx2D_Cxm1hM8"/>
<!-- Theme normal flutter -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"/>
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Flutter embedding marker -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- Jika kamu pakai clear-text HTTP -->
<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.absen
import io.flutter.embedding.android.FlutterActivity
class MainActivity : FlutterActivity()

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

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

View File

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

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<!-- Mengizinkan HTTP (cleartext) ke IP lokal 192.168.1.33 -->
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">192.168.1.6</domain>
</domain-config>
</network-security-config>

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>

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

@ -0,0 +1,21 @@
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,3 @@
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true

View File

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

View File

@ -0,0 +1,25 @@
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.7.0" apply false
id("org.jetbrains.kotlin.android") version "1.8.22" apply false
}
include(":app")

BIN
assets/logom.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
assets/logom2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

3
devtools_options.yaml Normal file
View File

@ -0,0 +1,3 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:

1
flutterabsensi Submodule

@ -0,0 +1 @@
Subproject commit 9fe873ccb28c04e38232c7f65b47bb6523b69e10

34
ios/.gitignore vendored Normal file
View File

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

View File

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

View File

@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"

View File

@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"

43
ios/Podfile Normal file
View File

@ -0,0 +1,43 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '12.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

View File

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

View File

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

View File

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

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

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Absen</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>absen</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.
}
}

1
laravelabsensi Submodule

@ -0,0 +1 @@
Subproject commit f2bced84ebbdddab06e19a49e0527224b09b8740

View File

@ -0,0 +1,223 @@
import 'dart:convert';
import 'dart:io';
import 'package:absen/config/config.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:http/http.dart' as http;
import 'package:image_picker/image_picker.dart';
class CheckinPhotoScreen extends StatefulWidget {
final String token;
final Position position;
const CheckinPhotoScreen({
Key? key,
required this.token,
required this.position,
}) : super(key: key);
@override
State<CheckinPhotoScreen> createState() => _CheckinPhotoScreenState();
}
class _CheckinPhotoScreenState extends State<CheckinPhotoScreen> {
File? _photo;
Uint8List? _webPhotoBytes;
String? _webPhotoName;
bool _isLoading = false;
Future<void> _pickPhoto() async {
try {
if (kIsWeb) {
final result = await FilePicker.platform.pickFiles(
type: FileType.image,
);
if (result != null && result.files.single.bytes != null) {
setState(() {
_webPhotoBytes = result.files.single.bytes;
_webPhotoName = result.files.single.name;
});
}
} else {
final picker = ImagePicker();
final picked = await picker.pickImage(
source: ImageSource.camera,
imageQuality: 70,
);
if (picked != null) {
setState(() {
_photo = File(picked.path);
});
}
}
} catch (e) {
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Gagal mengambil foto: $e')));
}
}
bool _isPhotoReady() {
if (kIsWeb) {
return _webPhotoBytes != null && _webPhotoName != null;
} else {
return _photo != null;
}
}
Future<void> _submitCheckin() async {
if (!_isPhotoReady()) return;
setState(() => _isLoading = true);
final token = widget.token;
final uri = Uri.parse('${AppConfig.baseUrl}/api/employee/attendance');
final request =
http.MultipartRequest('POST', uri)
..headers['Authorization'] = 'Bearer $token'
..fields['type'] = 'in'
..fields['latitude'] = widget.position.latitude.toString()
..fields['longitude'] = widget.position.longitude.toString();
if (kIsWeb && _webPhotoBytes != null && _webPhotoName != null) {
request.files.add(
http.MultipartFile.fromBytes(
'photo',
_webPhotoBytes!,
filename: _webPhotoName,
),
);
} else if (_photo != null) {
request.files.add(
await http.MultipartFile.fromPath('photo', _photo!.path),
);
}
try {
final streamed = await request.send();
final response = await http.Response.fromStream(streamed);
setState(() => _isLoading = false);
final data = jsonDecode(response.body);
if (response.statusCode == 200) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(data['message'] ?? 'Check-in berhasil!')),
);
Navigator.popUntil(context, (route) => route.isFirst);
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(data['message'] ?? 'Check-in gagal!')),
);
}
} catch (e) {
setState(() => _isLoading = false);
ScaffoldMessenger.of(
context,
).showSnackBar(const SnackBar(content: Text('Terjadi kesalahan.')));
}
}
@override
Widget build(BuildContext context) {
final buttonStyle = ElevatedButton.styleFrom(
minimumSize: const Size.fromHeight(48),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
);
return Scaffold(
appBar: AppBar(
title: const Text('Check-in: Ambil Foto'),
centerTitle: true,
),
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Column(
children: [
const SizedBox(height: 24),
const Text(
'Pastikan wajah terlihat jelas, bebas dari objek yang menutupi, dan latar belakang cukup terang.',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16),
),
const SizedBox(height: 24),
ElevatedButton.icon(
style: buttonStyle,
onPressed: _pickPhoto,
icon: const Icon(Icons.camera_alt),
label: Text(!_isPhotoReady() ? 'Ambil Foto' : 'Ubah Foto'),
),
const SizedBox(height: 16),
Expanded(
child: Center(
child:
_isPhotoReady()
? Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.black26,
blurRadius: 6,
offset: Offset(0, 3),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(12),
child:
kIsWeb
? Image.memory(
_webPhotoBytes!,
height: 250,
fit: BoxFit.cover,
)
: Image.file(
_photo!,
height: 250,
fit: BoxFit.cover,
),
),
)
: Column(
mainAxisSize: MainAxisSize.min,
children: const [
Icon(
Icons.photo_camera_outlined,
size: 80,
color: Colors.grey,
),
SizedBox(height: 8),
Text(
'Belum ada foto',
style: TextStyle(color: Colors.grey),
),
],
),
),
),
const SizedBox(height: 16),
SizedBox(
width: double.infinity,
child: ElevatedButton(
style: buttonStyle,
onPressed:
_isPhotoReady() && !_isLoading ? _submitCheckin : null,
child:
_isLoading
? const SizedBox(
height: 24,
width: 24,
child: CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2,
),
)
: const Text('Check-in'),
),
),
const SizedBox(height: 16),
],
),
),
),
);
}
}

327
lib/checkin_screen.dart Normal file
View File

@ -0,0 +1,327 @@
import 'dart:convert';
import 'dart:math';
import 'package:absen/config/config.dart';
import 'package:absen/models/attendance_area.dart';
import 'package:absen/widgets/google_map_web_view.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:http/http.dart' as http;
import 'checkin_photo_screen.dart';
class CheckinScreen extends StatefulWidget {
final String token;
const CheckinScreen({Key? key, required this.token}) : super(key: key);
@override
State<CheckinScreen> createState() => _CheckinScreenState();
}
class _CheckinScreenState extends State<CheckinScreen> {
Position? _position;
bool _isLoading = false;
GoogleMapController? _mapController;
List<AttendanceArea> _areas = [];
LatLng? get _latLng =>
_position != null
? LatLng(_position!.latitude, _position!.longitude)
: null;
@override
void initState() {
super.initState();
_getLocation();
_fetchAttendanceAreas();
}
Future<void> _getLocation() async {
try {
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
if (!serviceEnabled) {
await Geolocator.openLocationSettings();
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Aktifkan layanan lokasi!')),
);
return;
}
LocationPermission permission = await Geolocator.checkPermission();
if (permission == LocationPermission.denied) {
permission = await Geolocator.requestPermission();
if (permission == LocationPermission.denied) {
ScaffoldMessenger.of(
context,
).showSnackBar(const SnackBar(content: Text('Izin lokasi ditolak!')));
return;
}
}
if (permission == LocationPermission.deniedForever) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Izin lokasi permanen ditolak!')),
);
return;
}
Position? pos;
try {
pos = await Geolocator.getCurrentPosition(
desiredAccuracy: LocationAccuracy.best,
timeLimit: const Duration(seconds: 10),
);
} catch (_) {
pos = await Geolocator.getLastKnownPosition();
}
if (pos == null || (pos.latitude == 0.0 && pos.longitude == 0.0)) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Lokasi belum akurat, coba lagi.')),
);
return;
}
setState(() => _position = pos);
if (!kIsWeb &&
_mapController != null &&
_latLng != null &&
_areas.isNotEmpty) {
_moveCameraToBounds();
}
} catch (e) {
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Gagal mengambil lokasi: $e')));
}
}
Future<void> _fetchAttendanceAreas() async {
final uri = Uri.parse('${AppConfig.baseUrl}/api/employee/attendance/areas');
final token = widget.token;
try {
final resp = await http.get(
uri,
headers: {'Authorization': 'Bearer $token'},
);
if (resp.statusCode == 200) {
final List<dynamic> data = jsonDecode(resp.body);
final List<AttendanceArea> fetched =
data.map((e) {
return AttendanceArea(
lat: (e['center_lat'] as num).toDouble(),
lng: (e['center_lng'] as num).toDouble(),
radius: (e['radius'] as num).toDouble(),
);
}).toList();
setState(() {
_areas = fetched;
});
if (_mapController != null && _position != null) {
_moveCameraToBounds();
}
}
} catch (_) {}
}
void _moveCameraToBounds() {
if (_mapController == null || _position == null) return;
final List<LatLng> points = [
LatLng(_position!.latitude, _position!.longitude),
..._areas.map((a) => LatLng(a.lat, a.lng)),
];
double south = points.first.latitude, north = points.first.latitude;
double west = points.first.longitude, east = points.first.longitude;
for (var p in points) {
south = min(south, p.latitude);
north = max(north, p.latitude);
west = min(west, p.longitude);
east = max(east, p.longitude);
}
final bounds = LatLngBounds(
southwest: LatLng(south, west),
northeast: LatLng(north, east),
);
Future.delayed(const Duration(milliseconds: 300), () {
_mapController?.animateCamera(CameraUpdate.newLatLngBounds(bounds, 60));
});
}
Future<void> _validateLocation() async {
if (_position == null) return;
setState(() => _isLoading = true);
final uri = Uri.parse(
'${AppConfig.baseUrl}/api/employee/attendance/check-location',
);
try {
final response = await http.post(
uri,
headers: {
'Authorization': 'Bearer ${widget.token}',
'Content-Type': 'application/json',
},
body: jsonEncode({
'latitude': _position!.latitude,
'longitude': _position!.longitude,
'type': 'in',
}),
);
setState(() => _isLoading = false);
final data = jsonDecode(response.body);
if (response.statusCode == 200 && data['valid'] == true) {
Navigator.push(
context,
MaterialPageRoute(
builder:
(_) => CheckinPhotoScreen(
token: widget.token,
position: _position!,
),
),
);
} else {
final msg = data['message'] ?? 'Lokasi tidak valid';
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text(msg)));
}
} catch (e) {
setState(() => _isLoading = false);
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Gagal validasi lokasi: $e')));
}
}
@override
Widget build(BuildContext context) {
final buttonStyle = ElevatedButton.styleFrom(
minimumSize: const Size.fromHeight(48),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
);
return Scaffold(
appBar: AppBar(
title: const Text('Check-in: Validasi Lokasi'),
centerTitle: true,
),
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Column(
children: [
const SizedBox(height: 16),
const Text(
'Pastikan GPS aktif dan Anda berada dalam area yang diperbolehkan. '
'Tekan tombol di bawah untuk cek lokasi.',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16),
),
const SizedBox(height: 16),
Expanded(
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
clipBehavior: Clip.hardEdge,
elevation: 4,
child: _buildMapWidget(),
),
),
const SizedBox(height: 16),
SizedBox(
width: double.infinity,
child: ElevatedButton(
style: buttonStyle,
onPressed:
(_position != null && !_isLoading)
? _validateLocation
: null,
child:
_isLoading
? const SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2,
),
)
: const Text('Cek Lokasi & Lanjut'),
),
),
const SizedBox(height: 16),
],
),
),
),
);
}
Widget _buildMapWidget() {
if (kIsWeb) {
if (_position == null) {
return const Center(child: Text('Lokasi belum diambil'));
}
return GoogleMapWebView(
latitude: _position!.latitude,
longitude: _position!.longitude,
areas: _areas,
);
}
if (_latLng == null) {
return const Center(child: Text('Lokasi belum diambil'));
}
return SizedBox(
height: 300,
child: GoogleMap(
initialCameraPosition: CameraPosition(
target:
_areas.isNotEmpty
? LatLng(_areas[0].lat, _areas[0].lng)
: _latLng!,
zoom: 17,
),
markers: {
Marker(
markerId: const MarkerId('me'),
position: _latLng!,
infoWindow: const InfoWindow(title: 'Lokasi Anda'),
),
..._areas.asMap().entries.map(
(entry) => Marker(
markerId: MarkerId('area_${entry.key}'),
position: LatLng(entry.value.lat, entry.value.lng),
infoWindow: InfoWindow(title: 'Area Absen ${entry.key + 1}'),
icon: BitmapDescriptor.defaultMarkerWithHue(
BitmapDescriptor.hueAzure,
),
),
),
},
circles:
_areas
.asMap()
.entries
.map(
(entry) => Circle(
circleId: CircleId('absen_area_${entry.key}'),
center: LatLng(entry.value.lat, entry.value.lng),
radius: entry.value.radius,
fillColor: Colors.blue.withOpacity(0.2),
strokeColor: Colors.blue,
strokeWidth: 2,
),
)
.toSet(),
onMapCreated: (controller) {
_mapController = controller;
if (_position != null && _areas.isNotEmpty) {
_moveCameraToBounds();
}
},
myLocationEnabled: true,
),
);
}
}

View File

@ -0,0 +1,223 @@
import 'dart:convert';
import 'dart:io';
import 'package:absen/config/config.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:http/http.dart' as http;
import 'package:image_picker/image_picker.dart';
class CheckoutPhotoScreen extends StatefulWidget {
final String token;
final Position position;
const CheckoutPhotoScreen({
Key? key,
required this.token,
required this.position,
}) : super(key: key);
@override
State<CheckoutPhotoScreen> createState() => _CheckoutPhotoScreenState();
}
class _CheckoutPhotoScreenState extends State<CheckoutPhotoScreen> {
File? _photo;
Uint8List? _webPhotoBytes;
String? _webPhotoName;
bool _isLoading = false;
Future<void> _pickPhoto() async {
try {
if (kIsWeb) {
final result = await FilePicker.platform.pickFiles(
type: FileType.image,
);
if (result != null && result.files.single.bytes != null) {
setState(() {
_webPhotoBytes = result.files.single.bytes;
_webPhotoName = result.files.single.name;
});
}
} else {
final picker = ImagePicker();
final picked = await picker.pickImage(
source: ImageSource.camera,
imageQuality: 70,
);
if (picked != null) {
setState(() {
_photo = File(picked.path);
});
}
}
} catch (e) {
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Gagal mengambil foto: $e')));
}
}
bool _isPhotoReady() {
if (kIsWeb) {
return _webPhotoBytes != null && _webPhotoName != null;
} else {
return _photo != null;
}
}
Future<void> _submitCheckout() async {
if (!_isPhotoReady()) return;
setState(() => _isLoading = true);
final token = widget.token;
final uri = Uri.parse('${AppConfig.baseUrl}/api/employee/attendance');
final request =
http.MultipartRequest('POST', uri)
..headers['Authorization'] = 'Bearer $token'
..fields['type'] = 'out'
..fields['latitude'] = widget.position.latitude.toString()
..fields['longitude'] = widget.position.longitude.toString();
if (kIsWeb && _webPhotoBytes != null && _webPhotoName != null) {
request.files.add(
await http.MultipartFile.fromBytes(
'photo',
_webPhotoBytes!,
filename: _webPhotoName,
),
);
} else if (_photo != null) {
request.files.add(
await http.MultipartFile.fromPath('photo', _photo!.path),
);
}
try {
final streamed = await request.send();
final response = await http.Response.fromStream(streamed);
setState(() => _isLoading = false);
final data = jsonDecode(response.body);
if (response.statusCode == 200) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(data['message'] ?? 'Check-out berhasil!')),
);
Navigator.popUntil(context, (route) => route.isFirst);
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(data['message'] ?? 'Check-out gagal!')),
);
}
} catch (e) {
setState(() => _isLoading = false);
ScaffoldMessenger.of(
context,
).showSnackBar(const SnackBar(content: Text('Terjadi kesalahan.')));
}
}
@override
Widget build(BuildContext context) {
final buttonStyle = ElevatedButton.styleFrom(
minimumSize: const Size.fromHeight(48),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
);
return Scaffold(
appBar: AppBar(
title: const Text('Check-out: Ambil Foto'),
centerTitle: true,
),
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Column(
children: [
const SizedBox(height: 24),
const Text(
'Pastikan wajah terlihat jelas tanpa objek menutupi, dan latar belakang cukup terang.',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16),
),
const SizedBox(height: 24),
ElevatedButton.icon(
style: buttonStyle,
onPressed: _pickPhoto,
icon: const Icon(Icons.camera_alt),
label: Text(!_isPhotoReady() ? 'Ambil Foto' : 'Ubah Foto'),
),
const SizedBox(height: 16),
Expanded(
child: Center(
child:
_isPhotoReady()
? Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.black26,
blurRadius: 6,
offset: Offset(0, 3),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(12),
child:
kIsWeb
? Image.memory(
_webPhotoBytes!,
height: 250,
fit: BoxFit.cover,
)
: Image.file(
_photo!,
height: 250,
fit: BoxFit.cover,
),
),
)
: Column(
mainAxisSize: MainAxisSize.min,
children: const [
Icon(
Icons.photo_camera_outlined,
size: 80,
color: Colors.grey,
),
SizedBox(height: 8),
Text(
'Belum ada foto',
style: TextStyle(color: Colors.grey),
),
],
),
),
),
const SizedBox(height: 16),
SizedBox(
width: double.infinity,
child: ElevatedButton(
style: buttonStyle,
onPressed:
_isPhotoReady() && !_isLoading ? _submitCheckout : null,
child:
_isLoading
? const SizedBox(
height: 24,
width: 24,
child: CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2,
),
)
: const Text('Check-out'),
),
),
const SizedBox(height: 16),
],
),
),
),
);
}
}

378
lib/checkout_screen.dart Normal file
View File

@ -0,0 +1,378 @@
import 'dart:convert';
import 'dart:math';
import 'package:absen/config/config.dart';
import 'package:absen/models/attendance_area.dart';
import 'package:absen/widgets/google_map_web_view.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:http/http.dart' as http;
import 'checkout_photo_screen.dart';
class CheckoutScreen extends StatefulWidget {
final String token;
const CheckoutScreen({Key? key, required this.token}) : super(key: key);
@override
State<CheckoutScreen> createState() => _CheckoutScreenState();
}
class _CheckoutScreenState extends State<CheckoutScreen> {
Position? _position;
GoogleMapController? _mapController;
bool _isLoading = false;
bool _canCheckout = false;
bool _checkedStatus = false;
List<AttendanceArea> _areas = [];
LatLng? get _latLng =>
_position != null
? LatLng(_position!.latitude, _position!.longitude)
: null;
@override
void initState() {
super.initState();
_checkTodayStatus();
_fetchAttendanceAreas();
_getLocation();
}
Future<void> _checkTodayStatus() async {
setState(() => _checkedStatus = false);
final url = Uri.parse(
'${AppConfig.baseUrl}/api/employee/attendance/today-status',
);
try {
final resp = await http.get(
url,
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (resp.statusCode == 200) {
final data = jsonDecode(resp.body)['data'];
setState(() {
_canCheckout = data['clock_in'] != null && data['clock_out'] == null;
});
} else {
setState(() => _canCheckout = false);
}
} catch (_) {
setState(() => _canCheckout = false);
} finally {
setState(() => _checkedStatus = true);
}
}
Future<void> _fetchAttendanceAreas() async {
final uri = Uri.parse('${AppConfig.baseUrl}/api/employee/attendance/areas');
// Asumsikan endpoint mengembalikan JSON array: [ { center_lat, center_lng, radius }, ... ]
try {
final resp = await http.get(
uri,
headers: {'Authorization': 'Bearer ${widget.token}'},
);
if (resp.statusCode == 200) {
final List<dynamic> data = jsonDecode(resp.body);
final List<AttendanceArea> fetched =
data.map((e) {
return AttendanceArea(
lat: (e['center_lat'] as num).toDouble(),
lng: (e['center_lng'] as num).toDouble(),
radius: (e['radius'] as num).toDouble(),
);
}).toList();
setState(() {
_areas = fetched;
});
if (_mapController != null && _position != null) {
_moveCameraToBounds();
}
}
} catch (_) {
// Jika API lama hanya mengirim satu area, bisa fallback:
// final single = jsonDecode(resp.body);
// setState(() => _areas = [AttendanceArea(...)] );
}
}
Future<void> _getLocation() async {
try {
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
if (!serviceEnabled) {
await Geolocator.openLocationSettings();
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Aktifkan layanan lokasi!')),
);
return;
}
LocationPermission permission = await Geolocator.checkPermission();
if (permission == LocationPermission.denied) {
permission = await Geolocator.requestPermission();
if (permission == LocationPermission.denied) {
ScaffoldMessenger.of(
context,
).showSnackBar(const SnackBar(content: Text('Izin lokasi ditolak!')));
return;
}
}
if (permission == LocationPermission.deniedForever) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Izin lokasi permanen ditolak!')),
);
return;
}
final pos = await Geolocator.getCurrentPosition(
desiredAccuracy: LocationAccuracy.high,
);
setState(() => _position = pos);
if (_mapController != null && _areas.isNotEmpty) {
_moveCameraToBounds();
}
} catch (e) {
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Gagal mengambil lokasi: $e')));
}
}
void _moveCameraToBounds() {
if (_mapController == null || _position == null) return;
// kumpulkan semua LatLng: posisi user + semua pusat area
final List<LatLng> points = [
LatLng(_position!.latitude, _position!.longitude),
..._areas.map((a) => LatLng(a.lat, a.lng)),
];
double south = points.first.latitude, north = points.first.latitude;
double west = points.first.longitude, east = points.first.longitude;
for (var p in points) {
south = min(south, p.latitude);
north = max(north, p.latitude);
west = min(west, p.longitude);
east = max(east, p.longitude);
}
final bounds = LatLngBounds(
southwest: LatLng(south, west),
northeast: LatLng(north, east),
);
Future.delayed(const Duration(milliseconds: 300), () {
_mapController?.animateCamera(CameraUpdate.newLatLngBounds(bounds, 60));
});
}
Future<void> _validateLocationAndNavigate() async {
if (!_canCheckout) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Anda belum check-in hari ini!')),
);
return;
}
if (_position == null) {
ScaffoldMessenger.of(
context,
).showSnackBar(const SnackBar(content: Text('Lokasi belum diambil!')));
return;
}
// Opsional: cek client-side apakah posisi di dalam salah satu area
bool insideAny = false;
for (var area in _areas) {
final dist = Geolocator.distanceBetween(
_position!.latitude,
_position!.longitude,
area.lat,
area.lng,
); // meter
if (dist <= area.radius) {
insideAny = true;
break;
}
}
if (!_areas.isEmpty && !insideAny) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Anda berada di luar semua area yang diizinkan.'),
),
);
return;
}
setState(() => _isLoading = true);
final uri = Uri.parse(
'${AppConfig.baseUrl}/api/employee/attendance/check-location',
);
try {
final resp = await http.post(
uri,
headers: {
'Authorization': 'Bearer ${widget.token}',
'Content-Type': 'application/json',
},
body: jsonEncode({
'latitude': _position!.latitude,
'longitude': _position!.longitude,
'type': 'out',
}),
);
setState(() => _isLoading = false);
final data = jsonDecode(resp.body);
if (resp.statusCode == 200 && data['valid'] == true) {
Navigator.push(
context,
MaterialPageRoute(
builder:
(_) => CheckoutPhotoScreen(
token: widget.token,
position: _position!,
),
),
);
} else {
final msg = data['message'] ?? 'Lokasi tidak valid';
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text(msg)));
}
} catch (e) {
setState(() => _isLoading = false);
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Gagal validasi lokasi: $e')));
}
}
@override
Widget build(BuildContext context) {
final buttonStyle = ElevatedButton.styleFrom(
minimumSize: const Size.fromHeight(48),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
);
if (!_checkedStatus) {
return const Scaffold(body: Center(child: CircularProgressIndicator()));
}
return Scaffold(
appBar: AppBar(title: const Text('Check-out'), centerTitle: true),
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Column(
children: [
const SizedBox(height: 16),
Text(
_canCheckout
? 'Tekan tombol di bawah untuk cek lokasi dan lanjut ambil foto.'
: 'Anda belum melakukan check-in hari ini atau sudah check-out.',
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 16),
),
const SizedBox(height: 16),
Expanded(
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
elevation: 4,
clipBehavior: Clip.hardEdge,
child: _buildMapArea(),
),
),
const SizedBox(height: 16),
SizedBox(
width: double.infinity,
child: ElevatedButton(
style: buttonStyle,
onPressed:
(_position != null && !_isLoading && _canCheckout)
? _validateLocationAndNavigate
: null,
child:
_isLoading
? const SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2,
),
)
: const Text('Cek Lokasi & Lanjut'),
),
),
const SizedBox(height: 16),
],
),
),
),
);
}
Widget _buildMapArea() {
if (kIsWeb) {
if (_position == null) {
return const Center(child: Text('Lokasi belum diambil'));
}
return GoogleMapWebView(
latitude: _position!.latitude,
longitude: _position!.longitude,
areas: _areas,
);
}
if (_latLng == null) {
return const Center(child: Text('Lokasi belum diambil'));
}
// Tampilkan semua area sebagai circle & marker
final markers = <Marker>{
Marker(
markerId: const MarkerId('me'),
position: _latLng!,
infoWindow: const InfoWindow(title: 'Lokasi Anda'),
),
};
for (int i = 0; i < _areas.length; i++) {
final a = _areas[i];
markers.add(
Marker(
markerId: MarkerId('area_$i'),
position: LatLng(a.lat, a.lng),
infoWindow: InfoWindow(title: 'Area Absen ${i + 1}'),
icon: BitmapDescriptor.defaultMarkerWithHue(
BitmapDescriptor.hueAzure,
),
),
);
}
final circles = <Circle>{};
for (int i = 0; i < _areas.length; i++) {
final a = _areas[i];
circles.add(
Circle(
circleId: CircleId('absen_area_$i'),
center: LatLng(a.lat, a.lng),
radius: a.radius,
fillColor: Colors.blue.withOpacity(0.2),
strokeColor: Colors.blue,
strokeWidth: 2,
),
);
}
return GoogleMap(
initialCameraPosition: CameraPosition(
target:
_areas.isNotEmpty ? LatLng(_areas[0].lat, _areas[0].lng) : _latLng!,
zoom: 16,
),
markers: markers,
circles: circles,
onMapCreated: (ctrl) {
_mapController = ctrl;
if (_position != null && _areas.isNotEmpty) {
_moveCameraToBounds();
}
},
myLocationEnabled: true,
);
}
}

3
lib/config/config.dart Normal file
View File

@ -0,0 +1,3 @@
class AppConfig {
static const String baseUrl = 'http://192.168.1.6:8000';
}

818
lib/dashboard_screen.dart Normal file
View File

@ -0,0 +1,818 @@
import 'dart:convert';
import 'package:absen/config/config.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:intl/intl.dart';
import 'checkin_screen.dart';
import 'checkout_screen.dart';
import 'izin_screen.dart';
import 'profile_screen.dart';
import 'riwayat_screen.dart';
class DashboardScreen extends StatelessWidget {
final String userName;
final String token;
const DashboardScreen({Key? key, required this.userName, required this.token})
: super(key: key);
Future<Map<String, dynamic>> fetchTodayStatus(String token) async {
final url = Uri.parse(
'${AppConfig.baseUrl}/api/employee/attendance/today-status',
);
final response = await http.get(
url,
headers: {'Authorization': 'Bearer $token', 'Accept': 'application/json'},
);
if (response.statusCode == 200) {
return jsonDecode(response.body)['data'] ?? {};
} else {
throw Exception('Gagal mengambil status absensi');
}
}
Future<List<Map<String, dynamic>>> fetchLastActivities(String token) async {
final url = Uri.parse(
'${AppConfig.baseUrl}/api/employee/attendance/history?length=3&start=0',
);
final response = await http.get(
url,
headers: {'Authorization': 'Bearer $token', 'Accept': 'application/json'},
);
if (response.statusCode == 200) {
final data = jsonDecode(response.body)['data'] as List<dynamic>;
return data.cast<Map<String, dynamic>>();
} else {
throw Exception('Gagal mengambil aktivitas');
}
}
Future<List<Map<String, dynamic>>> fetchUpcomingPermissions(
String token,
) async {
final today = DateTime.now();
final todayStr =
"${today.year.toString().padLeft(4, '0')}-${today.month.toString().padLeft(2, '0')}-${today.day.toString().padLeft(2, '0')}";
final url = Uri.parse(
'${AppConfig.baseUrl}/api/employee/permission/history?start_date=$todayStr&length=5',
);
final response = await http.get(
url,
headers: {'Authorization': 'Bearer $token', 'Accept': 'application/json'},
);
if (response.statusCode == 200) {
final data = jsonDecode(response.body)['data'] as List<dynamic>;
return data.cast<Map<String, dynamic>>();
} else {
throw Exception('Gagal mengambil izin mendatang');
}
}
@override
Widget build(BuildContext context) {
final now = DateTime.now();
final dateStr = DateFormat('EEEE, d MMMM yyyy', 'id_ID').format(now);
final timeStr = DateFormat('HH:mm').format(now);
String greeting() {
final hour = now.hour;
if (hour >= 4 && hour < 10) return 'Selamat Pagi,';
if (hour >= 10 && hour < 15) return 'Selamat Siang,';
if (hour >= 15 && hour < 18) return 'Selamat Sore,';
return 'Selamat Malam,';
}
return Scaffold(
backgroundColor: const Color(0xFFF7F9FB),
body: SafeArea(
child: SingleChildScrollView(
child: Column(
children: [
// Header
Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF4F8DFD), Color(0xFF6FC8FB)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(24),
bottomRight: Radius.circular(24),
),
),
padding: const EdgeInsets.fromLTRB(20, 24, 20, 20),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
greeting(),
style: const TextStyle(
color: Colors.white,
fontSize: 16,
),
),
const SizedBox(height: 2),
Text(
(userName.isNotEmpty ? userName : 'Budi Santoso'),
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 20,
),
),
const SizedBox(height: 8),
Text(
'$dateStr$timeStr WIB',
style: const TextStyle(
color: Colors.white70,
fontSize: 13,
),
),
],
),
),
const CircleAvatar(
radius: 24,
backgroundImage: AssetImage('assets/logom.png'),
),
],
),
),
const SizedBox(height: 16),
// Tombol Aksi
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CheckinScreen(token: token),
),
);
},
child: _ActionButton(
icon: Icons.login,
label: 'Check-in',
color: const Color(0xFF4F8DFD),
),
),
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CheckoutScreen(token: token),
),
);
},
child: _ActionButton(
icon: Icons.logout,
label: 'Check-out',
color: const Color.fromARGB(255, 140, 150, 254),
),
),
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => IzinScreen(token: token),
),
);
},
child: _ActionButton(
icon: Icons.assignment_turned_in_outlined,
label: 'Izin',
color: const Color.fromARGB(255, 16, 171, 148),
iconColor: const Color.fromARGB(255, 16, 171, 148),
),
),
],
),
),
const SizedBox(height: 20),
// Jam Kerja Hari Ini
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: FutureBuilder<Map<String, dynamic>>(
future: fetchTodayStatus(token),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Container(
padding: const EdgeInsets.all(32),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: const Center(child: CircularProgressIndicator()),
);
}
if (snapshot.hasError) {
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Text(
'Gagal memuat data absensi hari ini',
style: TextStyle(color: Colors.red),
),
);
}
final data = snapshot.data ?? {};
final clockIn = data['clock_in']?['time'] ?? null;
final clockOut = data['clock_out']?['time'] ?? null;
// Jam kerja tetap 08:30 - 17:30
final startTime = DateTime(
now.year,
now.month,
now.day,
8,
00,
);
final endTime = DateTime(
now.year,
now.month,
now.day,
17,
00,
);
DateTime? checkInTime;
DateTime? checkOutTime;
if (clockIn != null) {
checkInTime = DateFormat('HH:mm:ss').parse(clockIn);
checkInTime = DateTime(
now.year,
now.month,
now.day,
checkInTime.hour,
checkInTime.minute,
checkInTime.second,
);
}
if (clockOut != null) {
checkOutTime = DateFormat('HH:mm:ss').parse(clockOut);
checkOutTime = DateTime(
now.year,
now.month,
now.day,
checkOutTime.hour,
checkOutTime.minute,
checkOutTime.second,
);
}
// Progress
double progress = 0;
String progressText = '0j 0m / 8j';
if (checkInTime != null) {
final end = checkOutTime ?? now;
final dur = end.difference(checkInTime);
final jam = dur.inHours;
final menit = dur.inMinutes % 60;
progress = dur.inMinutes / 480.0;
if (progress > 1) progress = 1;
progressText = '${jam}j ${menit}m / 8j';
}
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'Jam Kerja Hari Ini',
style: TextStyle(fontWeight: FontWeight.bold),
),
Text(
'${DateFormat('HH:mm').format(startTime)} - ${DateFormat('HH:mm').format(endTime)}',
style: const TextStyle(color: Colors.black54),
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Text(
'Progress',
style: TextStyle(
fontSize: 13,
color: Colors.black54,
),
),
const SizedBox(width: 8),
Text(
progressText,
style: const TextStyle(
fontSize: 13,
color: Colors.black87,
),
),
],
),
const SizedBox(height: 8),
LinearProgressIndicator(
value: progress,
backgroundColor: const Color(0xFFE3EAF2),
color: const Color(0xFF4F8DFD),
minHeight: 6,
borderRadius: const BorderRadius.all(
Radius.circular(8),
),
),
const SizedBox(height: 8),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Check-in: ${checkInTime != null ? DateFormat('HH:mm').format(checkInTime) : '-'}',
style: const TextStyle(fontSize: 13),
),
Text(
'Check-out: ${checkOutTime != null ? DateFormat('HH:mm').format(checkOutTime) : '-'}',
style: const TextStyle(fontSize: 13),
),
],
),
const SizedBox(height: 16),
// const Text(
// 'Kehadiran Minggu Ini',
// style: TextStyle(fontWeight: FontWeight.bold),
// ),
// const SizedBox(height: 8),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: const [
// _DayCircle('S', false),
// _DayCircle('S', false),
// _DayCircle('R', false),
// _DayCircle('K', true),
// _DayCircle('J', false),
// _DayCircle('S', false),
// _DayCircle('M', false),
// ],
// ),
],
),
);
},
),
),
const SizedBox(height: 20),
// Aktivitas Terakhir
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'Aktivitas Terakhir',
style: TextStyle(fontWeight: FontWeight.bold),
),
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => RiwayatScreen(
userName: userName,
token: token,
),
),
);
},
child: const Text(
'Lihat Semua',
style: TextStyle(
color: Color(0xFF4F8DFD),
fontSize: 13,
),
),
),
],
),
),
const SizedBox(height: 8),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: FutureBuilder<List<Map<String, dynamic>>>(
future: fetchLastActivities(token),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
}
if (snapshot.hasError) {
return const Text('Gagal memuat aktivitas');
}
final activities = snapshot.data ?? [];
if (activities.isEmpty) {
return const Text('Belum ada aktivitas');
}
return Column(
children:
activities.map((item) {
final type = item['type'];
final icon =
type == 'in' ? Icons.login : Icons.logout;
final title =
type == 'in' ? 'Check-in' : 'Check-out';
final date = item['date'] ?? '';
final time = item['time'] ?? '';
final status = item['status'] ?? '-';
late Color statusColor;
late String statusText;
switch (status) {
case 'pending':
statusColor = const Color(0xFFFFC542);
statusText = 'Menunggu';
break;
case 'accepted':
statusColor = const Color(0xFF1BCFB4);
statusText = 'Diterima';
break;
case 'jam_kerja_kurang':
statusColor = const Color(0xFFE57373);
statusText = 'Jam Kerja Kurang';
break;
case 'lembur':
statusColor = const Color(0xFF4F8DFD);
statusText = 'Lembur';
break;
case 'late':
statusColor = const Color(0xFFFF7043);
statusText = 'Terlambat';
break;
case 'rejected':
statusColor = const Color(0xFFD32F2F);
statusText = 'Ditolak';
break;
default:
statusColor = const Color(0xFF9E9E9E);
statusText =
status[0].toUpperCase() +
status.substring(1);
}
return _ActivityTile(
icon: icon,
title: title,
subtitle: '$date, $time WIB',
status: statusText,
statusColor: statusColor,
);
}).toList(),
);
},
),
),
const SizedBox(height: 20),
// Izin Mendatang
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: const [
Text(
'Izin Mendatang',
style: TextStyle(fontWeight: FontWeight.bold),
),
],
),
),
const SizedBox(height: 8),
SizedBox(
height: 120,
child: FutureBuilder<List<Map<String, dynamic>>>(
future: fetchUpcomingPermissions(token),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
}
if (snapshot.hasError) {
return const Center(
child: Text('Gagal memuat izin mendatang'),
);
}
final data = snapshot.data ?? [];
if (data.isEmpty) {
return const Center(
child: Text('Tidak ada izin mendatang'),
);
}
return ListView.separated(
scrollDirection: Axis.horizontal,
padding: const EdgeInsets.symmetric(horizontal: 20.0),
itemCount: data.length,
separatorBuilder: (_, __) => const SizedBox(width: 12),
itemBuilder: (context, i) {
final izin = data[i];
final status = izin['status'] ?? '';
Color statusColor;
String statusText;
if (status == 'pending') {
statusColor = const Color(0xFFFFC542);
statusText = 'Menunggu';
} else if (status == 'accepted') {
statusColor = const Color(0xFF1BCFB4);
statusText = 'Disetujui';
} else {
statusColor = const Color(0xFFE57373);
statusText = 'Ditolak';
}
final start = izin['start_date'] ?? '';
final end = izin['end_date'] ?? '';
String dateStr;
if (start == end) {
dateStr = start;
} else {
dateStr = '$start';
}
return SizedBox(
width: 220,
child: _IzinCard(
title: izin['category'] ?? '-',
date: dateStr,
status: statusText,
statusColor: statusColor,
description: izin['reason'] ?? '-',
),
);
},
);
},
),
),
const SizedBox(height: 32),
],
),
),
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: 0,
selectedItemColor: const Color(0xFF4F8DFD),
unselectedItemColor: Colors.black38,
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.home_rounded),
label: 'Beranda',
),
BottomNavigationBarItem(icon: Icon(Icons.history), label: 'Riwayat'),
BottomNavigationBarItem(icon: Icon(Icons.person), label: 'Profil'),
],
type: BottomNavigationBarType.fixed,
onTap: (index) {
if (index == 0) return; // stay on Dashboard
if (index == 1) {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder:
(context) =>
RiwayatScreen(userName: userName, token: token),
),
(route) => false,
);
}
if (index == 2) {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (context) => ProfileScreen(token: token),
),
(route) => false,
);
}
// Tambahkan navigasi ke halaman lain jika ada (Absensi)
},
),
);
}
}
class _ActionButton extends StatelessWidget {
final IconData icon;
final String label;
final Color color;
final Color? iconColor;
const _ActionButton({
required this.icon,
required this.label,
required this.color,
this.iconColor,
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
width: 90,
height: 70,
decoration: BoxDecoration(
color: color.withOpacity(0.15),
borderRadius: BorderRadius.circular(16),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(icon, color: iconColor ?? color, size: 28),
const SizedBox(height: 6),
Text(
label,
style: TextStyle(
fontSize: 13,
color: color,
fontWeight: FontWeight.w600,
),
),
],
),
);
}
}
class _DayCircle extends StatelessWidget {
final String label;
final bool isActive;
const _DayCircle(this.label, this.isActive, {Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final bool isSunday = label == 'M';
final Color bgColor =
isSunday
? const Color(0xFFFF6B6B)
: (isActive ? const Color(0xFF4F8DFD) : const Color(0xFFE3EAF2));
final Color textColor =
isSunday ? Colors.white : (isActive ? Colors.white : Colors.black54);
return Container(
width: 32,
height: 32,
decoration: BoxDecoration(color: bgColor, shape: BoxShape.circle),
alignment: Alignment.center,
child: Text(
label,
style: TextStyle(color: textColor, fontWeight: FontWeight.bold),
),
);
}
}
class _ActivityTile extends StatelessWidget {
final IconData icon;
final String title;
final String subtitle;
final String status;
final Color statusColor;
const _ActivityTile({
required this.icon,
required this.title,
required this.subtitle,
required this.status,
required this.statusColor,
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.only(bottom: 12),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
),
child: Row(
children: [
Container(
width: 36,
height: 36,
decoration: BoxDecoration(
color: const Color(0xFFF2F6FF),
borderRadius: BorderRadius.circular(10),
),
child: Icon(icon, color: const Color(0xFF4F8DFD), size: 22),
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: const TextStyle(fontWeight: FontWeight.bold),
),
const SizedBox(height: 2),
Text(
subtitle,
style: const TextStyle(fontSize: 13, color: Colors.black54),
),
],
),
),
Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
decoration: BoxDecoration(
color: statusColor.withOpacity(0.12),
borderRadius: BorderRadius.circular(8),
),
child: Text(
status,
style: TextStyle(
color: statusColor,
fontWeight: FontWeight.bold,
fontSize: 13,
),
),
),
],
),
);
}
}
class _IzinCard extends StatelessWidget {
final String title;
final String date;
final String status;
final Color statusColor;
final String description;
const _IzinCard({
required this.title,
required this.date,
required this.status,
required this.statusColor,
required this.description,
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(14),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(14),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 2,
),
decoration: BoxDecoration(
color: statusColor.withOpacity(0.15),
borderRadius: BorderRadius.circular(8),
),
child: Text(
status,
style: TextStyle(
color: statusColor,
fontWeight: FontWeight.bold,
fontSize: 12,
),
),
),
const Spacer(),
Text(
date,
style: const TextStyle(fontSize: 12, color: Colors.black54),
),
],
),
const SizedBox(height: 8),
Text(
title,
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
),
const SizedBox(height: 4),
Text(
description,
style: const TextStyle(fontSize: 13, color: Colors.black54),
),
],
),
);
}
}

424
lib/izin_screen.dart Normal file
View File

@ -0,0 +1,424 @@
import 'dart:convert';
import 'dart:io';
import 'package:absen/config/config.dart';
import 'package:dotted_border/dotted_border.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:image_picker/image_picker.dart';
class IzinScreen extends StatefulWidget {
final String token;
const IzinScreen({Key? key, required this.token}) : super(key: key);
@override
State<IzinScreen> createState() => _IzinScreenState();
}
class _IzinScreenState extends State<IzinScreen> {
final _formKey = GlobalKey<FormState>();
DateTime? _startDate;
DateTime? _endDate;
String? _category;
final TextEditingController _reasonController = TextEditingController();
// Photo state
File? _photo;
Uint8List? _webPhotoBytes;
String? _webPhotoName;
bool _isLoading = false;
final List<String> _categories = [
'Cuti Tahunan',
'Izin Sakit',
'Izin Setengah Hari',
'Dinas di Luar',
];
// Pick start/end dates
Future<void> _pickDate(bool isStart) async {
final picked = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime.now(),
lastDate: DateTime.now().add(const Duration(days: 365)),
);
if (picked != null) {
setState(() {
if (isStart)
_startDate = picked;
else
_endDate = picked;
});
}
}
// Pick proof photo
Future<void> _pickPhoto() async {
try {
if (kIsWeb) {
final result = await FilePicker.platform.pickFiles(
type: FileType.image,
);
if (result != null && result.files.single.bytes != null) {
setState(() {
_webPhotoBytes = result.files.single.bytes;
_webPhotoName = result.files.single.name;
});
}
} else {
final picker = ImagePicker();
final picked = await picker.pickImage(
source: ImageSource.gallery,
imageQuality: 70,
);
if (picked != null) {
setState(() => _photo = File(picked.path));
}
}
} catch (e) {
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Gagal mengambil foto: $e')));
}
}
// Submit permission including location & photo
Future<void> _submitIzin() async {
if (_startDate == null || _endDate == null || _category == null) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Mohon lengkapi semua field')),
);
return;
}
setState(() => _isLoading = true);
final uri = Uri.parse('${AppConfig.baseUrl}/api/employee/permission');
final req =
http.MultipartRequest('POST', uri)
..headers['Authorization'] = 'Bearer ${widget.token}'
..fields['start_date'] = _startDate!.toIso8601String().split('T')[0]
..fields['end_date'] = _endDate!.toIso8601String().split('T')[0]
..fields['category'] = _category!
..fields['reason'] = _reasonController.text;
if (kIsWeb && _webPhotoBytes != null && _webPhotoName != null) {
req.files.add(
http.MultipartFile.fromBytes(
'proof_photo',
_webPhotoBytes!,
filename: _webPhotoName,
),
);
} else if (_photo != null) {
req.files.add(
await http.MultipartFile.fromPath('proof_photo', _photo!.path),
);
}
try {
final streamed = await req.send();
final resp = await http.Response.fromStream(streamed);
final data = jsonDecode(resp.body);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(data['message'] ?? 'Pengajuan izin gagal!')),
);
if (resp.statusCode == 200) Navigator.pop(context);
} catch (_) {
ScaffoldMessenger.of(
context,
).showSnackBar(const SnackBar(content: Text('Terjadi kesalahan.')));
} finally {
if (mounted) setState(() => _isLoading = false);
}
}
// Whether a photo is selected
bool _isPhotoReady() {
return kIsWeb
? _webPhotoBytes != null && _webPhotoName != null
: _photo != null;
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Form Izin'),
backgroundColor: const Color(0xFF4F8DFD),
elevation: 0,
),
backgroundColor: const Color(0xFFF7F9FB),
body: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
child: Center(
child: Container(
width: 430,
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(18),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.06),
blurRadius: 16,
offset: const Offset(0, 4),
),
],
),
child: Form(
key: _formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Start date
const Text(
'Tanggal Mulai',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
),
const SizedBox(height: 8),
InkWell(
onTap: () => _pickDate(true),
child: Container(
padding: const EdgeInsets.symmetric(
vertical: 14,
horizontal: 16,
),
decoration: BoxDecoration(
color: const Color(0xFFF7F9FB),
border: Border.all(color: const Color(0xFFE3EAF2)),
borderRadius: BorderRadius.circular(10),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
_startDate == null
? 'yyyy-mm-dd'
: _startDate!.toIso8601String().split('T')[0],
style: TextStyle(
color:
_startDate == null
? Colors.grey
: Colors.black,
fontSize: 15,
),
),
const Icon(
Icons.calendar_today,
color: Color(0xFF4F8DFD),
),
],
),
),
),
const SizedBox(height: 18),
// End date
const Text(
'Tanggal Akhir',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
),
const SizedBox(height: 8),
InkWell(
onTap: () => _pickDate(false),
child: Container(
padding: const EdgeInsets.symmetric(
vertical: 14,
horizontal: 16,
),
decoration: BoxDecoration(
color: const Color(0xFFF7F9FB),
border: Border.all(color: const Color(0xFFE3EAF2)),
borderRadius: BorderRadius.circular(10),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
_endDate == null
? 'yyyy-mm-dd'
: _endDate!.toIso8601String().split('T')[0],
style: TextStyle(
color:
_endDate == null ? Colors.grey : Colors.black,
fontSize: 15,
),
),
const Icon(
Icons.calendar_today,
color: Color(0xFF4F8DFD),
),
],
),
),
),
const SizedBox(height: 18),
// Category
const Text(
'Kategori',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
),
const SizedBox(height: 8),
DropdownButtonFormField<String>(
value: _category,
decoration: InputDecoration(
filled: true,
fillColor: const Color(0xFFF7F9FB),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: const BorderSide(color: Color(0xFFE3EAF2)),
),
contentPadding: const EdgeInsets.symmetric(
vertical: 14,
horizontal: 16,
),
),
hint: const Text('Pilih kategori'),
items:
_categories
.map(
(value) => DropdownMenuItem(
value: value,
child: Text(value),
),
)
.toList(),
onChanged: (v) => setState(() => _category = v),
validator: (v) => v == null ? 'Pilih kategori' : null,
),
const SizedBox(height: 18),
// Reason
const Text(
'Alasan',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
),
const SizedBox(height: 8),
TextFormField(
controller: _reasonController,
decoration: InputDecoration(
filled: true,
fillColor: const Color(0xFFF7F9FB),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: const BorderSide(color: Color(0xFFE3EAF2)),
),
contentPadding: const EdgeInsets.symmetric(
vertical: 14,
horizontal: 16,
),
),
maxLines: 3,
validator:
(v) =>
v == null || v.isEmpty
? 'Alasan tidak boleh kosong'
: null,
),
const SizedBox(height: 18),
// Photo proof
const Text(
'Foto Bukti',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
),
const SizedBox(height: 8),
GestureDetector(
onTap: _pickPhoto,
child: DottedBorder(
color: const Color(0xFFB5C9F7),
borderType: BorderType.RRect,
radius: const Radius.circular(12),
dashPattern: const [6, 3],
strokeWidth: 1.5,
child: Container(
width: double.infinity,
padding: const EdgeInsets.symmetric(vertical: 24),
decoration: BoxDecoration(
color: const Color(0xFFF7F9FB),
borderRadius: BorderRadius.circular(12),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(
Icons.camera_alt,
size: 40,
color: Color(0xFFB5C9F7),
),
const SizedBox(height: 8),
const Text(
'Unggah foto bukti',
style: TextStyle(
color: Color(0xFFB5C9F7),
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 4),
Text(
_isPhotoReady() ? 'File terpilih' : 'Pilih File',
style: const TextStyle(
color: Color(0xFF4F8DFD),
fontWeight: FontWeight.w500,
),
),
if (_isPhotoReady())
Padding(
padding: const EdgeInsets.only(top: 12.0),
child:
kIsWeb
? Image.memory(
_webPhotoBytes!,
height: 80,
)
: Image.file(_photo!, height: 80),
),
],
),
),
),
),
const SizedBox(height: 28),
// Submit button
SizedBox(
width: double.infinity,
height: 48,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF4F8DFD),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
elevation: 0,
),
onPressed: _isLoading ? null : _submitIzin,
child:
_isLoading
? const CircularProgressIndicator(
color: Colors.white,
)
: const Text(
'Kirim',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
),
),
),
),
);
}
}

279
lib/login_screen.dart Normal file
View File

@ -0,0 +1,279 @@
import 'dart:convert';
import 'package:absen/config/config.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dashboard_screen.dart';
class LoginScreen extends StatefulWidget {
const LoginScreen({Key? key}) : super(key: key);
@override
State<LoginScreen> createState() => _LoginScreenState();
}
class _LoginScreenState extends State<LoginScreen> {
final TextEditingController _emailController = TextEditingController();
final TextEditingController _passwordController = TextEditingController();
bool _obscurePassword = true;
bool _isLoading = false;
Future<void> _login() async {
setState(() {
_isLoading = true;
});
final url = Uri.parse('${AppConfig.baseUrl}/api/login');
try {
final response = await http.post(
url,
headers: {
'Content-Type': 'application/json',
'X-Platform': 'mobile', // penting!
},
body: jsonEncode({
'email': _emailController.text.trim(),
'password': _passwordController.text,
}),
);
// final response = await http.post(
// url,
// headers: {'Content-Type': 'application/json'},
// body: jsonEncode({
// 'email': _emailController.text.trim(),
// 'password': _passwordController.text,
// }),
// );
final data = jsonDecode(response.body);
if (response.statusCode == 200) {
// Login berhasil
if (!mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(data['message'] ?? 'Login berhasil.')),
);
// Navigasi ke dashboard dengan nama user dan token
await Future.delayed(const Duration(milliseconds: 500));
if (mounted) {
final token = data['data']?['token'] ?? '';
String userName = '';
if (token.isNotEmpty) {
userName = await fetchUserNameByToken(token);
}
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder:
(context) =>
DashboardScreen(userName: userName, token: token),
),
);
}
} else {
// Login gagal
if (!mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(data['message'] ?? 'Login gagal.')),
);
}
} catch (e) {
if (!mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Terjadi kesalahan. Coba lagi nanti.')),
);
} finally {
if (mounted) {
setState(() {
_isLoading = false;
});
}
}
}
// Future<String> fetchUserNameByToken(String token) async {
// final url = Uri.parse('http://192.168.1.130:8000/api/user-by-token/$token');
// final response = await http.get(
// url,
// headers: {'Authorization': 'Bearer $token', 'Accept': 'application/json'},
// );
// if (response.statusCode == 200) {
// final data = jsonDecode(response.body);
// return data['data']?['name'] ?? '';
// } else {
// return '';
// }
// }
Future<String> fetchUserNameByToken(String token) async {
final url = Uri.parse('${AppConfig.baseUrl}/api/user-by-token/$token');
final response = await http.get(
url,
headers: {
'Authorization': 'Bearer $token',
'Accept': 'application/json',
'X-Platform': 'mobile',
},
);
if (response.statusCode == 200) {
final data = jsonDecode(response.body);
return data['data']?['name'] ?? '';
} else {
return '';
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 32.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 24),
ClipRRect(
borderRadius: BorderRadius.circular(
16,
), // Ubah sesuai keinginan
child: Image.asset(
'assets/logom.png',
height: 80,
fit: BoxFit.contain,
),
),
const SizedBox(height: 12),
const Text(
'Welcome back! Please login to your account',
style: TextStyle(fontSize: 16, color: Colors.black54),
textAlign: TextAlign.center,
),
const SizedBox(height: 32),
Align(
alignment: Alignment.centerLeft,
child: Text(
'Email',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
),
),
const SizedBox(height: 8),
TextField(
controller: _emailController,
decoration: InputDecoration(
prefixIcon: Icon(Icons.email_outlined),
hintText: 'Enter your email',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
keyboardType: TextInputType.emailAddress,
),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'Password',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
TextButton(
onPressed: () {},
child: const Text('Forgot Password?'),
style: TextButton.styleFrom(padding: EdgeInsets.zero),
),
],
),
TextField(
controller: _passwordController,
obscureText: _obscurePassword,
decoration: InputDecoration(
prefixIcon: Icon(Icons.lock_outline),
hintText: 'Enter your password',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
suffixIcon: IconButton(
icon: Icon(
_obscurePassword
? Icons.visibility_off
: Icons.visibility,
),
onPressed: () {
setState(() {
_obscurePassword = !_obscurePassword;
});
},
),
),
),
const SizedBox(height: 28),
SizedBox(
height: 48,
child: ElevatedButton(
onPressed: _isLoading ? null : _login,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child:
_isLoading
? const SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2,
),
)
: const Text(
'Login',
style: TextStyle(
fontSize: 18,
color: Colors.white,
),
),
),
),
const SizedBox(height: 24),
// Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// const Text("Don't have an account? "),
// GestureDetector(
// onTap: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => const RegisterScreen(),
// ),
// );
// },
// child: const Text(
// 'Sign up',
// style: TextStyle(
// color: Colors.blue,
// fontWeight: FontWeight.bold,
// ),
// ),
// ),
// ],
// ),
// const SizedBox(height: 24),
],
),
),
),
),
);
}
}

131
lib/main.dart Normal file
View File

@ -0,0 +1,131 @@
import 'package:flutter/material.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'login_screen.dart';
import 'checkin_photo_screen.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await initializeDateFormatting('id_ID', null);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
// This is the theme of your application.
//
// TRY THIS: Try running your application with "flutter run". You'll see
// the application has a purple toolbar. Then, without quitting the app,
// try changing the seedColor in the colorScheme below to Colors.green
// and then invoke "hot reload" (save your changes or press the "hot
// reload" button in a Flutter-supported IDE, or press "r" if you used
// the command line to start the app).
//
// Notice that the counter didn't reset back to zero; the application
// state is not lost during the reload. To reset the state, use hot
// restart instead.
//
// This works for code too, not just values: Most code changes can be
// tested with just a hot reload.
colorScheme: ColorScheme.fromSeed(
seedColor: const Color.fromARGB(255, 251, 251, 251),
),
),
home: const LoginScreen(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// TRY THIS: Try changing the color here to a specific color (to
// Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
// change color while the other colors stay the same.
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
//
// TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
// action in the IDE, or press "p" in the console), to see the
// wireframe for each widget.
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('You have pushed the button this many times:'),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}

View File

@ -0,0 +1,6 @@
class AttendanceArea {
final double lat;
final double lng;
final double radius;
AttendanceArea({required this.lat, required this.lng, required this.radius});
}

420
lib/profile_screen.dart Normal file
View File

@ -0,0 +1,420 @@
import 'dart:convert';
import 'package:absen/config/config.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart';
import 'dashboard_screen.dart';
import 'login_screen.dart'; // pastikan ada LoginScreen
import 'riwayat_screen.dart';
// Sesuaikan baseUrl sesuai environment:
// - Android emulator: 'http://10.0.2.2:8000'
// - iOS simulator: 'http://localhost:8000'
// - Perangkat nyata: 'http://<IP_PC>:8000'
// Untuk Web, gunakan host yang bisa diakses browser.
const String baseUrl = '${AppConfig.baseUrl}';
class ProfileScreen extends StatefulWidget {
final String token;
const ProfileScreen({Key? key, required this.token}) : super(key: key);
@override
State<ProfileScreen> createState() => _ProfileScreenState();
}
class _ProfileScreenState extends State<ProfileScreen> {
late Future<Map<String, dynamic>?> futureProfile;
@override
void initState() {
super.initState();
futureProfile = fetchProfile();
}
Future<Map<String, dynamic>?> fetchProfile() async {
final url = Uri.parse('$baseUrl/api/employee/profile');
try {
final response = await http.get(
url,
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
final body = jsonDecode(response.body);
return body['data'] as Map<String, dynamic>?;
} else {
return null;
}
} catch (_) {
return null;
}
}
void _refresh() {
setState(() {
futureProfile = fetchProfile();
});
}
Future<void> _logout() async {
final uri = Uri.parse('$baseUrl/api/logout');
try {
final resp = await http.post(
uri,
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (resp.statusCode == 200) {
final prefs = await SharedPreferences.getInstance();
await prefs.remove('token');
if (!mounted) return;
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (_) => const LoginScreen()),
(route) => false,
);
} else {
String msg = 'Gagal logout';
try {
final b = jsonDecode(resp.body);
msg = b['message'] ?? msg;
} catch (_) {}
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text(msg)));
}
} catch (e) {
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Error saat logout: $e')));
}
}
@override
Widget build(BuildContext context) {
return FutureBuilder<Map<String, dynamic>?>(
future: futureProfile,
builder: (context, snapshot) {
// Loading
if (snapshot.connectionState == ConnectionState.waiting) {
return Scaffold(
backgroundColor: const Color(0xFFF7F9FB),
appBar: AppBar(
title: const Text('Profil Saya'),
backgroundColor: const Color(0xFF4F8DFD),
elevation: 0,
centerTitle: true,
),
body: const Center(child: CircularProgressIndicator()),
);
}
// Error atau null
if (snapshot.hasError || snapshot.data == null) {
return Scaffold(
backgroundColor: const Color(0xFFF7F9FB),
appBar: AppBar(
title: const Text('Profil Saya'),
backgroundColor: const Color(0xFF4F8DFD),
elevation: 0,
centerTitle: true,
),
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text('Gagal memuat data profil'),
const SizedBox(height: 8),
ElevatedButton(
onPressed: _refresh,
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF4F8DFD),
),
child: const Text('Coba Lagi'),
),
],
),
),
);
}
// Data tersedia
final user = snapshot.data!;
final profile = user['profile'] as Map<String, dynamic>? ?? {};
final name = (user['name'] ?? '-').toString();
final email = (user['email'] ?? '-').toString();
final phone = (profile['phone_number'] ?? '-').toString();
final nip = (profile['nip'] ?? '-').toString();
final position = (profile['position'] ?? '-').toString();
final photoPath = profile['profile_photo'];
final photoUrl =
photoPath != null ? '$baseUrl/storage/$photoPath' : null;
return Scaffold(
backgroundColor: const Color(0xFFF7F9FB),
appBar: AppBar(
title: const Text('Profil Saya'),
backgroundColor: const Color(0xFF4F8DFD),
elevation: 0,
centerTitle: true,
),
body: SingleChildScrollView(
child: Column(
children: [
// Header: avatar + nama (tanpa tombol upload)
Container(
width: double.infinity,
decoration: const BoxDecoration(
color: Color(0xFF4F8DFD),
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(24),
bottomRight: Radius.circular(24),
),
),
child: Column(
children: [
const SizedBox(height: 40),
CircleAvatar(
radius: 40,
backgroundColor: Colors.white,
child: CircleAvatar(
radius: 36,
backgroundImage:
photoUrl != null
? NetworkImage(photoUrl)
: const AssetImage('assets/logom.png')
as ImageProvider,
),
),
const SizedBox(height: 12),
Text(
name,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
color: Colors.white,
),
),
const SizedBox(height: 24),
],
),
),
const SizedBox(height: 18),
// Informasi Pribadi tanpa edit
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Container(
width: double.infinity,
padding: const EdgeInsets.all(18),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(18),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.03),
blurRadius: 8,
offset: const Offset(0, 2),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Informasi Pribadi',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 15,
),
),
const SizedBox(height: 12),
_ProfileInfoRow(label: 'Nama', value: name),
_ProfileInfoRow(label: 'Email', value: email),
_ProfileInfoRow(label: 'No. Telepon', value: phone),
_ProfileInfoRow(label: 'NIP', value: nip),
_ProfileInfoRow(label: 'Jabatan', value: position),
],
),
),
),
const SizedBox(height: 18),
// Menu hanya logout
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
children: [
_ProfileMenuItem(
icon: Icons.logout,
label: 'Keluar',
color: Colors.red,
onTap: () async {
final confirmed =
await showDialog<bool>(
context: context,
builder:
(_) => AlertDialog(
title: const Text('Logout'),
content: const Text(
'Yakin ingin logout?',
),
actions: [
TextButton(
onPressed:
() =>
Navigator.pop(context, false),
child: const Text('Batal'),
),
TextButton(
onPressed:
() =>
Navigator.pop(context, true),
child: const Text('Ya'),
),
],
),
) ??
false;
if (confirmed) {
await _logout();
}
},
),
],
),
),
const SizedBox(height: 24),
],
),
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: 2,
selectedItemColor: const Color(0xFF4F8DFD),
unselectedItemColor: Colors.black38,
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.home_rounded),
label: 'Beranda',
),
BottomNavigationBarItem(
icon: Icon(Icons.history),
label: 'Riwayat',
),
BottomNavigationBarItem(
icon: Icon(Icons.person),
label: 'Profil',
),
],
type: BottomNavigationBarType.fixed,
onTap: (index) {
if (index == 2) return;
if (index == 0) {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder:
(context) => DashboardScreen(
userName: name,
token: widget.token,
),
),
(route) => false,
);
}
if (index == 1) {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder:
(context) =>
RiwayatScreen(userName: name, token: widget.token),
),
(route) => false,
);
}
},
),
);
},
);
}
}
class _ProfileInfoRow extends StatelessWidget {
final String label;
final String value;
const _ProfileInfoRow({required this.label, required this.value, Key? key})
: super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: 120,
child: Text(
label,
style: const TextStyle(color: Colors.black54, fontSize: 13),
),
),
Expanded(
child: Text(
value,
style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 13),
),
),
],
),
);
}
}
class _ProfileMenuItem extends StatelessWidget {
final IconData icon;
final String label;
final VoidCallback onTap;
final Color? color;
const _ProfileMenuItem({
required this.icon,
required this.label,
required this.onTap,
this.color,
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTap,
child: Container(
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 8),
decoration: const BoxDecoration(
border: Border(bottom: BorderSide(color: Color(0xFFF0F0F0))),
),
child: Row(
children: [
Icon(icon, color: color ?? const Color(0xFF4F8DFD)),
const SizedBox(width: 16),
Expanded(
child: Text(
label,
style: TextStyle(
color: color ?? Colors.black87,
fontWeight: FontWeight.w500,
fontSize: 15,
),
),
),
const Icon(Icons.chevron_right, color: Color(0xFFB0B0B0)),
],
),
),
);
}
}

252
lib/register_screen.dart Normal file
View File

@ -0,0 +1,252 @@
import 'dart:convert';
import 'package:absen/config/config.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
class RegisterScreen extends StatefulWidget {
const RegisterScreen({Key? key}) : super(key: key);
@override
State<RegisterScreen> createState() => _RegisterScreenState();
}
class _RegisterScreenState extends State<RegisterScreen> {
final TextEditingController _nameController = TextEditingController();
final TextEditingController _emailController = TextEditingController();
final TextEditingController _passwordController = TextEditingController();
final TextEditingController _confirmPasswordController =
TextEditingController();
bool _obscurePassword = true;
bool _obscureConfirmPassword = true;
bool _isLoading = false;
Future<void> _register() async {
setState(() {
_isLoading = true;
});
final url = Uri.parse('${AppConfig.baseUrl}/api/register');
// Ganti jika base URL berbeda
try {
final response = await http.post(
url,
headers: {'Content-Type': 'application/json'},
body: jsonEncode({
'name': _nameController.text.trim(),
'email': _emailController.text.trim(),
'password': _passwordController.text,
'password_confirmation': _confirmPasswordController.text,
'role': 'karyawan',
}),
);
final data = jsonDecode(response.body);
if (response.statusCode == 201) {
if (!mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(data['message'] ?? 'Registrasi berhasil.')),
);
await Future.delayed(const Duration(milliseconds: 500));
if (mounted) Navigator.pop(context);
} else {
if (!mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(data['message'] ?? 'Registrasi gagal.')),
);
}
} catch (e) {
if (!mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Terjadi kesalahan. Coba lagi nanti.')),
);
} finally {
if (mounted) {
setState(() {
_isLoading = false;
});
}
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 32.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 24),
Image.asset(
'assets/logom.png',
height: 80,
fit: BoxFit.contain,
),
const SizedBox(height: 12),
const Text(
'Buat akun baru Anda',
style: TextStyle(fontSize: 16, color: Colors.black54),
textAlign: TextAlign.center,
),
const SizedBox(height: 32),
Align(
alignment: Alignment.centerLeft,
child: Text(
'Nama Lengkap',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
),
),
const SizedBox(height: 8),
TextField(
controller: _nameController,
decoration: InputDecoration(
prefixIcon: Icon(Icons.person_outline),
hintText: 'Masukkan nama lengkap Anda',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
),
const SizedBox(height: 20),
Align(
alignment: Alignment.centerLeft,
child: Text(
'Email',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
),
),
const SizedBox(height: 8),
TextField(
controller: _emailController,
decoration: InputDecoration(
prefixIcon: Icon(Icons.email_outlined),
hintText: 'Masukkan email Anda',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
keyboardType: TextInputType.emailAddress,
),
const SizedBox(height: 20),
Align(
alignment: Alignment.centerLeft,
child: Text(
'Password',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
),
),
const SizedBox(height: 8),
TextField(
controller: _passwordController,
obscureText: _obscurePassword,
decoration: InputDecoration(
prefixIcon: Icon(Icons.lock_outline),
hintText: 'Buat password Anda',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
suffixIcon: IconButton(
icon: Icon(
_obscurePassword
? Icons.visibility_off
: Icons.visibility,
),
onPressed: () {
setState(() {
_obscurePassword = !_obscurePassword;
});
},
),
),
),
const SizedBox(height: 20),
Align(
alignment: Alignment.centerLeft,
child: Text(
'Konfirmasi Password',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
),
),
const SizedBox(height: 8),
TextField(
controller: _confirmPasswordController,
obscureText: _obscureConfirmPassword,
decoration: InputDecoration(
prefixIcon: Icon(Icons.lock_outline),
hintText: 'Konfirmasi password Anda',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
suffixIcon: IconButton(
icon: Icon(
_obscureConfirmPassword
? Icons.visibility_off
: Icons.visibility,
),
onPressed: () {
setState(() {
_obscureConfirmPassword = !_obscureConfirmPassword;
});
},
),
),
),
const SizedBox(height: 28),
SizedBox(
height: 48,
child: ElevatedButton(
onPressed: _isLoading ? null : _register,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child:
_isLoading
? const SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2,
),
)
: const Text(
'Daftar',
style: TextStyle(
fontSize: 18,
color: Colors.white,
),
),
),
),
const SizedBox(height: 24),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('Sudah punya akun? '),
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: const Text(
'Sign in',
style: TextStyle(
color: Colors.blue,
fontWeight: FontWeight.bold,
),
),
),
],
),
],
),
),
),
),
);
}
}

502
lib/riwayat_screen.dart Normal file
View File

@ -0,0 +1,502 @@
import 'dart:convert';
import 'package:absen/config/config.dart';
import 'package:absen/profile_screen.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:intl/intl.dart';
import 'dashboard_screen.dart';
class RiwayatScreen extends StatefulWidget {
final String token;
final String userName;
const RiwayatScreen({Key? key, required this.token, required this.userName})
: super(key: key);
@override
State<RiwayatScreen> createState() => _RiwayatScreenState();
}
class _RiwayatScreenState extends State<RiwayatScreen>
with SingleTickerProviderStateMixin {
late TabController _tabController;
DateTime? _startDate;
DateTime? _endDate;
bool _filtering = false;
@override
void initState() {
super.initState();
_tabController = TabController(length: 2, vsync: this);
}
Future<List<Map<String, dynamic>>> fetchAbsensi() async {
String urlStr =
'${AppConfig.baseUrl}/api/employee/attendance/history?length=20&start=0';
if (_startDate != null) {
urlStr += '&start_date=${DateFormat('yyyy-MM-dd').format(_startDate!)}';
}
if (_endDate != null) {
urlStr += '&end_date=${DateFormat('yyyy-MM-dd').format(_endDate!)}';
}
final url = Uri.parse(urlStr);
final response = await http.get(
url,
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
final data = jsonDecode(response.body)['data'] as List<dynamic>;
return data.cast<Map<String, dynamic>>();
} else {
throw Exception('Gagal mengambil riwayat absensi');
}
}
Future<List<Map<String, dynamic>>> fetchPermission() async {
String urlStr =
'${AppConfig.baseUrl}/api/employee/permission/history?length=20&start=0';
if (_startDate != null) {
urlStr += '&start_date=${DateFormat('yyyy-MM-dd').format(_startDate!)}';
}
if (_endDate != null) {
urlStr += '&end_date=${DateFormat('yyyy-MM-dd').format(_endDate!)}';
}
final url = Uri.parse(urlStr);
final response = await http.get(
url,
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
final decoded = jsonDecode(response.body);
final data = decoded['data'];
if (data is List) {
return data.cast<Map<String, dynamic>>();
} else {
return <Map<String, dynamic>>[];
}
} else {
throw Exception('Gagal mengambil riwayat izin');
}
}
Future<void> _pickDate(bool isStart) async {
final DateTime? picked = await showDatePicker(
context: context,
initialDate:
isStart
? (_startDate ?? DateTime.now())
: (_endDate ?? DateTime.now()),
firstDate: DateTime(2022, 1, 1),
lastDate: DateTime.now().add(const Duration(days: 365)),
);
if (picked != null) {
setState(() {
if (isStart) {
_startDate = picked;
} else {
_endDate = picked;
}
});
}
}
void _applyFilter() {
setState(() {
_filtering = !_filtering;
});
// FutureBuilder akan rebuild karena setState
}
void _clearFilter() {
setState(() {
_startDate = null;
_endDate = null;
_filtering = !_filtering;
});
}
Widget _buildFilterBar() {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
SizedBox(
width: 150,
child: InkWell(
onTap: () => _pickDate(true),
child: Container(
padding: const EdgeInsets.symmetric(
vertical: 10,
horizontal: 12,
),
decoration: BoxDecoration(
color: const Color(0xFFF7F9FB),
border: Border.all(color: const Color(0xFFE3EAF2)),
borderRadius: BorderRadius.circular(10),
),
child: Row(
children: [
const Icon(
Icons.date_range,
size: 18,
color: Color(0xFF4F8DFD),
),
const SizedBox(width: 6),
Flexible(
child: Text(
_startDate == null
? 'Tanggal Mulai'
: DateFormat('dd/MM/yyyy').format(_startDate!),
overflow: TextOverflow.ellipsis,
style: TextStyle(
color:
_startDate == null ? Colors.grey : Colors.black,
fontSize: 14,
),
),
),
],
),
),
),
),
const SizedBox(width: 10),
SizedBox(
width: 150,
child: InkWell(
onTap: () => _pickDate(false),
child: Container(
padding: const EdgeInsets.symmetric(
vertical: 10,
horizontal: 12,
),
decoration: BoxDecoration(
color: const Color(0xFFF7F9FB),
border: Border.all(color: const Color(0xFFE3EAF2)),
borderRadius: BorderRadius.circular(10),
),
child: Row(
children: [
const Icon(
Icons.date_range,
size: 18,
color: Color(0xFF4F8DFD),
),
const SizedBox(width: 6),
Flexible(
child: Text(
_endDate == null
? 'Tanggal Akhir'
: DateFormat('dd/MM/yyyy').format(_endDate!),
overflow: TextOverflow.ellipsis,
style: TextStyle(
color:
_endDate == null ? Colors.grey : Colors.black,
fontSize: 14,
),
),
),
],
),
),
),
),
const SizedBox(width: 10),
ElevatedButton(
onPressed: _applyFilter,
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF4F8DFD),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 12,
),
),
child: const Text(
'Terapkan',
style: TextStyle(fontSize: 13, color: Colors.white),
),
),
if (_startDate != null || _endDate != null)
IconButton(
icon: const Icon(Icons.clear, color: Colors.red),
onPressed: _clearFilter,
tooltip: 'Hapus Filter',
),
],
),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Riwayat - ${widget.userName}'),
backgroundColor: const Color(0xFF4F8DFD),
elevation: 0,
bottom: PreferredSize(
preferredSize: const Size.fromHeight(48),
child: Container(
color: const Color(0xFF4F8DFD),
child: TabBar(
controller: _tabController,
indicatorColor: Colors.white,
labelColor: Colors.white,
unselectedLabelColor: Colors.white70,
tabs: const [Tab(text: 'Absensi'), Tab(text: 'Izin')],
),
),
),
),
backgroundColor: const Color(0xFFF7F9FB),
body: Column(
children: [
_buildFilterBar(),
Expanded(
child: TabBarView(
controller: _tabController,
children: [
// Tab Absensi
FutureBuilder<List<Map<String, dynamic>>>(
future: fetchAbsensi(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
}
if (snapshot.hasError) {
return const Center(
child: Text('Gagal memuat data absensi'),
);
}
final data = snapshot.data ?? [];
if (data.isEmpty) {
return const Center(
child: Text('Belum ada data absensi'),
);
}
return ListView.builder(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
itemCount: data.length,
itemBuilder: (context, i) {
final item = data[i];
final status = item['status'] ?? '-';
late Color statusColor;
late String statusText;
switch (status) {
case 'pending':
statusColor = const Color(0xFFFFC542);
statusText = 'Menunggu';
break;
case 'accepted':
statusColor = const Color(0xFF1BCFB4);
statusText = 'Diterima';
break;
case 'jam_kerja_kurang':
statusColor = const Color(0xFFE57373);
statusText = 'Jam Kerja Kurang';
break;
case 'lembur':
statusColor = const Color(0xFF4F8DFD);
statusText = 'Lembur';
break;
case 'late':
statusColor = const Color(0xFFFF7043);
statusText = 'Terlambat';
break;
case 'rejected':
statusColor = const Color(0xFFD32F2F);
statusText = 'Ditolak';
break;
default:
statusColor = const Color(0xFF9E9E9E);
statusText =
status[0].toUpperCase() + status.substring(1);
}
return Card(
margin: const EdgeInsets.only(bottom: 12),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
child: ListTile(
leading: Icon(
item['type'] == 'in' ? Icons.login : Icons.logout,
color: const Color(0xFF4F8DFD),
),
title: Text(
item['type'] == 'in' ? 'Check-in' : 'Check-out',
style: const TextStyle(
fontWeight: FontWeight.bold,
),
),
subtitle: Text('${item['date']} ${item['time']}'),
trailing: Container(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
decoration: BoxDecoration(
color: statusColor.withOpacity(0.15),
borderRadius: BorderRadius.circular(8),
),
child: Text(
statusText,
style: TextStyle(
color: statusColor,
fontWeight: FontWeight.bold,
),
),
),
),
);
},
);
},
),
// Tab Izin
FutureBuilder<List<Map<String, dynamic>>>(
future: fetchPermission(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
}
if (snapshot.hasError) {
return const Center(
child: Text('Gagal memuat data izin'),
);
}
final data = snapshot.data ?? [];
if (data.isEmpty) {
return const Center(child: Text('Belum ada data izin'));
}
return ListView.builder(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
itemCount: data.length,
itemBuilder: (context, i) {
final item = data[i];
return Card(
margin: const EdgeInsets.only(bottom: 12),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
child: ListTile(
leading: const Icon(
Icons.assignment_turned_in_outlined,
color: Color(0xFF4F8DFD),
),
title: Text(
item['category'] ?? '-',
style: const TextStyle(
fontWeight: FontWeight.bold,
),
),
subtitle: Text(
'${item['start_date']} - ${item['end_date']}',
),
trailing: Container(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
decoration: BoxDecoration(
color:
item['status'] == 'accepted'
? const Color(
0xFF1BCFB4,
).withOpacity(0.15)
: (item['status'] == 'pending'
? const Color(
0xFFFFC542,
).withOpacity(0.15)
: const Color(
0xFFE57373,
).withOpacity(0.15)),
borderRadius: BorderRadius.circular(8),
),
child: Text(
item['status'] ?? '-',
style: TextStyle(
color:
item['status'] == 'accepted'
? const Color(0xFF1BCFB4)
: (item['status'] == 'pending'
? const Color(0xFFFFC542)
: const Color(0xFFE57373)),
fontWeight: FontWeight.bold,
),
),
),
),
);
},
);
},
),
],
),
),
],
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: 1,
selectedItemColor: const Color(0xFF4F8DFD),
unselectedItemColor: Colors.black38,
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.home_rounded),
label: 'Beranda',
),
BottomNavigationBarItem(icon: Icon(Icons.history), label: 'Riwayat'),
BottomNavigationBarItem(icon: Icon(Icons.person), label: 'Profil'),
],
type: BottomNavigationBarType.fixed,
onTap: (index) {
if (index == 1) return; // stay on Riwayat
if (index == 0) {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder:
(context) => DashboardScreen(
userName: widget.userName,
token: widget.token,
),
),
(route) => false,
);
}
if (index == 2) {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (context) => ProfileScreen(token: widget.token),
),
(route) => false,
);
}
// Tambahkan navigasi ke halaman lain jika ada (Absensi, Profil)
},
),
);
}
}

View File

@ -0,0 +1,2 @@
export 'google_map_web_view_stub.dart'
if (dart.library.html) 'google_map_web_view_web.dart';

View File

@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
import 'package:absen/models/attendance_area.dart';
class GoogleMapWebView extends StatelessWidget {
final double latitude;
final double longitude;
final double? areaLat;
final double? areaLng;
final double? areaRadius;
final List<AttendanceArea>? areas;
const GoogleMapWebView({
Key? key,
required this.latitude,
required this.longitude,
this.areaLat,
this.areaLng,
this.areaRadius,
this.areas,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return const Text('Google Maps hanya tersedia di Web.');
}
}

View File

@ -0,0 +1,164 @@
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';
import 'dart:math';
import 'package:absen/models/attendance_area.dart';
class GoogleMapWebView extends StatelessWidget {
final double latitude;
final double longitude;
final List<AttendanceArea>? areas;
const GoogleMapWebView({
Key? key,
required this.latitude,
required this.longitude,
this.areas,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
final mapHeight = constraints.maxWidth * 0.5;
final height = mapHeight.clamp(250.0, 400.0);
return SizedBox(
height: height,
child: FlutterMap(
options: MapOptions(
center: areas != null && areas!.isNotEmpty
? LatLng(areas![0].lat, areas![0].lng)
: LatLng(latitude, longitude),
zoom: 16,
),
children: [
TileLayer(
urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
subdomains: const ['a', 'b', 'c'],
),
if (areas != null && areas!.isNotEmpty)
CircleLayer(
circles: areas!
.map((a) => CircleMarker(
point: LatLng(a.lat, a.lng),
color: Colors.blue.withOpacity(0.2),
borderStrokeWidth: 2,
borderColor: Colors.blue,
radius: a.radius,
useRadiusInMeter: true,
))
.toList(),
),
MarkerLayer(
markers: [
Marker(
point: LatLng(latitude, longitude),
width: 40,
height: 40,
child: const Icon(Icons.person_pin_circle, color: Colors.red, size: 40),
),
if (areas != null)
...areas!.asMap().entries.map((entry) => Marker(
point: LatLng(entry.value.lat, entry.value.lng),
width: 24,
height: 24,
child: Container(
decoration: BoxDecoration(
color: Colors.black,
shape: BoxShape.circle,
border: Border.all(color: Colors.white, width: 2),
),
child: const Icon(Icons.circle, color: Colors.white, size: 12),
),
)),
],
),
],
),
);
},
);
}
}
class AnimatedPulseCircle extends StatefulWidget {
const AnimatedPulseCircle({Key? key}) : super(key: key);
@override
State<AnimatedPulseCircle> createState() => _AnimatedPulseCircleState();
}
class _AnimatedPulseCircleState extends State<AnimatedPulseCircle> with SingleTickerProviderStateMixin {
late AnimationController _controller;
@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this,
duration: const Duration(seconds: 2),
)..repeat(reverse: false);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return SizedBox(
width: 32,
height: 32,
child: Stack(
alignment: Alignment.center,
children: [
AnimatedBuilder(
animation: _controller,
builder: (context, child) {
double scale = 1 + _controller.value * 1.5;
double opacity = 1 - _controller.value;
return Opacity(
opacity: opacity,
child: Container(
width: 24 * scale,
height: 24 * scale,
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: RadialGradient(
colors: [
Colors.blue.withOpacity(0.3),
Colors.blue.withOpacity(0.0),
],
),
),
),
);
},
),
Container(
width: 20,
height: 20,
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: const LinearGradient(
colors: [Color(0xFF2196F3), Color(0xFF64B5F6)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
border: Border.all(color: Colors.white, width: 3),
boxShadow: [
BoxShadow(
color: Colors.blue.withOpacity(0.4),
blurRadius: 8,
spreadRadius: 1,
),
],
),
),
],
),
);
}
}

1
linux/.gitignore vendored Normal file
View File

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

128
linux/CMakeLists.txt Normal file
View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.13)
project(runner LANGUAGES CXX)
# Define the application target. To change its name, change BINARY_NAME in the
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
# work.
#
# Any new source files that you add to the application should be added here.
add_executable(${BINARY_NAME}
"main.cc"
"my_application.cc"
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
)
# Apply the standard set of build settings. This can be removed for applications
# that need different build settings.
apply_standard_settings(${BINARY_NAME})
# Add preprocessor definitions for the application ID.
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
# Add dependency libraries. Add any application-specific dependencies here.
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")

6
linux/runner/main.cc Normal file
View File

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

View File

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

View File

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

7
macos/.gitignore vendored Normal file
View File

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

View File

@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"

View File

@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"

View File

@ -0,0 +1,18 @@
//
// Generated file. Do not edit.
//
import FlutterMacOS
import Foundation
import file_picker
import file_selector_macos
import geolocator_apple
import shared_preferences_foundation
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
}

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