First commit

This commit is contained in:
Nathan SOULIER 2025-03-17 13:58:47 +01:00
commit fff5617757
159 changed files with 6972 additions and 0 deletions

45
.gitignore vendored Normal file
View File

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

45
.metadata Normal file
View File

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

9
LICENSE Normal file
View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) 2024 reflex-platform
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.

75
README.md Normal file
View File

@ -0,0 +1,75 @@
# Example App: Integrating with Reflex Platform
## Purpose
This repository contains an example Flutter application demonstrating how to integrate with the Reflex Platform, a powerful tool developed by Hardis Group. This example app showcases how to leverage the Reflex Platform's APIs to build custom integrations and extend the capabilities of your warehouse management system.
Whether you're a developer looking to understand how to interact with Reflex Platform's services or a business seeking to evaluate the integration potential, this example app provides a hands-on starting point. It makes use of the [Reflex Platform Dart SDK](https://git.reflex-platform.com/reflex-platform/dart-core-sdk) to demonstrate how to fetch data, and perform key operations within the Reflex Platform ecosystem.
## Features
- Demonstrates basic integration with Reflex Platform APIs.
- Illustrates authentication flows and API request patterns.
- Serves as a template for building more complex integrations.
## Getting Started
To get started with this example Flutter app, follow the steps below:
### 1. Clone the Repository
First, clone this repository to your local machine using the following command:
```bash
git clone https://git.reflex-platform.com/reflex-platform/flutter-rp-example
cd flutter-rp-example
```
### 2. Obtain a Reflex Platform Client ID
This example app requires a Reflex Platform client ID for authentication purposes. To obtain this, you need to get in contact with a Hardis representative. The representative will provide you with a unique `RP_AUTH_CLIENT_ID` that you'll use to authenticate API requests.
### 3. Configure the Application
Once you have your `RP_AUTH_CLIENT_ID`, you'll need to replace the placeholder value in the application with your actual client ID.
1. Open the project's configuration file, typically named `lib/globals.dart`.
2. Locate the line that defines `RP_AUTH_CLIENT_ID`:
```dart
const String RP_AUTH_CLIENT_ID = 'your_client_id_here';
```
3. Replace `'your_client_id_here'` with the client ID you received from Hardis.
### 3. Run the Application
With the configuration in place, you can now run the Flutter application. Use the following commands:
1. Ensure you have all the necessary dependencies installed:
```bash
flutter pub get
```
2. Run the application on your preferred device or emulator
```bash
flutter run
```
### 4. Explore and Extend
Once the application is running, explore the provided features and examine the code to understand how the integration with Reflex Platform works. You can use this example as a foundation to build more complex and tailored integrations for your specific use case.
## Requirements
* Flutter
* Android
* Android Studio
* iOS
* Xcode
* Cocoapods
## License
Distributed under the MIT [License](LICENSE). See `LICENSE` for more information.

1
analysis_options.yaml Normal file
View File

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

14
android/.gitignore vendored Normal file
View File

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

View File

@ -0,0 +1,44 @@
plugins {
id("com.android.application")
id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
}
android {
namespace = "com.example.sampleapp"
compileSdk = flutter.compileSdkVersion
ndkVersion = "27.0.12077973"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.sampleapp"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("debug")
}
}
}
flutter {
source = "../.."
}

View File

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

View File

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

View File

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

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

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

View File

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

View File

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

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

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

View File

@ -0,0 +1,3 @@
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true

View File

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

View File

@ -0,0 +1,25 @@
pluginManagement {
val flutterSdkPath = run {
val properties = java.util.Properties()
file("local.properties").inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
flutterSdkPath
}
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.7.0" apply false
id("org.jetbrains.kotlin.android") version "1.8.22" apply false
}
include(":app")

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

34
ios/.gitignore vendored Normal file
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

View File

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

View File

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

View File

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

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

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

View File

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

View File

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

3
l10n.yaml Normal file
View File

@ -0,0 +1,3 @@
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart

26
lib/globals.dart Normal file
View File

@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
class Globals {
Globals._();
static const String RP_AUTH_BASE_URL = "auth.reflex-platform.com";
static const String RP_AUTH_REALM = "reflex-platform";
static const String RP_AUTH_CLIENT_ID = "your_client_id_here";
static const String RP_GRPC_HOST = 'grpc.core.reflex-platform.com';
static const int RP_GRPC_PORT = 443;
static const Color RP_BG_COLOR = Color(0xfffcfcfd);
static const Color RP_BG_DARK_COLOR = Color(0xfff5f7f9);
static const Color RP_PRIMARY_COLOR = Color(0xff002151);
static const Color RP_PRIMARY_DARK_COLOR = Color(0xff335373);
static const Color RP_PRIMARY_LIGHT_COLOR = Color(0xffd9f1fb);
static const Color RP_PRIMARY_HOVER_COLOR = Color(0xff5DCEFF);
static const Color RP_DANGER_COLOR = Color(0xffdc3545);
static const Color RP_SUCCESS_COLOR = Color(0xff28a745);
static const Color RP_SECONDARY_COLOR = Color(0xff6c757d);
static const Color RP_LIGHT_COLOR = Color(0xffe9ecef);
}

54
lib/l10n/app_en.arb Normal file
View File

@ -0,0 +1,54 @@
{
"addPhoto": "Add photo",
"anomaly": "Anomaly",
"anomalyBadHandlingUnit": "Declined - Package in bad condition",
"anomalyCustomerRefused": "Declined - Customer declined",
"anomalyCustomerUnavailable": "Unavailable - Customer unavailable",
"anomalyOther": "Other reason",
"anomalyReason": "Anomaly reason",
"cancel": "Cancel",
"cannotNotifyDelivery": "Cannot notify delivery",
"copied": "copied",
"dateOn": "the {date} at {time}",
"@dateOn": {
"placeholders": {
"date": {
"type": "DateTime",
"format": "yMd"
},
"time": {
"type": "DateTime",
"format": "jm"
}
}
},
"deliveryOk": "Delivery notified as OK",
"deliveryWithAnomaly": "Delivery notified with anomaly",
"dimensions": "Dimensions (H x W x L)",
"error": "Error",
"handlingUnitIdentifier": "Handling unit Identifier",
"handlingUnitType": "Handling unit type",
"informations": "Informations",
"items": "Items",
"itemId": "Item ID",
"missingSendingFilesRights": "You are not allowed to send files in this project",
"nextDelivery": "Next delivery",
"noHandlingUnitFound": "No handling unit found",
"ok": "OK",
"or": "OR",
"organization": "Organization",
"pleaseTryAgain": "Please try again",
"pleaseIndicateAnomaly": "Please indicate if the handling unit has an anomaly or not",
"project": "Project",
"quantity": "Quantity",
"scanBarcode": "SCAN BARCODE",
"search": "Search",
"selectContext": "Select the desired organization and project of your delivery",
"selectHandlingUnit": "Select a handling unit by typing or scanning its identifier",
"signature": "Signature",
"start": "Start tour",
"tryAgain": "Try again",
"trackingNumber": "Tracking N°",
"validDelivery": "OK",
"weight": "Weight"
}

54
lib/l10n/app_fr.arb Normal file
View File

@ -0,0 +1,54 @@
{
"addPhoto": "Ajouter une photo",
"anomaly": "Anomalie",
"anomalyBadHandlingUnit": "Refusé - Colis abimé",
"anomalyCustomerRefused": "Refusé - Refus client",
"anomalyCustomerUnavailable": "Absence - Client non présent",
"anomalyOther": "Autres raisons",
"anomalyReason": "Raison de l'anomalie",
"cancel": "Annuler",
"cannotNotifyDelivery": "Impossible de notifier la livraison",
"copied": "copié",
"dateOn": "le {date} à {time}",
"@dateOn": {
"placeholders": {
"date": {
"type": "DateTime",
"format": "yMd"
},
"time": {
"type": "DateTime",
"format": "jm"
}
}
},
"deliveryOk": "Livraison déclarée conforme",
"deliveryWithAnomaly": "Livraison déclarée en anomalie",
"dimensions": "Dimensions (H x L x P)",
"error": "Erreur",
"handlingUnitIdentifier": "Identifiant du colis",
"handlingUnitType": "Type de colis",
"informations": "Informations",
"items": "Articles",
"itemId": "Article ID",
"missingSendingFilesRights": "Vous n'avez pas le droit d'envoyer de fichiers dans ce projet",
"nextDelivery": "Livraison suivante",
"noHandlingUnitFound": "Aucun colis trouvé pour cet identifiant de colis.",
"ok": "OK",
"or": "OU",
"organization": "Organisation",
"pleaseTryAgain": "Veuillez réessayer",
"pleaseIndicateAnomaly": "Veuillez indiquer si le colis présente une anomalie ou non",
"project": "Projet",
"quantity": "Quantité",
"scanBarcode": "SCANNER UN CODE BARRE",
"search": "Rechercher",
"selectContext": "Sélectionner l'organisation et le projet cible de votre livraison",
"selectHandlingUnit": "Sélectionner un colis en scannant ou tapant son numéro ou son identifiant tracking",
"signature": "Signature",
"start": "Démarrer la tournée",
"tryAgain": "Réessayer",
"trackingNumber": "N° Tracking",
"validDelivery": "Valide",
"weight": "Poids"
}

