jefry 4 lat temu
rodzic
commit
291041e7b4
100 zmienionych plików z 6660 dodań i 86 usunięć
  1. +34
    -84
      .gitignore
  2. +10
    -0
      .metadata
  3. +15
    -2
      README.md
  4. +7
    -0
      android/.gitignore
  5. +108
    -0
      android/app/build.gradle
  6. +7
    -0
      android/app/src/debug/AndroidManifest.xml
  7. +31
    -0
      android/app/src/main/AndroidManifest.xml
  8. +12
    -0
      android/app/src/main/kotlin/com/thamringroup/hris/unitstocks/MainActivity.kt
  9. +12
    -0
      android/app/src/main/res/drawable/launch_background.xml
  10. BIN
      android/app/src/main/res/mipmap-hdpi/ic_launcher.png
  11. BIN
      android/app/src/main/res/mipmap-hdpi/launcher_icon.png
  12. BIN
      android/app/src/main/res/mipmap-mdpi/ic_launcher.png
  13. BIN
      android/app/src/main/res/mipmap-mdpi/launcher_icon.png
  14. BIN
      android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
  15. BIN
      android/app/src/main/res/mipmap-xhdpi/launcher_icon.png
  16. BIN
      android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  17. BIN
      android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png
  18. BIN
      android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  19. BIN
      android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png
  20. +8
    -0
      android/app/src/main/res/values/styles.xml
  21. +7
    -0
      android/app/src/profile/AndroidManifest.xml
  22. +32
    -0
      android/build.gradle
  23. +4
    -0
      android/gradle.properties
  24. +6
    -0
      android/gradle/wrapper/gradle-wrapper.properties
  25. +4
    -0
      android/key.properties
  26. +15
    -0
      android/settings.gradle
  27. BIN
      android/unitKey.jks
  28. BIN
      asset/icon.png
  29. +32
    -0
      ios/.gitignore
  30. +26
    -0
      ios/Flutter/AppFrameworkInfo.plist
  31. +1
    -0
      ios/Flutter/Debug.xcconfig
  32. +1
    -0
      ios/Flutter/Release.xcconfig
  33. +518
    -0
      ios/Runner.xcodeproj/project.pbxproj
  34. +7
    -0
      ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  35. +91
    -0
      ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
  36. +7
    -0
      ios/Runner.xcworkspace/contents.xcworkspacedata
  37. +13
    -0
      ios/Runner/AppDelegate.swift
  38. +122
    -0
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
  39. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
  40. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
  41. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
  42. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
  43. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
  44. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
  45. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
  46. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
  47. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
  48. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
  49. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png
  50. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png
  51. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png
  52. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png
  53. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
  54. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
  55. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png
  56. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png
  57. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
  58. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
  59. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
  60. +23
    -0
      ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
  61. BIN
      ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
  62. BIN
      ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
  63. BIN
      ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
  64. +5
    -0
      ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
  65. +37
    -0
      ios/Runner/Base.lproj/LaunchScreen.storyboard
  66. +26
    -0
      ios/Runner/Base.lproj/Main.storyboard
  67. +45
    -0
      ios/Runner/Info.plist
  68. +1
    -0
      ios/Runner/Runner-Bridging-Header.h
  69. +324
    -0
      lib/Util/DBHelper.dart
  70. +41
    -0
      lib/Util/Prefs.dart
  71. +149
    -0
      lib/Util/UnitModel.dart
  72. +96
    -0
      lib/Util/Util.dart
  73. +154
    -0
      lib/Util/download_Upload_Handler.dart
  74. +85
    -0
      lib/Util/photo_viewer.dart
  75. +1065
    -0
      lib/home_page.dart
  76. +442
    -0
      lib/login_page.dart
  77. +53
    -0
      lib/main.dart
  78. +381
    -0
      lib/stocking.dart
  79. +951
    -0
      lib/unit_details.dart
  80. +43
    -0
      local_plugin/location-3.0.2/.gitignore
  81. +162
    -0
      local_plugin/location-3.0.2/CHANGELOG.md
  82. +19
    -0
      local_plugin/location-3.0.2/LICENSE
  83. +156
    -0
      local_plugin/location-3.0.2/README.md
  84. +42
    -0
      local_plugin/location-3.0.2/android/build.gradle
  85. +3
    -0
      local_plugin/location-3.0.2/android/gradle.properties
  86. +6
    -0
      local_plugin/location-3.0.2/android/gradle/wrapper/gradle-wrapper.properties
  87. +1
    -0
      local_plugin/location-3.0.2/android/settings.gradle
  88. +6
    -0
      local_plugin/location-3.0.2/android/src/main/AndroidManifest.xml
  89. +425
    -0
      local_plugin/location-3.0.2/android/src/main/java/com/lyokone/location/FlutterLocation.java
  90. +113
    -0
      local_plugin/location-3.0.2/android/src/main/java/com/lyokone/location/LocationPlugin.java
  91. +134
    -0
      local_plugin/location-3.0.2/android/src/main/java/com/lyokone/location/MethodCallHandlerImpl.java
  92. +69
    -0
      local_plugin/location-3.0.2/android/src/main/java/com/lyokone/location/StreamHandlerImpl.java
  93. +4
    -0
      local_plugin/location-3.0.2/darwin/Classes/LocationPlugin.h
  94. +321
    -0
      local_plugin/location-3.0.2/darwin/Classes/LocationPlugin.m
  95. +43
    -0
      local_plugin/location-3.0.2/example/.gitignore
  96. +10
    -0
      local_plugin/location-3.0.2/example/.metadata
  97. +16
    -0
      local_plugin/location-3.0.2/example/README.md
  98. +7
    -0
      local_plugin/location-3.0.2/example/android/.gitignore
  99. +60
    -0
      local_plugin/location-3.0.2/example/android/app/build.gradle
  100. +12
    -0
      local_plugin/location-3.0.2/example/android/app/src/androidTest/java/com/lyokone/locationexample/EmbedderV1ActivityTest.java

+ 34
- 84
.gitignore Wyświetl plik

@@ -1,87 +1,37 @@
# ---> Android
# Built application files
*.apk
*.aar
*.ap_
*.aab

# Files for the ART/Dalvik VM
*.dex

# Java class files
# Miscellaneous
*.class

# Generated files
bin/
gen/
out/
# Uncomment the following line in case you need and you don't have the release build type files in your app
# release/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# IntelliJ
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
#*.jks
#*.keystore

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/

# Google Services (e.g. APIs or Firebase)
# google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json

# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md

# Version control
vcs.xml

# lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/

*.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/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Exceptions to above rules.
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages

+ 10
- 0
.metadata Wyświetl plik

@@ -0,0 +1,10 @@
# 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: f139b11009aeb8ed2a3a3aa8b0066e482709dde3
channel: stable

project_type: app

+ 15
- 2
README.md Wyświetl plik

@@ -1,3 +1,16 @@
# Unit-App
# unitstocks

flutter app untuk unitstock
App to stock Thamrin Brothers Units

## 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://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

+ 7
- 0
android/.gitignore Wyświetl plik

@@ -0,0 +1,7 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java

+ 108
- 0
android/app/build.gradle Wyświetl plik

@@ -0,0 +1,108 @@
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.8.0'
}
plugins {
javalite {
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
}
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.0.0-pre2'
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
remove java
}
task.plugins {
javalite { }
grpc {
option 'lite'
}
}
}
}
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
compileSdkVersion 29

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

lintOptions {
disable 'InvalidPackage'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.thamringroup.unitstocks"
minSdkVersion 18
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? rootProject.file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
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.release
}
}
}

flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

+ 7
- 0
android/app/src/debug/AndroidManifest.xml Wyświetl plik

@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thamringroup.unitstocks">
<!-- Flutter 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>

+ 31
- 0
android/app/src/main/AndroidManifest.xml Wyświetl plik

@@ -0,0 +1,31 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thamringroup.unitstocks">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name="io.flutter.app.FlutterApplication"
android:label="unitstocks"
android:icon="@mipmap/launcher_icon">
<activity
android:name=".MainActivity"
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>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>

+ 12
- 0
android/app/src/main/kotlin/com/thamringroup/hris/unitstocks/MainActivity.kt Wyświetl plik

@@ -0,0 +1,12 @@
package com.thamringroup.unitstocks

import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}

+ 12
- 0
android/app/src/main/res/drawable/launch_background.xml Wyświetl plik

@@ -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>

BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher.png Wyświetl plik

Przed Po
Szerokość: 72  |  Wysokość: 72  |  Rozmiar: 544 B

BIN
android/app/src/main/res/mipmap-hdpi/launcher_icon.png Wyświetl plik

Przed Po
Szerokość: 72  |  Wysokość: 72  |  Rozmiar: 4.5 KiB

BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher.png Wyświetl plik

Przed Po
Szerokość: 48  |  Wysokość: 48  |  Rozmiar: 442 B

BIN
android/app/src/main/res/mipmap-mdpi/launcher_icon.png Wyświetl plik

Przed Po
Szerokość: 48  |  Wysokość: 48  |  Rozmiar: 2.1 KiB

BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png Wyświetl plik

Przed Po
Szerokość: 96  |  Wysokość: 96  |  Rozmiar: 721 B

BIN
android/app/src/main/res/mipmap-xhdpi/launcher_icon.png Wyświetl plik

Przed Po
Szerokość: 96  |  Wysokość: 96  |  Rozmiar: 6.0 KiB

BIN
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png Wyświetl plik

Przed Po
Szerokość: 144  |  Wysokość: 144  |  Rozmiar: 1.0 KiB

BIN
android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png Wyświetl plik

Przed Po
Szerokość: 144  |  Wysokość: 144  |  Rozmiar: 12 KiB

BIN
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png Wyświetl plik

Przed Po
Szerokość: 192  |  Wysokość: 192  |  Rozmiar: 1.4 KiB

BIN
android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png Wyświetl plik

Przed Po
Szerokość: 192  |  Wysokość: 192  |  Rozmiar: 14 KiB

+ 8
- 0
android/app/src/main/res/values/styles.xml Wyświetl plik

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
</resources>

+ 7
- 0
android/app/src/profile/AndroidManifest.xml Wyświetl plik

@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thamringroup.unitstocks">
<!-- Flutter 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>

+ 32
- 0
android/build.gradle Wyświetl plik

@@ -0,0 +1,32 @@
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
jcenter()
}
}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
delete rootProject.buildDir
}

+ 4
- 0
android/gradle.properties Wyświetl plik

@@ -0,0 +1,4 @@
org.gradle.jvmargs=-Xmx5120M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true

+ 6
- 0
android/gradle/wrapper/gradle-wrapper.properties Wyświetl plik

@@ -0,0 +1,6 @@
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip

+ 4
- 0
android/key.properties Wyświetl plik

@@ -0,0 +1,4 @@
storePassword=Thamrin1234
keyPassword=Thamrin1234
keyAlias=key
storeFile=\\unitKey.jks

+ 15
- 0
android/settings.gradle Wyświetl plik

@@ -0,0 +1,15 @@
include ':app'

def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()

def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}

plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}

BIN
android/unitKey.jks Wyświetl plik


BIN
asset/icon.png Wyświetl plik

Przed Po
Szerokość: 512  |  Wysokość: 512  |  Rozmiar: 116 KiB

+ 32
- 0
ios/.gitignore Wyświetl plik

@@ -0,0 +1,32 @@
*.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/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

+ 26
- 0
ios/Flutter/AppFrameworkInfo.plist Wyświetl plik

@@ -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>$(DEVELOPMENT_LANGUAGE)</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>8.0</string>
</dict>
</plist>

+ 1
- 0
ios/Flutter/Debug.xcconfig Wyświetl plik

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

+ 1
- 0
ios/Flutter/Release.xcconfig Wyświetl plik

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

+ 518
- 0
ios/Runner.xcodeproj/project.pbxproj Wyświetl plik

@@ -0,0 +1,518 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {

/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
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 PBXCopyFilesBuildPhase section */
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
);
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>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; 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>"; };
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; 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 = (
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
3B80C3931E831B6300D905FE /* App.framework */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEBA1CF902C7004384FC /* Flutter.framework */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
9740EEB31CF90195004384FC /* Generated.xcconfig */,
);
name = Flutter;
sourceTree = "<group>";
};
97C146E51CF9000F007C117D = {
isa = PBXGroup;
children = (
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
);
sourceTree = "<group>";
};
97C146EF1CF9000F007C117D /* Products */ = {
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
);
name = Products;
sourceTree = "<group>";
};
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C147021CF9000F007C117D /* Info.plist */,
97C146F11CF9000F007C117D /* Supporting Files */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
);
path = Runner;
sourceTree = "<group>";
};
97C146F11CF9000F007C117D /* Supporting Files */ = {
isa = PBXGroup;
children = (
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
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 = {
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "The Chromium Authors";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 1100;
};
};
};
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
);
};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
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;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
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 */
97C146EA1CF9000F007C117D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase 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;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
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;
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 = 8.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;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.thamringroup.unitstocks;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Profile;
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
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;
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 = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
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;
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 = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
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;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.thamringroup.unitstocks;
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;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.thamringroup.unitstocks;
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 */
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 */;
}

+ 7
- 0
ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata Wyświetl plik

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

+ 91
- 0
ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme Wyświetl plik

@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
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">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</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>

+ 7
- 0
ios/Runner.xcworkspace/contents.xcworkspacedata Wyświetl plik

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

+ 13
- 0
ios/Runner/AppDelegate.swift Wyświetl plik

@@ -0,0 +1,13 @@
import UIKit
import Flutter

@UIApplicationMain
@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)
}
}

+ 122
- 0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json Wyświetl plik

@@ -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"
}
}

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png Wyświetl plik

Przed Po
Szerokość: 1024  |  Wysokość: 1024  |  Rozmiar: 167 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png Wyświetl plik

Przed Po
Szerokość: 20  |  Wysokość: 20  |  Rozmiar: 958 B

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png Wyświetl plik

Przed Po
Szerokość: 40  |  Wysokość: 40  |  Rozmiar: 1.8 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png Wyświetl plik

Przed Po
Szerokość: 60  |  Wysokość: 60  |  Rozmiar: 2.5 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png Wyświetl plik

Przed Po
Szerokość: 29  |  Wysokość: 29  |  Rozmiar: 1.3 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png Wyświetl plik

Przed Po
Szerokość: 58  |  Wysokość: 58  |  Rozmiar: 2.4 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png Wyświetl plik

Przed Po
Szerokość: 87  |  Wysokość: 87  |  Rozmiar: 5.9 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png Wyświetl plik

Przed Po
Szerokość: 40  |  Wysokość: 40  |  Rozmiar: 1.8 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png Wyświetl plik

Przed Po
Szerokość: 80  |  Wysokość: 80  |  Rozmiar: 5.0 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png Wyświetl plik

Przed Po
Szerokość: 120  |  Wysokość: 120  |  Rozmiar: 9.4 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png Wyświetl plik

Przed Po
Szerokość: 50  |  Wysokość: 50  |  Rozmiar: 2.1 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png Wyświetl plik

Przed Po
Szerokość: 100  |  Wysokość: 100  |  Rozmiar: 7.3 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png Wyświetl plik

Przed Po
Szerokość: 57  |  Wysokość: 57  |  Rozmiar: 2.3 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png Wyświetl plik

Przed Po
Szerokość: 114  |  Wysokość: 114  |  Rozmiar: 8.9 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png Wyświetl plik

Przed Po
Szerokość: 120  |  Wysokość: 120  |  Rozmiar: 9.4 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png Wyświetl plik

Przed Po
Szerokość: 180  |  Wysokość: 180  |  Rozmiar: 17 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png Wyświetl plik

Przed Po
Szerokość: 72  |  Wysokość: 72  |  Rozmiar: 4.5 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png Wyświetl plik

Przed Po
Szerokość: 144  |  Wysokość: 144  |  Rozmiar: 12 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png Wyświetl plik

Przed Po
Szerokość: 76  |  Wysokość: 76  |  Rozmiar: 5.0 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png Wyświetl plik

Przed Po
Szerokość: 152  |  Wysokość: 152  |  Rozmiar: 13 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png Wyświetl plik

Przed Po
Szerokość: 167  |  Wysokość: 167  |  Rozmiar: 15 KiB

+ 23
- 0
ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json Wyświetl plik

@@ -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"
}
}

BIN
ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png Wyświetl plik

Przed Po
Szerokość: 1  |  Wysokość: 1  |  Rozmiar: 68 B

BIN
ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png Wyświetl plik

Przed Po
Szerokość: 1  |  Wysokość: 1  |  Rozmiar: 68 B

BIN
ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png Wyświetl plik

Przed Po
Szerokość: 1  |  Wysokość: 1  |  Rozmiar: 68 B

+ 5
- 0
ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md Wyświetl plik