61
lib/locator.dart Normal file
View File

@ -0,0 +1,61 @@
import 'package:dart_core_sdk/gcs-api.pbgrpc.dart';
import 'package:dart_core_sdk/handlingunitQuery.pbgrpc.dart';
import 'package:dart_core_sdk/proj.pbgrpc.dart';
import 'package:dart_core_sdk/trackingInput.pbgrpc.dart';
import 'package:sampleapp/globals.dart';
import 'package:sampleapp/router/router.dart';
import 'package:sampleapp/services/auth/auth.dart';
import 'package:get_it/get_it.dart';
import 'package:sampleapp/services/gcs.dart';
import 'package:sampleapp/services/grpc_service.dart';
import 'package:sampleapp/utils.dart';
final locator = GetIt.instance;
Future<void> setup() async {
var redirectURI = getRedirectURI();
var callbackUrlScheme = await getCallbackUrlScheme();
AuthService authService = AuthService(
host: Globals.RP_AUTH_BASE_URL,
realm: Globals.RP_AUTH_REALM,
clientId: Globals.RP_AUTH_CLIENT_ID,
redirectUri: redirectURI,
callbackUrlScheme: callbackUrlScheme,
);
locator.registerLazySingleton<AuthService>(() => authService);
locator.registerLazySingleton<ReflexRouterDelegate>(
() => ReflexRouterDelegate(authService));
locator.registerLazySingleton<ProjectServiceClient>(() => GrpcClient.initializeClient(
authService,
Globals.RP_GRPC_HOST,
Globals.RP_GRPC_PORT,
(channel, interceptors) => ProjectServiceClient(channel, interceptors: interceptors),
) as ProjectServiceClient);
locator.registerLazySingleton<GcsApiClient>(() => GrpcClient.initializeClient(
authService,
Globals.RP_GRPC_HOST,
Globals.RP_GRPC_PORT,
(channel, interceptors) => GcsApiClient(channel, interceptors: interceptors),
) as GcsApiClient);
locator.registerLazySingleton<HandlingunitQueryClient>(() => GrpcClient.initializeClient(
authService,
Globals.RP_GRPC_HOST,
Globals.RP_GRPC_PORT,
(channel, interceptors) => HandlingunitQueryClient(channel, interceptors: interceptors),
) as HandlingunitQueryClient);
locator.registerLazySingleton<TrackingInputAPIClient>(() => GrpcClient.initializeClient(
authService,
Globals.RP_GRPC_HOST,
Globals.RP_GRPC_PORT,
(channel, interceptors) => TrackingInputAPIClient(channel, interceptors: interceptors),
) as TrackingInputAPIClient);
locator.registerLazySingleton<GcsService>(() => GcsService());
}

61
lib/main.dart Normal file
View File

@ -0,0 +1,61 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:sampleapp/services/auth/auth.dart';
import 'package:sampleapp/router/router.dart';
import 'package:provider/provider.dart';
import 'globals.dart';
import 'locator.dart';
import 'services/auth/auth_view_model.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Setup injections
await setup();
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
late ReflexRouterDelegate delegate;
late AuthService authService;
@override
void initState() {
authService = locator.get<AuthService>();
delegate = locator.get<ReflexRouterDelegate>();
super.initState();
}
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider<AuthViewModel>(
create: (_) => AuthViewModel(authService),
child: MaterialApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: const [
Locale('en'),
Locale('fr'),
Locale('es'),
Locale('pl'),
],
theme: ThemeData(
scaffoldBackgroundColor: Globals.RP_BG_COLOR,
),
home: Router(routerDelegate: delegate),
),
);
}
}
class AuthRepository {}

25
lib/pages/home.dart Normal file
View File

@ -0,0 +1,25 @@
import 'package:flutter/material.dart';
import 'package:sampleapp/services/auth/auth.dart';
import 'package:sampleapp/widgets/home_screen.dart';
import 'package:provider/provider.dart';
import '../globals.dart';
import '../locator.dart';
import '../services/auth/auth_view_model.dart';
import '../widgets/components/reflex_app_bar.dart';
class HomePage extends Page {
final VoidCallback onLogout;
const HomePage({required this.onLogout})
: super(key: const ValueKey('HomePage'));
@override
Route createRoute(BuildContext context) {
return MaterialPageRoute(
settings: this,
builder: (BuildContext context) {
return HomeScreen(onLogout: onLogout);
},
);
}
}

18
lib/pages/login.dart Normal file
View File

@ -0,0 +1,18 @@
import 'package:flutter/material.dart';
import '../widgets/login_screen.dart';
class LoginPage extends Page {
final VoidCallback onLogin;
const LoginPage({required this.onLogin})
: super(key: const ValueKey('LoginPage'));
@override
Route createRoute(BuildContext context) {
return MaterialPageRoute(
settings: this,
builder: (BuildContext context) => LoginScreen(onLogin: onLogin),
);
}
}

18
lib/pages/splash.dart Normal file
View File

@ -0,0 +1,18 @@
import 'package:flutter/material.dart';
import 'package:sampleapp/widgets/splash_screen.dart';
import '../globals.dart';
class SplashPage extends Page {
const SplashPage();
@override
Route createRoute(BuildContext context) {
return MaterialPageRoute(
settings: this,
builder: (BuildContext context) {
return const SplashScreen();
},
);
}
}

84
lib/router/router.dart Normal file
View File

@ -0,0 +1,84 @@
import 'package:flutter/material.dart';
import '../services/auth/auth.dart';
import '../pages/home.dart';
import '../pages/splash.dart';
import '../pages/login.dart';
class ReflexRouterDelegate extends RouterDelegate
with ChangeNotifier, PopNavigatorRouterDelegateMixin {
@override
GlobalKey<NavigatorState> get navigatorKey => _navigatorKey;
final GlobalKey<NavigatorState> _navigatorKey;
bool? _loggedIn;
bool? get loggedIn => _loggedIn;
set loggedIn(value) {
_loggedIn = value;
notifyListeners();
}
final AuthService authService;
ReflexRouterDelegate(this.authService)
: _navigatorKey = GlobalKey<NavigatorState>() {
_init();
}
_init() async {
try {
await authService.init();
loggedIn = await authService.isLoggedIn();
} catch (e) {
showDialog(
context: navigatorKey.currentContext!,
builder: (context) => AlertDialog(
title: Text('Error'),
content: Text('Error: $e'),
),
);
loggedIn = false;
}
}
@override
Widget build(BuildContext context) {
List<Page> stack;
if (loggedIn == null) {
stack = _splashStack;
} else if (loggedIn!) {
stack = _loggedInStack;
} else {
stack = _loggedOutStack;
}
return WillPopScope(
onWillPop: () async => !await navigatorKey.currentState!.maybePop(),
child: Navigator(
key: navigatorKey,
pages: stack,
onPopPage: (route, result) {
if (!route.didPop(result)) return false;
return true;
},
));
}
List<Page> get _splashStack => [const SplashPage()];
List<Page> get _loggedOutStack => [
LoginPage(onLogin: () {
loggedIn = true;
})
];
List<Page> get _loggedInStack {
return [
HomePage(onLogout: () {
loggedIn = false;
}),
];
}
@override
Future<void> setNewRoutePath(configuration) async {/* Do Nothing */}
}

212
lib/services/auth/auth.dart Normal file
View File

@ -0,0 +1,212 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter_web_auth_2/flutter_web_auth_2.dart';
import 'dart:convert' show jsonDecode;
import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart';
class User {
const User(
{required this.firstname, required this.lastname, required this.email});
final String firstname;
final String lastname;
final String email;
static User fromJson(jsonDecode) {
if (jsonDecode == "") {
return const User(firstname: '', lastname: '', email: '');
}
return User(
firstname: jsonDecode['firstname'],
lastname: jsonDecode['lastname'],
email: jsonDecode['email']);
}
Map<String, dynamic> toJson() => {
'firstname': firstname,
'lastname': lastname,
'email': email,
};
}
class TokenRefresher {
final AuthService authService;
final Duration refreshInterval;
late Timer _timer;
TokenRefresher(this.authService, {required this.refreshInterval});
void start() {
_timer = Timer.periodic(refreshInterval, (timer) async {
try {
await authService.doRefreshToken();
} catch (e) {
if (kDebugMode) {
print('Failed to refresh token');
}
}
});
}
void stop() {
_timer.cancel();
}
}
class AuthService {
String clientId;
String host;
String redirectUri;
String realm;
String callbackUrlScheme;
User? user;
TokenRefresher? tokenRefresher;
String? accessToken = '';
String? refreshToken = '';
AuthService(
{required this.host,
required this.realm,
required this.clientId,
required this.redirectUri,
required this.callbackUrlScheme}) ;
// Add init method to initialize the AuthService, it retrives the access token from the shared preferences
Future<void> init() async {
final prefs = await SharedPreferences.getInstance();
accessToken = prefs.getString('accessToken');
refreshToken = prefs.getString('refreshToken');
}
Future<bool> login() async {
// Build the url
final url =
Uri.https(host, '/auth/realms/$realm/protocol/openid-connect/auth', {
'response_type': 'code',
'client_id': clientId,
'redirect_uri': '$callbackUrlScheme:/$redirectUri',
'scope': 'openid',
});
// Present the dialog to the user
try {
final result = await FlutterWebAuth2.authenticate(
url: url.toString(), callbackUrlScheme: callbackUrlScheme);
// Extract code from resulting url
final code = Uri.parse(result).queryParameters['code'];
// Use this code to get an access token
final tokenUrl =
Uri.https(host, '/auth/realms/$realm/protocol/openid-connect/token');
var response = await http.post(tokenUrl, body: {
'client_id': clientId,
'grant_type': 'authorization_code',
'code': code,
'redirect_uri': '$callbackUrlScheme:/$redirectUri',
});
if (response.statusCode != 200) {
throw Exception('Failed to login');
}
// Get the access token from the response
await setAccessToken(jsonDecode(response.body)['access_token'] as String);
await setRefreshToken(jsonDecode(response.body)['refresh_token'] as String);
} catch (e) {
return false;
}
tokenRefresher = TokenRefresher(this, refreshInterval: const Duration(seconds: 60));
tokenRefresher!.start();
return true;
}
Future<bool> logout() async {
if (accessToken == null || accessToken == "") {
throw Exception('Not logged in');
}
final logoutUrl =
Uri.https(host, '/auth/realms/$realm/protocol/openid-connect/logout');
final response = await http.post(logoutUrl, body: {
'client_id': clientId,
'refresh_token': refreshToken,
});
if (response.statusCode != 204) {
throw Exception('Failed to logout');
}
final prefs = await SharedPreferences.getInstance();
await prefs.clear();
user = null;
tokenRefresher!.stop();
return true;
}
Future<bool> doRefreshToken() async {
if (refreshToken == "") {
throw Exception('Not logged in');
}
final tokenUrl =
Uri.https(host, '/auth/realms/$realm/protocol/openid-connect/token');
final response = await http.post(tokenUrl, body: {
'client_id': clientId,
'grant_type': 'refresh_token',
'refresh_token': refreshToken,
});
if (response.statusCode != 200) {
throw Exception('Failed to refresh token: ${response.body}');
}
// Get the access token from the response
await setAccessToken(jsonDecode(response.body)['access_token'] as String);
await setRefreshToken(jsonDecode(response.body)['refresh_token'] as String);
return true;
}
Future<bool> isLoggedIn() async {
user = await getUser();
return user != null;
}
Future<void> setAccessToken(String token) async {
final prefs = await SharedPreferences.getInstance();
accessToken = token;
}
Future<void> setRefreshToken(String token) async {
final prefs = await SharedPreferences.getInstance();
prefs.setString('refreshToken', token);
refreshToken = token;
}
Future<User?> getUser() async {
if (this.user != null) {
return this.user!;
}
final userInfoEndpoint =
Uri.https(host, '/auth/realms/$realm/protocol/openid-connect/userinfo');
var response = await http.get(userInfoEndpoint, headers: {
'Authorization': 'Bearer $accessToken',
});
if (response.statusCode != 200) {
return null;
}
final userMap = jsonDecode(response.body) as Map<String, dynamic>;
var user = User(
firstname: userMap['given_name'] as String,
lastname: userMap['family_name'] as String,
email: userMap['email'] as String);
this.user = user;
return user;
}
}

View File

@ -0,0 +1,30 @@
import 'package:flutter/cupertino.dart';
import 'package:sampleapp/services/auth/auth.dart';
class AuthViewModel extends ChangeNotifier {
final AuthService authService;
bool loggingIn = false;
bool loggingOut = false;
AuthViewModel(this.authService);
Future<bool> login() {
return Future.delayed(Duration.zero, () async {
loggingIn = true;
notifyListeners();
await authService.login();
loggingIn = false;
notifyListeners();
return authService.isLoggedIn();
});
}
Future<bool> logout() async {
loggingOut = true;
notifyListeners();
await authService.logout();
loggingOut = false;
notifyListeners();
return !(await authService.isLoggedIn());
}
}

44
lib/services/gcs.dart Normal file
View File

@ -0,0 +1,44 @@
import 'dart:io';
import 'package:http/http.dart' as http;
import 'package:http_parser/http_parser.dart';
class GcsService {
// ========================================
// ======== GCS GOOGLE API SERVICE ========
static const GCS_GOOGLE_BASE_URI = "https://storage.googleapis.com";
static const GCS_GOOGLE_UPLOAD_ENDPOINT = "/upload/storage/v1/b/";
static const GET_BUCKET_STS_GOOGLE_ENDPOINT =
"/api.GcsApi/GetBucketSTSGoogle";
Future<bool> uploadImage(String token, String bucketName, String resourceName,
String fileName, File file) async {
var headersData = {
"Authorization": "Bearer $token",
"Content-Type": "image/png",
};
var paramsData = {
'uploadType': 'multipart/related; boundary=image/png',
'name': "$resourceName$fileName",
};
var uploadURI = "$GCS_GOOGLE_BASE_URI$GCS_GOOGLE_UPLOAD_ENDPOINT";
var query = paramsData.entries.map((p) => '${p.key}=${p.value}').join('&');
var request = http.MultipartRequest(
"POST", Uri.parse("$uploadURI$bucketName/o?$resourceName$query"));
request.headers.addAll(headersData);
request.files.add(await http.MultipartFile.fromPath(fileName, file.path,
contentType: MediaType('image', 'png')));
var response = await request.send();
if (response.statusCode != 200) {
throw Exception('Failed to upload image.');
}
return response.statusCode == 200;
}
}

View File

@ -0,0 +1,31 @@
import 'package:grpc/grpc.dart';
import 'package:sampleapp/services/auth/auth.dart';
class AuthInterceptor extends ClientInterceptor {
final AuthService authService;
AuthInterceptor(this.authService);
@override
ResponseFuture<R> interceptUnary<Q, R>(
ClientMethod<Q, R> method, Q request, CallOptions options, invoker) {
final metadata = <String, String>{};
metadata['authorization'] = 'Bearer ${authService.accessToken}';
options = options.mergedWith(CallOptions(metadata: metadata));
return invoker(method, request, options);
}
}
class GrpcClient {
static Client initializeClient(AuthService authService, String host, int port, Client Function(ClientChannel, List<ClientInterceptor>) clientFactory) {
final interceptor = AuthInterceptor(authService);
final channel = ClientChannel(
host,
port: port,
options: const ChannelOptions(
credentials: ChannelCredentials.secure(),
),
);
return clientFactory(channel, [interceptor]);
}
}