@@ -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.

+ 37
- 0
ios/Runner/Base.lproj/LaunchScreen.storyboard Wyświetl plik

@@ -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>

+ 26
- 0
ios/Runner/Base.lproj/Main.storyboard Wyświetl plik

@@ -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>

+ 45
- 0
ios/Runner/Info.plist Wyświetl plik

@@ -0,0 +1,45 @@
<?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>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>unitstocks</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>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>

+ 1
- 0
ios/Runner/Runner-Bridging-Header.h Wyświetl plik

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

+ 324
- 0
lib/Util/DBHelper.dart Wyświetl plik

@@ -0,0 +1,324 @@
import 'dart:async';
import 'dart:io' as io;
import 'UnitModel.dart';
import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart';
import 'package:sqflite/sqflite.dart';
import 'Prefs.dart';
import '../main.dart';

class DBHelper {
DBHelper._();

static final DBHelper database = DBHelper._();
static Database _db;

Future<Database> get db async {
if (_db != null) return _db;
_db = await initDb();
return _db;
}

initDb() async {
io.Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, "UnitStocking.db");
var theDb = await openDatabase(path, version: 1,onCreate: await _onCreate);
return theDb;
}

closeDb() async {
final database = await db;
await database.close();
_db = null;
}

_onCreate(Database db, int version) async {
io.Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, "UnitStocking.db");
io.File file = io.File(path);
print('Database created, ${file.lengthSync()}');
var res = await db.query(tableName.values,where: "${columnName.name} = ?",whereArgs: [keyClass.stock_id]);
valueTab value = valueTab.fromJson(res.first);
await prefs.setString(keyClass.stock_id, value.value);
}

getCount(mesin) async {
final database = await db;
var res =
await database.rawQuery("SELECT COUNT(*) as count FROM ${tableName.blob} where ${columnName.mesin} = '$mesin'");
return res.isNotEmpty ? Count.fromJson(res.first).count : 0;
}

getUnitdetailMaster(id) async{
try{
final database = await db;
var res = await database.rawQuery("SELECT * FROM '${tableName.master}' WHERE ${columnName.id} = $id");
return res.isNotEmpty ? Unit.fromJson(res.first) : null;
}
catch(e){
print(e);
return null;
}
}

// Future<List<Unit>> getAllUnits() async {
// final database = await db;
// var res = await database.query("${tableName.master}");
//// var res = await database.rawQuery("SELECT ${columnName.tipe} from ${tableName.}");
//// var res = await database.rawQuery("SELECT b.${columnName.id}, b.${columnName.mesin}, b.${columnName.tipe}, b.${columnName.warna}, IFNULL((SELECT ${columnName.timestamp} from ${tableName.unit} where ${columnName.mesin} = b.${columnName.mesin}),'-') ${columnName.timestamp}, (SELECT ${columnName.id} from ${tableName.unit} where ${columnName.mesin} = b.${columnName.mesin}) ${columnName.mesin_id} from ${tableName.master} b");
// List<Unit> list =
// res.isNotEmpty ? res.map((c) => Unit.fromJson(c)).toList() : [];
// return list;
// }

Future<List<Unit>> getAllUnits({inserted=false}) async {
final database = await db;
var res = await database.query("${tableName.master}",where: (inserted)?"${columnName.flag} = 'TRUE'":null,orderBy: "CASE WHEN ${columnName.flag} = 'FALSE' THEN 0 ELSE 1 END, ${columnName.state} desc");
// var res = await database.rawQuery("SELECT ${columnName.id}, ${columnName.mesin}, ${columnName.tipe}, ${columnName.state}, ${columnName.warna}, ${columnName.rangka},${columnName.kode},${columnName.flag}, ${columnName.timestamp} from ${tableName.master} ORDER BY CASE WHEN ${columnName.flag} = 'FALSE' THEN 0 ELSE 1 END, ${columnName.state} desc");
List<Unit> list =
res.isNotEmpty ? res.map((c) => Unit.fromJson(c)).toList() : [];
return list;
}

Future<List<Unit>> searchAllUnits(String query,{inserted:false}) async {
print("${(inserted)?"${columnName.flag} = 'TRUE' AND ":''} REPLACE(${columnName.mesin},'-','') like '%$query%' or ${columnName.rangka} like '%$query%' or ${columnName.mesin} like '%$query%' or ${columnName.timestamp} like '%$query%' or ${columnName.tipe} like '%$query%' or ${columnName.warna} like '%$query%' or UPPER(${columnName.state}) like '%$query%'");
final database = await db;
try{
var res = await database.query(tableName.master,where: "${(inserted)?"${columnName.flag} = 'TRUE' AND ":''} (REPLACE(${columnName.mesin},'-','') like '%$query%' or ${columnName.rangka} like '%$query%' or ${columnName.mesin} like '%$query%' or ${columnName.timestamp} like '%$query%' or ${columnName.tipe} like '%$query%' or ${columnName.warna} like '%$query%' or UPPER(${columnName.state}) like '%$query%')",orderBy: "CASE WHEN ${columnName.flag} = 'FALSE' THEN 0 ELSE 1 END, ${columnName.state} desc");
// var res = await database.rawQuery(
// "select * from (SELECT ${columnName.id}, ${columnName.state}, ${columnName.rangka}, ${columnName.mesin}, ${columnName.tipe}, ${columnName.warna}, ${columnName.timestamp}, ${columnName.mesin} from ${tableName.master} ) where REPLACE(${columnName.mesin},'-','') like '%$query%' or ${columnName.rangka} like '%$query%' or ${columnName.mesin} like '%$query%' or ${columnName.timestamp} like '%$query%' or ${columnName.tipe} like '%$query%' or ${columnName.warna} like '%$query%' or UPPER(${columnName.state}) like '%$query%' ORDER BY CASE WHEN ${columnName.flag} = 'FALSE' THEN 0 ELSE 1 END, ${columnName.state} desc");
List<Unit> list =
res.isNotEmpty ? res.map((c) => Unit.fromJson(c)).toList() : [];
return list;
}
catch(e){
print(e);
return [];
}

}

// Future<List<insertUnit>> getAllInsertUnits() async {
// final database = await db;
//// var res = await database.query("${tableName.unit}");
// var res = await database.rawQuery("SELECT a.${columnName.id},a.${columnName.mesin},b.${columnName.rangka},b.${columnName.tipe},b.${columnName.warna}, a.${columnName.timestamp}, b.${columnName.state} from ${tableName.unit} a, ${tableName.master} b where a.${columnName.mesin} = b.${columnName.mesin}");
// List<insertUnit> list =
// res.isNotEmpty ? res.map((c) => insertUnit.fromJson(c)).toList() : [];
// return list;
// }

// Future<List<blobImage>> getAllBlobImage(mesin) async {
// final database = await db;
//// var res = await database.query("${tableName.blob}");
// var res = await database.query("${tableName.blob}",where: "${columnName.mesin} = ?",whereArgs: [mesin]);
//// print([mesin_id,res]);
//
// List<blobImage> list =
// res.isNotEmpty ? res.map((c) => blobImage.fromJson(c)).toList() : [];
// return list;
// }

getBlobUnits(mesin) async{
try{
final database = await db;
var res = await database.query("${tableName.blob}" ,where: "${columnName.mesin} = ?", whereArgs: [mesin]);
List<blobImage> list =
res.isNotEmpty ? res.map((c) => blobImage.fromJson(c)).toList() : [];
return list;
}
catch(e){
print(e);
return null;
}
}

insertUpdateBlob(blobImage blob) async{
return (blob.blob_id==null)?newInsertBlob(blob):updateBlob(blob);
}

deleteBlob(blob_id) async {
final database = await db;
try{
await database.delete("${tableName.blob}", where: "${columnName.blob_id} = ?", whereArgs: [blob_id]);
return true;
}
catch(e){
print(e);
return null;
}
}

updateUnit(Unit unitUpdate) async{
try{
final database = await db;
var res = await database.update("${tableName.master}", unitUpdate.toJson(),
where: "${columnName.id} = ?", whereArgs: [unitUpdate.id]);
print('Row Updated');
return res;
}
catch(e){
print(e);
return null;
}
}

updateBlob(blobImage blobUpdate) async{
try{
final database = await db;
var res = await database.update("${tableName.blob}", blobUpdate.toJson(),
where: "${columnName.blob_id} = ?", whereArgs: [blobUpdate.blob_id]);
print('Row Updated');
return res;
}
catch(e){
print(e);
return null;
}
}

newInsertBlob(blobImage newBlob) async {
final database = await db;
try{
var res = await database.rawInsert("Insert into ${tableName.blob}(${columnName.blob_file},${columnName.mesin},${columnName.lat},${columnName.long},${columnName.jenis})VALUES(?,?,?,?,?)", [
newBlob.blob_file,
newBlob.mesin,
newBlob.lat,
newBlob.long,
newBlob.jenis
]);
print('Image Inserted');
return res;
}
catch(e){
print(e);
return null;
}
}

getBlobImage(mesin) async{
final database = await db;
var res = await database.query("${tableName.blob}",where: "${columnName.mesin} = ? AND ${columnName.no_urut} = ?",whereArgs: [mesin,'1']);
return res.isNotEmpty ? blobImage.fromJson(res.first) : null;
}

// Future<List<insertUnit>> searchAllInsertUnits(String query) async {
// final database = await db;
// var res = await database.rawQuery(
// "select * from (SELECT a.${columnName.id},a.${columnName.mesin},b.${columnName.tipe},b.${columnName.warna}, a.${columnName.timestamp}, b.${columnName.state}, b.${columnName.rangka} from ${tableName.unit} a, ${tableName.master} b where a.${columnName.mesin} = b.${columnName.mesin}) where REPLACE(${columnName.mesin},'-','') like '%$query%' or ${columnName.mesin} like '%$query%' or ${columnName.timestamp} like '%$query%' or ${columnName.warna} like '%$query%' or ${columnName.tipe} like '%$query%'");
// List<insertUnit> list =
// res.isNotEmpty ? res.map((c) => insertUnit.fromJson(c)).toList() : [];
// return list;
// }
//
// updateInsertUnit(insertUnit newPart) async {
// try{
// final database = await db;
//// var res = await database.update("${tableName.unit}", newPart.toJson(),
//// where: "${columnName.id} = ?", whereArgs: [newPart.id]);
// var res = await database.rawQuery("Update ${tableName.unit} SET ${columnName.id} = ${newPart.id}, ${columnName.mesin} = '${newPart.mesin}' WHERE ${columnName.id} = ${newPart.id}");
// print('Row Updated');
// return res;
// }
// catch(e){
// print(e);
// return null;
// }
// }

Future<List<jenisDrop>> getAllJenis() async {
try{
final database = await db;
var res = await database.query("${tableName.jenis}");
// var res = (id==null)?await database.query("${tableName.jenis}") :await database.rawQuery("select a.${columnName.value}, b.${columnName.jenis} from ${tableName.jenis} a, ${tableName.blob} b where a.${columnName.value} <> b.${columnName.jenis} AND b.${columnName.mesin_id} = $id");
// print(res);
List<jenisDrop> list =
res.isNotEmpty ? res.map((c) => jenisDrop.fromJson(c)).toList() : [];
return list;
}
catch(e){
print(e);
return null;
}
}

getValue(value)async{
try{
final database = await db;
var res = await database.query(tableName.values,where: "${columnName.name} = ?",whereArgs: [value]);
return res.isEmpty?null:valueTab.fromJson(res.first);
}
catch(e){
return null;
}
}

insertUpdateValue(valueTab newValue)async{
try{
final database = await db;
var res = await database.rawQuery("Select Count(*) as count from ${tableName.values} where ${columnName.name} = '${newValue.name}'");
int count = res.isNotEmpty ? Count.fromJson(res.first).count : 0;
return (count==0)?addNewValue(newValue):updateValue(newValue);
}
catch(e){
print(e);
return null;
}
}

updateValue(valueTab newValue) async {
try{
final database = await db;
var res = await database.update("${tableName.values}", newValue.toJson(),
where: "${columnName.name} = ?", whereArgs: [newValue.name]);
print('Row Updated');
return res;
}
catch(e){
print(e);
return null;
}
}

addNewValue(valueTab newValue) async {
final database = await db;
try{
var res = await database.rawInsert("Insert into ${tableName.values}(${columnName.name},${columnName.value})VALUES(?,?)", [
newValue.name,
newValue.value
]);
print('Row Inserted');
return res;
}
catch(e){
print(e);
return null;
}
}

// deleteInsertUnit(String id) async {
// final database = await db;
// try{
// await database.delete("${tableName.unit}", where: "${columnName.id} = ?", whereArgs: [id]);
// return true;
// }
// catch(e){
// print(e);
// return null;
// }
// }

deleteAll() async {
final database = await db;
try{
await database.rawQuery("DROP TABLE IF EXISTS ${tableName.blob}");
// await database.rawQuery("DROP TABLE IF EXISTS ${tableName.unit}");
await database.rawQuery("DROP TABLE IF EXISTS ${tableName.master}");
return true;
}
catch(e){
print(e);
return null;
}
}

}

+ 41
- 0
lib/Util/Prefs.dart Wyświetl plik

@@ -0,0 +1,41 @@
class keyClass{
static String lastDownload = 'LAST_DOWNLOAD';
static String lastUpload = 'LAST_UPLOAD';
static String duration = 'DURATION';
static String loginId = 'LOGIN_ID';
static String hostAddress = 'HOST';
static String company = 'COMPANY';
static String user_id = 'USER';
static String cabang_id = 'CABANG_ID';
static String logged_in = 'LOGGED_IN';
static String targetProccess = 'dbPath';
static String submitProccess = 'SUBMIT';
static String stock_id = 'STOCK_TAKING_UNIT_ID';
}
class columnName{
static String id = 'ID';
static String mesin = 'MESIN';
static String warna = 'WARNA';
static String tipe = 'TIPE';
static String rangka = 'RANGKA';
static String kode = 'KODE';
static String tahun = 'TAHUN';
static String lat = 'LATITUDE';
static String long = 'LONGITUDE';
static String timestamp = 'TIMESTAMP';
static String blob_id = 'BLOB_ID';
static String blob_file = 'BLOB_FILE';
static String name = 'NAME';
static String value = 'VALUE';
static String optional = 'OPTIONAL';
static String jenis = 'JENIS';
static String state = 'STATE';
static String no_urut = 'NO_URUT';
static String flag = 'FLAG_INSERT';
}
class tableName{
static String master = 'refTable';
static String blob = 'blobTable';
static String jenis = 'jenisBlobTable';
static String values = 'valueTable';
}

+ 149
- 0
lib/Util/UnitModel.dart Wyświetl plik

@@ -0,0 +1,149 @@
import 'Prefs.dart';


class Unit {
int id;
String rangka;
String mesin;
String kode;
String tahun;
String tipe;
String warna;
String state;
String flag;
String timestamp;


Unit({
this.id,
this.rangka,
this.mesin,
this.kode,
this.tahun,
this.tipe,
this.warna,
this.state,
this.flag,
this.timestamp,
});

factory Unit.fromJson(Map<String, dynamic> json) {
return new Unit(
id: json[columnName.id],
rangka: json[columnName.rangka],
mesin: json[columnName.mesin],
kode: json[columnName.kode],
tahun: json[columnName.tahun],
tipe: json[columnName.tipe],
warna : json[columnName.warna],
state: json[columnName.state],
flag: json[columnName.flag],
timestamp: json[columnName.timestamp]??''
);}

Map<String, dynamic> toJson() => {
columnName.id: id,
columnName.rangka: rangka.toUpperCase(),
columnName.mesin : mesin.toUpperCase(),
columnName.kode : kode.toUpperCase(),
columnName.tahun : tahun,
columnName.tipe: tipe,
columnName.warna: warna,
columnName.state :state,
columnName.flag :flag,
columnName.timestamp :timestamp,
};
}

class blobImage {
int blob_id;
var blob_file;
String mesin;
String lat;
String long;
String jenis;
String no_urut;


blobImage({
this.blob_id,
this.blob_file,
this.mesin,
this.lat,
this.long,
this.jenis,
this.no_urut
});

Map<String, dynamic> toJson() => {
columnName.blob_id: blob_id,
columnName.blob_file : blob_file,
columnName.mesin : mesin,
columnName.lat : lat,
columnName.long : long,
columnName.jenis : jenis,
columnName.no_urut : no_urut
};

factory blobImage.fromJson(Map<String, dynamic> json) => new blobImage(
blob_id: json[columnName.blob_id],
blob_file: json[columnName.blob_file],
mesin: json[columnName.mesin],
lat: json[columnName.lat],
long: json[columnName.long],
jenis: json[columnName.jenis],
no_urut: json[columnName.no_urut]
);
}