31
lib/utils.dart Normal file
View File

@ -0,0 +1,31 @@
import 'dart:io' show Platform;
import 'package:package_info_plus/package_info_plus.dart';
String getRedirectURI() {
try {
if (Platform.isAndroid) {
return "";
} else {
return "/localhost:3000/auth.html";
}
} catch (e) {
// Must be web
return "/localhost:3000/auth.html";
}
}
Future<String> getCallbackUrlScheme() async {
try {
if (Platform.isAndroid) {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
return packageInfo.packageName;
} else {
return "http";
}
} catch (e) {
// Must be web
return "http";
}
}

View File

@ -0,0 +1,97 @@
import 'package:flutter/material.dart';
import 'package:sampleapp/widgets/components/reflex_box.dart';
import '../../globals.dart';
class ReflexAlert extends StatefulWidget {
final String? title;
final String text;
final IconData icon;
final bool? bigIcon;
final Color? color;
const ReflexAlert(
{Key? key,
required this.text,
required this.icon,
this.color,
bigIcon,
this.title})
: bigIcon = bigIcon ?? false,
super(key: key);
@override
_ReflexAlertState createState() => _ReflexAlertState();
}
class _ReflexAlertState extends State<ReflexAlert> {
_buildColumnAlert() {
return Column(crossAxisAlignment: CrossAxisAlignment.center, children: [
Icon(
widget.icon,
color: Colors.white,
size: 40,
),
const SizedBox(height: 10),
if (widget.title != null)
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Text(
widget.title ?? "",
style: const TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold),
softWrap: true,
)),
Text(
widget.text,
style: const TextStyle(color: Colors.white),
softWrap: true,
),
]);
}
Widget _buildRowAlert() {
return Row(children: [
Flexible(
flex: 0,
child: Icon(
widget.icon,
color: Colors.white,
)),
Flexible(flex: 0, child: const SizedBox(width: 10)),
Expanded(
child:
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
if (widget.title != null)
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Text(
widget.title ?? "",
style: const TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold),
softWrap: true,
)),
Text(
widget.text,
style: const TextStyle(color: Colors.white),
softWrap: true,
),
]))
]);
}
@override
Widget build(BuildContext context) {
return ReflexBox(
color: widget.color ?? Globals.RP_PRIMARY_COLOR,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: widget.bigIcon == true
? _buildColumnAlert()
: _buildRowAlert()));
}
}

View File

@ -0,0 +1,33 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import '../../globals.dart';
class ReflexAppBar extends StatelessWidget implements PreferredSizeWidget {
final Function()? onBackCallback;
const ReflexAppBar({Key? key, required this.actions, this.onBackCallback})
: super(key: key);
final List<Widget> actions;
final webHeight = 200;
@override
Widget build(BuildContext context) {
return AppBar(
leading: onBackCallback != null
? IconButton(
icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
onPressed: onBackCallback,
)
: null,
backgroundColor: Globals.RP_PRIMARY_COLOR,
centerTitle: false,
actions: actions,
title: const Text('Reflex Platform', style: TextStyle(color: Colors.white)),
);
}
@override
Size get preferredSize => Size.fromHeight(kToolbarHeight);
}

View File

@ -0,0 +1,27 @@
import 'package:flutter/material.dart';
import '../../globals.dart';
class ReflexBox extends StatefulWidget {
final Widget child;
final Color? color;
const ReflexBox({Key? key, this.color, required this.child})
: super(key: key);
@override
_ReflexBoxState createState() => _ReflexBoxState();
}
class _ReflexBoxState extends State<ReflexBox> {
@override
Widget build(BuildContext context) {
return Material(
clipBehavior: Clip.antiAlias,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5.0))),
//backgrround
color: widget.color ?? Globals.RP_BG_DARK_COLOR,
child: widget.child);
}
}

View File

@ -0,0 +1,44 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import '../../globals.dart';
class ReflexButton extends StatelessWidget implements PreferredSizeWidget {
final Function()? onPressed;
final String text;
final bool? isFullWidth;
final Color? color;
final Color? textColor;
const ReflexButton(
{Key? key,
this.onPressed,
required this.text,
this.isFullWidth,
this.color,
this.textColor})
: super(key: key);
@override
Widget build(BuildContext context) {
return ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: isFullWidth == true
? const Size.fromHeight(36)
: const Size(0, 36),
backgroundColor: color ?? Globals.RP_PRIMARY_COLOR,
foregroundColor: textColor ?? Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0),
),
),
onPressed: onPressed,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(text),
));
}
@override
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
}

View File

@ -0,0 +1,30 @@
import 'package:flutter/material.dart';
import '../../globals.dart';
class ReflexCircularProgress extends StatefulWidget {
final Color? color;
final double? size;
const ReflexCircularProgress({Key? key, this.color, this.size})
: super(key: key);
@override
_ReflexCircularProgressState createState() => _ReflexCircularProgressState();
}
class _ReflexCircularProgressState extends State<ReflexCircularProgress> {
@override
Widget build(BuildContext context) {
return Center(
child: SizedBox(
width: widget.size ?? 50.0,
height: widget.size ?? 50.0,
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(
widget.color ?? Globals.RP_PRIMARY_COLOR),
),
),
);
}
}

View File

@ -0,0 +1,87 @@
import 'package:flutter/material.dart';
import 'package:sampleapp/globals.dart';
class ReflexDropdownButtonFormField<T> extends StatefulWidget {
final List<DropdownMenuItem<T>> items;
final T? value;
final ValueChanged<T?>? onChanged;
final String? label;
final Widget? hint;
final Widget? disabledHint;
final ValueChanged<T?>? onSaved;
final FormFieldValidator<T>? validator;
final bool isExpanded;
final bool isDense;
final double? iconSize;
final Color? iconEnabledColor;
final Color? iconDisabledColor;
final Color? dropdownColor;
const ReflexDropdownButtonFormField({
Key? key,
required this.items,
this.value,
this.onChanged,
this.label,
this.hint,
this.disabledHint,
this.onSaved,
this.validator,
this.isExpanded = false,
this.isDense = false,
this.iconSize,
this.iconEnabledColor,
this.iconDisabledColor,
this.dropdownColor,
}) : super(key: key);
@override
_ReflexDropdownButtonFormFieldState<T> createState() => _ReflexDropdownButtonFormFieldState<T>();
}
class _ReflexDropdownButtonFormFieldState<T> extends State<ReflexDropdownButtonFormField<T>> {
final FocusNode _focusNode = FocusNode();
@override
void dispose() {
_focusNode.dispose();
super.dispose();
}
void _requestFocus(){
setState(() {
FocusScope.of(context).requestFocus(_focusNode);
});
}
@override
Widget build(BuildContext context) {
return DropdownButtonFormField<T>(
onTap: _requestFocus,
focusNode: _focusNode,
items: widget.items,
value: widget.value,
onChanged: widget.onChanged,
decoration: InputDecoration(
focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: Globals.RP_PRIMARY_COLOR, width: 2.0),
),
labelText: widget.label,
labelStyle: TextStyle(
color: _focusNode.hasFocus ? Globals.RP_PRIMARY_COLOR : Colors.grey,
),
),
hint: widget.hint,
disabledHint: widget.disabledHint,
onSaved: widget.onSaved,
validator: widget.validator,
isExpanded: widget.isExpanded,
isDense: widget.isDense,
iconSize: widget.iconSize ?? 24.0,
iconEnabledColor: widget.iconEnabledColor,
iconDisabledColor: widget.iconDisabledColor,
dropdownColor: widget.dropdownColor,
);
}
}

View File

@ -0,0 +1,195 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:dart_core_sdk/handlingunit.pb.dart';
import 'package:sampleapp/globals.dart';
import 'package:sampleapp/widgets/components/reflex_alert.dart';
import 'package:sampleapp/widgets/components/reflex_button.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'reflex_box.dart';
class ReflexHUInfo extends StatefulWidget {
final Handlingunit hu;
final bool showArticles;
const ReflexHUInfo({super.key, required this.hu, required this.showArticles});
@override
_ReflexHUInfoState createState() => _ReflexHUInfoState();
}
class _ReflexHUInfoState extends State<ReflexHUInfo> {
@override
void initState() {
super.initState();
}
String _translateUnit(String unit) {
switch (unit) {
case "KILOGRAM":
return "kg";
case "CENTIMETER":
return "cm";
default:
return "";
}
}
Future<void> _copyToClipboard(String key, String value) {
return Clipboard.setData(ClipboardData(text: value)).then((_) =>
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text("$key ${AppLocalizations.of(context)!.copied}"))));
}
List<Widget> _buildArticles() {
return [
const SizedBox(height: 20),
Text(AppLocalizations.of(context)!.items,
style: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold)),
const SizedBox(height: 5),
Expanded(
child: ReflexBox(
child: Scrollbar(
child: ListView(
padding: const EdgeInsets.symmetric(horizontal: 10),
shrinkWrap: true,
children: [
...widget.hu.payload.preparedContents.map((e) => Row(
children: [
Expanded(
flex: 2,
child: TextField(
enabled: false,
style: const TextStyle(
color: Colors.black,
),
decoration: InputDecoration(
border: InputBorder.none,
labelText: AppLocalizations.of(context)!.itemId,
),
controller:
TextEditingController(text: e.goods.itemID),
)),
Expanded(
flex: 1,
child: TextField(
enabled: false,
style: const TextStyle(
color: Colors.black,
),
decoration: InputDecoration(
border: InputBorder.none,
labelText: AppLocalizations.of(context)!.quantity,
),
controller: TextEditingController(
text: e.quantity.value!.toString()),
)),
],
)),
],
),
),
)),
];
}
Widget _buildHU() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(AppLocalizations.of(context)!.informations,
style: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold)),
const SizedBox(height: 5),
ReflexBox(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(children: [
TextField(
enabled: false,
style: const TextStyle(
fontSize: 24,
color: Colors.black,
),
decoration: InputDecoration(
border: InputBorder.none,
labelText: AppLocalizations.of(context)!.handlingUnitIdentifier,
),
controller: TextEditingController(text: widget.hu.iD.refID),
),
TextField(
readOnly: true,
style: const TextStyle(
color: Colors.black,
),
decoration: InputDecoration(
suffixIcon: IconButton(
onPressed: () => _copyToClipboard(AppLocalizations.of(context)!.trackingNumber,
widget.hu.payload.currentTrackingSummary.trackingID),
icon: const Icon(Icons.copy)),
border: InputBorder.none,
labelText: AppLocalizations.of(context)!.trackingNumber,
labelStyle: const TextStyle(color: Colors.grey),
),
controller: TextEditingController(
text: widget.hu.payload.currentTrackingSummary.trackingID),
),
Row(
children: [
Flexible(
flex: 2,
child: TextField(
enabled: false,
style: const TextStyle(
color: Colors.black,
),
decoration: InputDecoration(
border: InputBorder.none,
labelText: AppLocalizations.of(context)!.handlingUnitType,
),
controller: TextEditingController(
text: widget.hu.payload.information.containerType),
)),
Expanded(
flex: 2,
child: TextField(
enabled: false,
style: const TextStyle(
color: Colors.black,
),
decoration: InputDecoration(
border: InputBorder.none,
labelText: AppLocalizations.of(context)!.dimensions,
),
controller: TextEditingController(
text:
"${widget.hu.payload.information.height.value} x ${widget.hu.payload.information.width.value} x ${widget.hu.payload.information.length!.value} ${_translateUnit(widget.hu.payload.information.length.unit.name)}"),
)),
Flexible(
child: TextField(
enabled: false,
style: const TextStyle(
color: Colors.black,
),
decoration: InputDecoration(
border: InputBorder.none,
labelText: AppLocalizations.of(context)!.weight
),
controller: TextEditingController(
text:
"${widget.hu.payload.information.weight.value} ${_translateUnit(widget.hu.payload.information.weight.unit.name)}"),
),
),
],
)
]),
)),
if (widget.showArticles) ..._buildArticles(),
],
);
}
@override
Widget build(BuildContext context) {
return _buildHU();
}
}

View File

@ -0,0 +1,69 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_signaturepad/signaturepad.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../../globals.dart';
class ReflexSignature extends StatefulWidget {
final GlobalKey<SfSignaturePadState> signaturePadKey;
ReflexSignature({Key? key, required this.signaturePadKey}) : super(key: key);
@override
_ReflexSignatureState createState() => _ReflexSignatureState();
}
class _ReflexSignatureState extends State<ReflexSignature> {
bool isInputFocused = false;
@override
Widget build(BuildContext context) {
return InputDecorator(
isFocused: isInputFocused,
decoration: InputDecoration(
focusColor: Globals.RP_PRIMARY_COLOR,
focusedBorder: OutlineInputBorder(
borderSide:
const BorderSide(color: Globals.RP_PRIMARY_COLOR, width: 2.0),
borderRadius: BorderRadius.circular(10.0),
),
enabledBorder: OutlineInputBorder(
borderSide:
const BorderSide(color: Globals.RP_LIGHT_COLOR, width: 1.0),
borderRadius: BorderRadius.circular(10.0),
),
labelText: AppLocalizations.of(context)!.signature,
),
child: Stack(children: [
SfSignaturePad(
key: widget.signaturePadKey,
minimumStrokeWidth: 2,
maximumStrokeWidth: 2,
strokeColor: Colors.black,
onDrawStart: () {
setState(() {
isInputFocused = true;
});
return false;
},
onDrawEnd: () {
setState(() {
isInputFocused = false;
});
},
),
Positioned(
right: 0,
top: 0,
child: CircleAvatar(
backgroundColor: Globals.RP_BG_DARK_COLOR,
child: IconButton(
color: Colors.black,
onPressed: () {
widget.signaturePadKey.currentState!.clear();
},
icon: const Icon(Icons.clear))),
)
]));
}
}

View File

@ -0,0 +1,74 @@
import 'package:flutter/material.dart';
import '../../globals.dart';
class ReflexTextFormField extends StatefulWidget {
final String? initialValue;
final ValueChanged<String>? onChanged;
final FormFieldValidator<String>? validator;
final bool obscureText;
final TextInputType keyboardType;
final String? label;
final TextEditingController? controller;
const ReflexTextFormField({
Key? key,
this.initialValue,
this.onChanged,
this.validator,
this.obscureText = false,
this.keyboardType = TextInputType.text,
this.label,
this.controller,
}) : super(key: key);
@override
_ReflexTextFormFieldState createState() => _ReflexTextFormFieldState();
}
class _ReflexTextFormFieldState extends State<ReflexTextFormField> {
final FocusNode _focusNode = FocusNode();
late TextEditingController _controller;
@override
void initState() {
super.initState();
_controller = widget.controller ?? TextEditingController(text: widget.initialValue);
}
@override
void dispose() {
_focusNode.dispose();
if (widget.controller == null) {
_controller.dispose();
}
super.dispose();
}
void _requestFocus() {
setState(() {
FocusScope.of(context).requestFocus(_focusNode);
});
}
@override
Widget build(BuildContext context) {
return TextFormField(
controller: _controller,
focusNode: _focusNode,
onTap: _requestFocus,
onChanged: widget.onChanged,
obscureText: widget.obscureText,
keyboardType: widget.keyboardType,
validator: widget.validator,
decoration: InputDecoration(
focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: Globals.RP_PRIMARY_COLOR, width: 2.0),
),
labelText: widget.label,
labelStyle: TextStyle(color:
_focusNode.hasFocus ? Globals.RP_PRIMARY_COLOR : Colors.black
),
),
);
}
}

View File