class valueTab {
String name;
String value;


valueTab({
this.name,
this.value
});

Map<String, dynamic> toJson() => {
columnName.name : name,
columnName.value : value,
};

factory valueTab.fromJson(Map<String, dynamic> json) => new valueTab(
name: json[columnName.name],
value: json[columnName.value],
);
}

class jenisDrop {
String value;
String no_urut;

jenisDrop({
this.value,
this.no_urut
});

Map<String, dynamic> toJson() => {
columnName.value : value,
columnName.no_urut : no_urut
};

factory jenisDrop.fromJson(Map<String, dynamic> json) => new jenisDrop(
value: json[columnName.value],
no_urut: json[columnName.no_urut]
);
}

class Count {
int count;
Count({
this.count,
});

factory Count.fromJson(Map<String, dynamic> json) => new Count(
count: json["count"],
);
}

+ 96
- 0
lib/Util/Util.dart Wyświetl plik

@@ -0,0 +1,96 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:http/http.dart' as http;
import 'package:flutter/material.dart';
import 'package:flushbar/flushbar.dart';
import '../main.dart';
import 'package:location/location.dart';
import 'package:permission_handler/permission_handler.dart' as pHandler;
import 'package:app_settings/app_settings.dart';

class Util{
JsonDataPostRaw(Map jsonData, String url,{timeout:false}) async{
const JsonDecoder decoder = const JsonDecoder();
try {
var response;
if (timeout)
response = await http.post(
'$url', headers: {'Content-type': 'application/json'},
body: json.encode(jsonData)).timeout(
const Duration(seconds: 10));
else
response = await http.post(
'$url', headers: {'Content-type': 'application/json'},
body: json.encode(jsonData));
final Map data = decoder.convert(response.body);
return data;
} on TimeoutException catch(e){
return {"STATUS":0,"DATA":"Request Timeout"};
}
on Exception catch(exception){
print(url);
// Toast("Not Connected to Server", Colors.red);
return {"STATUS":0,"DATA":"Not Connected to Server. $exception"};
}
}

showLoading(context,{dissmissable=false,onwillpop}){
showDialog(
context: context,
builder: (BuildContext context) {
return WillPopScope(
onWillPop: onwillpop??()async{return true;},
child: new Center(
child: new CircularProgressIndicator(),
),
);
},
barrierDismissible: dissmissable,
);
}

showFlushbar(context,text,{color:Colors.grey}){
Flushbar(
message: "$text",
backgroundColor: color,
duration: Duration(seconds: 5),
)..show(context);
}
streamLocation(context)async{
print('checking location');
bool gpsEnabled = false;
pHandler.PermissionStatus permissionEnabled = await pHandler.Permission.locationWhenInUse.status;
if(await location.serviceEnabled()){
gpsEnabled = await location.serviceEnabled();
}
else{
print('requesting gps');
gpsEnabled = await location.requestService();
await streamLocation(context);
}
// print([gpsEnabled,permissionEnabled]);
if(gpsEnabled){
if(permissionEnabled == pHandler.PermissionStatus.granted){
if(locationStream==null){
locationStream = location.onLocationChanged.listen((LocationData event) {
currentPosisiton = event;
});
}
}
else if(permissionEnabled==pHandler.PermissionStatus.denied || permissionEnabled==pHandler.PermissionStatus.undetermined){
print('requesting permission');
showFlushbar(context,'Location permission is needed to locate your REAL location. Please grant the permission!');
await Future.delayed(Duration(seconds: 1));
await pHandler.Permission.locationWhenInUse.request();
await streamLocation(context);
}
else if (permissionEnabled==pHandler.PermissionStatus.permanentlyDenied){
showFlushbar(context,'It seems, your system security explicitly denied the permission to access your location. Please MANUALLY enable it in setings!');
await Future.delayed(Duration(seconds: 3));
AppSettings.openAppSettings();
exit(0);
}
}
}
}

+ 154
- 0
lib/Util/download_Upload_Handler.dart Wyświetl plik

@@ -0,0 +1,154 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:path_provider/path_provider.dart';
import 'package:http/http.dart';
class file_Trans_Handler {

// double _progress = 0;
String _path = '';
StreamSubscription dlulStream;
String _error = '';
get path => _path;
get error => _error;
StreamController _progress = new StreamController<double>();
Stream<double> get progress =>_progress.stream;
var client = new Client();

downloadFile(String fileName,String link) async {
StreamedResponse _response;
List<int> _bytes = [];
int _total = 0;
print('Start Download');
_progress.add(null);
try {
Request req = new Request('GET', Uri.parse(link));
// req.headers = '';
_response = await client.send(req).timeout(
Duration(seconds: 20));
// _response = await client.get('$link',headers: 'application/json')
_total = _response.contentLength;
print('${_total / 1024} KB');
dlulStream = _response.stream.listen((value) {
_bytes.addAll(value);
_progress.add(((_bytes.length / _total)));
})
..onDone(() async {
_progress.add(0.0);
print('Finish Download');
final file = File(
"${(await getApplicationDocumentsDirectory()).path}/$fileName");
await file.writeAsBytes(_bytes);
_path = file.path;
})
..onError((e) async {
print('Error Download, $e');
_progress.add(-1.0);
_error = e.toString();
});
}
catch(e){
print('Error Download, $e');
_progress.add(-1.0);
_error = e.toString();
}
}

uploadFile(String fileName,String link,String company,String cabang_id) async{
final file = File(
"${(await getApplicationDocumentsDirectory()).path}/$fileName");
if(file.existsSync()){
Uint8List byte = file.readAsBytesSync();
// print("file size ${file.lengthSync()/1024}");
try{
var _reponse = await client.post(
'$link', headers: {'Content-type': 'application/json'},
body: json.encode({"byte":byte,"cabangId":cabang_id,"company":company}));
print('File send ${file.lengthSync()/1024} KB');
final Map data = JsonDecoder().convert(_reponse.body);
// print(_reponse.body);
// if(data['STATUS']==1){
// return {"STATUS":1,"DATA":'File send ${file.lengthSync()/1024} KB'};
// }
// else {
return data;
// }
}
catch(e){
print(e);
return {"STATUS":0,"DATA":'Request timeout. Make sure server is up and running'};
}
}
else{
return {"STATUS":0,"DATA":'No such file'};
}
}

unPackDb(String link,String company,String cabang_id,String dbPath) async{
try{
var _reponse = await client.post(
'$link', headers: {'Content-type': 'application/json'},
body: json.encode({"cabangId":cabang_id,"company":company,"dbPath":dbPath}));
final Map data = JsonDecoder().convert(_reponse.body);
return data;
}
catch(e){
print(e);
return {"STATUS":0,"DATA":'Upload timeout. Make sure server is up and running'};
}
}

submitDb(String link,String company,String stock_id) async{
try{
var _reponse = await client.post(
'$link', headers: {'Content-type': 'application/json'},
body: json.encode({"stockTakingId":stock_id,"company":company}));
final Map data = JsonDecoder().convert(_reponse.body);
return data;
}
catch(e){
print(e);
return {"STATUS":0,"DATA":'Request timeout. Make sure server is up and running'};
}
}

uploadMultipart(String fileName,String link)async{
StreamedResponse _response;
List<int> _bytes = [];
int _total = 0;
var request = MultipartRequest('POST', Uri.parse(link));
request.files.add(
await MultipartFile.fromPath(
'picture',
"${(await getApplicationDocumentsDirectory()).path}/$fileName"
)
);
_response = await client.send(request);
_total = File("${(await getApplicationDocumentsDirectory()).path}/$fileName").lengthSync();
dlulStream = _response.stream.listen((value) {
_bytes.addAll(value);
print('upload ${_bytes.length/_total}');
_progress.add(((_bytes.length / _total)));
})
..onDone(() async {
_progress.add(0.0);
print('Finish Download');
final file = File(
"${(await getApplicationDocumentsDirectory()).path}/$fileName");
await file.writeAsBytes(_bytes);
_path = file.path;
})
..onError((e) async {
print('Error Download, $e');
_progress.add(-1.0);
_error = e.toString();
});
}

cancel()async{
client?.close();
await dlulStream?.cancel();
_progress?.close();
}
}

+ 85
- 0
lib/Util/photo_viewer.dart Wyświetl plik

@@ -0,0 +1,85 @@
import 'dart:io';
import 'dart:typed_data';
import 'package:image_picker/image_picker.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';
import 'UnitModel.dart';

import 'Util.dart';

class PhotoViewer extends StatefulWidget {
Uint8List byte;
String id;
List<jenisDrop> dropMenu;
bool edit;
String jenis;
PhotoViewer(this.byte,{this.id,this.edit= true,this.dropMenu,this.jenis});
// PhotoViewer({Key key}) : super(key: key);
@override
_PhotoViewerState createState() => _PhotoViewerState();
}

class _PhotoViewerState extends State<PhotoViewer> {
Util util = new Util();
String jenisImages;
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Flexible(
flex: 8,
child: Container(
child: Hero(
tag: widget.id,
child: PhotoView(
imageProvider: MemoryImage(widget.byte),
),
),
),
),
Expanded(
flex: 1,
child: Material(
color: Colors.transparent,
child: Container(
child: Text(widget.jenis,style: TextStyle(color: Colors.white,fontSize: 18),),
),
),
),
(widget.edit)?Flexible(
flex: 1,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
FlatButton(
child: Text('Cancel'),
color: Colors.red,
onPressed: (){Navigator.pop(context);},
),
FlatButton(
child: Text('Change'),
color: Colors.green,
onPressed: ()async{
File temp = await ImagePicker.pickImage(source: ImageSource.camera,maxWidth: 800);
if(temp!=null){
util.showLoading(context);
widget.byte = temp.readAsBytesSync();
temp.deleteSync();
setState(() {

});
await Future.delayed(Duration(seconds: 1));
}
Navigator.pop(context);
if(temp!= null)Navigator.pop(context,{'byte':widget.byte});
},
),
],
),
):Container()
],
);
}
}

+ 1065
- 0
lib/home_page.dart
Plik diff jest za duży
Wyświetl plik


+ 442
- 0
lib/login_page.dart Wyświetl plik

@@ -0,0 +1,442 @@
import 'dart:io';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'main.dart';
import 'Util/Prefs.dart';


class LoginPage extends StatefulWidget {
LoginPage({Key key}) : super(key: key);
@override
_LoginPageState createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
final userCon = new TextEditingController();
final passCon = new TextEditingController();
final hostAddress = new TextEditingController();
List<dynamic> cabangDrop = [];
String selected;



Login()async{
util.showLoading(context);
var result = await util.JsonDataPostRaw({"User":userCon.text,"Pass":passCon.text}, '${prefs.getString(keyClass.hostAddress)??'https://unitstocksbackend.thamringroup.web.id'}/login');
if(result['STATUS']==1){
prefs.setString(keyClass.user_id, result['DATA'][keyClass.user_id]);
prefs.setString(keyClass.company, result['DATA'][keyClass.company]);
prefs.setBool(keyClass.logged_in, true);
var cabangList = await util.JsonDataPostRaw({"company":prefs.getString(keyClass.company),"User":prefs.getString(keyClass.user_id)}, '${prefs.getString(keyClass.hostAddress)??'https://unitstocksbackend.thamringroup.web.id'}/getCabangByUser');
Navigator.pop(context);
if(cabangList['STATUS']==1){
cabangDrop = cabangList['DATA'];
print(cabangList);
selected = cabangDrop[0]['RETURN_VALUE'];
setState(() {
});
FocusScope.of(context).requestFocus(new FocusNode());
}
else{
util.showFlushbar(context, cabangList['DATA'],color: Colors.red);
}
}
else{
Navigator.pop(context);
util.showFlushbar(context, result['DATA'],color: Colors.red);
}
}

@override
Widget build(BuildContext context) {
// if(prefs.getBool(keyClass.logged_in)==null||!prefs.getBool(keyClass.logged_in)){
return Scaffold(
body: WillPopScope(
onWillPop: ()async{
if(prefs.getBool(keyClass.logged_in)==null||!prefs.getBool(keyClass.logged_in)){
await showDialog(context: context,builder: (context)=>AlertDialog(
content: Text('Exit the app?'),
actions: <Widget>[
FlatButton(
child: Text('Exit'),
onPressed: ()async{
Navigator.pop(context);
await locationStream?.cancel();
exit(0);
},
),
FlatButton(
child: Text('Cancel'),
onPressed: (){
Navigator.pop(context);
},
)

],
));
}
else{
setState(() {
prefs.setBool(keyClass.logged_in, false);
prefs.remove(keyClass.cabang_id);
prefs.remove(keyClass.company);
prefs.remove(keyClass.user_id);
});
}
return false;
},
child: Container(
decoration: BoxDecoration(
color: Colors.white
),
child: Stack(
children: <Widget>[
Positioned.fill(
child: Column(
children: <Widget>[
Expanded(
flex: 1,
child: Container(),
),
Expanded(
flex: 3,
child: InkWell(
onLongPress: ()async{
hostAddress.text = prefs.getString(keyClass.hostAddress)??'https://unitstocksbackend.thamringroup.web.id';
await showDialog(context: context,builder: (context)=>AlertDialog(
title: Text('Set IP Address'),
content: TextField(
controller: hostAddress,
onSubmitted: (value){
prefs.setString(keyClass.hostAddress,(value=='')?'https://unitstocksbackend.thamringroup.web.id':value);
Navigator.pop(context);
},
),
actions: <Widget>[
FlatButton(
child: Text('OK'),
onPressed: (){
prefs.setString(keyClass.hostAddress,(hostAddress.text=='')?'https://unitstocksbackend.thamringroup.web.id':hostAddress.text);
Navigator.pop(context);
},
)
],
));
},
child: Column(
children: <Widget>[
Container(child: Icon(Icons.input,size: 150,color: Colors.indigo,),),
Text('Login',style: TextStyle(fontSize: 25,color: Colors.indigo,fontWeight: FontWeight.bold),),
],
),
),
),
Expanded(
flex: 3,
child: Column(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width*0.8,
child: TextFormField(
controller: userCon,
style: TextStyle(color: Colors.indigo,fontSize: 16),
decoration: InputDecoration(
hintText: 'User ID',
contentPadding:EdgeInsets.only(left: 30,right: 30,top: 20,bottom: 20),
hintStyle: TextStyle(fontSize: 16,color: Colors.indigo.withOpacity(0.7)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.indigo,
width: 2),
borderRadius: BorderRadius.circular(100)
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.indigo.withOpacity(0.5),
width: 0.5),
borderRadius: BorderRadius.circular(100)
)
),
),
),
SizedBox(height: 15,),
Container(
width: MediaQuery.of(context).size.width*0.8,
child: TextFormField(
obscureText: true,
controller: passCon,
style: TextStyle(color: Colors.indigo,fontSize: 16),
decoration: InputDecoration(
contentPadding:EdgeInsets.only(left: 30,right: 30,top: 20,bottom: 20),
hintText: 'Password',
hintStyle: TextStyle(fontSize: 16,color: Colors.indigo.withOpacity(0.7)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.indigo,
width: 2),
borderRadius: BorderRadius.circular(100)
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.indigo.withOpacity(0.5),
width: 0.5),
borderRadius: BorderRadius.circular(100)
)
),
),
),
SizedBox(height: 30,),
FlatButton(
onPressed: Login,
padding: EdgeInsets.all(15),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100.0),
side: BorderSide(color: Colors.indigo)
),
color: Colors.indigo,
child: Container(width: MediaQuery.of(context).size.width*0.7,child: Text('Login',textAlign: TextAlign.center,style: TextStyle(color: Colors.white,fontSize: 21),)),
)
],
),
),
// Expanded(
// flex: 3,
// child: Container(color: Colors.yellow,),
// ),
],
),
),
(prefs.getBool(keyClass.logged_in)==null||!prefs.getBool(keyClass.logged_in))
?Container()
:Positioned.fill(
child: Container(
color: Colors.white.withOpacity(0.9),
child: Center(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 5,
blurRadius: 7,
offset: Offset(0, 3), // changes position of shadow
),
],
borderRadius: BorderRadius.circular(5)
),
height: MediaQuery.of(context).size.height/3.2,
width: MediaQuery.of(context).size.width*0.75,
child: Column(
children: <Widget>[
Flexible(
flex:3,
child: Container(
padding: EdgeInsets.only(top:10,left: 10,right: 10),
alignment: Alignment.center,
decoration: BoxDecoration(
// color: Colors.indigo,
borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5))
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(Icons.business,size: 70,color: Colors.indigo,),
SizedBox(height: 5,),
Text('Pilih Cabang',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16,color: Colors.indigo),)
],
),
),
),
Flexible(
flex: 1,
child: Container(
padding: EdgeInsets.only(left: 20,right: 20),
alignment: Alignment.centerLeft,
child: Theme(
data: ThemeData(
canvasColor: Colors.white,
primaryColor: Colors.indigo,
accentColor: Colors.indigo,
hintColor: Colors.indigo
),
child: DropdownButtonFormField(
style: TextStyle(color: Colors.black.withOpacity(0.6),fontWeight: FontWeight.w500,fontSize: 14,),
decoration: InputDecoration(
contentPadding: EdgeInsets.all(8.0),
),
value: selected,
onChanged: (value){
setState(() {
selected = value;
});
},
items: cabangDrop.map<DropdownMenuItem<dynamic>>((item)=>DropdownMenuItem(
value: item['RETURN_VALUE'],
child: Text(item["DISPLAY_VALUE"]),
)).toList(),
),
),
),
),
Flexible(
flex: 1,
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
ButtonTheme(
minWidth: 10,
child: FlatButton(
onPressed: (){
prefs.setString(keyClass.cabang_id, selected);
Navigator.pushNamed(context, '/home');
},
child: Text('Set',style: TextStyle(color: Colors.indigo),),
),
),
FlatButton(
onPressed: (){
setState(() {
prefs.setBool(keyClass.logged_in, false);
prefs.remove(keyClass.cabang_id);
prefs.remove(keyClass.company);
prefs.remove(keyClass.user_id);
});
},
child: Text('Cancel',style: TextStyle(color: Colors.indigo)),
)
],
),
),
)
],
),
),
),
)
),
],
),
),
),
);
// }
// else{
// return WillPopScope(
// onWillPop: ()async{
// setState(() {
// prefs.setBool(keyClass.logged_in, false);
// prefs.remove(keyClass.cabang_id);
// prefs.remove(keyClass.company);
// prefs.remove(keyClass.user_id);
// });
// return false;
// },
// child: Material(
// child: Container(
// color: Colors.grey.withOpacity(0.7),
// child: Center(
// child: Container(
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(5)
// ),
// height: MediaQuery.of(context).size.height/3.2,
// width: MediaQuery.of(context).size.width*0.75,
// child: Column(
// children: <Widget>[
// Flexible(
// flex:3,
// child: Container(
// padding: EdgeInsets.only(top:10,left: 10,right: 10),
// alignment: Alignment.center,
// decoration: BoxDecoration(
//// color: Colors.indigo,
// borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5))
// ),
// child: Column(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// Icon(Icons.business,size: 70,color: Colors.indigo,),
// SizedBox(height: 5,),
// Text('Pilih Cabang',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16,color: Colors.indigo),)
// ],
// ),
// ),
// ),
// Flexible(
// flex: 1,
// child: Container(
// padding: EdgeInsets.only(left: 20,right: 20),
// alignment: Alignment.centerLeft,
// child: Theme(
// data: ThemeData(
// canvasColor: Colors.white,
// primaryColor: Colors.indigo,
// accentColor: Colors.indigo,
// hintColor: Colors.indigo
// ),
// child: DropdownButtonFormField(
// style: TextStyle(color: Colors.black.withOpacity(0.6),fontWeight: FontWeight.w500,fontSize: 14,),
// decoration: InputDecoration(
// contentPadding: EdgeInsets.all(8.0),
// ),
// value: selected,
// onChanged: (value){
// setState(() {
// selected = value;
// });
// },
// items: cabangDrop.map<DropdownMenuItem<dynamic>>((item)=>DropdownMenuItem(
// value: item['RETURN_VALUE'],
// child: Text(item["DISPLAY_VALUE"]),
// )).toList(),
// ),
// ),
// ),
// ),
// Flexible(
// flex: 1,
// child: Container(
// child: Row(
// mainAxisAlignment: MainAxisAlignment.end,
// children: <Widget>[
// ButtonTheme(
// minWidth: 10,
// child: FlatButton(
// onPressed: (){
// prefs.setString(keyClass.cabang_id, selected);
// Navigator.pushNamed(context, '/home');
// },
// child: Text('Set',style: TextStyle(color: Colors.indigo),),
// ),
// ),
// FlatButton(
// onPressed: (){
// setState(() {
// prefs.setBool(keyClass.logged_in, false);
// prefs.remove(keyClass.cabang_id);
// prefs.remove(keyClass.company);
// prefs.remove(keyClass.user_id);
// });
// },
// child: Text('Cancel',style: TextStyle(color: Colors.indigo)),
// )
// ],
// ),
// ),
// )
// ],
// ),
// ),
// ),
// ),
// ),
// );
// }
}
}