@ -0,0 +1,149 @@
import 'package:dart_core_sdk/handlingunit.pb.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:grpc/grpc.dart';
import 'package:sampleapp/services/grpc_service.dart';
import 'package:sampleapp/widgets/components/reflex_app_bar.dart';
import 'package:provider/provider.dart';
import 'package:sampleapp/widgets/components/reflex_circular_progress.dart';
import '../globals.dart';
import '../locator.dart';
import '../services/auth/auth.dart';
import '../services/auth/auth_view_model.dart';
import 'scan_flow/delivery_confirmed.dart' as sf;
import 'scan_flow/select_context_screen.dart' as sf;
import 'scan_flow/scan_barcode_screen.dart' as sf;
import 'scan_flow/scan_result_screen.dart' as sf;
const routePrefixHome = '/home/';
const routeHome = '/home/$routeSelectContext';
const routeSelectContext = 'select_context';
const routeScanBarCode = 'scan_barcode';
const routeScanResult = 'scan_result';
const routeDeliveryConfirmed = 'delivery_confirmed';
class HomeScreen extends StatefulWidget {
final VoidCallback onLogout;
const HomeScreen({super.key, required this.onLogout});
@override
State<StatefulWidget> createState() {
return HomeScreenState();
}
}
class HomeScreenState extends State<HomeScreen> {
final _navigatorKey = GlobalKey<NavigatorState>();
String? _projectID;
String? _handlingUnitID;
Handlingunit? _handlingUnit;
bool? _isDeliveryValid;
@override
void initState() {
super.initState();
}
Future<void> _logout(AuthViewModel avm) async {
showDialog(
barrierDismissible: false,
context: context,
builder: (context) => const Center(child: ReflexCircularProgress()));
await avm.logout().then((result) => {
Navigator.of(context, rootNavigator: true).pop(),
if (result) widget.onLogout()
});
}
void _onContextSelected(String projectID) {
_projectID = projectID;
_navigatorKey.currentState!.pushNamed(routeScanBarCode);
}
void _onBarCodeScanned(String handlingUnitRefId, Handlingunit? handlingUnitResult) {
_handlingUnit = handlingUnitResult;
_handlingUnitID = handlingUnitRefId;
_navigatorKey.currentState!.pushNamed(routeScanResult);
}
void _onDeliveryConfirmed(bool isDeliveryValid) {
_isDeliveryValid = isDeliveryValid;
_navigatorKey.currentState!.pushNamed(routeDeliveryConfirmed);
}
void _onNextDelivery() {
_navigatorKey.currentState!.pushNamedAndRemoveUntil(
routeScanBarCode, ModalRoute.withName(routeSelectContext));
}
Route _onGenerateRoute(RouteSettings settings) {
late Widget page;
switch (settings.name) {
case routeSelectContext:
page = sf.SelectContext(onContextSelected: _onContextSelected);
break;
case routeScanBarCode:
page = sf.ScanBarcode(
onBarcodeScanned: _onBarCodeScanned, projectID: _projectID!);
break;
case routeScanResult:
page = sf.ScanResult(
refID: _handlingUnitID!,
handlingUnit: _handlingUnit,
projectID: _projectID!,
onDeliveryConfirmed: _onDeliveryConfirmed);
break;
case routeDeliveryConfirmed:
page = sf.DeliveryConfirmed(
projectID: _projectID!,
handlingUnit: _handlingUnit!,
isDeliveryValid: _isDeliveryValid!,
onNextDelivery: _onNextDelivery,
);
break;
default:
page = Text(settings.name!);
}
return CupertinoPageRoute<dynamic>(
builder: (context) {
return page;
},
settings: settings,
);
}
@override
Widget build(BuildContext context) {
final authViewModel = context.watch<AuthViewModel>();
return WillPopScope(
onWillPop: () async {
if (_navigatorKey.currentState!.canPop()) {
_navigatorKey.currentState!.pop();
return false;
}
return true;
},
child: Scaffold(
appBar: ReflexAppBar(
actions: [
IconButton(
icon: const Icon(
Icons.logout,
color: Colors.white,
),
onPressed: () => _logout(authViewModel)
)
],
onBackCallback: () => {
if (_navigatorKey.currentState!.canPop())
{_navigatorKey.currentState!.pop()}
}),
body: Navigator(
key: _navigatorKey,
initialRoute: routeSelectContext,
onGenerateRoute: _onGenerateRoute)));
}
}

View File

@ -0,0 +1,48 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:sampleapp/widgets/components/reflex_circular_progress.dart';
import '../services/auth/auth_view_model.dart';
class LoginScreen extends StatefulWidget {
final VoidCallback onLogin;
const LoginScreen({Key? key, required this.onLogin}) : super(key: key);
@override
_LoginScreenState createState() => _LoginScreenState();
}
class _LoginScreenState extends State<LoginScreen> {
Future<void> _login() async {
final authViewModel = context.read<AuthViewModel>();
final result = await authViewModel.login();
if (result == true) widget.onLogin();
}
@override
void initState() {
super.initState();
_login();
}
@override
Widget build(BuildContext context) {
final authViewModel = context.watch<AuthViewModel>();
return Scaffold(
body: Center(
child: authViewModel.loggingIn
? const ReflexCircularProgress()
: ElevatedButton(
onPressed: () async {
await _login();
},
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text('Log in'),
),
),
),
);
}
}

View File

@ -0,0 +1,334 @@
import 'dart:io';
import 'dart:typed_data';
import 'package:dart_core_sdk/gcs-api.pbgrpc.dart';
import 'package:dart_core_sdk/handlingunit.pb.dart';
import 'package:dart_core_sdk/trackingInput.pbgrpc.dart';
import 'package:dart_core_sdk/transportShared.pb.dart';
import 'package:dart_core_sdk/transportShared.pbenum.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter/material.dart';
import 'package:sampleapp/globals.dart';
import 'package:sampleapp/services/gcs.dart';
import 'package:sampleapp/widgets/components/reflex_alert.dart';
import 'package:sampleapp/widgets/components/reflex_button.dart';
import 'package:sampleapp/widgets/components/reflex_circular_progress.dart';
import 'package:sampleapp/widgets/components/reflex_dropdown_button_form_field.dart';
import 'package:sampleapp/widgets/components/reflex_signature.dart';
import 'package:image_picker/image_picker.dart';
import 'package:intl/intl.dart';
import 'package:path_provider/path_provider.dart';
import 'package:syncfusion_flutter_signaturepad/signaturepad.dart';
import '../../locator.dart';
import '../components/reflex_hu_info.dart';
import 'dart:ui';
import 'package:badges/badges.dart' as bd;
import 'package:dart_core_sdk/shared.pb.dart' as rp;
class DeliveryConfirmed extends StatefulWidget {
final bool isDeliveryValid;
final Handlingunit handlingUnit;
final String projectID;
final void Function() onNextDelivery;
const DeliveryConfirmed(
{super.key,
required this.isDeliveryValid,
required this.handlingUnit,
required this.projectID,
required this.onNextDelivery});
@override
_DeliveryConfirmedState createState() => _DeliveryConfirmedState();
}
class _DeliveryConfirmedState extends State<DeliveryConfirmed> {
@override
void initState() {
super.initState();
}
final GlobalKey<SfSignaturePadState> signaturePadKey = GlobalKey();
var _selectedAnomalyReason = "";
final ImagePicker _picker = ImagePicker();
final List<File> _imageFileList = [];
Future<bool> _callTrackingServiceNotified(
TrackingEventCode code, String reason) async {
TrackingEvent event = TrackingEvent(
code: code,
date: rp.DateTime(dateTime: DateTime.now().toUtc().toIso8601String(), authorTimeZone: "UTC"),
reason: reason);
bool notified = false;
await locator
.get<TrackingInputAPIClient>()
.notified(
TrackingNotifiedRequest(
header: rp.RequestProjectHeader(
projectID: widget.projectID,
),
iD: rp.EntityID(
refID: widget.handlingUnit.iD.refID,
),
payload: TrackingNotifiedPayload(
events: [event],
)
)
).then((value) => notified = true);
return notified;
}
String _buildFileName(String fileName) {
return "${fileName}_${widget.handlingUnit.iD.refID}_${DateTime.now().toUtc().toIso8601String().split('.')[0].replaceAll("-", "_").replaceAll(":", "_")}.png";
}
void _takePhoto() async {
XFile? pickedFile = await _picker.pickImage(
source: ImageSource.camera, maxHeight: 720, maxWidth: 1280);
if (pickedFile == null) return;
setState(() => _imageFileList.add(File(pickedFile.path)));
}
Future<void> _uploadPhotos(GetBucketSTSResult stsinfo, String resourceName) async {
GcsService gcsService = locator.get<GcsService>();
for (var i = 0; i < _imageFileList.length; i++) {
final String fileName = _buildFileName("photo_$i");
await gcsService
.uploadImage(
stsinfo.accessToken,
stsinfo.bucketName,
resourceName,
"${widget.handlingUnit.iD.refID}/photos/$fileName",
_imageFileList[i])
.catchError((e) => throw e);
}
}
Future<void> _handlePostSuccesfulDelivery() async {
// Call the TrackingService to notify the delivery
var notified = await _callTrackingServiceNotified(
TrackingEventCode.TRACKING_EVENT_IFTSTA_21, "");
if (!notified) {
throw Exception(AppLocalizations.of(context)!.cannotNotifyDelivery);
}
// Upload Signature
// First get a token STS
GetBucketSTSResult? stsinfo;
GcsApiClient gcsApiService = locator.get<GcsApiClient>();
await gcsApiService.getBucketSTS(GetBucketSTSRequest(projectID: widget.projectID)).then((v) => {
stsinfo = v,
});
// Look for the project id in the resourcelist
final String resourceName = stsinfo!.resources.firstWhere(
(element) => element.endsWith("${widget.projectID}/"),
orElse: () => "");
if (resourceName == "") {
throw Exception(
AppLocalizations.of(context)!.missingSendingFilesRights);
}
// Turn the signature into a png file
final String fileName = _buildFileName("signature");
final image = await signaturePadKey.currentState!.toImage(pixelRatio: 3.0);
final signatureByteData =
await image.toByteData(format: ImageByteFormat.png);
final Uint8List signatureBytes = signatureByteData!.buffer.asUint8List(
signatureByteData.offsetInBytes, signatureByteData.lengthInBytes);
final String path = (await getTemporaryDirectory()).path;
final String tmpfileName = "$path/signature.png";
final File signatureFile = File(tmpfileName);
await signatureFile.writeAsBytes(signatureBytes);
// Upload the signature to GCS
GcsService gcsService = locator.get<GcsService>();
await gcsService
.uploadImage(
stsinfo!.accessToken,
stsinfo!.bucketName,
resourceName,
"${widget.handlingUnit.iD.refID}/signatures/$fileName",
signatureFile)
.catchError((e) => throw e);
// And the photos
await _uploadPhotos(stsinfo!, resourceName);
}
Future<bool> _handlePostAnomalyDelivery() async {
GetBucketSTSResult? stsinfo;
GcsApiClient gcsApiClient = locator.get<GcsApiClient>();
await gcsApiClient.getBucketSTS(GetBucketSTSRequest(projectID: widget.projectID)).then((v) => {
stsinfo = v,
});
// Look for the project id in the resourcelist
final String resourceName = stsinfo!.resources.firstWhere(
(element) => element.endsWith("${widget.projectID}/"),
orElse: () => "");
if (resourceName == "") {
throw Exception(
AppLocalizations.of(context)!.missingSendingFilesRights);
}
await _uploadPhotos(stsinfo!, resourceName);
var notified = await _callTrackingServiceNotified(
TrackingEventCode.TRACKING_EVENT_IFTSTA_56, _selectedAnomalyReason);
if (!notified) {
throw Exception(AppLocalizations.of(context)!.cannotNotifyDelivery);
}
return true;
}
void _handleOnNextDelivery() async {
try {
showDialog(
barrierDismissible: false,
context: context,
builder: (context) =>
const Center(child: ReflexCircularProgress()));
if (widget.isDeliveryValid) {
await _handlePostSuccesfulDelivery();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(AppLocalizations.of(context)!.deliveryOk),
),
);
} else {
await _handlePostAnomalyDelivery();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(AppLocalizations.of(context)!.deliveryWithAnomaly),
),
);
}
Navigator.of(context, rootNavigator: true).pop();
widget.onNextDelivery();
} catch (e) {
Navigator.of(context, rootNavigator: true).pop();
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(AppLocalizations.of(context)!.error),
content: Text(e.toString()),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(AppLocalizations.of(context)!.cancel),
),
TextButton(
onPressed: () =>
{Navigator.of(context).pop(), widget.onNextDelivery()},
child: Text(AppLocalizations.of(context)!.nextDelivery),
),
],
));
}
}
Widget _buildSignatureBox() {
return ReflexSignature(signaturePadKey: signaturePadKey);
}
Widget _buildAnomalyInput() {
final List<String> _anomalyReasons = [
AppLocalizations.of(context)!.anomalyBadHandlingUnit,
AppLocalizations.of(context)!.anomalyCustomerRefused,
AppLocalizations.of(context)!.anomalyCustomerUnavailable,
AppLocalizations.of(context)!.anomalyOther
];
_selectedAnomalyReason = _anomalyReasons[0];
return ReflexDropdownButtonFormField(
label: AppLocalizations.of(context)!.anomalyReason,
value: _anomalyReasons[0],
items: _anomalyReasons.map<DropdownMenuItem<String>>((String reason) {
return DropdownMenuItem<String>(
value: reason,
child: Text(reason),
);
}).toList(),
onChanged: (String? value) {
setState(() {
_selectedAnomalyReason = value!;
});
},
);
}
@override
Widget build(BuildContext context) {
final dateNowLocale = AppLocalizations.of(context)!.dateOn(DateTime.now(), DateTime.now());
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: [
ReflexHUInfo(
hu: widget.handlingUnit,
showArticles: false,
),
const SizedBox(
height: 10,
),
SizedBox(
width: double.infinity,
child: ReflexAlert(
bigIcon: true,
title: widget.isDeliveryValid
? AppLocalizations.of(context)!.deliveryOk
: AppLocalizations.of(context)!.deliveryWithAnomaly,
text: dateNowLocale,
icon: widget.isDeliveryValid ? Icons.check : Icons.error,
color: widget.isDeliveryValid
? Globals.RP_SUCCESS_COLOR
: Globals.RP_DANGER_COLOR,
)),
const SizedBox(
height: 15,
),
Flexible(
child: widget.isDeliveryValid
? _buildSignatureBox()
: _buildAnomalyInput()),
const SizedBox(
height: 10,
),
Row(
children: [
Expanded(
child: bd.Badge(
badgeStyle: const bd.BadgeStyle(
badgeColor: Globals.RP_PRIMARY_COLOR,
),
badgeContent: Text(
_imageFileList.length.toString(),
style: const TextStyle(color: Colors.white),
),
child: ReflexButton(
isFullWidth: true,
color: Globals.RP_LIGHT_COLOR,
textColor: Colors.black,
text: AppLocalizations.of(context)!.addPhoto,
onPressed: _takePhoto,
))),
const SizedBox(width: 15),
Expanded(
child: ReflexButton(
text: AppLocalizations.of(context)!.nextDelivery,
onPressed: _handleOnNextDelivery,
)),
],
),
],
)));
}
}

View File

@ -0,0 +1,122 @@
import 'package:flutter/material.dart';
import 'package:dart_core_sdk/handlingunit.pb.dart';
import 'package:dart_core_sdk/handlingunitQuery.pbgrpc.dart';
import 'package:dart_core_sdk/shared.pb.dart';
import 'package:sampleapp/widgets/components/reflex_button.dart';
import 'package:barcode_scan2/barcode_scan2.dart';
import 'package:sampleapp/widgets/components/reflex_circular_progress.dart';
import 'package:sampleapp/widgets/components/reflex_text_form_field.dart';
import '../../locator.dart';
import '../components/reflex_alert.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
class ScanBarcode extends StatefulWidget {
final String projectID;
final void Function(String refID, Handlingunit? handlingUnitResult) onBarcodeScanned;
const ScanBarcode(
{super.key, required this.projectID, required this.onBarcodeScanned});
@override
_ScanBarcodeState createState() => _ScanBarcodeState();
}
class _ScanBarcodeState extends State<ScanBarcode> {
final _handlingUnitIDController = TextEditingController();
bool _isButtonDisabled() {
return _handlingUnitIDController.text.isEmpty;
}
void _onHandlingUnitLookup() async {
showDialog(
barrierDismissible: false,
context: context,
builder: (context) => const Center(child: ReflexCircularProgress()));
await locator
.get<HandlingunitQueryClient>()
.getByIds(HandlingunitByIdQuery(
header: QueryProjectHeader(
projectID: widget.projectID,
),
iDs: [EntityID(
refID: _handlingUnitIDController.text,
)],
))
.then((res) => {
widget.onBarcodeScanned(_handlingUnitIDController.text, res.objects.isNotEmpty ? res.objects.first : null),
Navigator.of(context, rootNavigator: true).pop()
})
.catchError((e) => {
Navigator.of(context, rootNavigator: true).pop(),
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(AppLocalizations.of(context)!.error),
content: Text(e.toString()),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text(AppLocalizations.of(context)!.ok))
],
))
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(15.0),
child: Form(
child: Column(
children: [
ReflexTextFormField(
controller: _handlingUnitIDController,
label: AppLocalizations.of(context)!.handlingUnitIdentifier,
onChanged: (v) {
setState(() {});
},
),
// Separator
const SizedBox(height: 20),
Text(
AppLocalizations.of(context)!.or,
style: const TextStyle(
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 20),
// Scan button
ReflexButton(
text: AppLocalizations.of(context)!.scanBarcode,
isFullWidth: true,
onPressed: () async {
var result = await BarcodeScanner.scan();
if (result.rawContent.isNotEmpty) {
setState(() {
_handlingUnitIDController.text = result.rawContent.trim();
});
_onHandlingUnitLookup();
}
}),
ReflexAlert(
text:
AppLocalizations.of(context)!.selectHandlingUnit,
icon: Icons.info_outline_rounded,
),
const SizedBox(height: 20),
Align(
alignment: Alignment.centerRight,
child: ReflexButton(
text: AppLocalizations.of(context)!.search,
onPressed:
_isButtonDisabled() ? null : _onHandlingUnitLookup,
))
],
))));
}
}