+ 53
- 0
lib/main.dart Wyświetl plik

@@ -0,0 +1,53 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:unitstocks/Util/Prefs.dart';
import 'package:unitstocks/login_page.dart';
import 'home_page.dart';
import 'stocking.dart';
import 'unit_details.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:location/location.dart';
import 'Util/Util.dart';

SharedPreferences prefs;
Location location = Location();
StreamSubscription locationStream;
LocationData currentPosisiton;
Util util = new Util();
void main() async{
WidgetsFlutterBinding.ensureInitialized();
prefs = await SharedPreferences.getInstance();
location.changeSettings(accuracy: LocationAccuracy.high);
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((_) {
runApp(new MyApp());
});
}

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Unit Stock',
theme: ThemeData(
pageTransitionsTheme: PageTransitionsTheme(
builders: {
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
}
),
primarySwatch: Colors.indigo,
),
debugShowCheckedModeBanner: false,

home: (prefs.getBool(keyClass.logged_in)??false)?HomePage(title:'Home Page'):LoginPage(),
routes: {
'/home': (context) => new HomePage(title:'Home Page'),
'/stocking' : (context) => new Stocking(),
'/unitdetails' : (context) => new UnitDetails(),
'/login' :(context) => new LoginPage(),
},
);
}
}


+ 381
- 0
lib/stocking.dart Wyświetl plik

@@ -0,0 +1,381 @@
import 'dart:async';
import 'dart:typed_data';
import 'package:flutter/services.dart';

import 'main.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:unitstocks/unit_details.dart';
import 'Util/DBHelper.dart';
import 'Util/UnitModel.dart';
import 'Util/Util.dart';
import 'Util/photo_viewer.dart';
import 'package:barcode_scan/barcode_scan.dart';

class Stocking extends StatefulWidget {
Stocking({Key key}) : super(key: key);

@override
_StockingState createState() => _StockingState();
}

class _StockingState extends State<Stocking> with SingleTickerProviderStateMixin {
// List<insertUnit> Units = [];
List<Unit> unitsRef = [];
List<blobImage> Blobs = [];
List<blobImage> BlobsRef = [];
bool completed = false;
Util util = new Util();
int totalUnit = 0;
final search_controller = new TextEditingController();
// TabController _tabBarcontroller;
bool hideAppbar = false;
String search = '';

loadUnit()async{
print('loading units');
Blobs.clear();
BlobsRef.clear();
await DBHelper.database.closeDb();
// Units = (search=='')?await DBHelper.database.getAllInsertUnits():await DBHelper.database.searchAllInsertUnits(search.toUpperCase());
unitsRef = (search=='')?await DBHelper.database.getAllUnits(inserted: completed):await DBHelper.database.searchAllUnits(search.toUpperCase(),inserted: completed);
// totalUnit = await DBHelper.database.getCount();
// for (int i = 0;i<Units.length;i++){
// var blob = await DBHelper.database.getBlobImage(Units[i].id);
// Blobs.add(blob);
// }
for (int i = 0;i<unitsRef.length;i++){
var blob = (unitsRef[i].mesin!=null)?await DBHelper.database.getBlobImage(unitsRef[i].mesin):null;
BlobsRef.add(blob);
}
print([BlobsRef.length,unitsRef.length]);
setState(() {
});
}

Map<Function, Timer> _timeouts = {};
void debounce(Duration timeout, Function target, [List arguments = const []]) {
if (_timeouts.containsKey(target)) {
_timeouts[target].cancel();
}

Timer timer = Timer(timeout, () {
Function.apply(target, arguments);
});

_timeouts[target] = timer;
}

void _onChanged(String val)async {
search = search_controller.text;
await loadUnit();
}

Future scan() async {
try {
search = '';
setState(() => search_controller.text = search);
ScanResult result = await BarcodeScanner.scan();
String barcode = result.rawContent;
setState(() => this.search = barcode);
} on PlatformException catch (e) {
if (e.code == BarcodeScanner.cameraAccessDenied) {
util.showFlushbar(context, 'The user did not grant the camera permission!',color: Colors.red);
setState(() {
this.search = '';
});
} else {
util.showFlushbar(context, 'Unknown error: $e',color: Colors.red);
setState(() => this.search = '');
}
} on FormatException {
setState(() => this.search =
'');
} catch (e) {
util.showFlushbar(context, 'Unknown error: $e',color: Colors.red);
setState(() => this.search = '');
}
setState(() => search_controller.text = search);
}

@override
void initState() {
// TODO: implement initState
super.initState();
// _tabBarcontroller = new TabController(length: 1, vsync:this);
WidgetsBinding.instance.addPostFrameCallback((_) async {
util.showLoading(context);
await Future.sync(()async{await loadUnit();});
Navigator.pop(context);
if(locationStream==null)await util.streamLocation(context);
else {
if(locationStream.isPaused) locationStream.resume();
}
// setState(() {
// unitsRef.add(new Unit(flag: 'False',tipe: "sdasdas",id: 2,mesin: "sdfasdas",kode: "dasdas",rangka: "asdasd",tahun: "2020",warna: "MERAH",state: "OnChanne;"));
// unitsRef.add(new Unit(flag: 'False',tipe: "sdasdas",id: 2,mesin: "sdfasdas",kode: "dasdas",rangka: "asdasd",tahun: "2020",warna: "MERAH",state: "OnChanne;"));
// unitsRef.add(new Unit(flag: 'False',tipe: "sdasdas",id: 2,mesin: "sdfasdas",kode: "dasdas",rangka: "asdasd",tahun: "2020",warna: "MERAH",state: "OnChanne;"));
// unitsRef.add(new Unit(flag: 'False',tipe: "sdasdas",id: 2,mesin: "sdfasdas",kode: "dasdas",rangka: "asdasd",tahun: "2020",warna: "MERAH",state: "OnChanne;"));
// unitsRef.add(new Unit(flag: 'False',tipe: "sdasdas",id: 2,mesin: "sdfasdas",kode: "dasdas",rangka: "asdasd",tahun: "2020",warna: "MERAH",state: "OnChanne;"));
// });
});
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
print('LocationStream paused');
if(!locationStream.isPaused)locationStream.pause();
}
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: ()async{
if(hideAppbar) {
setState(() {
hideAppbar=false;
search = '';
search_controller.text = '';
});
await loadUnit();
return false;
}
else {
return true;
}
},
child: Scaffold(
appBar: (hideAppbar)?
AppBar(
backgroundColor: Colors.white,
leading: GestureDetector(
onTap:()async{
setState(() {
hideAppbar=false;
search = '';
search_controller.text = '';
});
await loadUnit();
},child: Container(width: 20,child: Icon(Icons.arrow_back,color:Colors.grey))),
title: Container(
color: Colors.white,
child: TextFormField(
maxLines: 1,
controller: search_controller,
onChanged: (val) => debounce(const Duration(milliseconds: 300), _onChanged, [val]),
// onChanged: (value)async{
// search = search_controller.text;
// await loadUnit();
// },
decoration: InputDecoration.collapsed(
hintText: 'Search..',
),
),
),
actions: <Widget>[
FlatButton(
onPressed: ()async{await scan();await loadUnit();},
child: Icon(Icons.select_all,color:Colors.grey),
)
],
)
:null,
// AppBar(
// backgroundColor: Colors.indigo.withOpacity(0.8),
// title: Text('Unit Stocking'),
// actions: <Widget>[
// IconButton(
// icon: Icon(Icons.search,color:Colors.white),
// onPressed: (){
// setState(() {
// hideAppbar = true;
// });
// },
// ),
// ],
// ),
body: Column(
children: <Widget>[
(hideAppbar)?Container():SizedBox(height: MediaQuery.of(context).size.height/25,),
Expanded(
child:Stack(
children: <Widget>[
Container(
child: ListView.builder(
padding: EdgeInsets.only(bottom: 10),
itemCount: unitsRef.length,
shrinkWrap: false,
itemBuilder: (context,index){
Uint8List display;
display = unitsRef[index].flag=='FALSE'?null:(BlobsRef.length==unitsRef.length)?BlobsRef[index].blob_file:null;
return Column(
children: <Widget>[
(index==0)?Container(padding: EdgeInsets.only(top: 10,left: 10,right: 10),alignment: Alignment.centerRight,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
children: <Widget>[
Checkbox(
value: completed,
onChanged: (value)async{
setState(() {
completed = value;
});
await loadUnit();
},
),
Text('Completed')
],
),
(completed||hideAppbar)?Container():Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Text('Unit : ',style: TextStyle(color: Colors.grey,fontSize: 15),),
Text('${(unitsRef.where((element) => element.flag=='TRUE').length==unitsRef.length)?'Done':'${unitsRef.length-unitsRef.where((element) => element.flag=='TRUE').length}'}',style: TextStyle(color: (unitsRef.length==unitsRef.where((element) => element.flag=='TRUE').length)?Colors.green:Colors.black,fontWeight: FontWeight.bold,fontSize: 16),),
Text(!(unitsRef.length==unitsRef.where((element) => element.flag=='TRUE').length)?' of':'',style: TextStyle(color: Colors.grey,fontSize: 15),),
Text(!(unitsRef.length==unitsRef.where((element) => element.flag=='TRUE').length)?' ${unitsRef.length}':'',style: TextStyle(color: Colors.black,fontSize: 16,fontWeight: FontWeight.bold,),),
],
),
],
),):Container(),
Padding(
padding: const EdgeInsets.only(left:10,right: 10,top: 10),
child: Container(
padding: EdgeInsets.all(5.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey,
blurRadius: 5.0, // has the effect of softening the shadow
spreadRadius: 2.0, // has the effect of extending the shadow
offset: Offset(
00.0, // horizontal, move right 10
2.0, // vertical, move down 10
),
)
],
border: Border.all(color: Colors.grey.withOpacity(0.5)),
),
child:Row(
children: <Widget>[
Expanded(
flex: 3,
child: InkWell(
onTap: ()async{
// if(display!=null)Navigator.push(context, MaterialPageRoute(builder: (context) => PhotoViewer(Blobs[index].blob_file,id: Blobs[index].blob_id.toString(),edit: false,jenis: Blobs[index].jenis,)));
if(display==null){
var result = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => UnitDetails(unit: unitsRef[index],),
),
);
if(result!=null){
util.showLoading(context);
await loadUnit();
Navigator.pop(context);
}
}
else{
await Navigator.push(context, MaterialPageRoute(builder: (context) => PhotoViewer(display,id: unitsRef[index].id.toString(),jenis: '',edit: false,)));
}
},
child: Hero(tag: unitsRef[index].id,child: Padding(
padding: EdgeInsets.only(right: 10),
child: Container(width: 100,height: 100,alignment: Alignment.center,child:(display==null)?Icon(Icons.crop_original,color: Colors.white,size: 80,):null,
decoration: BoxDecoration(
color: Colors.grey.withOpacity(0.5),
image: (display!=null)?DecorationImage(
image: MemoryImage(display),fit: BoxFit.cover,):null,)),
)),
)),
Expanded(
flex: 7,
child: InkWell(
onTap: ()async{
var result;
// if(display!=null) {
// result = await Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => UnitDetails(idInsert: unitsRef[index].mesin_id,),
// ),
// );
// }
// if(display==null){
result = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => UnitDetails(unit: unitsRef[index],),
),
);
// }
if(result!=null){
util.showLoading(context);
await loadUnit();
Navigator.pop(context);
}
},
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('Rangka : ${unitsRef[index].rangka}'),
Divider(height: 10,),
Text('Tipe : ${unitsRef[index].tipe}'),
Divider(height: 10,),
Row(
children: <Widget>[
// Container(width: MediaQuery.of(context).size.width*0.35,child: Text('State : ${unitsRef[index].state}')),
// Container(width: MediaQuery.of(context).size.width*0.5,child: Text('Tipe : ${unitsRef[index].tipe}',style: TextStyle(fontSize: 12),)),
Text('Timestamp : ${unitsRef[index].timestamp}'),
],
),
Divider(height: 10,),
Row(
children: <Widget>[
Container(width: MediaQuery.of(context).size.width*0.35,child: Text('Warna : ${unitsRef[index].warna}')),
Text('State : ${unitsRef[index].state}'),
],
)
],
),
),
)),
],
)),
),
],
);
},
),
),
],
),
),
],
),
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.indigo.withOpacity(0.8),
onPressed: ()async{
setState(() {
hideAppbar = !(hideAppbar??false);
});
// var result = await Navigator.push(context, MaterialPageRoute(builder: (context)=>UnitDetails(unit: new Unit(flag: 'FALSE'),)));
// if(result!=null){
// util.showLoading(context);
// await loadUnit();
// Navigator.pop(context);
// }
},
child: Icon(Icons.search,color:Colors.white),
),
),
);
}
}

+ 951
- 0
lib/unit_details.dart Wyświetl plik

@@ -0,0 +1,951 @@
import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/services.dart';
import 'Util/UnitModel.dart';
import 'Util/photo_viewer.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'Util/DBHelper.dart';
import 'Util/Util.dart';
import 'main.dart';
import 'package:intl/intl.dart';
//import 'package:autocomplete_textfield/autocomplete_textfield.dart';

class UnitDetails extends StatefulWidget {
Unit unit;
UnitDetails({this.unit});
@override
_UnitDetailsState createState() => _UnitDetailsState();
}

class _UnitDetailsState extends State<UnitDetails> {
final tipeController = TextEditingController();
final rangkaController = TextEditingController();
final colorController = TextEditingController();
final kodeController = TextEditingController();
final mesinController = TextEditingController();
final tahunController = TextEditingController();
final stateController = TextEditingController();

// insertUnit _unitDetails;
bool isChanged = false;
Util util = new Util();
List<Uint8List> images = [];
List<int> blobIds = [];
List<int> deleteBlobIds = [];
List<jenisDrop> dropMenu = [];
List<String> jenisImages = [];
int jenisLength=0;
Unit _currentUnit;
List<blobImage> blobList = [];
// List<Unit> allUnits = [];

loadUnitDetails(context)async{
// if(widget.idInsert!=null){
//// var result = await DBHelper.database.getInsertUnit(widget.idInsert);
//// if(result!=null){
//// _unitDetails = result;
//// mesinController.text = _unitDetails.mesin;
//// tipeController.text= _unitDetails.tipe;
//// rangkaController.text = _unitDetails.rangka;
//// colorController.text = _unitDetails.warna;
//// tahunController.text = _unitDetails.tahun;
//// kodeController.text = _unitDetails.kode;
//// stateController.text = _unitDetails.state;
////
//// result = await DBHelper.database.getAllBlobImage(_unitDetails.id);
//// if(result!=null){
//// for(int i =0; i<result.length;i++){
//// images.add(result[i].blob_file);
//// blobIds.add(result[i].blob_id);
//// jenisImages.add(result[i].jenis);
//// }
//// }
//// setState(() {
//// });
//// }
//// else{
//// util.showFlushbar(context, 'Unit can\'t be found');
//// }
// await DBHelper.database.closeDb();
// }
// else{
// var result = await DBHelper.database.getUnitdetailMaster(widget.idRef);
// if (result!=null){
_currentUnit = widget.unit;
tipeController.text= _currentUnit.tipe;
rangkaController.text = _currentUnit.rangka;
colorController.text = _currentUnit.warna;
kodeController.text = _currentUnit.kode;
mesinController.text = _currentUnit.mesin;
tahunController.text = _currentUnit.tahun;
stateController.text = _currentUnit.state;
// }
// }
await loadBlob();
}
// loadTipe() async{
// allUnits.clear();
// allUnits = await DBHelper.database.getAllUnits();
// }
loadBlob()async{
var result = await DBHelper.database.getBlobUnits(mesinController.text);
if(result!=null){
setState(() {
blobList = result;
});
// for(int i =0; i<result.length;i++){
// images.add(result[i].blob_file);
// blobIds.add(result[i].blob_id);
// jenisImages.add(result[i].jenis);
// }
// dropMenu = result;
// jenisLength = result.length;
// if(jenisImages.length!=0){
// for (int i =0;i<jenisImages.length;i++){
// dropMenu.removeWhere((element) => element.value==jenisImages[i]);
// }
// }
}
}

@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
util.showLoading(context);
await Future.sync(()async{await loadUnitDetails(context);});
Navigator.pop(context);
});
}
@override
Widget build(BuildContext context) {
// if(allUnits.length!=0){
// print(allUnits[0].tipe);
//// loadTipe();
// }
return Scaffold(
resizeToAvoidBottomPadding: true,
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0.0,
iconTheme: IconThemeData(
color: Colors.indigo,
),
title: Text((widget.unit.flag=='FALSE')?'Inserting New Unit':'Editing Unit',style: TextStyle(color: Colors.indigo),),
),
body: WillPopScope(
onWillPop: ()async{
if(widget.unit.flag=='TRUE'){
if(isChanged){
await showDialog(context: context,builder: (context)=>
Material(
color: Colors.white.withOpacity(0.9),
child: Center(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 2,
blurRadius: 2,
offset: Offset(0, 0), // changes position of shadow
),
],
borderRadius: BorderRadius.circular(5)
),
height: MediaQuery.of(context).size.height/4.8,
width: MediaQuery.of(context).size.width*0.75,
child: Column(
children: <Widget>[
Flexible(
flex:3,
child: Container(
padding: EdgeInsets.only(top:10,left: 10,right: 10),
alignment: Alignment.center,
decoration: BoxDecoration(
// color: Colors.indigo,
borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5))
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(Icons.warning,size: 70,color: Colors.indigo,),
],
),
),
),
Flexible(
flex: 1,
child: Container(
padding: EdgeInsets.only(left: 20,right: 20),
alignment: Alignment.centerLeft,
child: Text('Data belum disimpan. Lanjutkan ?',style: TextStyle(fontWeight: FontWeight.w500,fontSize: 14,color: Colors.black.withOpacity(0.6)),)
),
),
Flexible(
flex: 1,
child: Container(
padding: EdgeInsets.only(bottom:10),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
FlatButton(
child: Text('Proceed'),
// color: Colors.red,
onPressed: (){
Navigator.pop(context);
Navigator.pop(context);
},
),
FlatButton(
child: Text('Cancel'),
// color: Colors.grey,
onPressed: (){
Navigator.pop(context);
},
),
],
),
),
)
],
),
),
),
),
);
}
else Navigator.pop(context);
}
else{
bool not_empty = (stateController.text!='-'&&mesinController.text!='-'&&tahunController.text!='-'&&kodeController.text!='-'&&colorController.text!='-'&&rangkaController.text!='-'&&tipeController.text!='-');
if(blobList.where((element) => element.blob_file!=null).length!=0){
await showDialog(context: context,builder: (context)=>
Material(
color: Colors.white.withOpacity(0.9),
child: Center(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 2,
blurRadius: 2,
offset: Offset(0, 0), // changes position of shadow
),
],
borderRadius: BorderRadius.circular(5)
),
height: MediaQuery.of(context).size.height/4.8,
width: MediaQuery.of(context).size.width*0.75,
child: Column(
children: <Widget>[
Flexible(
flex:3,
child: Container(
padding: EdgeInsets.only(top:10,left: 10,right: 10),
alignment: Alignment.center,
decoration: BoxDecoration(
// color: Colors.indigo,
borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5))
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(Icons.warning,size: 70,color: Colors.indigo,),
],
),
),
),
Flexible(
flex: 1,
child: Container(
padding: EdgeInsets.only(left: 20,right: 20),
alignment: Alignment.centerLeft,
child: Text('Data belum disimpan. Lanjutkan ?',style: TextStyle(fontWeight: FontWeight.w500,fontSize: 14,color: Colors.black.withOpacity(0.6)),)
),
),
Flexible(
flex: 1,
child: Container(
padding: EdgeInsets.only(bottom:10),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
FlatButton(
child: Text('Back',style: TextStyle(color: Colors.indigo),),
onPressed: (){
Navigator.pop(context);
Navigator.pop(context);
},
),
FlatButton(
child: Text('Cancel',style: TextStyle(color: Colors.indigo)),
onPressed: (){
Navigator.pop(context);
},
),
],
),
),
)
],
),
),
),
),
);
}
else Navigator.pop(context);
}
return false;
},
child: Container(
padding: EdgeInsets.only(left:10,right: 10,bottom: 10),
child: Column(
children: <Widget>[
// SizedBox(height: MediaQuery.of(context).size.height/25,),
Expanded(
child: Row(
children: <Widget>[
Flexible(
flex: 4,
child: Container(
height: MediaQuery.of(context).size.height,
child:
ListView.builder(
// itemCount: ((images.length+1)>jenisLength)?jenisLength:images.length+1,
itemCount: blobList.length,
itemBuilder: (context, index){
// Uint8List image = ((images.length==0)||(images.length<(index+1)))?null:images[index];
Uint8List image = blobList[index].blob_file;
return Padding(
padding: const EdgeInsets.only(top: 10,right: 10),
child: Material(
child: InkWell(
onTap: ()async{
if(image==null){
// var selected = await showDialog(
// context: context,
// builder: (context){
// var selected = dropMenu[0].value;
// return WillPopScope(
// onWillPop: ()async{
// Navigator.pop(context,false);
// return false;
// },
// child: AlertDialog(
// content: StatefulBuilder(
// builder: (context,setState){
// return DropdownButtonFormField(
// decoration: InputDecoration.collapsed(),
// value: selected,
// onChanged: (value){
// setState(() {
// selected = value;
// });
// },
// items: dropMenu.map((item) {
// return new DropdownMenuItem<String>(
// value: item.value,
// child: Row(
// children: <Widget>[
// Text(item.value),
//// (item.optional=='TRUE')?Container():Text(' *',style: TextStyle(color: Colors.red),)
// ],
// ),
// );
// }).toList(),
// );
// },
// ),
// actions: <Widget>[
// FlatButton(
// child: Text('Done'),
// onPressed: ()async{
// jenisImages.add(selected);
//
// Navigator.pop(context,true);
// },
// ),
// FlatButton(
// child: Text('Cancel'),
// onPressed: (){
// Navigator.pop(context,false);
// },
// ),
// ],
// ),
// );
// }
// );
// if (selected){
File temp = await ImagePicker.pickImage(source: ImageSource.camera,maxWidth: 800,imageQuality: 80);
if(temp!=null){
isChanged = true;
blobList[index].blob_file = temp.readAsBytesSync();
temp.deleteSync();
// if(widget.idInsert!=null) {
// blobIds.add(null);
// isChanged = true;
// }
setState(() {
});
}
// else {
// jenisImages.removeLast();
// }
// await loadDropMenu();
// }
}
else {
// List<jenisDrop> dropNewMenu = new List<jenisDrop>.from(dropMenu);
// dropNewMenu.add(new jenisDrop(value: jenisImages[index]));
var result = await Navigator.push(context, MaterialPageRoute(builder: (context) => PhotoViewer(image,id: widget.unit.id.toString()+'.$index',jenis: blobList[index].jenis,)));
if(result!=null){
blobList[index] = result['byte'];
isChanged = true;
// images[index] = result['byte'];
// jenisImages[index] = result['jenis'];
// await loadDropMenu();
// if(widget.idInsert!=null) {
// isChanged = true;
// }
setState(() {
});
}
}
},
splashColor: Colors.grey,
child: Column(
children: <Widget>[
Container(padding: EdgeInsets.all(5),child: Text(blobList[index].jenis)),
Stack(
children: <Widget>[
Container(
decoration: BoxDecoration(
color: Colors.grey.withOpacity(0.7),
image: (image!=null)?DecorationImage(
image: MemoryImage(image),
fit: BoxFit.cover
):null,
),
height: MediaQuery.of(context).size.width*0.35,
width: MediaQuery.of(context).size.width*0.35,
child: (image==null)?Icon(Icons.add):null,
),
(image!=null)?Container(
height: MediaQuery.of(context).size.width*0.35,
width: MediaQuery.of(context).size.width*0.35,
alignment: Alignment.topRight,
child: InkWell(
onTap: ()async{
// if(widget.idInsert!=null){
// isChanged = true;
// deleteBlobIds.add(blobIds[index]);
// blobIds.removeAt(index);
// }
setState(() {
blobList[index].blob_file = null;
// images.removeAt(index);
// jenisImages.removeAt(index);
});
// await loadDropMenu();
},
child: Container(
padding: EdgeInsets.all(5),
child: Icon(Icons.cancel,color: Colors.red,)),
),
):Container(),
],
),
],
),
),
),
);
})
),
),
Flexible(
flex: 6,
child: Container(
alignment: Alignment.topLeft,
padding: EdgeInsets.only(top: 10),
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
// Divider(),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: <Widget>[
// Expanded(
// child:
// textfield??Container(),
// ),
// ],
// ),
Padding(
padding: const EdgeInsets.all(5.0),
child: Text('Units Details',style: TextStyle(fontSize: 18,fontWeight: FontWeight.bold),),
),
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('Tipe : '),
Expanded(
child:
TextFormField(
enabled: false,
style: TextStyle(color: Colors.grey),
controller: tipeController,
decoration: InputDecoration.collapsed(hintText: null),
),
),
],
),
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('Mesin : '),
Expanded(
child: TextFormField(
enabled: false,
style: TextStyle(color: Colors.grey),
controller: mesinController,
decoration: InputDecoration.collapsed(hintText: null),
),
),
],
),
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('Rangka : '),
Expanded(
child: TextFormField(
enabled: false,
style: TextStyle(color: Colors.grey),
controller: rangkaController,
decoration: InputDecoration.collapsed(hintText: null),
),
),
],
),
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('Kode : '),
Expanded(
child: TextFormField(
enabled: false,
style: TextStyle(color: Colors.grey),
controller: kodeController,
decoration: InputDecoration.collapsed(hintText: null),
),
),
],
),
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('Tahun : '),
Expanded(
child: TextFormField(
enabled: false,
style: TextStyle(color: Colors.grey),
controller: tahunController,
decoration: InputDecoration.collapsed(hintText: null),
),
),
],
),
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('Warna : '),
Expanded(
child: TextFormField(
enabled: false,
style: TextStyle(color: Colors.grey),
controller: colorController,
decoration: InputDecoration.collapsed(hintText: null),
),
),
],
),
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('State : '),
Expanded(
child: TextFormField(
enabled: false,
style: TextStyle(color: Colors.grey),
controller: stateController,
decoration: InputDecoration.collapsed(hintText: null),
),
),
],
),
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
FlatButton(
child: Text((widget.unit.flag=='FALSE')?'Add':'Save'),
onPressed: ()async{
bool succeed = false;
String errMsg = '';
util.showLoading(context);
await Future.sync(()async{
if(currentPosisiton!=null) {
if(blobList.where((element) => element.blob_file!=null).length==blobList.length){
for(int i = 0 ; i<blobList.length;i++){
blobList[i].lat = currentPosisiton.latitude.toString();
blobList[i].long = currentPosisiton.longitude.toString();
var result = await DBHelper.database.updateBlob(blobList[i]);
succeed = (result!=null);
if(!succeed) {
i = blobList.length;
}
}
if(succeed){
_currentUnit.timestamp = DateFormat('dd-MM-yyyy HH:mm:ss').format(DateTime.now());
_currentUnit.flag = 'TRUE';
var result = await DBHelper.database.updateUnit(_currentUnit);
succeed = (result!=null);
}
}
else{
succeed = false;
errMsg ='Please take all the pictures';
}
}
else{
succeed = false;
errMsg ='Failed getting current location. Please check gps.';
}
});
Navigator.pop(context);
// if(!ModalRoute.of(context).isCurrent)Navigator.popUntil(context,ModalRoute.withName('/unitdetails') );
if(!ModalRoute.of(context).isCurrent)Navigator.pop(context);
if(succeed) Navigator.pop(context,succeed);
util.showFlushbar(context, (succeed)?'Data updated':errMsg,color: (succeed)?Colors.grey:Colors.red);

// bool valid = false;
// String errMsg= '';
// if(widget.idInsert==null){
// bool not_empty = (stateController.text!='-'&&mesinController.text!='-'&&tahunController.text!='-'&&kodeController.text!='-'&&colorController.text!='-'&&rangkaController.text!='-'&&tipeController.text!='-');
// if(not_empty&&images.length==jenisLength){
// valid = true;
// }
// else{
// if(!not_empty) errMsg='Please fill all the Unit details';
// else errMsg='You must atleast take required pictures of unit';
// }
// }
// else{
// checkChanges();
// valid = true;
// }
// if(valid){
// bool succeed = false;
// util.showLoading(context);
// await Future.sync(()async{
// if(currentPosisiton!=null){
// if(widget.idInsert==null){
// var result = await DBHelper.database.checkUnitbyMesin(mesinController.text.replaceAll('-', ''));
// if(result==0){
// insertUnit input = new insertUnit(
// mesin: mesinController.text,
// timestamp:DateFormat('dd-MM-yyyy HH:mm:ss').format(DateTime.now()),
// );
// var insertID = await DBHelper.database.newInsertUnit(input);
// if(insertID!=null){
// for(int i=0;i<images.length;i++){
// blobImage newBlob = new blobImage(
// blob_file: images[i],
// mesin_id: insertID,
// lat: currentPosisiton.latitude.toString(),
// long: currentPosisiton.longitude.toString(),
// jenis: jenisImages[i],
// );
// var result = await DBHelper.database.newInsertBlob(newBlob);
// succeed = (result!=null);
// if(!succeed) {
// i = images.length;
// }
// }
// }
// await DBHelper.database.closeDb();
// }
// else{
// errMsg = "Data mesin ${mesinController.text} sudah diinput";
// }
// }
// else{
// if(isChanged){
// if(images.length==jenisLength){
// _unitDetails.mesin = mesinController.text;
// _unitDetails.timestamp = DateFormat('dd-MM-yyyy HH:mm:ss').format(DateTime.now());
// var updateresult = await DBHelper.database.updateInsertUnit(_unitDetails);
// if(updateresult!=null){
// print(deleteBlobIds);
// for(int j=0;j<deleteBlobIds.length;j++){
// var result = await DBHelper.database.deleteBlob(deleteBlobIds[j]);
// succeed = (result!=null);
// if(!succeed) {
// j = deleteBlobIds.length;
// }
// }
// for(int i=0;i<images.length;i++){
// blobImage newBlob = new blobImage(
// blob_id: blobIds[i],
// blob_file: images[i],
// mesin_id: _unitDetails.id,
// lat : currentPosisiton.latitude.toString(),
// long : currentPosisiton.longitude.toString(),
// jenis: jenisImages[i],
// );
// var result = await DBHelper.database.insertUpdateBlob(newBlob);
// succeed = (result!=null);
// if(!succeed) {
// i = images.length;
// }
// }
// }
// await DBHelper.database.closeDb();
// }
// else errMsg = 'You must atleast take required pictures of unit';
// }
// else succeed =true;
// }
// }
// else{
// errMsg = 'Failed fetching location. Please make sure gps enabled';
// }
// });
// Navigator.pop(context);
//// print('aaaaaaaaaaaaaa ${ModalRoute.of(context).isCurrent}');
// if(!ModalRoute.of(context).isCurrent)Navigator.popUntil(context, ModalRoute.withName('/unitdetails'));
// if(succeed){
// Navigator.pop(context,succeed);
// print(currentPosisiton);
// util.showFlushbar(context, 'Row ${widget.idInsert==null?'Inserted':'Updated'}');
// }
// else{
// util.showFlushbar(context, 'Failed to ${widget.idInsert==null?'insert':'update'} row. ${errMsg??''}',color: Colors.red);
// }
// }
// else{
// util.showFlushbar(context,errMsg);
// }
},
color: Colors.green,
),
FlatButton(
child: Text('Cancel'),
onPressed: ()async {
if(widget.unit.flag=='TRUE'){
if(isChanged){
await showDialog(context: context,builder: (context)=>
Material(
color: Colors.white.withOpacity(0.9),
child: Center(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 2,
blurRadius: 2,
offset: Offset(0, 0), // changes position of shadow
),
],
borderRadius: BorderRadius.circular(5)
),
height: MediaQuery.of(context).size.height/4.8,
width: MediaQuery.of(context).size.width*0.75,
child: Column(
children: <Widget>[
Flexible(
flex:3,
child: Container(
padding: EdgeInsets.only(top:10,left: 10,right: 10),
alignment: Alignment.center,
decoration: BoxDecoration(
// color: Colors.indigo,
borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5))
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(Icons.warning,size: 70,color: Colors.indigo,),
],
),
),
),
Flexible(
flex: 1,
child: Container(
padding: EdgeInsets.only(left: 20,right: 20),
alignment: Alignment.centerLeft,
child: Text('Data belum disimpan. Lanjutkan ?',style: TextStyle(fontWeight: FontWeight.w500,fontSize: 14,color: Colors.black.withOpacity(0.6)),)
),
),
Flexible(
flex: 1,
child: Container(
padding: EdgeInsets.only(bottom:10),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
FlatButton(
child: Text('Proceed'),
onPressed: (){
Navigator.pop(context);
Navigator.popUntil(context,ModalRoute.withName('/stocking'));
},
),
FlatButton(
child: Text('Cancel'),
// color: Colors.grey,
onPressed: (){
Navigator.pop(context);
},
),
],
),
),
)
],
),
),
),
),
);
}
else Navigator.pop(context);
}
else {
// bool not_empty = (stateController.text!='-'&&mesinController.text!='-'&&tahunController.text!='-'&&kodeController.text!='-'&&colorController.text!='-'&&rangkaController.text!='-'&&tipeController.text!='-');
if(blobList.where((element) => element.blob_file!=null).length!=0){
await showDialog(context: context,builder: (context)=>
Material(
color: Colors.white.withOpacity(0.9),
child: Center(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 2,
blurRadius: 2,
offset: Offset(0, 0), // changes position of shadow
),
],
borderRadius: BorderRadius.circular(5)
),
height: MediaQuery.of(context).size.height/4.8,
width: MediaQuery.of(context).size.width*0.75,
child: Column(
children: <Widget>[
Flexible(
flex:3,
child: Container(
padding: EdgeInsets.only(top:10,left: 10,right: 10),
alignment: Alignment.center,
decoration: BoxDecoration(
// color: Colors.indigo,
borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5))
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(Icons.warning,size: 70,color: Colors.indigo,),
],
),
),
),
Flexible(
flex: 1,
child: Container(
padding: EdgeInsets.only(left: 20,right: 20),
alignment: Alignment.centerLeft,
child: Text('Data belum disimpan. Lanjutkan ?',style: TextStyle(fontWeight: FontWeight.w500,fontSize: 14,color: Colors.black.withOpacity(0.6)),)
),
),
Flexible(
flex: 1,
child: Container(
padding: EdgeInsets.only(bottom:10),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
FlatButton(
child: Text('Back'),
onPressed: (){
Navigator.pop(context);
Navigator.popUntil(context,ModalRoute.withName('/stocking'));
},
),
FlatButton(
child: Text('Cancel'),
onPressed: (){
Navigator.pop(context);
},
),
],
),
),
)
],
),
),
),
),
);
}
else Navigator.pop(context);
}
},
color: Colors.redAccent,
)
],
)
],
),
),
),
)
],
),
),
],
),
),
),
);
}
}