View File

@ -0,0 +1,101 @@
import 'package:flutter/material.dart';
import 'package:dart_core_sdk/handlingunit.pb.dart';
import 'package:sampleapp/widgets/components/reflex_button.dart';
import 'package:sampleapp/widgets/components/reflex_hu_info.dart';
import '../../globals.dart';
import '../components/reflex_alert.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
class ScanResult extends StatefulWidget {
final String refID;
final Handlingunit? handlingUnit;
final String projectID;
final void Function(bool isDeliveryValid) onDeliveryConfirmed;
const ScanResult(
{super.key,
required this.projectID,
required this.onDeliveryConfirmed,
this.handlingUnit, required this.refID});
@override
_ScanResultState createState() => _ScanResultState();
}
class _ScanResultState extends State<ScanResult> {
@override
void initState() {
super.initState();
}
void _onAnomalyPressed() async {
widget.onDeliveryConfirmed(false);
}
void _onValidPressed() async {
widget.onDeliveryConfirmed(true);
}
Widget _buildNoHu() {
return Column(children: [
TextField(
decoration: InputDecoration(
labelText: AppLocalizations.of(context)!.handlingUnitIdentifier,
),
controller: TextEditingController(text: widget.refID),
readOnly: true,
),
ReflexAlert(
icon: Icons.access_alarm_rounded,
text:
"${AppLocalizations.of(context)!.noHandlingUnitFound}\n${AppLocalizations.of(context)!.pleaseTryAgain}.",
color: Globals.RP_DANGER_COLOR),
ReflexButton(
text: AppLocalizations.of(context)!.tryAgain,
onPressed: () => Navigator.pop(context),
isFullWidth: true,
),
]);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(15.0),
child: widget.handlingUnit == null
? _buildNoHu()
: Column(children: [
Expanded(
child: ReflexHUInfo(
hu: widget.handlingUnit!,
showArticles: true,
)),
SizedBox(height: 10),
ReflexAlert(
text:
AppLocalizations.of(context)!.pleaseIndicateAnomaly,
icon: Icons.info_outline_rounded),
Row(
children: [
Expanded(
child: ReflexButton(
text: AppLocalizations.of(context)!.anomaly,
color: Globals.RP_DANGER_COLOR,
onPressed: () => _onAnomalyPressed(),
),
),
const SizedBox(width: 10),
Expanded(
child: ReflexButton(
text: AppLocalizations.of(context)!.validDelivery,
color: Globals.RP_SUCCESS_COLOR,
onPressed: () => _onValidPressed(),
),
),
],
)
])));
}
}

View File

@ -0,0 +1,119 @@
import 'package:flutter/material.dart';
import 'package:dart_core_sdk/proj.pbgrpc.dart';
import 'package:sampleapp/globals.dart';
import 'package:sampleapp/widgets/components/reflex_alert.dart';
import 'package:sampleapp/widgets/components/reflex_button.dart';
import 'package:sampleapp/widgets/components/reflex_circular_progress.dart';
import 'package:sampleapp/widgets/components/reflex_dropdown_button_form_field.dart';
import '../../locator.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
class SelectContext extends StatefulWidget {
final void Function(String projectID) onContextSelected;
const SelectContext({super.key, required this.onContextSelected});
@override
_SelectContextState createState() => _SelectContextState();
}
class _SelectContextState extends State<SelectContext> {
final projectClient = locator.get<ProjectServiceClient>();
List<MyContext> contexts = [];
List<Project> projectList = [];
Project? selectedProject;
bool isLoading = true;
@override
void initState() {
super.initState();
_loadContexts();
}
Future<void> _loadContexts() async {
projectClient.getMyUIContext(GetMyContextRequest()).then((value) {
contexts = value.myContexts;
projectList = contexts.first.projects.map((idName) => Project(iD: idName.iD, name: idName.name)).toList();
projectList.sort((a, b) => a.name.compareTo(b.name));
selectedProject = projectList.isNotEmpty ? projectList.first : null;
}).whenComplete(() => setState(() {
isLoading = false;
}));
}
Widget _buildContextDropdowns() {
return ListView(shrinkWrap: true, children: [
ReflexDropdownButtonFormField<String>(
label: AppLocalizations.of(context)!.organization,
value: contexts.isNotEmpty ? contexts[0].organisation.iD : '',
items: contexts.map<DropdownMenuItem<String>>((MyContext c) {
return DropdownMenuItem<String>(
value: c.organisation.iD,
child: Text(c.organisation.name),
);
}).toList(),
// On change, update the project list
onChanged: (value) {
setState(() {
projectList = contexts.firstWhere((element) => element.organisation.iD == value).projects.map((idName) => Project(iD: idName.iD, name: idName.name)).toList();
projectList.sort((a, b) => a.name.compareTo(b.name));
selectedProject = projectList.isNotEmpty ? projectList.first : null;
});
},
),
ReflexDropdownButtonFormField<String>(
label: AppLocalizations.of(context)!.project,
value: projectList.isNotEmpty ? projectList[0].iD : '',
items: projectList.map<DropdownMenuItem<String>>((Project p) {
return DropdownMenuItem<String>(
value: p.iD,
child: Text(p.name),
);
}).toList(),
// On change, update the selected project
onChanged: (value) {
setState(() {
selectedProject =
projectList.firstWhere((element) => element.iD == value);
});
},
),
]);
}
bool _isButtonDisabled() {
return selectedProject == null;
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: [
!isLoading
? _buildContextDropdowns()
: const ReflexCircularProgress(),
const SizedBox(height: 20),
ReflexAlert(
icon: Icons.info_outline_rounded,
text:
AppLocalizations.of(context)!.selectContext
),
const SizedBox(height: 20),
Align(
alignment: Alignment.centerRight,
child: ReflexButton(
text: AppLocalizations.of(context)!.start,
onPressed: _isButtonDisabled()
? null
: () {
widget.onContextSelected(selectedProject!.iD);
},
))
],
)));
}
}

View File

@ -0,0 +1,34 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import '../globals.dart';
class SplashScreen extends StatefulWidget {
const SplashScreen({super.key});
@override
State<StatefulWidget> createState() {
return SplashState();
}
}
class SplashState extends State<SplashScreen> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return const Scaffold(
backgroundColor: Globals.RP_PRIMARY_COLOR,
body: Center(
child:
Image(image: AssetImage('assets/images/LOGO_REFLEX_WHITE.png'),
height: 200.0,
width: 200.0,)),
);
}
}

1
linux/.gitignore vendored Normal file
View File

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

128
linux/CMakeLists.txt Normal file
View File

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

View File

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

View File

@ -0,0 +1,27 @@
//
// Generated file. Do not edit.
//
// clang-format off
#include "generated_plugin_registrant.h"
#include <desktop_webview_window/desktop_webview_window_plugin.h>
#include <file_selector_linux/file_selector_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
#include <window_to_front/window_to_front_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) desktop_webview_window_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopWebviewWindowPlugin");
desktop_webview_window_plugin_register_with_registrar(desktop_webview_window_registrar);
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
g_autoptr(FlPluginRegistrar) window_to_front_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "WindowToFrontPlugin");
window_to_front_plugin_register_with_registrar(window_to_front_registrar);
}

View File

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

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