+ 43
- 0
local_plugin/location-3.0.2/.gitignore Wyświetl plik

@@ -0,0 +1,43 @@
.atom/
.idea/
.vscode/

.packages
.pub/
.dart_tool/
pubspec.lock
flutter_export_environment.sh

examples/all_plugins/pubspec.yaml

Podfile
Podfile.lock
Pods/
.symlinks/
**/Flutter/App.framework/
**/Flutter/Flutter.framework/
**/Flutter/Generated.xcconfig
**/Flutter/flutter_assets/
ServiceDefinitions.json
xcuserdata/
*.xcworkspace
**/DerivedData/

local.properties
keystore.properties
.gradle/
gradlew
gradlew.bat
gradle-wrapper.jar
.flutter-plugins-dependencies
*.iml

GeneratedPluginRegistrant.h
GeneratedPluginRegistrant.m
GeneratedPluginRegistrant.java
build/
.flutter-plugins

.project
.classpath
.settings

+ 162
- 0
local_plugin/location-3.0.2/CHANGELOG.md Wyświetl plik

@@ -0,0 +1,162 @@
## [3.0.2] 3rd April 2020

- Improve code coverage
- Fix a bug when requesting permission using an intent (thanks to kennethj)
- Fix a bug when onDetachedFromActivity is called (thanks to creativepsyco)

## [3.0.1] 27th March 2020

- Fix a crash happening during iOS build

## [3.0.0] 26th March 2020

- Add Web and macOS as new supported platforms (huge thanks to long1eu)
- [BREAKING] Enums are now following Dart guidelines.
- [BREAKING] _onLocationChanged_ is now a getter to follow Dart guidelines.

## [2.5.4] 11st March 2020

- Update documentation
- Fix: Airplane mode was preventing location from being requested
- Fix: Not crashing when activity is not set on Android

## [2.5.3] 26th February 2020

- Improve code coverage
- Update documentation

## [2.5.2] 25th February 2020

- Fix crash on pre-1.12 projects
- Align PermissionStatus on iOS with Android

## [2.5.1] 23rd February 2020

- Fix SDK version

## [2.5.0] 23rd February 2020

- [BREAKING] The `requestPermission` and `hasPermission` are now returning PermissionStatus enum.
- Upgrade to Android Embedding V2 (follow https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects if the plugin isn't working after upgrade)
- Resolve getLocation when service is disabled thanks to nicowernli
- Update example app
- Fix bugs leading to non returning code
- `getLocation` now throws properly
- `pub.dev` now states that the plugin is not compatible with Flutter Web (yet)

## [2.4.0] 14th February 2020

- Align timestamp in Android and iOS, previously the iOS timestamp was in seconds instead of milliseconds. Thanks to 781flyingdutchman.

## [2.3.7] 08th January 2020

- Fix bug where requestPermission is called after the user has already denied the system location dialog, then this method call would never return.

## [2.3.6] 07th January 2020

- Fix ClassCastException errors on some Android phones when requesting Location status.

## [2.3.5] 10th April 2019

- Fix incompatibily with headless plugins thanks to ehhc
- Fix error with iOS when permission already given
- Add Google maps example

## [2.3.4] 8th April 2019

- Fix error on Android 21 API thanks to noordawod
- Update Google API version

## [2.3.3] 31th March 2019

- Align altitude on Sea Level when available on Android (matching iOS altitude).

## [2.3.2] 27th March 2019

- Remove GPS limitation on Android

## [2.3.1] 25th March 2019

- Fixes README
- Fixes requestPermission not responding the correct result on iOS

## [2.3.0] 22nd March 2019

- Update example App with proper cancel
- Add possibility to set accuracy, interval and minimum notification ditance of the requests.
- Add LocationAccuracy object

## [2.2.0] 19th March 2019

- Actually updating locatino when using getLocation (not only relying on LastLocation)
- Add timestamp to LocationData
- Add serviceEnabled method to check whether Location Service is enabled.
- Add requestService method to ask the user to activate the location service.
- Fix continuous callback heading

## [2.1.0] 16th Match 2019

- iOS permission should be closer to Android permission behaviour thanks to PerrchicK
- Adding requestPermission(), to manually request permission
- Several feature fixed for less crash when using the plugin
- Code Cleanup
- Update Readme and add a warning for the location bug in iOS simulator

## [2.0.0] 25th January 2019

- Code cleanup
- BREAKING CHANGE: Change Dart API to return structured data rather than a map.

## [1.4.0] 21st August 2018

- Add lazy permission request thanks to yathit
- Add hasPermission() thanks to vagrantrobbie
- Bug correction thanks to jalpedersen
- Add more examples

## [1.3.4] 4th June 2018

- Fix crash for Android API pre 27 thanks to matthewtsmith.

## [1.3.3] 30th May 2018

- Correct implementation of iOS plugin to match Android behaviour. No need to call getLocation
to get permissions for location callbacks.

## [1.3.2] 30th May 2018

- Change implementation to api in build.gradle in order to solve incompatibilities between
GMS versions thanks to luccascorrea

## [1.3.1] 29th May 2018

- Added speed and speed_accuracy (only Android truly discover speed accuracy, so its always 0 for now on iOS)
- Solved a crash

## [1.3.0] 27th May 2018

- Make it compatible with Firebase thanks to quangIO
- Resolve runtime error exception thanks to jharrison902
- Update gitignore thanks to bcko

## [1.2.0] 5th April 2018

- Permissions denied on Android handled thanks to g123k
- Dart 2 update thanks to efortuna

## [1.1.6] - 19th Octobre 2017.

- iOS code from Swift to Objective-C thanks to fluff

## [1.1.1] - 20th July 2017.

- Fixes for iOS result's format.

## [1.1.0] - 17th July 2017.

- Added permission check for Android 6+ (thanks netdur). Still no callback when permissions granted
so aiming SDK 21 is safer.

## [1.0.0] - 7th July 2017.

- Initial Release.

+ 19
- 0
local_plugin/location-3.0.2/LICENSE Wyświetl plik

@@ -0,0 +1,19 @@
Copyright (c) 2017, Guillaume Bernos.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

+ 156
- 0
local_plugin/location-3.0.2/README.md Wyświetl plik

@@ -0,0 +1,156 @@
# Flutter Location Plugin

[![pub package](https://img.shields.io/pub/v/location.svg)](https://pub.dartlang.org/packages/location) ![Cirrus CI - Task and Script Build Status](https://img.shields.io/cirrus/github/Lyokone/flutterlocation?task=test)
[![codecov](https://codecov.io/gh/Lyokone/flutterlocation/branch/master/graph/badge.svg)](https://codecov.io/gh/Lyokone/flutterlocation)

This plugin for [Flutter](https://flutter.io)
handles getting location on Android and iOS. It also provides callbacks when location is changed.

<p align="center">
<img src="https://raw.githubusercontent.com/Lyokone/flutterlocation/master/location/src/demo_readme.gif" alt="Demo App" style="margin:auto" width="372" height="686">
</p>

## Getting Started

Add this to your package's `pubspec.yaml` file:

```yaml
dependencies:
location: ^3.0.0
```

### Android

With Flutter 1.12, all the dependencies are automatically added to your project.
If your project was created before Flutter 1.12, you may need to follow [this](https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects).

### iOS

And to use it in iOS, you have to add this permission in Info.plist :

```xml
NSLocationWhenInUseUsageDescription
NSLocationAlwaysUsageDescription
```

### Web

Nothing to do, the plugin works directly out of box.

### macOS

Ensure that the application is properly "sandboxed" and that the location is enabled. You can do this in Xcode with the following steps:

1. In the project navigator, click on your application's target. This should bring up a view with tabs such as "General", "Capabilities", "Resource Tags", etc.
1. Click on the "Capabilities" tab. This will give you a list of items such as "App Groups", "App Sandbox" and so on. Each item will have an "On/Off" button.
1. Turn on the "App Sandbox" item and press the ">" button on the left to show the sandbox stuff.
1. In the "App Data" section, select "Location".

Add this permission in Info.plist :

```xml
NSLocationWhenInUseUsageDescription
NSLocationAlwaysUsageDescription
```

## Usage

Then you just have to import the package with

```dart
import 'package:location/location.dart';
```

In order to request location, you should always check manually Location Service status and Permission status.

```dart
Location location = new Location();

bool _serviceEnabled;
PermissionStatus _permissionGranted;
LocationData _locationData;

_serviceEnabled = await location.serviceEnabled();
if (!_serviceEnabled) {
_serviceEnabled = await location.requestService();
if (!_serviceEnabled) {
return;
}
}

_permissionGranted = await location.hasPermission();
if (_permissionGranted == PermissionStatus.denied) {
_permissionGranted = await location.requestPermission();
if (_permissionGranted != PermissionStatus.granted) {
return;
}
}

_locationData = await location.getLocation();
```

You can also get continuous callbacks when your position is changing:

```dart
location.onLocationChanged.listen((LocationData currentLocation) {
// Use current location
});
```

Be sure to check the example project to get other code samples.

## Public Methods Summary

| Return | Description |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Future\<PermissionStatus> | **requestPermission()** <br>Request the Location permission. Return a PermissionStatus to know if the permission has been granted. |
| Future\<PermissionStatus> | **hasPermission()** <br>Return a PermissionStatus to know the state of the location permission. |
| Future\<bool> | **serviceEnabled()** <br>Return a boolean to know if the Location Service is enabled or if the user manually deactivated it. |
| Future\<bool> | **requestService()** <br>Show an alert dialog to request the user to activate the Location Service. On iOS, will only display an alert due to Apple Guidelines, the user having to manually go to Settings. Return a boolean to know if the Location Service has been activated (always `false` on iOS). |
| Future\<bool> | **changeSettings(LocationAccuracy accuracy = LocationAccuracy.HIGH, int interval = 1000, double distanceFilter = 0)** <br>Will change the settings of futur requests. `accuracy`will describe the accuracy of the request (see the LocationAccuracy object). `interval` will set the desired interval for active location updates, in milliseconds (only affects Android). `distanceFilter` set the minimum displacement between location updates in meters. |
| Future\<LocationData> | **getLocation()** <br>Allow to get a one time position of the user. It will try to request permission if not granted yet and will throw a `PERMISSION_DENIED` error code if permission still not granted. |
| Stream\<LocationData> | **onLocationChanged** <br>Get the stream of the user's location. It will try to request permission if not granted yet and will throw a `PERMISSION_DENIED` error code if permission still not granted. |

You should try to manage permission manually with `requestPermission()` to avoid error, but plugin will try handle some cases for you.

## Objects

```dart
class LocationData {
final double latitude; // Latitude, in degrees
final double longitude; // Longitude, in degrees
final double accuracy; // Estimated horizontal accuracy of this location, radial, in meters
final double altitude; // In meters above the WGS 84 reference ellipsoid
final double speed; // In meters/second
final double speedAccuracy; // In meters/second, always 0 on iOS
final double heading; //Heading is the horizontal direction of travel of this device, in degrees
final double time; //timestamp of the LocationData
}


enum LocationAccuracy {
powerSave, // To request best accuracy possible with zero additional power consumption,
low, // To request "city" level accuracy
balanced, // To request "block" level accuracy
high, // To request the most accurate locations available
navigation // To request location for navigation usage (affect only iOS)
}

// Status of a permission request to use location services.
enum PermissionStatus {
/// The permission to use location services has been granted.
granted,
// The permission to use location services has been denied by the user. May have been denied forever on iOS.
denied,
// The permission to use location services has been denied forever by the user. No dialog will be displayed on permission request.
deniedForever
}

```

Note: you can convert the timestamp into a `DateTime` with: `DateTime.fromMillisecondsSinceEpoch(locationData.time.toInt())`

## Feedback

Please feel free to [give me any feedback](https://github.com/Lyokone/flutterlocation/issues)
helping support this plugin !

+ 42
- 0
local_plugin/location-3.0.2/android/build.gradle Wyświetl plik

@@ -0,0 +1,42 @@
group 'com.lyokone.location'
version '1.0-SNAPSHOT'

buildscript {
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}

rootProject.allprojects {
repositories {
google()
jcenter()

}
}




apply plugin: 'com.android.library'

android {
compileSdkVersion 28

defaultConfig {
minSdkVersion 16
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
disable 'InvalidPackage'
}
}

dependencies {
api 'com.google.android.gms:play-services-location:16.+'
}

+ 3
- 0
local_plugin/location-3.0.2/android/gradle.properties Wyświetl plik

@@ -0,0 +1,3 @@
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536M

+ 6
- 0
local_plugin/location-3.0.2/android/gradle/wrapper/gradle-wrapper.properties Wyświetl plik

@@ -0,0 +1,6 @@
#Sun Feb 16 18:22:06 CET 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

+ 1
- 0
local_plugin/location-3.0.2/android/settings.gradle Wyświetl plik

@@ -0,0 +1 @@
rootProject.name = 'location'

+ 6
- 0
local_plugin/location-3.0.2/android/src/main/AndroidManifest.xml Wyświetl plik

@@ -0,0 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lyokone.location">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

</manifest>

+ 425
- 0
local_plugin/location-3.0.2/android/src/main/java/com/lyokone/location/FlutterLocation.java Wyświetl plik

@@ -0,0 +1,425 @@
package com.lyokone.location;

import android.Manifest;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationManager;
import android.location.OnNmeaMessageListener;
import android.os.Build;
import android.os.Looper;
import android.util.Log;

import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.api.ResolvableApiException;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationCallback;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationResult;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.LocationSettingsRequest;
import com.google.android.gms.location.LocationSettingsResponse;
import com.google.android.gms.location.LocationSettingsStatusCodes;
import com.google.android.gms.location.SettingsClient;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;

import java.util.HashMap;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import io.flutter.plugin.common.EventChannel.EventSink;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.PluginRegistry;

class FlutterLocation
implements PluginRegistry.RequestPermissionsResultListener, PluginRegistry.ActivityResultListener {
private static final String TAG = "FlutterLocation";

private final Context applicationContext;

@Nullable
public Activity activity;

private static final int REQUEST_PERMISSIONS_REQUEST_CODE = 34;
private static final int REQUEST_CHECK_SETTINGS = 0x1;

private static final int GPS_ENABLE_REQUEST = 0x1001;

public FusedLocationProviderClient mFusedLocationClient;
private SettingsClient mSettingsClient;
private static LocationRequest mLocationRequest;
private LocationSettingsRequest mLocationSettingsRequest;
public LocationCallback mLocationCallback;

@TargetApi(Build.VERSION_CODES.N)
private OnNmeaMessageListener mMessageListener;

private Double mLastMslAltitude;

// Parameters of the request
private static long updateIntervalMilliseconds = 5000;
private static long fastestUpdateIntervalMilliseconds = updateIntervalMilliseconds / 2;
private static Integer locationAccuracy = LocationRequest.PRIORITY_HIGH_ACCURACY;
private static float distanceFilter = 0f;

public EventSink events;

// Store result until a permission check is resolved
public Result result;

// Store result until a location is getting resolved
public Result getLocationResult;

private int locationPermissionState;

private boolean waitingForPermission = false;
private LocationManager locationManager;

public HashMap<Integer, Integer> mapFlutterAccuracy = new HashMap<Integer, Integer>() {
{
put(0, LocationRequest.PRIORITY_NO_POWER);
put(1, LocationRequest.PRIORITY_LOW_POWER);
put(2, LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
put(3, LocationRequest.PRIORITY_HIGH_ACCURACY);
put(4, LocationRequest.PRIORITY_HIGH_ACCURACY);
}
};

FlutterLocation(Context applicationContext, @Nullable Activity activity) {
this.applicationContext = applicationContext;
this.activity = activity;
}

FlutterLocation(PluginRegistry.Registrar registrar) {
this(registrar.context(), registrar.activity());
registrar.addRequestPermissionsResultListener(this);
}

void setActivity(@Nullable Activity activity) {
this.activity = activity;
mFusedLocationClient = LocationServices.getFusedLocationProviderClient(activity);
mSettingsClient = LocationServices.getSettingsClient(activity);
locationManager = (LocationManager) activity.getSystemService(Context.LOCATION_SERVICE);

createLocationCallback();
createLocationRequest();
buildLocationSettingsRequest();
}

@Override
public boolean onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
return onRequestPermissionsResultHandler(requestCode, permissions, grantResults);
}

public boolean onRequestPermissionsResultHandler(int requestCode, String[] permissions, int[] grantResults) {
if (requestCode == REQUEST_PERMISSIONS_REQUEST_CODE && permissions.length == 1
&& permissions[0].equals(Manifest.permission.ACCESS_FINE_LOCATION)) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// Checks if this permission was automatically triggered by a location request
if (getLocationResult != null || events != null) {
startRequestingLocation();
}
if (result != null) {
result.success(1);
result = null;
}
} else {
if (!shouldShowRequestPermissionRationale()) {
sendError("PERMISSION_DENIED_NEVER_ASK",
"Location permission denied forever - please open app settings", null);
if (result != null) {
result.success(2);
result = null;
}
} else {
sendError("PERMISSION_DENIED", "Location permission denied", null);
if (result != null) {
result.success(0);
result = null;
}
}
}
return true;
}
return false;

}

@Override
public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
if (result == null) {
return false;
}
switch (requestCode) {
case GPS_ENABLE_REQUEST:
if (resultCode == Activity.RESULT_OK) {
result.success(1);
} else {
result.success(0);
}
break;
case REQUEST_CHECK_SETTINGS:
if (resultCode == Activity.RESULT_OK) {
startRequestingLocation();
return true;
}

result.error("SERVICE_STATUS_DISABLED", "Failed to get location. Location services disabled", null);
return false;
default:
return false;
}
return true;
}

public void changeSettings(Integer locationAccuracy, Long updateIntervalMilliseconds,
Long fastestUpdateIntervalMilliseconds, Float distanceFilter) {
this.locationAccuracy = locationAccuracy;
this.updateIntervalMilliseconds = updateIntervalMilliseconds;
this.fastestUpdateIntervalMilliseconds = fastestUpdateIntervalMilliseconds;
this.distanceFilter = distanceFilter;

createLocationCallback();
createLocationRequest();
buildLocationSettingsRequest();
}

private void sendError(String errorCode, String errorMessage, Object errorDetails) {
if (getLocationResult != null) {
getLocationResult.error(errorCode, errorMessage, errorDetails);
getLocationResult = null;
}
if (events != null) {
events.error(errorCode, errorMessage, errorDetails);
events = null;
}
}

/**
* Creates a callback for receiving location events.
*/
private void createLocationCallback() {
mLocationCallback = new LocationCallback() {
@Override
public void onLocationResult(LocationResult locationResult) {
super.onLocationResult(locationResult);
Location location = locationResult.getLastLocation();
HashMap<String, Double> loc = new HashMap<>();
loc.put("latitude", location.getLatitude());
loc.put("longitude", location.getLongitude());
loc.put("accuracy", (double) location.getAccuracy());

// Using NMEA Data to get MSL level altitude
if (mLastMslAltitude == null || Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
loc.put("altitude", location.getAltitude());
} else {
loc.put("altitude", mLastMslAltitude);
}

loc.put("speed", (double) location.getSpeed());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
loc.put("speed_accuracy", (double) location.getSpeedAccuracyMetersPerSecond());
}
loc.put("heading", (double) location.getBearing());
loc.put("time", (double) location.getTime());

if (getLocationResult != null) {
getLocationResult.success(loc);
getLocationResult = null;
}
if (events != null) {
events.success(loc);
} else {
mFusedLocationClient.removeLocationUpdates(mLocationCallback);
}
}
};

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
mMessageListener = new OnNmeaMessageListener() {
@Override
public void onNmeaMessage(String message, long timestamp) {
if (message.startsWith("$")) {
String[] tokens = message.split(",");
String type = tokens[0];

// Parse altitude above sea level, Detailed description of NMEA string here
// http://aprs.gids.nl/nmea/#gga
if (type.startsWith("$GPGGA") && tokens.length > 9) {
if (!tokens[9].isEmpty()) {
mLastMslAltitude = Double.parseDouble(tokens[9]);
}
}
}
}
};
}
}

/**
* Sets up the location request. Android has two location request settings:
*/
private void createLocationRequest() {
this.mLocationRequest = LocationRequest.create();

this.mLocationRequest.setInterval(this.updateIntervalMilliseconds);
this.mLocationRequest.setFastestInterval(this.fastestUpdateIntervalMilliseconds);
this.mLocationRequest.setPriority(this.locationAccuracy);
this.mLocationRequest.setSmallestDisplacement(this.distanceFilter);
}

/**
* Uses a
* {@link com.google.android.gms.location.LocationSettingsRequest.Builder} to
* build a {@link com.google.android.gms.location.LocationSettingsRequest} that
* is used for checking if a device has the needed location settings.
*/
private void buildLocationSettingsRequest() {
LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder();
builder.addLocationRequest(mLocationRequest);
mLocationSettingsRequest = builder.build();
}

/**
* Return the current state of the permissions needed.
*/
public boolean checkPermissions() {
this.locationPermissionState = ActivityCompat.checkSelfPermission(activity,
Manifest.permission.ACCESS_FINE_LOCATION);
return this.locationPermissionState == PackageManager.PERMISSION_GRANTED;
}

public void requestPermissions() {
if (checkPermissions()) {
result.success(1);
return;
}
ActivityCompat.requestPermissions(activity, new String[] { Manifest.permission.ACCESS_FINE_LOCATION },
REQUEST_PERMISSIONS_REQUEST_CODE);
}

public boolean shouldShowRequestPermissionRationale() {
return ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.ACCESS_FINE_LOCATION);
}

public boolean checkServiceEnabled(final Result result) {
boolean gps_enabled = false;
boolean network_enabled = false;

try {
gps_enabled = this.locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
network_enabled = this.locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
} catch (Exception ex) {
result.error("SERVICE_STATUS_ERROR", "Location service status couldn't be determined", null);
return false;
}
if (gps_enabled && network_enabled) {
if (result != null) {
result.success(1);
}
return true;

} else {
if (result != null) {
result.success(0);
}
return false;
}
}

public void requestService(final Result result) {
if (this.checkServiceEnabled(null)) {
result.success(1);
return;
}
this.result = result;
mSettingsClient.checkLocationSettings(mLocationSettingsRequest).addOnFailureListener(activity,
new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
if (e instanceof ResolvableApiException) {
ResolvableApiException rae = (ResolvableApiException) e;
int statusCode = rae.getStatusCode();
switch (statusCode) {
case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
try {
// Show the dialog by calling startResolutionForResult(), and check the
// result in onActivityResult().
rae.startResolutionForResult(activity, GPS_ENABLE_REQUEST);
} catch (IntentSender.SendIntentException sie) {
result.error("SERVICE_STATUS_ERROR", "Could not resolve location request",
null);
}
break;
case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
result.error("SERVICE_STATUS_DISABLED",
"Failed to get location. Location services disabled", null);
break;
}
} else {
// This should not happen according to Android documentation but it has been
// observed on some phones.
result.error("SERVICE_STATUS_ERROR", "Unexpected error type received", null);
}
}
});
}

public void startRequestingLocation() {
mSettingsClient.checkLocationSettings(mLocationSettingsRequest)
.addOnSuccessListener(activity, new OnSuccessListener<LocationSettingsResponse>() {
@Override
public void onSuccess(LocationSettingsResponse locationSettingsResponse) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
locationManager.addNmeaListener(mMessageListener);
}
mFusedLocationClient.requestLocationUpdates(mLocationRequest, mLocationCallback,
Looper.myLooper());
}
}).addOnFailureListener(activity, new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
if (e instanceof ResolvableApiException) {
ResolvableApiException rae = (ResolvableApiException) e;
int statusCode = rae.getStatusCode();
switch (statusCode) {
case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
try {
// Show the dialog by calling startResolutionForResult(), and check the
// result in onActivityResult().
rae.startResolutionForResult(activity, REQUEST_CHECK_SETTINGS);
} catch (IntentSender.SendIntentException sie) {
Log.i(TAG, "PendingIntent unable to execute request.");
}
break;
}
} else {
ApiException ae = (ApiException) e;
int statusCode = ae.getStatusCode();
switch (statusCode) {
case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
// This error code happens during AirPlane mode.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
locationManager.addNmeaListener(mMessageListener);
}
mFusedLocationClient.requestLocationUpdates(mLocationRequest, mLocationCallback,
Looper.myLooper());
break;
default:
// This should not happen according to Android documentation but it has been
// observed on some phones.
sendError("UNEXPECTED_ERROR", e.getMessage(), null);
break;
}
}
}
});
}

}

+ 113
- 0
local_plugin/location-3.0.2/android/src/main/java/com/lyokone/location/LocationPlugin.java Wyświetl plik

@@ -0,0 +1,113 @@
package com.lyokone.location;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
import io.flutter.plugin.common.PluginRegistry.Registrar;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.PluginRegistry;

/**
* LocationPlugin
*/
public class LocationPlugin implements FlutterPlugin, ActivityAware {
private static final String TAG = "LocationPlugin";
@Nullable
private MethodCallHandlerImpl methodCallHandler;
@Nullable
private StreamHandlerImpl streamHandlerImpl;

@Nullable
private FlutterLocation location;

private FlutterPluginBinding pluginBinding;
private ActivityPluginBinding activityBinding;

public static void registerWith(Registrar registrar) {
FlutterLocation flutterLocation = new FlutterLocation(registrar);
flutterLocation.setActivity(registrar.activity());

MethodCallHandlerImpl handler = new MethodCallHandlerImpl(flutterLocation);
handler.startListening(registrar.messenger());

StreamHandlerImpl streamHandlerImpl = new StreamHandlerImpl(flutterLocation);
streamHandlerImpl.startListening(registrar.messenger());
}

@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
pluginBinding = binding;

location = new FlutterLocation(binding.getApplicationContext(), /* activity= */ null);
methodCallHandler = new MethodCallHandlerImpl(location);
methodCallHandler.startListening(binding.getBinaryMessenger());

streamHandlerImpl = new StreamHandlerImpl(location);
streamHandlerImpl.startListening(binding.getBinaryMessenger());
}

@Override
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
pluginBinding = null;

if (methodCallHandler != null) {
methodCallHandler.stopListening();
methodCallHandler = null;
}

if (streamHandlerImpl != null) {
streamHandlerImpl.stopListening();
streamHandlerImpl = null;
}

location = null;
}

@Override
public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) {
location.setActivity(binding.getActivity());

activityBinding = binding;
setup(pluginBinding.getBinaryMessenger(), activityBinding.getActivity(), null);
}

@Override
public void onDetachedFromActivity() {
tearDown();
}

@Override
public void onDetachedFromActivityForConfigChanges() {
onDetachedFromActivity();
}

@Override
public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) {
onAttachedToActivity(binding);
}

private void setup(final BinaryMessenger messenger, final Activity activity,
final PluginRegistry.Registrar registrar) {
if (registrar != null) {
// V1 embedding setup for activity listeners.
registrar.addActivityResultListener(location);
registrar.addRequestPermissionsResultListener(location);
} else {
// V2 embedding setup for activity listeners.
activityBinding.addActivityResultListener(location);
activityBinding.addRequestPermissionsResultListener(location);
}
}

private void tearDown() {
activityBinding.removeActivityResultListener(location);
activityBinding.removeRequestPermissionsResultListener(location);
}
}

+ 134
- 0
local_plugin/location-3.0.2/android/src/main/java/com/lyokone/location/MethodCallHandlerImpl.java Wyświetl plik

@@ -0,0 +1,134 @@
package com.lyokone.location;

import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import androidx.annotation.Nullable;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;

final class MethodCallHandlerImpl implements MethodCallHandler {
private static final String TAG = "MethodCallHandlerImpl";

private final FlutterLocation location;
@Nullable
private MethodChannel channel;

private static final String METHOD_CHANNEL_NAME = "lyokone/location";

MethodCallHandlerImpl(FlutterLocation location) {
this.location = location;
}

@Override
public void onMethodCall(MethodCall call, Result result) {
if (location.activity == null) {
result.error("NO_ACTIVITY", null, null);
return;
}

switch (call.method) {
case "changeSettings":
onChangeSettings(call, result);
break;
case "getLocation":
onGetLocation(result);
break;
case "hasPermission":
onHasPermission(result);
break;
case "requestPermission":
onRequestPermission(result);
break;
case "serviceEnabled":
location.checkServiceEnabled(result);
break;
case "requestService":
location.requestService(result);
break;
default:
result.notImplemented();
break;
}
}

/**
* Registers this instance as a method call handler on the given
* {@code messenger}.
*/
void startListening(BinaryMessenger messenger) {
if (channel != null) {
Log.wtf(TAG, "Setting a method call handler before the last was disposed.");
stopListening();
}

channel = new MethodChannel(messenger, METHOD_CHANNEL_NAME);
channel.setMethodCallHandler(this);
}

/**
* Clears this instance from listening to method calls.
*/
void stopListening() {
if (channel == null) {
Log.d(TAG, "Tried to stop listening when no MethodChannel had been initialized.");
return;
}

channel.setMethodCallHandler(null);
channel = null;
}

private void onChangeSettings(MethodCall call, Result result) {
try {
final Integer locationAccuracy = location.mapFlutterAccuracy.get(call.argument("accuracy"));
final Long updateIntervalMilliseconds = new Long((int) call.argument("interval"));
final Long fastestUpdateIntervalMilliseconds = updateIntervalMilliseconds / 2;
final Float distanceFilter = new Float((double) call.argument("distanceFilter"));

location.changeSettings(locationAccuracy, updateIntervalMilliseconds, fastestUpdateIntervalMilliseconds,
distanceFilter);

result.success(1);
} catch (Exception e) {
result.error("CHANGE_SETTINGS_ERROR",
"An unexcepted error happened during location settings change:" + e.getMessage(), null);
}
}

private void onGetLocation(Result result) {
location.getLocationResult = result;
if (!location.checkPermissions()) {
location.requestPermissions();
} else {
location.startRequestingLocation();
}
}

private void onHasPermission(Result result) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
result.success(1);
return;
}

if (location.checkPermissions()) {
result.success(1);
} else {
result.success(0);
}
}

private void onRequestPermission(Result result) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
result.success(1);
return;
}

location.result = result;
location.requestPermissions();
}

}

+ 69
- 0
local_plugin/location-3.0.2/android/src/main/java/com/lyokone/location/StreamHandlerImpl.java Wyświetl plik

@@ -0,0 +1,69 @@
package com.lyokone.location;

import android.util.Log;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.EventChannel;
import io.flutter.plugin.common.EventChannel.StreamHandler;
import io.flutter.plugin.common.EventChannel.EventSink;

class StreamHandlerImpl implements StreamHandler {
private static final String TAG = "StreamHandlerImpl";

private final FlutterLocation location;
private EventChannel channel;

private static final String STREAM_CHANNEL_NAME = "lyokone/locationstream";

StreamHandlerImpl(FlutterLocation location) {
this.location = location;
}

/**
* Registers this instance as a stream events handler on the given
* {@code messenger}.
*/
void startListening(BinaryMessenger messenger) {
if (channel != null) {
Log.wtf(TAG, "Setting a method call handler before the last was disposed.");
stopListening();
}

channel = new EventChannel(messenger, STREAM_CHANNEL_NAME);
channel.setStreamHandler(this);
}

/**
* Clears this instance from listening to stream events.
*/
void stopListening() {
if (channel == null) {
Log.d(TAG, "Tried to stop listening when no MethodChannel had been initialized.");
return;
}

channel.setStreamHandler(null);
channel = null;
}

@Override
public void onListen(Object arguments, final EventSink eventsSink) {
location.events = eventsSink;
if (location.activity == null) {
eventsSink.error("NO_ACTIVITY", null, null);
return;
}

if (!location.checkPermissions()) {
location.requestPermissions();
return;
}
location.startRequestingLocation();
}

@Override
public void onCancel(Object arguments) {
location.mFusedLocationClient.removeLocationUpdates(location.mLocationCallback);
location.events = null;
}

}

+ 4
- 0
local_plugin/location-3.0.2/darwin/Classes/LocationPlugin.h Wyświetl plik

@@ -0,0 +1,4 @@
#import <Flutter/Flutter.h>

@interface LocationPlugin : NSObject <FlutterPlugin>
@end

+ 321
- 0
local_plugin/location-3.0.2/darwin/Classes/LocationPlugin.m Wyświetl plik

@@ -0,0 +1,321 @@
#import "LocationPlugin.h"

#ifdef COCOAPODS
@import CoreLocation;
#else
#import <CoreLocation/CoreLocation.h>
#endif

@interface LocationPlugin() <FlutterStreamHandler, CLLocationManagerDelegate>
@property (strong, nonatomic) CLLocationManager *clLocationManager;
@property (copy, nonatomic) FlutterResult flutterResult;
@property (assign, nonatomic) BOOL locationWanted;
@property (assign, nonatomic) BOOL permissionWanted;

@property (copy, nonatomic) FlutterEventSink flutterEventSink;
@property (assign, nonatomic) BOOL flutterListening;
@property (assign, nonatomic) BOOL hasInit;
@end

@implementation LocationPlugin

+(void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
FlutterMethodChannel *channel =
[FlutterMethodChannel methodChannelWithName:@"lyokone/location"
binaryMessenger:registrar.messenger];
FlutterEventChannel *stream =
[FlutterEventChannel eventChannelWithName:@"lyokone/locationstream"
binaryMessenger:registrar.messenger];

LocationPlugin *instance = [[LocationPlugin alloc] init];
[registrar addMethodCallDelegate:instance channel:channel];
[stream setStreamHandler:instance];
}

-(instancetype)init {
self = [super init];

if (self) {
self.locationWanted = NO;
self.permissionWanted = NO;
self.flutterListening = NO;
self.hasInit = NO;
}
return self;
}

-(void)initLocation {
if (!(self.hasInit)) {
self.hasInit = YES;

if ([CLLocationManager locationServicesEnabled]) {
self.clLocationManager = [[CLLocationManager alloc] init];
self.clLocationManager.delegate = self;
self.clLocationManager.desiredAccuracy = kCLLocationAccuracyBest;
}
}
}

-(void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
[self initLocation];
if ([call.method isEqualToString:@"changeSettings"]) {
if ([CLLocationManager locationServicesEnabled]) {
NSDictionary *dictionary = @{
@"0" : @(kCLLocationAccuracyKilometer),
@"1" : @(kCLLocationAccuracyHundredMeters),
@"2" : @(kCLLocationAccuracyNearestTenMeters),
@"3" : @(kCLLocationAccuracyBest),
@"4" : @(kCLLocationAccuracyBestForNavigation)
};

self.clLocationManager.desiredAccuracy =
[dictionary[call.arguments[@"accuracy"]] doubleValue];
double distanceFilter = [call.arguments[@"distanceFilter"] doubleValue];
if (distanceFilter == 0){
distanceFilter = kCLDistanceFilterNone;
}
self.clLocationManager.distanceFilter = distanceFilter;
result(@1);
}
} else if ([call.method isEqualToString:@"getLocation"]) {
if (![CLLocationManager locationServicesEnabled]) {
result([FlutterError errorWithCode:@"SERVICE_STATUS_DISABLED" message:@"Failed to get location. Location services disabled" details:nil]);
return;
}
if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied) {
// Location services are requested but user has denied
NSString *message = @"The user explicitly denied the use of location services for this "
"app or location services are currently disabled in Settings.";
result([FlutterError errorWithCode:@"PERMISSION_DENIED"
message:message
details:nil]);
return;
}

self.flutterResult = result;
self.locationWanted = YES;

if ([self isPermissionGranted]) {
[self.clLocationManager startUpdatingLocation];
} else {
[self requestPermission];
if ([self isPermissionGranted]) {
[self.clLocationManager startUpdatingLocation];
}
}
} else if ([call.method isEqualToString:@"hasPermission"]) {
if ([self isPermissionGranted]) {
result(@1);
} else {
result(@0);
}
} else if ([call.method isEqualToString:@"requestPermission"]) {
if ([self isPermissionGranted]) {
result(@1);
} else if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined) {
self.flutterResult = result;
self.permissionWanted = YES;
[self requestPermission];
} else {
result(@2);
}
} else if ([call.method isEqualToString:@"serviceEnabled"]) {
if ([CLLocationManager locationServicesEnabled]) {
result(@1);
} else {
result(@0);
}
} else if ([call.method isEqualToString:@"requestService"]) {
if ([CLLocationManager locationServicesEnabled]) {
result(@1);
} else {
#if TARGET_OS_OSX
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:@"Location is Disabled"];
[alert setInformativeText:@"To use location, go to your System Preferences > Security & Privacy > Privacy > Location Services."];
[alert addButtonWithTitle:@"Open"];
[alert addButtonWithTitle:@"Cancel"];
[alert beginSheetModalForWindow:NSApplication.sharedApplication.mainWindow
completionHandler:^(NSModalResponse returnCode) {
if (returnCode == NSAlertFirstButtonReturn) {
NSString *urlString = @"x-apple.systempreferences:com.apple.preference.security?Privacy_LocationServices";
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:urlString]];
} else {
NSLog(@"Cancel");
}
}];
#else
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location is Disabled"
message:@"To use location, go to your Settings App > Privacy > Location Services."
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil];
[alert show];
#endif
result(@0);
}
} else {
result(FlutterMethodNotImplemented);
}
}


-(void) requestPermission {
#if TARGET_OS_OSX
if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"] != nil) {
if (@available(macOS 10.15, *)) {
[self.clLocationManager requestAlwaysAuthorization];
}
}
#else
if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"] != nil) {
[self.clLocationManager requestWhenInUseAuthorization];
}
else if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"] != nil) {
[self.clLocationManager requestAlwaysAuthorization];
}
#endif
else {
[NSException raise:NSInternalInconsistencyException format:
@"To use location in iOS8 and above you need to define either "
"NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription in the app "
"bundle's Info.plist file"];
}
}

-(BOOL) isPermissionGranted {
BOOL isPermissionGranted = NO;
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
#if TARGET_OS_OSX
if (status == kCLAuthorizationStatusAuthorized) {
// Location services are available
isPermissionGranted = YES;
} else if (@available(macOS 10.12, *)) {
if (status == kCLAuthorizationStatusAuthorizedAlways) {
// Location services are available
isPermissionGranted = YES;
}
}
#else //if TARGET_OS_IOS
if (status == kCLAuthorizationStatusAuthorizedWhenInUse ||
status == kCLAuthorizationStatusAuthorizedAlways) {
// Location services are available
isPermissionGranted = YES;
}
#endif
else if (status == kCLAuthorizationStatusDenied ||
status == kCLAuthorizationStatusRestricted) {
// Location services are requested but user has denied / the app is restricted from
// getting location
isPermissionGranted = NO;
} else if (status == kCLAuthorizationStatusNotDetermined) {
// Location services never requested / the user still haven't decide
isPermissionGranted = NO;
} else {
isPermissionGranted = NO;
}
return isPermissionGranted;
}

-(FlutterError*)onListenWithArguments:(id)arguments eventSink:(FlutterEventSink)events {
self.flutterEventSink = events;
self.flutterListening = YES;

if ([self isPermissionGranted]) {
[self.clLocationManager startUpdatingLocation];
} else {
[self requestPermission];
}

return nil;
}

-(FlutterError*)onCancelWithArguments:(id)arguments {
self.flutterListening = NO;
[self.clLocationManager stopUpdatingLocation];
return nil;
}

#pragma mark - CLLocationManagerDelegate Methods

-(void)locationManager:(CLLocationManager*)manager
didUpdateLocations:(NSArray<CLLocation*>*)locations {
CLLocation *location = locations.firstObject;
NSTimeInterval timeInSeconds = [location.timestamp timeIntervalSince1970];
NSDictionary<NSString*,NSNumber*>* coordinatesDict =
@{
@"latitude": @(location.coordinate.latitude),
@"longitude": @(location.coordinate.longitude),
@"accuracy": @(location.horizontalAccuracy),
@"altitude": @(location.altitude),
@"speed": @(location.speed),
@"speed_accuracy": @0.0,
@"heading": @(location.course),
@"time": @(((double) timeInSeconds) * 1000.0) // in milliseconds since the epoch
};

if (self.locationWanted) {
self.locationWanted = NO;
self.flutterResult(coordinatesDict);
}
if (self.flutterListening) {
self.flutterEventSink(coordinatesDict);
} else {
[self.clLocationManager stopUpdatingLocation];
}
}

- (void)locationManager:(CLLocationManager *)manager
didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
if (status == kCLAuthorizationStatusDenied) {
// The user denied authorization
NSLog(@"User denied permissions");
if (self.permissionWanted) {
self.permissionWanted = NO;
self.flutterResult(@0);
}
}
#if TARGET_OS_OSX
else if (status == kCLAuthorizationStatusAuthorized) {
NSLog(@"User granted permissions");
if (self.permissionWanted) {
self.permissionWanted = NO;
self.flutterResult(@1);
}

if (self.locationWanted || self.flutterListening) {
[self.clLocationManager startUpdatingLocation];
}
} else if (@available(macOS 10.12, *)) {
if (status == kCLAuthorizationStatusAuthorizedAlways) {
NSLog(@"User granted permissions");
if (self.permissionWanted) {
self.permissionWanted = NO;
self.flutterResult(@1);
}

if (self.locationWanted || self.flutterListening) {
[self.clLocationManager startUpdatingLocation];
}
}
}
#else //if TARGET_OS_IOS
else if (status == kCLAuthorizationStatusAuthorizedWhenInUse ||
status == kCLAuthorizationStatusAuthorizedAlways) {
NSLog(@"User granted permissions");
if (self.permissionWanted) {
self.permissionWanted = NO;
self.flutterResult(@1);
}

if (self.locationWanted || self.flutterListening) {
[self.clLocationManager startUpdatingLocation];
}
}
#endif
}


@end

+ 43
- 0
local_plugin/location-3.0.2/example/.gitignore Wyświetl plik

@@ -0,0 +1,43 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# 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/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Exceptions to above rules.
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages

+ 10
- 0
local_plugin/location-3.0.2/example/.metadata Wyświetl plik

@@ -0,0 +1,10 @@
# 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: 0b8abb4724aa590dd0f429683339b1e045a1594d
channel: stable

project_type: app

+ 16
- 0
local_plugin/location-3.0.2/example/README.md Wyświetl plik

@@ -0,0 +1,16 @@
# location_example

Demonstrates how to use the location plugin.

## 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://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

+ 7
- 0
local_plugin/location-3.0.2/example/android/.gitignore Wyświetl plik

@@ -0,0 +1,7 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java

+ 60
- 0
local_plugin/location-3.0.2/example/android/app/build.gradle Wyświetl plik

@@ -0,0 +1,60 @@
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 28

lintOptions {
disable 'InvalidPackage'
}

defaultConfig {
applicationId "com.lyokone.locationexample"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

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.debug
}
}
}

flutter {
source '../..'
}

dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

+ 12
- 0
local_plugin/location-3.0.2/example/android/app/src/androidTest/java/com/lyokone/locationexample/EmbedderV1ActivityTest.java Wyświetl plik

@@ -0,0 +1,12 @@
package com.lyokone.locationexample;

import androidx.test.rule.ActivityTestRule;
import dev.flutter.plugins.e2e.FlutterRunner;
import org.junit.Rule;
import org.junit.runner.RunWith;

@RunWith(FlutterRunner.class)
public class EmbedderV1ActivityTest {
@Rule
public ActivityTestRule<EmbedderV1Activity> rule = new ActivityTestRule<>(EmbedderV1Activity.class);
}

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików

Ładowanie…
Anuluj
Zapisz