mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 10:48:53 +03:30
beta commit
This commit is contained in:
+37
-37
@@ -1,37 +1,37 @@
|
|||||||
# Miscellaneous
|
# Miscellaneous
|
||||||
*.class
|
*.class
|
||||||
*.log
|
*.log
|
||||||
*.pyc
|
*.pyc
|
||||||
*.swp
|
*.swp
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.atom/
|
.atom/
|
||||||
.buildlog/
|
.buildlog/
|
||||||
.history
|
.history
|
||||||
.svn/
|
.svn/
|
||||||
|
|
||||||
# IntelliJ related
|
# IntelliJ related
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
*.iws
|
*.iws
|
||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
# The .vscode folder contains launch configuration and tasks you configure in
|
# 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
|
# VS Code which you may wish to be included in version control, so this line
|
||||||
# is commented out by default.
|
# is commented out by default.
|
||||||
#.vscode/
|
#.vscode/
|
||||||
|
|
||||||
# Flutter/Dart/Pub related
|
# Flutter/Dart/Pub related
|
||||||
**/doc/api/
|
**/doc/api/
|
||||||
.dart_tool/
|
.dart_tool/
|
||||||
.flutter-plugins
|
.flutter-plugins
|
||||||
.flutter-plugins-dependencies
|
.flutter-plugins-dependencies
|
||||||
.packages
|
.packages
|
||||||
.pub-cache/
|
.pub-cache/
|
||||||
.pub/
|
.pub/
|
||||||
/build/
|
/build/
|
||||||
|
|
||||||
# Web related
|
# Web related
|
||||||
lib/generated_plugin_registrant.dart
|
lib/generated_plugin_registrant.dart
|
||||||
|
|
||||||
# Exceptions to above rules.
|
# Exceptions to above rules.
|
||||||
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
|
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
|
||||||
|
|||||||
@@ -4,7 +4,27 @@
|
|||||||
# This file should be version controlled and should not be manually edited.
|
# This file should be version controlled and should not be manually edited.
|
||||||
|
|
||||||
version:
|
version:
|
||||||
revision: 9f5ff2306bb3e30b2b98eee79cd231b1336f41f4
|
revision: "ead455963c12b453cdb2358cad34969c76daf180"
|
||||||
channel: stable
|
channel: "stable"
|
||||||
|
|
||||||
project_type: app
|
project_type: app
|
||||||
|
|
||||||
|
# Tracks metadata for the flutter migrate command
|
||||||
|
migration:
|
||||||
|
platforms:
|
||||||
|
- platform: root
|
||||||
|
create_revision: ead455963c12b453cdb2358cad34969c76daf180
|
||||||
|
base_revision: ead455963c12b453cdb2358cad34969c76daf180
|
||||||
|
- platform: web
|
||||||
|
create_revision: ead455963c12b453cdb2358cad34969c76daf180
|
||||||
|
base_revision: ead455963c12b453cdb2358cad34969c76daf180
|
||||||
|
|
||||||
|
# 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'
|
||||||
|
|||||||
Vendored
+12
-12
@@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
// Use IntelliSense to learn about possible attributes.
|
// Use IntelliSense to learn about possible attributes.
|
||||||
// Hover to view descriptions of existing attributes.
|
// Hover to view descriptions of existing attributes.
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "Flutter",
|
"name": "Flutter",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "dart"
|
"type": "dart"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
# CSSD
|
# CSSD
|
||||||
|
|
||||||
A new Flutter project.
|
A new Flutter project.
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
This project is a starting point for a Flutter application.
|
This project is a starting point for a Flutter application.
|
||||||
|
|
||||||
A few resources to get you started if this is your first Flutter project:
|
A few resources to get you started if this is your first Flutter project:
|
||||||
|
|
||||||
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
|
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
|
||||||
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
|
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
|
||||||
|
|
||||||
For help getting started with Flutter, view our
|
For help getting started with Flutter, view our
|
||||||
[online documentation](https://flutter.dev/docs), which offers tutorials,
|
[online documentation](https://flutter.dev/docs), which offers tutorials,
|
||||||
samples, guidance on mobile development, and a full API reference.
|
samples, guidance on mobile development, and a full API reference.
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# This file configures the analyzer, which statically analyzes Dart code to
|
||||||
|
# check for errors, warnings, and lints.
|
||||||
|
#
|
||||||
|
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
|
||||||
|
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
|
||||||
|
# invoked from the command line by running `flutter analyze`.
|
||||||
|
|
||||||
|
# The following line activates a set of recommended lints for Flutter apps,
|
||||||
|
# packages, and plugins designed to encourage good coding practices.
|
||||||
|
# include: package:flutter_lints/flutter.yaml
|
||||||
|
|
||||||
|
linter:
|
||||||
|
# The lint rules applied to this project can be customized in the
|
||||||
|
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||||
|
# included above or to enable additional rules. A list of all available lints
|
||||||
|
# and their documentation is published at https://dart.dev/lints.
|
||||||
|
#
|
||||||
|
# Instead of disabling a lint rule for the entire project in the
|
||||||
|
# section below, it can also be suppressed for a single line of code
|
||||||
|
# or a specific dart file by using the `// ignore: name_of_lint` and
|
||||||
|
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
||||||
|
# producing the lint.
|
||||||
|
rules:
|
||||||
|
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
||||||
|
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
||||||
|
# Additional information about this file can be found at
|
||||||
|
# https://dart.dev/guides/language/analysis-options
|
||||||
+7
-7
@@ -1,7 +1,7 @@
|
|||||||
gradle-wrapper.jar
|
gradle-wrapper.jar
|
||||||
/.gradle
|
/.gradle
|
||||||
/captures/
|
/captures/
|
||||||
/gradlew
|
/gradlew
|
||||||
/gradlew.bat
|
/gradlew.bat
|
||||||
/local.properties
|
/local.properties
|
||||||
GeneratedPluginRegistrant.java
|
GeneratedPluginRegistrant.java
|
||||||
|
|||||||
+68
-67
@@ -1,67 +1,68 @@
|
|||||||
def localProperties = new Properties()
|
def localProperties = new Properties()
|
||||||
def localPropertiesFile = rootProject.file('local.properties')
|
def localPropertiesFile = rootProject.file('local.properties')
|
||||||
if (localPropertiesFile.exists()) {
|
if (localPropertiesFile.exists()) {
|
||||||
localPropertiesFile.withReader('UTF-8') { reader ->
|
localPropertiesFile.withReader('UTF-8') { reader ->
|
||||||
localProperties.load(reader)
|
localProperties.load(reader)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
||||||
if (flutterRoot == null) {
|
if (flutterRoot == null) {
|
||||||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
throw GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
||||||
}
|
}
|
||||||
|
|
||||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||||
if (flutterVersionCode == null) {
|
if (flutterVersionCode == null) {
|
||||||
flutterVersionCode = '1'
|
flutterVersionCode = '1'
|
||||||
}
|
}
|
||||||
|
|
||||||
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
||||||
if (flutterVersionName == null) {
|
if (flutterVersionName == null) {
|
||||||
flutterVersionName = '1.0'
|
flutterVersionName = '1.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 33
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main.java.srcDirs += 'src/main/kotlin'
|
main.java.srcDirs += 'src/main/kotlin'
|
||||||
}
|
}
|
||||||
|
|
||||||
lintOptions {
|
lintOptions {
|
||||||
disable 'InvalidPackage'
|
// disable 'InvalidPackage'
|
||||||
}
|
baseline(file("lint-baseline.xml"))
|
||||||
|
}
|
||||||
defaultConfig {
|
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
defaultConfig {
|
||||||
applicationId "com.example.cssd"
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
minSdkVersion 21
|
applicationId "com.example.cssd"
|
||||||
targetSdkVersion 28
|
minSdkVersion 21
|
||||||
versionCode flutterVersionCode.toInteger()
|
targetSdkVersion 28
|
||||||
versionName flutterVersionName
|
versionCode flutterVersionCode.toInteger()
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
versionName flutterVersionName
|
||||||
}
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
buildTypes {
|
|
||||||
release {
|
buildTypes {
|
||||||
// TODO: Add your own signing config for the release build.
|
release {
|
||||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
// TODO: Add your own signing config for the release build.
|
||||||
signingConfig signingConfigs.debug
|
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||||
}
|
signingConfig signingConfigs.debug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
flutter {
|
|
||||||
source '../..'
|
flutter {
|
||||||
}
|
source '../..'
|
||||||
|
}
|
||||||
dependencies {
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
dependencies {
|
||||||
testImplementation 'junit:junit:4.12'
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
androidTestImplementation 'androidx.test:runner:1.1.1'
|
testImplementation 'junit:junit:4.12'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
androidTestImplementation 'androidx.test:runner:1.1.1'
|
||||||
}
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<issues format="6" by="lint 7.3.0" type="baseline" client="gradle" dependencies="false" name="AGP (7.3.0)" variant="fatal" version="7.3.0">
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="ExpiredTargetSdkVersion"
|
||||||
|
message="Google Play requires that apps target API level 31 or higher.
"
|
||||||
|
errorLine1=" targetSdkVersion 28"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="44"
|
||||||
|
column="9"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
</issues>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.cssd">
|
package="com.example.cssd">
|
||||||
<!-- Flutter needs it to communicate with the running application
|
<!-- Flutter needs it to communicate with the running application
|
||||||
to allow setting breakpoints, to provide hot reload, etc.
|
to allow setting breakpoints, to provide hot reload, etc.
|
||||||
-->
|
-->
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -1,32 +1,32 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.cssd">
|
package="com.example.cssd">
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
|
||||||
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
|
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
|
||||||
calls FlutterMain.startInitialization(this); in its onCreate method.
|
calls FlutterMain.startInitialization(this); in its onCreate method.
|
||||||
In most cases you can leave this as-is, but you if you want to provide
|
In most cases you can leave this as-is, but you if you want to provide
|
||||||
additional functionality it is fine to subclass or reimplement
|
additional functionality it is fine to subclass or reimplement
|
||||||
FlutterApplication and put your custom class here. -->
|
FlutterApplication and put your custom class here. -->
|
||||||
<application
|
<application
|
||||||
android:name="io.flutter.app.FlutterApplication"
|
android:name="${applicationName}"
|
||||||
android:label="CSSD-DOC"
|
android:label="CSSD-DOC"
|
||||||
android:icon="@mipmap/ic_launcher">
|
android:icon="@mipmap/ic_launcher">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:theme="@style/LaunchTheme"
|
android:theme="@style/LaunchTheme"
|
||||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="true"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<!-- Don't delete the meta-data below.
|
<!-- Don't delete the meta-data below.
|
||||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="flutterEmbedding"
|
android:name="flutterEmbedding"
|
||||||
android:value="2" />
|
android:value="2" />
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.example.cssd
|
package com.example.cssd
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import io.flutter.embedding.android.FlutterActivity
|
import io.flutter.embedding.android.FlutterActivity
|
||||||
import io.flutter.embedding.engine.FlutterEngine
|
import io.flutter.embedding.engine.FlutterEngine
|
||||||
import io.flutter.plugins.GeneratedPluginRegistrant
|
import io.flutter.plugins.GeneratedPluginRegistrant
|
||||||
|
|
||||||
class MainActivity: FlutterActivity() {
|
class MainActivity: FlutterActivity() {
|
||||||
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
|
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
|
||||||
GeneratedPluginRegistrant.registerWith(flutterEngine);
|
GeneratedPluginRegistrant.registerWith(flutterEngine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Modify this file to customize your launch splash screen -->
|
<!-- Modify this file to customize your launch splash screen -->
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:drawable="@android:color/white" />
|
<item android:drawable="@android:color/white" />
|
||||||
|
|
||||||
<!-- You can insert your own image assets here -->
|
<!-- You can insert your own image assets here -->
|
||||||
<!-- <item>
|
<!-- <item>
|
||||||
<bitmap
|
<bitmap
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:src="@mipmap/launch_image" />
|
android:src="@mipmap/launch_image" />
|
||||||
</item> -->
|
</item> -->
|
||||||
</layer-list>
|
</layer-list>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||||
<!-- Show a splash screen on the activity. Automatically removed when
|
<!-- Show a splash screen on the activity. Automatically removed when
|
||||||
Flutter draws its first frame -->
|
Flutter draws its first frame -->
|
||||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.cssd">
|
package="com.example.cssd">
|
||||||
<!-- Flutter needs it to communicate with the running application
|
<!-- Flutter needs it to communicate with the running application
|
||||||
to allow setting breakpoints, to provide hot reload, etc.
|
to allow setting breakpoints, to provide hot reload, etc.
|
||||||
-->
|
-->
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.3.61'
|
ext.kotlin_version = '1.7.10'
|
||||||
repositories {
|
repositories {
|
||||||
// google()
|
// google()
|
||||||
maven {
|
maven {
|
||||||
@@ -10,7 +10,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.1.0'
|
classpath 'com.android.tools.build:gradle:7.3.0'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,6 +34,6 @@ subprojects {
|
|||||||
project.evaluationDependsOn(':app')
|
project.evaluationDependsOn(':app')
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
tasks.register("clean", Delete) {
|
||||||
delete rootProject.buildDir
|
delete rootProject.buildDir
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
org.gradle.jvmargs=-Xmx1536M
|
org.gradle.jvmargs=-Xmx1536M
|
||||||
android.enableR8=true
|
android.enableR8=true
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
|||||||
+1
-1
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
|
||||||
|
|||||||
+15
-15
@@ -1,15 +1,15 @@
|
|||||||
include ':app'
|
include ':app'
|
||||||
|
|
||||||
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
|
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
|
||||||
|
|
||||||
def plugins = new Properties()
|
def plugins = new Properties()
|
||||||
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
|
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
|
||||||
if (pluginsFile.exists()) {
|
if (pluginsFile.exists()) {
|
||||||
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
|
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins.each { name, path ->
|
plugins.each { name, path ->
|
||||||
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
|
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
|
||||||
include ":$name"
|
include ":$name"
|
||||||
project(":$name").projectDir = pluginDirectory
|
project(":$name").projectDir = pluginDirectory
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
include ':app'
|
include ':app'
|
||||||
|
|||||||
+63
-63
@@ -1,63 +1,63 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
viewBox="0 0 512.004 512.004" style="enable-background:new 0 0 512.004 512.004;" xml:space="preserve">
|
viewBox="0 0 512.004 512.004" style="enable-background:new 0 0 512.004 512.004;" xml:space="preserve">
|
||||||
<g>
|
<g>
|
||||||
<polygon style="fill:#DFE3E6;" points="52.967,247.176 141.243,247.176 141.243,167.728 52.967,167.728 "/>
|
<polygon style="fill:#DFE3E6;" points="52.967,247.176 141.243,247.176 141.243,167.728 52.967,167.728 "/>
|
||||||
<polygon style="fill:#C6C9CB;" points="61.795,167.728 132.416,167.728 132.416,141.245 61.795,141.245 "/>
|
<polygon style="fill:#C6C9CB;" points="61.795,167.728 132.416,167.728 132.416,141.245 61.795,141.245 "/>
|
||||||
<polygon style="fill:#DFE3E6;" points="70.622,141.245 123.588,141.245 123.588,88.403 70.622,88.403 "/>
|
<polygon style="fill:#DFE3E6;" points="70.622,141.245 123.588,141.245 123.588,88.403 70.622,88.403 "/>
|
||||||
<path style="fill:#C6C9CB;" d="M123.588,35.436H70.622c10.69,16.031,10.69,36.926,0,52.966h52.966
|
<path style="fill:#C6C9CB;" d="M123.588,35.436H70.622c10.69,16.031,10.69,36.926,0,52.966h52.966
|
||||||
C112.898,72.361,112.898,51.467,123.588,35.436"/>
|
C112.898,72.361,112.898,51.467,123.588,35.436"/>
|
||||||
<polygon style="fill:#DFE3E6;" points="88.278,0 105.933,0 123.588,35.434 70.622,35.434 "/>
|
<polygon style="fill:#DFE3E6;" points="88.278,0 105.933,0 123.588,35.434 70.622,35.434 "/>
|
||||||
<polygon style="fill:#C6C9CB;" points="61.795,282.486 132.416,282.486 132.416,247.176 61.795,247.176 "/>
|
<polygon style="fill:#C6C9CB;" points="61.795,282.486 132.416,282.486 132.416,247.176 61.795,247.176 "/>
|
||||||
<polygon style="fill:#DFE3E6;" points="211.864,247.176 300.14,247.176 300.14,167.728 211.864,167.728 "/>
|
<polygon style="fill:#DFE3E6;" points="211.864,247.176 300.14,247.176 300.14,167.728 211.864,167.728 "/>
|
||||||
<polygon style="fill:#C6C9CB;" points="220.691,167.728 291.312,167.728 291.312,141.245 220.691,141.245 "/>
|
<polygon style="fill:#C6C9CB;" points="220.691,167.728 291.312,167.728 291.312,141.245 220.691,141.245 "/>
|
||||||
<polygon style="fill:#DFE3E6;" points="229.519,141.245 282.485,141.245 282.485,88.403 229.519,88.403 "/>
|
<polygon style="fill:#DFE3E6;" points="229.519,141.245 282.485,141.245 282.485,88.403 229.519,88.403 "/>
|
||||||
<path style="fill:#C6C9CB;" d="M282.485,35.436h-52.966c10.69,16.031,10.69,36.926,0,52.966h52.966
|
<path style="fill:#C6C9CB;" d="M282.485,35.436h-52.966c10.69,16.031,10.69,36.926,0,52.966h52.966
|
||||||
C271.794,72.361,271.794,51.467,282.485,35.436"/>
|
C271.794,72.361,271.794,51.467,282.485,35.436"/>
|
||||||
<polygon style="fill:#DFE3E6;" points="247.174,0 264.829,0 282.485,35.434 229.519,35.434 "/>
|
<polygon style="fill:#DFE3E6;" points="247.174,0 264.829,0 282.485,35.434 229.519,35.434 "/>
|
||||||
<polygon style="fill:#C6C9CB;" points="220.691,282.486 291.312,282.486 291.312,247.176 220.691,247.176 "/>
|
<polygon style="fill:#C6C9CB;" points="220.691,282.486 291.312,282.486 291.312,247.176 220.691,247.176 "/>
|
||||||
<polygon style="fill:#DFE3E6;" points="370.76,247.176 459.036,247.176 459.036,167.728 370.76,167.728 "/>
|
<polygon style="fill:#DFE3E6;" points="370.76,247.176 459.036,247.176 459.036,167.728 370.76,167.728 "/>
|
||||||
<polygon style="fill:#C6C9CB;" points="379.588,167.728 450.209,167.728 450.209,141.245 379.588,141.245 "/>
|
<polygon style="fill:#C6C9CB;" points="379.588,167.728 450.209,167.728 450.209,141.245 379.588,141.245 "/>
|
||||||
<polygon style="fill:#DFE3E6;" points="388.416,141.245 441.381,141.245 441.381,88.403 388.416,88.403 "/>
|
<polygon style="fill:#DFE3E6;" points="388.416,141.245 441.381,141.245 441.381,88.403 388.416,88.403 "/>
|
||||||
<path style="fill:#C6C9CB;" d="M441.381,35.436h-52.966c10.69,16.031,10.69,36.926,0,52.966h52.966
|
<path style="fill:#C6C9CB;" d="M441.381,35.436h-52.966c10.69,16.031,10.69,36.926,0,52.966h52.966
|
||||||
C430.691,72.361,430.691,51.467,441.381,35.436"/>
|
C430.691,72.361,430.691,51.467,441.381,35.436"/>
|
||||||
<polygon style="fill:#DFE3E6;" points="406.071,0 423.726,0 441.381,35.434 388.416,35.434 "/>
|
<polygon style="fill:#DFE3E6;" points="406.071,0 423.726,0 441.381,35.434 388.416,35.434 "/>
|
||||||
<polygon style="fill:#C6C9CB;" points="379.588,282.486 450.209,282.486 450.209,247.176 379.588,247.176 "/>
|
<polygon style="fill:#C6C9CB;" points="379.588,282.486 450.209,282.486 450.209,247.176 379.588,247.176 "/>
|
||||||
<g>
|
<g>
|
||||||
<polygon style="fill:#8B8C8D;" points="79.45,512.004 114.76,512.004 114.76,282.486 79.45,282.486 "/>
|
<polygon style="fill:#8B8C8D;" points="79.45,512.004 114.76,512.004 114.76,282.486 79.45,282.486 "/>
|
||||||
<polygon style="fill:#8B8C8D;" points="238.347,512.004 273.657,512.004 273.657,282.486 238.347,282.486 "/>
|
<polygon style="fill:#8B8C8D;" points="238.347,512.004 273.657,512.004 273.657,282.486 238.347,282.486 "/>
|
||||||
<polygon style="fill:#8B8C8D;" points="397.243,512.004 432.553,512.004 432.553,282.486 397.243,282.486 "/>
|
<polygon style="fill:#8B8C8D;" points="397.243,512.004 432.553,512.004 432.553,282.486 397.243,282.486 "/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.9 KiB |
+112
-112
@@ -1,112 +1,112 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
|
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
|
||||||
<g>
|
<g>
|
||||||
<g>
|
<g>
|
||||||
<path d="M452,40h-24V0h-40v40H124V0H84v40H60C26.916,40,0,66.916,0,100v352c0,33.084,26.916,60,60,60h392
|
<path d="M452,40h-24V0h-40v40H124V0H84v40H60C26.916,40,0,66.916,0,100v352c0,33.084,26.916,60,60,60h392
|
||||||
c33.084,0,60-26.916,60-60V100C512,66.916,485.084,40,452,40z M472,452c0,11.028-8.972,20-20,20H60c-11.028,0-20-8.972-20-20V188
|
c33.084,0,60-26.916,60-60V100C512,66.916,485.084,40,452,40z M472,452c0,11.028-8.972,20-20,20H60c-11.028,0-20-8.972-20-20V188
|
||||||
h432V452z M472,148H40v-48c0-11.028,8.972-20,20-20h24v40h40V80h264v40h40V80h24c11.028,0,20,8.972,20,20V148z"/>
|
h432V452z M472,148H40v-48c0-11.028,8.972-20,20-20h24v40h40V80h264v40h40V80h24c11.028,0,20,8.972,20,20V148z"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
<g>
|
<g>
|
||||||
<rect x="76" y="230" width="40" height="40"/>
|
<rect x="76" y="230" width="40" height="40"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
<g>
|
<g>
|
||||||
<rect x="156" y="230" width="40" height="40"/>
|
<rect x="156" y="230" width="40" height="40"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
<g>
|
<g>
|
||||||
<rect x="236" y="230" width="40" height="40"/>
|
<rect x="236" y="230" width="40" height="40"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
<g>
|
<g>
|
||||||
<rect x="316" y="230" width="40" height="40"/>
|
<rect x="316" y="230" width="40" height="40"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
<g>
|
<g>
|
||||||
<rect x="396" y="230" width="40" height="40"/>
|
<rect x="396" y="230" width="40" height="40"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
<g>
|
<g>
|
||||||
<rect x="76" y="310" width="40" height="40"/>
|
<rect x="76" y="310" width="40" height="40"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
<g>
|
<g>
|
||||||
<rect x="156" y="310" width="40" height="40"/>
|
<rect x="156" y="310" width="40" height="40"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
<g>
|
<g>
|
||||||
<rect x="236" y="310" width="40" height="40"/>
|
<rect x="236" y="310" width="40" height="40"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
<g>
|
<g>
|
||||||
<rect x="316" y="310" width="40" height="40"/>
|
<rect x="316" y="310" width="40" height="40"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
<g>
|
<g>
|
||||||
<rect x="76" y="390" width="40" height="40"/>
|
<rect x="76" y="390" width="40" height="40"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
<g>
|
<g>
|
||||||
<rect x="156" y="390" width="40" height="40"/>
|
<rect x="156" y="390" width="40" height="40"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
<g>
|
<g>
|
||||||
<rect x="236" y="390" width="40" height="40"/>
|
<rect x="236" y="390" width="40" height="40"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
<g>
|
<g>
|
||||||
<rect x="316" y="390" width="40" height="40"/>
|
<rect x="316" y="390" width="40" height="40"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
<g>
|
<g>
|
||||||
<rect x="396" y="310" width="40" height="40"/>
|
<rect x="396" y="310" width="40" height="40"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.9 KiB |
+32
-32
@@ -1,32 +1,32 @@
|
|||||||
*.mode1v3
|
*.mode1v3
|
||||||
*.mode2v3
|
*.mode2v3
|
||||||
*.moved-aside
|
*.moved-aside
|
||||||
*.pbxuser
|
*.pbxuser
|
||||||
*.perspectivev3
|
*.perspectivev3
|
||||||
**/*sync/
|
**/*sync/
|
||||||
.sconsign.dblite
|
.sconsign.dblite
|
||||||
.tags*
|
.tags*
|
||||||
**/.vagrant/
|
**/.vagrant/
|
||||||
**/DerivedData/
|
**/DerivedData/
|
||||||
Icon?
|
Icon?
|
||||||
**/Pods/
|
**/Pods/
|
||||||
**/.symlinks/
|
**/.symlinks/
|
||||||
profile
|
profile
|
||||||
xcuserdata
|
xcuserdata
|
||||||
**/.generated/
|
**/.generated/
|
||||||
Flutter/App.framework
|
Flutter/App.framework
|
||||||
Flutter/Flutter.framework
|
Flutter/Flutter.framework
|
||||||
Flutter/Flutter.podspec
|
Flutter/Flutter.podspec
|
||||||
Flutter/Generated.xcconfig
|
Flutter/Generated.xcconfig
|
||||||
Flutter/app.flx
|
Flutter/app.flx
|
||||||
Flutter/app.zip
|
Flutter/app.zip
|
||||||
Flutter/flutter_assets/
|
Flutter/flutter_assets/
|
||||||
Flutter/flutter_export_environment.sh
|
Flutter/flutter_export_environment.sh
|
||||||
ServiceDefinitions.json
|
ServiceDefinitions.json
|
||||||
Runner/GeneratedPluginRegistrant.*
|
Runner/GeneratedPluginRegistrant.*
|
||||||
|
|
||||||
# Exceptions to above rules.
|
# Exceptions to above rules.
|
||||||
!default.mode1v3
|
!default.mode1v3
|
||||||
!default.mode2v3
|
!default.mode2v3
|
||||||
!default.pbxuser
|
!default.pbxuser
|
||||||
!default.perspectivev3
|
!default.perspectivev3
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
<?xml version="1.0" encoding="UTF-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">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>App</string>
|
<string>App</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>io.flutter.flutter.app</string>
|
<string>io.flutter.flutter.app</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>App</string>
|
<string>App</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>FMWK</string>
|
<string>FMWK</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.0</string>
|
<string>1.0</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.0</string>
|
<string>1.0</string>
|
||||||
<key>MinimumOSVersion</key>
|
<key>MinimumOSVersion</key>
|
||||||
<string>8.0</string>
|
<string>8.0</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
#include "Generated.xcconfig"
|
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||||
|
#include "Generated.xcconfig"
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
#include "Generated.xcconfig"
|
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||||
|
#include "Generated.xcconfig"
|
||||||
|
|||||||
+44
@@ -0,0 +1,44 @@
|
|||||||
|
# Uncomment this line to define a global platform for your project
|
||||||
|
# platform :ios, '11.0'
|
||||||
|
|
||||||
|
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||||
|
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||||
|
|
||||||
|
project 'Runner', {
|
||||||
|
'Debug' => :debug,
|
||||||
|
'Profile' => :release,
|
||||||
|
'Release' => :release,
|
||||||
|
}
|
||||||
|
|
||||||
|
def flutter_root
|
||||||
|
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
|
||||||
|
unless File.exist?(generated_xcode_build_settings_path)
|
||||||
|
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
||||||
|
end
|
||||||
|
|
||||||
|
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||||
|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||||
|
return matches[1].strip if matches
|
||||||
|
end
|
||||||
|
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
|
||||||
|
end
|
||||||
|
|
||||||
|
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||||
|
|
||||||
|
flutter_ios_podfile_setup
|
||||||
|
|
||||||
|
target 'Runner' do
|
||||||
|
use_frameworks!
|
||||||
|
use_modular_headers!
|
||||||
|
|
||||||
|
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
||||||
|
target 'RunnerTests' do
|
||||||
|
inherit! :search_paths
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
post_install do |installer|
|
||||||
|
installer.pods_project.targets.each do |target|
|
||||||
|
flutter_additional_ios_build_settings(target)
|
||||||
|
end
|
||||||
|
end
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Workspace
|
<Workspace
|
||||||
version = "1.0">
|
version = "1.0">
|
||||||
<FileRef
|
<FileRef
|
||||||
location = "group:Runner.xcodeproj">
|
location = "group:Runner.xcodeproj">
|
||||||
</FileRef>
|
</FileRef>
|
||||||
</Workspace>
|
</Workspace>
|
||||||
|
|||||||
@@ -1,91 +1,91 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1020"
|
LastUpgradeVersion = "1020"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
buildImplicitDependencies = "YES">
|
buildImplicitDependencies = "YES">
|
||||||
<BuildActionEntries>
|
<BuildActionEntries>
|
||||||
<BuildActionEntry
|
<BuildActionEntry
|
||||||
buildForTesting = "YES"
|
buildForTesting = "YES"
|
||||||
buildForRunning = "YES"
|
buildForRunning = "YES"
|
||||||
buildForProfiling = "YES"
|
buildForProfiling = "YES"
|
||||||
buildForArchiving = "YES"
|
buildForArchiving = "YES"
|
||||||
buildForAnalyzing = "YES">
|
buildForAnalyzing = "YES">
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
BuildableName = "Runner.app"
|
BuildableName = "Runner.app"
|
||||||
BlueprintName = "Runner"
|
BlueprintName = "Runner"
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</BuildActionEntry>
|
</BuildActionEntry>
|
||||||
</BuildActionEntries>
|
</BuildActionEntries>
|
||||||
</BuildAction>
|
</BuildAction>
|
||||||
<TestAction
|
<TestAction
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||||
<Testables>
|
<Testables>
|
||||||
</Testables>
|
</Testables>
|
||||||
<MacroExpansion>
|
<MacroExpansion>
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
BuildableName = "Runner.app"
|
BuildableName = "Runner.app"
|
||||||
BlueprintName = "Runner"
|
BlueprintName = "Runner"
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</MacroExpansion>
|
</MacroExpansion>
|
||||||
<AdditionalOptions>
|
<AdditionalOptions>
|
||||||
</AdditionalOptions>
|
</AdditionalOptions>
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
launchStyle = "0"
|
launchStyle = "0"
|
||||||
useCustomWorkingDirectory = "NO"
|
useCustomWorkingDirectory = "NO"
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
debugDocumentVersioning = "YES"
|
debugDocumentVersioning = "YES"
|
||||||
debugServiceExtension = "internal"
|
debugServiceExtension = "internal"
|
||||||
allowLocationSimulation = "YES">
|
allowLocationSimulation = "YES">
|
||||||
<BuildableProductRunnable
|
<BuildableProductRunnable
|
||||||
runnableDebuggingMode = "0">
|
runnableDebuggingMode = "0">
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
BuildableName = "Runner.app"
|
BuildableName = "Runner.app"
|
||||||
BlueprintName = "Runner"
|
BlueprintName = "Runner"
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</BuildableProductRunnable>
|
</BuildableProductRunnable>
|
||||||
<AdditionalOptions>
|
<AdditionalOptions>
|
||||||
</AdditionalOptions>
|
</AdditionalOptions>
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction
|
<ProfileAction
|
||||||
buildConfiguration = "Profile"
|
buildConfiguration = "Profile"
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
savedToolIdentifier = ""
|
savedToolIdentifier = ""
|
||||||
useCustomWorkingDirectory = "NO"
|
useCustomWorkingDirectory = "NO"
|
||||||
debugDocumentVersioning = "YES">
|
debugDocumentVersioning = "YES">
|
||||||
<BuildableProductRunnable
|
<BuildableProductRunnable
|
||||||
runnableDebuggingMode = "0">
|
runnableDebuggingMode = "0">
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
BuildableName = "Runner.app"
|
BuildableName = "Runner.app"
|
||||||
BlueprintName = "Runner"
|
BlueprintName = "Runner"
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</BuildableProductRunnable>
|
</BuildableProductRunnable>
|
||||||
</ProfileAction>
|
</ProfileAction>
|
||||||
<AnalyzeAction
|
<AnalyzeAction
|
||||||
buildConfiguration = "Debug">
|
buildConfiguration = "Debug">
|
||||||
</AnalyzeAction>
|
</AnalyzeAction>
|
||||||
<ArchiveAction
|
<ArchiveAction
|
||||||
buildConfiguration = "Release"
|
buildConfiguration = "Release"
|
||||||
revealArchiveInOrganizer = "YES">
|
revealArchiveInOrganizer = "YES">
|
||||||
</ArchiveAction>
|
</ArchiveAction>
|
||||||
</Scheme>
|
</Scheme>
|
||||||
|
|||||||
+7
-7
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Workspace
|
<Workspace
|
||||||
version = "1.0">
|
version = "1.0">
|
||||||
<FileRef
|
<FileRef
|
||||||
location = "group:Runner.xcodeproj">
|
location = "group:Runner.xcodeproj">
|
||||||
</FileRef>
|
</FileRef>
|
||||||
</Workspace>
|
</Workspace>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
import Flutter
|
import Flutter
|
||||||
|
|
||||||
@UIApplicationMain
|
@UIApplicationMain
|
||||||
@objc class AppDelegate: FlutterAppDelegate {
|
@objc class AppDelegate: FlutterAppDelegate {
|
||||||
override func application(
|
override func application(
|
||||||
_ application: UIApplication,
|
_ application: UIApplication,
|
||||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||||
) -> Bool {
|
) -> Bool {
|
||||||
GeneratedPluginRegistrant.register(with: self)
|
GeneratedPluginRegistrant.register(with: self)
|
||||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,122 +1,122 @@
|
|||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
"size" : "20x20",
|
"size" : "20x20",
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"filename" : "Icon-App-20x20@2x.png",
|
"filename" : "Icon-App-20x20@2x.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "20x20",
|
"size" : "20x20",
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"filename" : "Icon-App-20x20@3x.png",
|
"filename" : "Icon-App-20x20@3x.png",
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "29x29",
|
"size" : "29x29",
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"filename" : "Icon-App-29x29@1x.png",
|
"filename" : "Icon-App-29x29@1x.png",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "29x29",
|
"size" : "29x29",
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"filename" : "Icon-App-29x29@2x.png",
|
"filename" : "Icon-App-29x29@2x.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "29x29",
|
"size" : "29x29",
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"filename" : "Icon-App-29x29@3x.png",
|
"filename" : "Icon-App-29x29@3x.png",
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "40x40",
|
"size" : "40x40",
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"filename" : "Icon-App-40x40@2x.png",
|
"filename" : "Icon-App-40x40@2x.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "40x40",
|
"size" : "40x40",
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"filename" : "Icon-App-40x40@3x.png",
|
"filename" : "Icon-App-40x40@3x.png",
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "60x60",
|
"size" : "60x60",
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"filename" : "Icon-App-60x60@2x.png",
|
"filename" : "Icon-App-60x60@2x.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "60x60",
|
"size" : "60x60",
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"filename" : "Icon-App-60x60@3x.png",
|
"filename" : "Icon-App-60x60@3x.png",
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "20x20",
|
"size" : "20x20",
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"filename" : "Icon-App-20x20@1x.png",
|
"filename" : "Icon-App-20x20@1x.png",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "20x20",
|
"size" : "20x20",
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"filename" : "Icon-App-20x20@2x.png",
|
"filename" : "Icon-App-20x20@2x.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "29x29",
|
"size" : "29x29",
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"filename" : "Icon-App-29x29@1x.png",
|
"filename" : "Icon-App-29x29@1x.png",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "29x29",
|
"size" : "29x29",
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"filename" : "Icon-App-29x29@2x.png",
|
"filename" : "Icon-App-29x29@2x.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "40x40",
|
"size" : "40x40",
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"filename" : "Icon-App-40x40@1x.png",
|
"filename" : "Icon-App-40x40@1x.png",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "40x40",
|
"size" : "40x40",
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"filename" : "Icon-App-40x40@2x.png",
|
"filename" : "Icon-App-40x40@2x.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "76x76",
|
"size" : "76x76",
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"filename" : "Icon-App-76x76@1x.png",
|
"filename" : "Icon-App-76x76@1x.png",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "76x76",
|
"size" : "76x76",
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"filename" : "Icon-App-76x76@2x.png",
|
"filename" : "Icon-App-76x76@2x.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "83.5x83.5",
|
"size" : "83.5x83.5",
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"filename" : "Icon-App-83.5x83.5@2x.png",
|
"filename" : "Icon-App-83.5x83.5@2x.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "1024x1024",
|
"size" : "1024x1024",
|
||||||
"idiom" : "ios-marketing",
|
"idiom" : "ios-marketing",
|
||||||
"filename" : "Icon-App-1024x1024@1x.png",
|
"filename" : "Icon-App-1024x1024@1x.png",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"info" : {
|
"info" : {
|
||||||
"version" : 1,
|
"version" : 1,
|
||||||
"author" : "xcode"
|
"author" : "xcode"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-23
@@ -1,23 +1,23 @@
|
|||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"filename" : "LaunchImage.png",
|
"filename" : "LaunchImage.png",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"filename" : "LaunchImage@2x.png",
|
"filename" : "LaunchImage@2x.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"filename" : "LaunchImage@3x.png",
|
"filename" : "LaunchImage@3x.png",
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"info" : {
|
"info" : {
|
||||||
"version" : 1,
|
"version" : 1,
|
||||||
"author" : "xcode"
|
"author" : "xcode"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Launch Screen Assets
|
# Launch Screen Assets
|
||||||
|
|
||||||
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
|
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.
|
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.
|
||||||
@@ -1,37 +1,37 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?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">
|
<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>
|
<dependencies>
|
||||||
<deployment identifier="iOS"/>
|
<deployment identifier="iOS"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<scenes>
|
<scenes>
|
||||||
<!--View Controller-->
|
<!--View Controller-->
|
||||||
<scene sceneID="EHf-IW-A2E">
|
<scene sceneID="EHf-IW-A2E">
|
||||||
<objects>
|
<objects>
|
||||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||||
<layoutGuides>
|
<layoutGuides>
|
||||||
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
|
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
|
||||||
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
|
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
|
||||||
</layoutGuides>
|
</layoutGuides>
|
||||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
|
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
|
||||||
</imageView>
|
</imageView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
|
<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"/>
|
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="53" y="375"/>
|
<point key="canvasLocation" x="53" y="375"/>
|
||||||
</scene>
|
</scene>
|
||||||
</scenes>
|
</scenes>
|
||||||
<resources>
|
<resources>
|
||||||
<image name="LaunchImage" width="168" height="185"/>
|
<image name="LaunchImage" width="168" height="185"/>
|
||||||
</resources>
|
</resources>
|
||||||
</document>
|
</document>
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?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">
|
<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>
|
<dependencies>
|
||||||
<deployment identifier="iOS"/>
|
<deployment identifier="iOS"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<scenes>
|
<scenes>
|
||||||
<!--Flutter View Controller-->
|
<!--Flutter View Controller-->
|
||||||
<scene sceneID="tne-QT-ifu">
|
<scene sceneID="tne-QT-ifu">
|
||||||
<objects>
|
<objects>
|
||||||
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
|
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
|
||||||
<layoutGuides>
|
<layoutGuides>
|
||||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||||
</layoutGuides>
|
</layoutGuides>
|
||||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||||
</view>
|
</view>
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
</scene>
|
</scene>
|
||||||
</scenes>
|
</scenes>
|
||||||
</document>
|
</document>
|
||||||
|
|||||||
+45
-45
@@ -1,45 +1,45 @@
|
|||||||
<?xml version="1.0" encoding="UTF-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">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>cssd</string>
|
<string>cssd</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>$(FLUTTER_BUILD_NAME)</string>
|
<string>$(FLUTTER_BUILD_NAME)</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>UILaunchStoryboardName</key>
|
<key>UILaunchStoryboardName</key>
|
||||||
<string>LaunchScreen</string>
|
<string>LaunchScreen</string>
|
||||||
<key>UIMainStoryboardFile</key>
|
<key>UIMainStoryboardFile</key>
|
||||||
<string>Main</string>
|
<string>Main</string>
|
||||||
<key>UISupportedInterfaceOrientations</key>
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
<array>
|
<array>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
</array>
|
</array>
|
||||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
<array>
|
<array>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
</array>
|
</array>
|
||||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||||
<false/>
|
<false/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
const kLightBlue = Color(0xFF32CAD5);
|
||||||
|
const kLightBlueSub = Color(0xFF5FDDE7);
|
||||||
|
const kPink = Color(0xFFEE3552);
|
||||||
|
const kPinkSub = Color(0xFFFE687F);
|
||||||
|
const kBlue = Color(0xFF389ADC);
|
||||||
|
const kBlueSub = Color(0xFF60AFE2);
|
||||||
|
const kPurple = Color(0xFFAF3C77);
|
||||||
|
const kPurpleSub = Color(0xFFBB5B8D);
|
||||||
|
const kDarkBlue = Color(0xFF14537D);
|
||||||
|
const kDarkBlueSub = Color(0XFF668FAC);
|
||||||
|
const kDarkPurple = Color(0xFF862054);
|
||||||
|
const kDarkPurpleSub = Color(0xFFB75788);
|
||||||
+50
-27
@@ -1,27 +1,50 @@
|
|||||||
class Routes {
|
class Routes {
|
||||||
static const cycleAddScreen = '/CycleAddScreen';
|
static const cycleAddScreen = '/CycleAddScreen';
|
||||||
static const cycleDetailScreen = '/CycleDetailScreen';
|
static const cycleDetailScreen = '/CycleDetailScreen';
|
||||||
static const cycleFilterScreen = '/CycleFilterScreen';
|
static const cycleFilterScreen = '/CycleFilterScreen';
|
||||||
static const cycleResultScreen = '/CycleResultScreen';
|
static const cycleResultScreen = '/CycleResultScreen';
|
||||||
static const cycleScanScreen = '/CycleScanScreen';
|
static const cycleScanScreen = '/CycleScanScreen';
|
||||||
static const homePage = '/HomePage';
|
static const homePage = '/HomePage';
|
||||||
static const labelAddScreen = '/LabelAddScreen';
|
static const labelAddScreen = '/LabelAddScreen';
|
||||||
static const labelUpdateScreen = '/LabelUpdateScreen';
|
static const labelUpdateScreen = '/LabelUpdateScreen';
|
||||||
static const labelDetailScreen = '/LabelDetailScreen';
|
static const labelDetailScreen = '/LabelDetailScreen';
|
||||||
static const labelFilterScreen = '/LabelFilterScreen';
|
static const labelFilterScreen = '/LabelFilterScreen';
|
||||||
static const labelResultScreen = '/LabelResultScreen';
|
static const labelResultScreen = '/LabelResultScreen';
|
||||||
static const labelScanScreen = '/LabelScanScreen';
|
static const labelScanScreen = '/LabelScanScreen';
|
||||||
static const loginScreen = '/LoginScreen';
|
static const loginScreen = '/LoginScreen';
|
||||||
static const forgetPassScreen = '/ForgetPassScreen';
|
static const forgetPassScreen = '/ForgetPassScreen';
|
||||||
static const sendCodeScreen = '/SendCodeScreen';
|
static const sendCodeScreen = '/SendCodeScreen';
|
||||||
static const rePassScreen = '/RePassScreen';
|
static const rePassScreen = '/RePassScreen';
|
||||||
static const myInfoScreen = '/MyInfoScreen';
|
static const myInfoScreen = '/MyInfoScreen';
|
||||||
static const testResultAddScreen = '/TestResultAddScreen';
|
static const testResultAddScreen = '/TestResultAddScreen';
|
||||||
static const testDetailsScreen = '/TestDetailsScreen';
|
static const testDetailsScreen = '/TestDetailsScreen';
|
||||||
static const testFilterScreen = '/TestFilterScreen';
|
static const testFilterScreen = '/TestFilterScreen';
|
||||||
static const testResultScreen = '/TestResultScreen';
|
static const testResultScreen = '/TestResultScreen';
|
||||||
static const testVerifyScreen = '/TestVerifyScreen';
|
static const testVerifyScreen = '/TestVerifyScreen';
|
||||||
static const testScanScreen = '/TestScanScreen';
|
static const testScanScreen = '/TestScanScreen';
|
||||||
static const captureImageScreen = '/captureImageScreen';
|
static const captureImageScreen = '/captureImageScreen';
|
||||||
|
static const packageAddScreen = '/PackageAddScreen';
|
||||||
}
|
static const packageResultScreen = '/PackageResultScreen';
|
||||||
|
static const packageFilterScreen = '/PackageFilterScreen';
|
||||||
|
static const packageDetailScreen = '/PackageDetailScreen';
|
||||||
|
static const itemAddScreen = '/ItemAddScreen';
|
||||||
|
static const itemResultScreen = '/ItemResultScreen';
|
||||||
|
static const itemFilterScreen = '/ItemFilterScreen';
|
||||||
|
static const itemDetailScreen = '/ItemDetailScreen';
|
||||||
|
static const formTestResultScreen = '/FormTestResultScreen';
|
||||||
|
static const cycleUpdateScreen = '/CycleUpdateScreen';
|
||||||
|
static const packageUpdateScreen = '/PackageUpdateScreen';
|
||||||
|
static const itemUpdateScreen = '/ItemUpdateScreen';
|
||||||
|
static const itemScanScreen = '/ItemScanScreen';
|
||||||
|
static const packageScanScreen = '/PackageScanScreen';
|
||||||
|
static const myItemsResultScreen = '/MyItemsResultScreen';
|
||||||
|
static const myItemsFilterScreen = '/MyItemsFilterScreen';
|
||||||
|
static const myItemsDetailScreen = '/MyItemsDetailScreen';
|
||||||
|
static const itemsTransferScreen = '/ItemsTransferScreen';
|
||||||
|
static const myItemsHistoryScreen = '/MyItemsHistoryScreen';
|
||||||
|
static const myPackagesResultScreen = '/MyPackagesResultScreen';
|
||||||
|
static const myPackagesFilterScreen = '/MyPackagesFilterScreen';
|
||||||
|
static const myPackagesDetailScreen = '/MyPackagesDetailScreen';
|
||||||
|
static const packagesTransferScreen = '/PackagesTransferScreen';
|
||||||
|
static const myPackagesHistoryScreen = '/MyPackagesHistoryScreen';
|
||||||
|
}
|
||||||
|
|||||||
+166
-81
@@ -1,81 +1,166 @@
|
|||||||
class Url {
|
class Url {
|
||||||
static const String baseUrl = 'https://www.cssd-doc.com/api';
|
static const String baseUrl = 'https://www.cssd-doc.com/api';
|
||||||
|
|
||||||
static const String login = '$baseUrl/login';
|
// https://app.cssd-doc.com
|
||||||
|
|
||||||
static const String getInputs = '$baseUrl/GetInputs';
|
static const String login = '$baseUrl/login';
|
||||||
|
|
||||||
static const String getUserInfo = '$baseUrl/GetInfo';
|
static const String logOut = '$baseUrl/logOut';
|
||||||
|
|
||||||
// static const String testResults = '$baseUrl/TestResults';
|
static const String getInputs = '$baseUrl/GetInputs';
|
||||||
|
|
||||||
static const String filterItems = '$baseUrl/TestResults/ListFilterItems';
|
static const String getUserInfo = '$baseUrl/GetInfo';
|
||||||
|
|
||||||
static const String labelItems = '$baseUrl/GetLabels';
|
// static const String testResults = '$baseUrl/TestResults';
|
||||||
|
|
||||||
static const String packageItems = '$baseUrl/GetPackages';
|
static const String filterItems = '$baseUrl/TestResults/ListFilterItems';
|
||||||
|
|
||||||
static const String requestResetPass = '$baseUrl/password/phone';
|
static const String labelItems = '$baseUrl/GetLabels';
|
||||||
|
|
||||||
static const String verifyResetPass = '$baseUrl/password/verifyCode';
|
static const String packageItems = '$baseUrl/GetPackages';
|
||||||
|
|
||||||
static const String sendResetPass = '$baseUrl/password/reset';
|
static const String itemItems = '$baseUrl/GetItems';
|
||||||
|
|
||||||
static const String addImage = '$baseUrl/UploadFile';
|
static const String requestResetPass = '$baseUrl/password/phone';
|
||||||
|
|
||||||
|
static const String verifyResetPass = '$baseUrl/password/verifyCode';
|
||||||
|
|
||||||
static String testResults(int id) {
|
static const String sendResetPass = '$baseUrl/password/reset';
|
||||||
return '$baseUrl/TestResults?page=$id';
|
|
||||||
}
|
static const String addImage = '$baseUrl/UploadFile';
|
||||||
|
|
||||||
static String testResultVerification(String id,String value) {
|
// static String getUserMedicalCenterId(int id) {
|
||||||
return '$baseUrl/TestResults/Verify/$id/$value';
|
// return '$baseUrl/users?medical_center_id=$id';
|
||||||
}
|
// }
|
||||||
|
|
||||||
static String labelResults(int id) {
|
static String testResults(int id) {
|
||||||
return '$baseUrl/Labels?page=$id';
|
return '$baseUrl/TestResults?page=$id';
|
||||||
}
|
}
|
||||||
|
|
||||||
static String cycleResults(int id) {
|
static String labelResults(int id) {
|
||||||
return '$baseUrl/Cycles?page=$id';
|
return '$baseUrl/Labels?page=$id';
|
||||||
}
|
}
|
||||||
|
|
||||||
static String verifyTest(int id) {
|
static String cycleResults(int id) {
|
||||||
return '$baseUrl/TestResults/Verify/$id';
|
return '$baseUrl/Cycles?page=$id';
|
||||||
}
|
}
|
||||||
|
|
||||||
static String testResultFormValues(String id) {
|
static String packageResults(int id) {
|
||||||
return '$baseUrl/TestResults/$id/edit';
|
return '$baseUrl/Packages?page=$id';
|
||||||
}
|
}
|
||||||
|
|
||||||
static String updateTestResult(String id) {
|
static String itemResults(int id) {
|
||||||
return '$baseUrl/TestResults/$id';
|
return '$baseUrl/Items?page=$id';
|
||||||
}
|
}
|
||||||
|
|
||||||
static const String createTestResult = '$baseUrl/TestResults';
|
static String verifyTest(int id) {
|
||||||
|
return '$baseUrl/TestResults/Verify/$id';
|
||||||
static const String createCycleResult = '$baseUrl/Cycles';
|
}
|
||||||
|
|
||||||
static const String createLabelResult = '$baseUrl/Labels';
|
static String testResultFormValues(String id) {
|
||||||
|
return '$baseUrl/TestResults/$id/edit';
|
||||||
static String updateLabelResult(String id) {
|
}
|
||||||
return '$baseUrl/Labels/$id';
|
|
||||||
}
|
static String updateTestResult(String id) {
|
||||||
|
return '$baseUrl/TestResults/$id';
|
||||||
static String getTestResult(String id) {
|
}
|
||||||
return '$baseUrl/TestResults/$id';
|
|
||||||
}
|
static String updateCycleResult(String id) {
|
||||||
|
return '$baseUrl/Cycles/$id';
|
||||||
static String getLabelResult(String id) {
|
}
|
||||||
return '$baseUrl/Labels/$id';
|
|
||||||
}
|
static String updatePackageResult(String id) {
|
||||||
|
return '$baseUrl/Packages/$id';
|
||||||
static String getCycleResult(String id) {
|
}
|
||||||
return '$baseUrl/Cycles/$id';
|
|
||||||
}
|
static String updateItemResult(String id) {
|
||||||
|
return '$baseUrl/Items/$id';
|
||||||
static String removeTestResult(String id) {
|
}
|
||||||
return '$baseUrl/TestResults/$id';
|
|
||||||
}
|
static const String createTestResult = '$baseUrl/TestResults';
|
||||||
}
|
|
||||||
|
static const String createCycleResult = '$baseUrl/Cycles';
|
||||||
|
|
||||||
|
static const String createLabelResult = '$baseUrl/Labels';
|
||||||
|
|
||||||
|
static const String createPackageResult = '$baseUrl/Packages';
|
||||||
|
|
||||||
|
static const String createItemResult = '$baseUrl/Items';
|
||||||
|
|
||||||
|
static String getMyItems(int id) {
|
||||||
|
return '$baseUrl/transfer-my-items?page=$id';
|
||||||
|
}
|
||||||
|
|
||||||
|
static String getHospitalItems(int id) {
|
||||||
|
return '$baseUrl/transfer-items?page=$id';
|
||||||
|
}
|
||||||
|
|
||||||
|
static String getMyItemRequests = '$baseUrl/my-suspended-transfer-items';
|
||||||
|
|
||||||
|
static const String getHospitalItemRequests =
|
||||||
|
'$baseUrl/suspended-transfer-items';
|
||||||
|
|
||||||
|
static String transferItems(String id) {
|
||||||
|
return '$baseUrl/transfer-items/$id';
|
||||||
|
}
|
||||||
|
|
||||||
|
static String testResultVerification(String id, String value) {
|
||||||
|
return '$baseUrl/TestResults/Verify/$id/$value';
|
||||||
|
}
|
||||||
|
|
||||||
|
static String verifyItemRequests(String id, String value) {
|
||||||
|
return '$baseUrl/transfer-items/ChangeStatus/$id';
|
||||||
|
}
|
||||||
|
|
||||||
|
static String updateLabelResult(String id) {
|
||||||
|
return '$baseUrl/Labels/$id';
|
||||||
|
}
|
||||||
|
|
||||||
|
static String getTestResult(String id) {
|
||||||
|
return '$baseUrl/TestResults/$id';
|
||||||
|
}
|
||||||
|
|
||||||
|
static String getLabelResult(String id) {
|
||||||
|
return '$baseUrl/Labels/$id';
|
||||||
|
}
|
||||||
|
|
||||||
|
static String getCycleResult(String id) {
|
||||||
|
return '$baseUrl/Cycles/$id';
|
||||||
|
}
|
||||||
|
|
||||||
|
static String removeTestResult(String id) {
|
||||||
|
return '$baseUrl/TestResults/$id';
|
||||||
|
}
|
||||||
|
|
||||||
|
static String removeLabels(String id) {
|
||||||
|
return '$baseUrl/Labels/$id';
|
||||||
|
}
|
||||||
|
|
||||||
|
static String removeCycles(String id) {
|
||||||
|
return '$baseUrl/Cycles/$id';
|
||||||
|
}
|
||||||
|
|
||||||
|
static String getPackageResult(String id) {
|
||||||
|
return '$baseUrl/Packages/$id';
|
||||||
|
}
|
||||||
|
|
||||||
|
static String removePackages(String id) {
|
||||||
|
return '$baseUrl/Packages/$id';
|
||||||
|
}
|
||||||
|
|
||||||
|
static String getItemResult(String id) {
|
||||||
|
return '$baseUrl/Items/$id';
|
||||||
|
}
|
||||||
|
|
||||||
|
static String removeItems(String id) {
|
||||||
|
return '$baseUrl/Items/$id';
|
||||||
|
}
|
||||||
|
|
||||||
|
static String changeItemStatus(String id) {
|
||||||
|
return '$baseUrl/Items/ChangeStatus/$id';
|
||||||
|
}
|
||||||
|
|
||||||
|
static String getUsers(String id) {
|
||||||
|
return '$baseUrl/Users?medicalCenter_id=$id';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+11
-11
@@ -1,11 +1,11 @@
|
|||||||
class User {
|
class User {
|
||||||
static String _token;
|
static String? _token;
|
||||||
|
|
||||||
static String get token {
|
static String get token {
|
||||||
return 'Bearer ' + User._token;
|
return 'Bearer ' + User._token!;
|
||||||
}
|
}
|
||||||
|
|
||||||
static set token (String token) {
|
static set token(String token) {
|
||||||
User._token = token;
|
User._token = token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+201
-147
@@ -1,147 +1,201 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:cssd/pages/CyclePages/cycle_update_screen.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:cssd/pages/ItemPages/item_add_screen.dart';
|
||||||
import 'package:flutter_phoenix/flutter_phoenix.dart';
|
import 'package:cssd/pages/ItemPages/item_detail_screen.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:cssd/pages/ItemPages/item_filter_screen.dart';
|
||||||
|
import 'package:cssd/pages/ItemPages/item_result_screen.dart';
|
||||||
import 'config/routes.dart';
|
import 'package:cssd/pages/ItemPages/item_scan_screen.dart';
|
||||||
import 'pages/cycle_add_screen.dart';
|
import 'package:cssd/pages/ItemPages/item_update_screen.dart';
|
||||||
import 'pages/cycle_detail_screen.dart';
|
import 'package:cssd/pages/LabelPages/label_update_screen.dart';
|
||||||
import 'pages/cycle_filter_screen.dart';
|
import 'package:cssd/pages/MyItemsPages/Result/my_items_result_screen.dart';
|
||||||
import 'pages/cycle_result_screen.dart';
|
import 'package:cssd/pages/MyItemsPages/my_items_detail_screen.dart';
|
||||||
import 'pages/cycle_scan_screen.dart';
|
import 'package:cssd/pages/MyItemsPages/my_items_filter_screen.dart';
|
||||||
import 'pages/forget_pass_screen.dart';
|
import 'package:cssd/pages/MyItemsPages/my_items_history_screen.dart';
|
||||||
import 'pages/home_screen.dart';
|
import 'package:cssd/pages/MyItemsPages/my_items_transfer_screen.dart';
|
||||||
import 'pages/label_add_screen.dart';
|
import 'package:cssd/pages/MyPackagesPages/Result/my_packages_result_screen.dart';
|
||||||
import 'pages/label_detail_screen.dart';
|
import 'package:cssd/pages/MyPackagesPages/my_packages_detail_screen.dart';
|
||||||
import 'pages/label_filter_screen.dart';
|
import 'package:cssd/pages/MyPackagesPages/my_packages_filter_screen.dart';
|
||||||
import 'pages/label_result_screen.dart';
|
import 'package:cssd/pages/MyPackagesPages/my_packages_history_screen.dart';
|
||||||
import 'pages/label_scan_screen.dart';
|
import 'package:cssd/pages/MyPackagesPages/my_packages_transfer_screen.dart';
|
||||||
import 'pages/label_update_screen.dart';
|
import 'package:cssd/pages/PackagePages/package_add_screen.dart';
|
||||||
import 'pages/login_screen.dart';
|
import 'package:cssd/pages/PackagePages/package_detail_screen.dart';
|
||||||
import 'pages/my_info_screen.dart';
|
import 'package:cssd/pages/PackagePages/package_filter_screen.dart';
|
||||||
import 'pages/rePass_screen.dart';
|
import 'package:cssd/pages/PackagePages/package_result_screen.dart';
|
||||||
import 'pages/test_add_screen.dart';
|
import 'package:cssd/pages/PackagePages/package_scan_screen.dart';
|
||||||
import 'pages/test_detail_screen.dart';
|
import 'package:cssd/pages/PackagePages/package_update_screen.dart';
|
||||||
import 'pages/test_filter_screen.dart';
|
import 'package:cssd/pages/TestPages/test_form_page.dart';
|
||||||
import 'pages/test_result_screen.dart';
|
import 'package:cssd/providers/items.dart';
|
||||||
import 'pages/test_scan_screen.dart';
|
import 'package:cssd/providers/my_items.dart';
|
||||||
import 'pages/test_verify_screen.dart';
|
import 'package:cssd/providers/my_packages.dart';
|
||||||
import 'pages/verify_pass_screen.dart';
|
import 'package:cssd/providers/packages.dart';
|
||||||
import 'providers/auth.dart';
|
import 'package:cssd/providers/users.dart';
|
||||||
import 'providers/connectivity.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'providers/cycles.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'providers/input.dart';
|
import 'package:flutter_phoenix/flutter_phoenix.dart';
|
||||||
import 'providers/labels.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'providers/my_info.dart';
|
|
||||||
import 'providers/test_results.dart';
|
import 'config/routes.dart';
|
||||||
import 'widgets/Global/splash_screen.dart';
|
import 'pages/CyclePages/cycle_add_screen.dart';
|
||||||
import 'widgets/TestResultScreens/Add/capture_image.dart';
|
import 'pages/CyclePages/cycle_detail_screen.dart';
|
||||||
|
import 'pages/CyclePages/cycle_filter_screen.dart';
|
||||||
void main() {
|
import 'pages/CyclePages/cycle_result_screen.dart';
|
||||||
runApp(Phoenix(child: MyApp()));
|
import 'pages/CyclePages/cycle_scan_screen.dart';
|
||||||
SystemChrome.setPreferredOrientations([
|
import 'pages/LoginRegisterPages/forget_pass_screen.dart';
|
||||||
DeviceOrientation.portraitUp,
|
import 'pages/home_screen.dart';
|
||||||
DeviceOrientation.portraitDown,
|
import 'pages/LabelPages/label_add_screen.dart';
|
||||||
]);
|
import 'pages/LabelPages/label_detail_screen.dart';
|
||||||
// SystemChrome.setEnabledSystemUIOverlays([]);
|
import 'pages/LabelPages/label_filter_screen.dart';
|
||||||
// SystemChrome.setSystemUIOverlayStyle(
|
import 'pages/LabelPages/label_result_screen.dart';
|
||||||
// const SystemUiOverlayStyle(
|
import 'pages/LabelPages/label_scan_screen.dart';
|
||||||
// statusBarColor: Colors.red,
|
import 'pages/LoginRegisterPages/login_screen.dart';
|
||||||
// systemNavigationBarColor: Colors.red,
|
import 'pages/my_info_screen.dart';
|
||||||
// systemNavigationBarDividerColor: Colors.blue,
|
import 'pages/LoginRegisterPages/rePass_screen.dart';
|
||||||
// ),
|
import 'pages/TestPages/test_add_screen.dart';
|
||||||
// );
|
import 'pages/TestPages/test_detail_screen.dart';
|
||||||
}
|
import 'pages/TestPages/test_filter_screen.dart';
|
||||||
|
import 'pages/TestPages/test_result_screen.dart';
|
||||||
class MyApp extends StatelessWidget {
|
import 'pages/TestPages/test_scan_screen.dart';
|
||||||
@override
|
import 'pages/TestPages/test_verify_screen.dart';
|
||||||
Widget build(BuildContext context) {
|
import 'pages/LoginRegisterPages/verify_pass_screen.dart';
|
||||||
return MultiProvider(
|
import 'providers/auth.dart';
|
||||||
providers: [
|
import 'providers/connectivity.dart';
|
||||||
ChangeNotifierProvider.value(
|
import 'providers/cycles.dart';
|
||||||
value: Auth(),
|
import 'providers/input.dart';
|
||||||
),
|
import 'providers/labels.dart';
|
||||||
ChangeNotifierProvider.value(
|
import 'providers/my_info.dart';
|
||||||
value: TestResultsProvider(),
|
import 'providers/test_results.dart';
|
||||||
),
|
import 'widgets/Global/splash_screen.dart';
|
||||||
ChangeNotifierProvider.value(
|
import 'widgets/TestResultScreens/Add/capture_image.dart';
|
||||||
value: Inputs(),
|
|
||||||
),
|
void main() {
|
||||||
ChangeNotifierProvider.value(
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
value: MyInfoProvider(),
|
SystemChrome.setPreferredOrientations([
|
||||||
),
|
DeviceOrientation.portraitUp,
|
||||||
ChangeNotifierProvider.value(
|
DeviceOrientation.portraitDown,
|
||||||
value: LabelsProvider(),
|
]);
|
||||||
),
|
runApp(Phoenix(child: MyApp()));
|
||||||
ChangeNotifierProvider.value(
|
}
|
||||||
value: CyclesProvider(),
|
|
||||||
),
|
class MyApp extends StatelessWidget {
|
||||||
ChangeNotifierProvider.value(
|
@override
|
||||||
value: ConnectivityProvider(),
|
Widget build(BuildContext context) {
|
||||||
)
|
return MultiProvider(
|
||||||
],
|
providers: [
|
||||||
child: Consumer<Auth>(
|
ChangeNotifierProvider.value(
|
||||||
builder: (ctx, auth, _) => Consumer<ConnectivityProvider>(
|
value: Auth(),
|
||||||
builder: (ct, connection, _) {
|
),
|
||||||
connection.checkConnection();
|
ChangeNotifierProvider.value(
|
||||||
print(connection.conStatus);
|
value: TestResultsProvider(),
|
||||||
return MaterialApp(
|
),
|
||||||
debugShowCheckedModeBanner: false,
|
ChangeNotifierProvider.value(
|
||||||
title: 'CSSD-DOC',
|
value: Inputs(),
|
||||||
theme: ThemeData(
|
),
|
||||||
primaryColor: Colors.black,
|
ChangeNotifierProvider.value(
|
||||||
// cursorColor: Colors.black,
|
value: MyInfoProvider(),
|
||||||
fontFamily: 'montserrat',
|
),
|
||||||
// primaryTextTheme: TextTheme(
|
ChangeNotifierProvider.value(
|
||||||
// body1: TextStyle(
|
value: LabelsProvider(),
|
||||||
// color: Colors.black,
|
),
|
||||||
// ),
|
ChangeNotifierProvider.value(
|
||||||
// )
|
value: CyclesProvider(),
|
||||||
// textTheme: TextTheme(
|
),
|
||||||
// body2: TextStyle(color: Colors.white, fontSize: 16),
|
ChangeNotifierProvider.value(
|
||||||
// ),
|
value: ConnectivityProvider(),
|
||||||
),
|
),
|
||||||
home: auth.isAuth
|
ChangeNotifierProvider.value(
|
||||||
? HomePage()
|
value: PackageProvider(),
|
||||||
: FutureBuilder(
|
),
|
||||||
future: auth.tryAutoLogin(),
|
ChangeNotifierProvider.value(
|
||||||
builder: (ctx, authResultSnapshot) =>
|
value: ItemProvider(),
|
||||||
authResultSnapshot.connectionState ==
|
),
|
||||||
ConnectionState.waiting
|
ChangeNotifierProvider.value(
|
||||||
? SplashScreen()
|
value: MyItemProvider(),
|
||||||
: LoginScreen(),
|
),
|
||||||
),
|
ChangeNotifierProvider.value(
|
||||||
routes: {
|
value: MyPackageProvider(),
|
||||||
Routes.homePage: (ctx) => HomePage(),
|
),
|
||||||
Routes.loginScreen: (ctx) => LoginScreen(),
|
ChangeNotifierProvider.value(
|
||||||
Routes.forgetPassScreen: (ctx) => ForgetPassScreen(),
|
value: UsersProvider(),
|
||||||
Routes.myInfoScreen: (ctx) => MyInfoScreen(),
|
),
|
||||||
Routes.testResultScreen: (ctx) => TestResultScreen(),
|
],
|
||||||
Routes.testDetailsScreen: (ctx) => TestDetailsScreen(),
|
child: Consumer<Auth>(
|
||||||
Routes.testFilterScreen: (ctx) => TestFilterScreen(),
|
builder: (ctx, auth, _) => Consumer<ConnectivityProvider>(
|
||||||
// Routes.register: (ctx) => Register(),
|
builder: (ct, connection, _) {
|
||||||
Routes.testResultAddScreen: (ctx) => TestResultAddScreen(),
|
connection.checkConnection();
|
||||||
Routes.labelDetailScreen: (ctx) => LabelDetailScreen(),
|
print(connection.conStatus);
|
||||||
Routes.cycleDetailScreen: (ctx) => CycleDetailScreen(),
|
return MaterialApp(
|
||||||
Routes.labelFilterScreen: (ctx) => LabelFilterScreen(),
|
debugShowCheckedModeBanner: false,
|
||||||
Routes.cycleFilterScreen: (ctx) => CycleFilterScreen(),
|
title: 'CSSD-DOC',
|
||||||
Routes.cycleScanScreen: (ctx) => CycleScanScreen(),
|
theme: ThemeData(
|
||||||
Routes.labelScanScreen: (ctx) => LabelScanScreen(),
|
primaryColor: Colors.black,
|
||||||
Routes.cycleAddScreen: (ctx) => CycleAddScreen(),
|
fontFamily: 'montserrat',
|
||||||
Routes.labelAddScreen: (ctx) => LabelAddScreen(),
|
),
|
||||||
Routes.labelUpdateScreen: (ctx) => LabelUpdateScreen(),
|
home: auth.isAuth
|
||||||
Routes.labelResultScreen: (ctx) => LabelResultScreen(),
|
? HomePage()
|
||||||
Routes.cycleResultScreen: (ctx) => CycleResultScreen(),
|
: FutureBuilder(
|
||||||
Routes.testVerifyScreen: (ctx) => TestVerifyScreen(),
|
future: auth.tryAutoLogin(),
|
||||||
Routes.testScanScreen: (ctx) => TestScanScreen(),
|
builder: (ctx, authResultSnapshot) =>
|
||||||
Routes.sendCodeScreen: (ctx) => VerifyPassScreen(),
|
authResultSnapshot.connectionState ==
|
||||||
Routes.rePassScreen: (ctx) => RePassScreen(),
|
ConnectionState.waiting
|
||||||
Routes.captureImageScreen: (ctx) => CaptureImage(),
|
? SplashScreen()
|
||||||
},
|
: LoginScreen(),
|
||||||
);
|
),
|
||||||
},
|
routes: {
|
||||||
),
|
Routes.homePage: (ctx) => HomePage(),
|
||||||
),
|
Routes.loginScreen: (ctx) => LoginScreen(),
|
||||||
);
|
Routes.forgetPassScreen: (ctx) => ForgetPassScreen(),
|
||||||
}
|
Routes.myInfoScreen: (ctx) => MyInfoScreen(),
|
||||||
}
|
Routes.testResultScreen: (ctx) => TestResultScreen(),
|
||||||
|
Routes.testDetailsScreen: (ctx) => TestDetailsScreen(),
|
||||||
|
Routes.testFilterScreen: (ctx) => TestFilterScreen(),
|
||||||
|
Routes.testResultAddScreen: (ctx) => TestResultAddScreen(),
|
||||||
|
Routes.labelDetailScreen: (ctx) => LabelDetailScreen(),
|
||||||
|
Routes.cycleDetailScreen: (ctx) => CycleDetailScreen(),
|
||||||
|
Routes.labelFilterScreen: (ctx) => LabelFilterScreen(),
|
||||||
|
Routes.cycleFilterScreen: (ctx) => CycleFilterScreen(),
|
||||||
|
Routes.cycleScanScreen: (ctx) => CycleScanScreen(),
|
||||||
|
Routes.labelScanScreen: (ctx) => LabelScanScreen(),
|
||||||
|
Routes.labelUpdateScreen: (ctx) => LabelUpdateScreen(),
|
||||||
|
Routes.cycleAddScreen: (ctx) => CycleAddScreen(),
|
||||||
|
Routes.labelAddScreen: (ctx) => LabelAddScreen(),
|
||||||
|
Routes.labelResultScreen: (ctx) => LabelResultScreen(),
|
||||||
|
Routes.cycleResultScreen: (ctx) => CycleResultScreen(),
|
||||||
|
Routes.testVerifyScreen: (ctx) => TestVerifyScreen(),
|
||||||
|
Routes.testScanScreen: (ctx) => TestScanScreen(),
|
||||||
|
Routes.sendCodeScreen: (ctx) => VerifyPassScreen(),
|
||||||
|
Routes.rePassScreen: (ctx) => RePassScreen(),
|
||||||
|
Routes.captureImageScreen: (ctx) => CaptureImage(),
|
||||||
|
Routes.packageAddScreen: (ctx) => PackageAddScreen(),
|
||||||
|
Routes.packageResultScreen: (ctx) => PackageResultScreen(),
|
||||||
|
Routes.packageDetailScreen: (ctx) => PackageDetailScreen(),
|
||||||
|
Routes.packageFilterScreen: (ctx) => PackageFilterScreen(),
|
||||||
|
Routes.itemResultScreen: (ctx) => ItemResultScreen(),
|
||||||
|
Routes.itemAddScreen: (ctx) => ItemAddScreen(),
|
||||||
|
Routes.itemFilterScreen: (ctx) => ItemFilterScreen(),
|
||||||
|
Routes.itemDetailScreen: (ctx) => ItemDetailScreen(),
|
||||||
|
Routes.formTestResultScreen: (ctx) => FormPage(),
|
||||||
|
Routes.cycleUpdateScreen: (ctx) => CycleUpdateScreen(),
|
||||||
|
Routes.packageUpdateScreen: (ctx) => PackageUpdateScreen(),
|
||||||
|
Routes.itemUpdateScreen: (ctx) => ItemUpdateScreen(),
|
||||||
|
Routes.itemScanScreen: (ctx) => ItemScanScreen(),
|
||||||
|
Routes.packageScanScreen: (ctx) => PackageScanScreen(),
|
||||||
|
Routes.myItemsResultScreen: (ctx) => MyItemsResultScreen(),
|
||||||
|
Routes.myItemsFilterScreen: (ctx) => MyItemsFilterScreen(),
|
||||||
|
Routes.myItemsDetailScreen: (ctx) => MyItemsDetailScreen(),
|
||||||
|
Routes.itemsTransferScreen: (ctx) => ItemsTransferScreen(),
|
||||||
|
Routes.myItemsHistoryScreen: (ctx) => MyItemsHistoryScreen(),
|
||||||
|
Routes.myPackagesResultScreen: (ctx) =>
|
||||||
|
MyPackagesResultScreen(),
|
||||||
|
Routes.myPackagesFilterScreen: (ctx) => MyPackageFilterScreen(),
|
||||||
|
Routes.myPackagesDetailScreen: (ctx) =>
|
||||||
|
MyPackagesDetailScreen(),
|
||||||
|
Routes.packagesTransferScreen: (ctx) => PackageTransferScreen(),
|
||||||
|
Routes.myPackagesHistoryScreen: (ctx) =>
|
||||||
|
MyPackagesHistoryScreen(),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
enum ConnectionStatus{
|
|
||||||
Wifi,
|
|
||||||
Calcular,
|
|
||||||
Offline
|
|
||||||
}
|
|
||||||
@@ -1,52 +1,90 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
class CycleResultObject {
|
|
||||||
final String id;
|
class CycleResultObject extends Equatable {
|
||||||
final List<String> label;
|
final String id;
|
||||||
final String createdAt;
|
final List<String> label;
|
||||||
|
final String createdAt;
|
||||||
CycleResultObject({
|
|
||||||
@required this.id,
|
CycleResultObject({
|
||||||
@required this.label,
|
required this.id,
|
||||||
@required this.createdAt,
|
required this.label,
|
||||||
});
|
required this.createdAt,
|
||||||
}
|
});
|
||||||
|
|
||||||
class CycleDetailObject {
|
@override
|
||||||
final String id;
|
List<Object> get props => [id, label, createdAt];
|
||||||
final String description;
|
|
||||||
final String createDate;
|
@override
|
||||||
final String hospitalName;
|
bool get stringify => true;
|
||||||
|
}
|
||||||
final String date;
|
|
||||||
final String sterileId;
|
class CycleDetailObject extends Equatable {
|
||||||
final String cycleNumber;
|
final String id;
|
||||||
final List<String> labels;
|
final String description;
|
||||||
|
final String createDate;
|
||||||
CycleDetailObject({
|
final String hospitalName;
|
||||||
@required this.id,
|
|
||||||
@required this.description,
|
final String date;
|
||||||
@required this.createDate,
|
final String sterileId;
|
||||||
@required this.hospitalName,
|
final String cycleNumber;
|
||||||
@required this.date,
|
final List<String> labels;
|
||||||
@required this.sterileId,
|
|
||||||
@required this.cycleNumber,
|
CycleDetailObject({
|
||||||
@required this.labels,
|
required this.id,
|
||||||
});
|
required this.description,
|
||||||
}
|
required this.createDate,
|
||||||
|
required this.hospitalName,
|
||||||
class CycleFilterObject {
|
required this.date,
|
||||||
final String id;
|
required this.sterileId,
|
||||||
final String cycleNumber;
|
required this.cycleNumber,
|
||||||
final String sterilizerId;
|
required this.labels,
|
||||||
final String hospital;
|
});
|
||||||
final String date;
|
|
||||||
|
@override
|
||||||
CycleFilterObject({
|
List<Object> get props {
|
||||||
@required this.id,
|
return [
|
||||||
@required this.cycleNumber,
|
id,
|
||||||
@required this.sterilizerId,
|
description,
|
||||||
@required this.hospital,
|
createDate,
|
||||||
@required this.date,
|
hospitalName,
|
||||||
});
|
date,
|
||||||
}
|
sterileId,
|
||||||
|
cycleNumber,
|
||||||
|
labels,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get stringify => true;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CycleFilterObject extends Equatable {
|
||||||
|
final String id;
|
||||||
|
final String cycleNumber;
|
||||||
|
final String sterilizerId;
|
||||||
|
final String hospital;
|
||||||
|
final String date;
|
||||||
|
|
||||||
|
CycleFilterObject({
|
||||||
|
required this.id,
|
||||||
|
required this.cycleNumber,
|
||||||
|
required this.sterilizerId,
|
||||||
|
required this.hospital,
|
||||||
|
required this.date,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props {
|
||||||
|
return [
|
||||||
|
id,
|
||||||
|
cycleNumber,
|
||||||
|
sterilizerId,
|
||||||
|
hospital,
|
||||||
|
date,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get stringify => true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,111 @@
|
|||||||
|
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
|
class ItemResultObject extends Equatable {
|
||||||
|
final String id;
|
||||||
|
final String name;
|
||||||
|
final String size;
|
||||||
|
final String userName;
|
||||||
|
final int status;
|
||||||
|
final String? batchId;
|
||||||
|
|
||||||
|
ItemResultObject({
|
||||||
|
required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.size,
|
||||||
|
required this.userName,
|
||||||
|
required this.status,
|
||||||
|
this.batchId,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
size,
|
||||||
|
userName,
|
||||||
|
status,
|
||||||
|
batchId!,
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get stringify => true;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ItemDetailObject extends Equatable {
|
||||||
|
final String id;
|
||||||
|
final String name;
|
||||||
|
final String userName;
|
||||||
|
final String size;
|
||||||
|
final String specific;
|
||||||
|
final String hospital;
|
||||||
|
final String description;
|
||||||
|
final String createdAt;
|
||||||
|
final String udi;
|
||||||
|
final int status;
|
||||||
|
|
||||||
|
ItemDetailObject({
|
||||||
|
required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.userName,
|
||||||
|
required this.size,
|
||||||
|
required this.specific,
|
||||||
|
required this.hospital,
|
||||||
|
required this.description,
|
||||||
|
required this.createdAt,
|
||||||
|
required this.udi,
|
||||||
|
required this.status,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props {
|
||||||
|
return [
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
userName,
|
||||||
|
size,
|
||||||
|
specific,
|
||||||
|
hospital,
|
||||||
|
description,
|
||||||
|
createdAt,
|
||||||
|
udi,
|
||||||
|
status,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get stringify => true;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ItemFilterObject extends Equatable {
|
||||||
|
final String id;
|
||||||
|
final String name;
|
||||||
|
final String udi;
|
||||||
|
final String hospital;
|
||||||
|
final String size;
|
||||||
|
final String specific;
|
||||||
|
|
||||||
|
ItemFilterObject({
|
||||||
|
required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.udi,
|
||||||
|
required this.hospital,
|
||||||
|
required this.size,
|
||||||
|
required this.specific,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props {
|
||||||
|
return [
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
udi,
|
||||||
|
hospital,
|
||||||
|
size,
|
||||||
|
specific,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get stringify => true;
|
||||||
|
}
|
||||||
@@ -1,56 +1,88 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
class LabelResultObject {
|
|
||||||
final String id;
|
class LabelResultObject extends Equatable {
|
||||||
final String package;
|
final String id;
|
||||||
final String packageId;
|
final String package;
|
||||||
final String expireDate;
|
final String packageId;
|
||||||
|
final String expireDate;
|
||||||
LabelResultObject({
|
|
||||||
@required this.id,
|
LabelResultObject({
|
||||||
@required this.package,
|
required this.id,
|
||||||
@required this.packageId,
|
required this.package,
|
||||||
@required this.expireDate,
|
required this.packageId,
|
||||||
});
|
required this.expireDate,
|
||||||
}
|
});
|
||||||
|
|
||||||
class LabelDetailsObject {
|
@override
|
||||||
final String id;
|
List<Object> get props => [id, package, packageId, expireDate];
|
||||||
final String package;
|
|
||||||
final String packageId;
|
@override
|
||||||
final String hospitalName;
|
bool get stringify => true;
|
||||||
|
}
|
||||||
final String createDate;
|
|
||||||
final String expireDate;
|
class LabelDetailsObject extends Equatable {
|
||||||
final String sterileDate;
|
final String id;
|
||||||
final String sterileId;
|
final String package;
|
||||||
final String cycleNumber;
|
final String packageId;
|
||||||
final String lotNumber;
|
final String hospitalName;
|
||||||
|
|
||||||
LabelDetailsObject({
|
final String createDate;
|
||||||
@required this.id,
|
final String expireDate;
|
||||||
@required this.package,
|
final String sterileDate;
|
||||||
@required this.packageId,
|
final String sterileId;
|
||||||
@required this.hospitalName,
|
final String cycleNumber;
|
||||||
@required this.createDate,
|
final String lotNumber;
|
||||||
@required this.expireDate,
|
|
||||||
@required this.sterileDate,
|
LabelDetailsObject({
|
||||||
@required this.sterileId,
|
required this.id,
|
||||||
@required this.cycleNumber,
|
required this.package,
|
||||||
@required this.lotNumber,
|
required this.packageId,
|
||||||
});
|
required this.hospitalName,
|
||||||
}
|
required this.createDate,
|
||||||
|
required this.expireDate,
|
||||||
class LabelFilterObject {
|
required this.sterileDate,
|
||||||
final String id;
|
required this.sterileId,
|
||||||
final String cycleNumber;
|
required this.cycleNumber,
|
||||||
final String sterilizerId;
|
required this.lotNumber,
|
||||||
final String hospital;
|
});
|
||||||
|
|
||||||
LabelFilterObject({
|
@override
|
||||||
@required this.id,
|
List<Object> get props {
|
||||||
@required this.cycleNumber,
|
return [
|
||||||
@required this.sterilizerId,
|
id,
|
||||||
@required this.hospital,
|
package,
|
||||||
});
|
packageId,
|
||||||
}
|
hospitalName,
|
||||||
|
createDate,
|
||||||
|
expireDate,
|
||||||
|
sterileDate,
|
||||||
|
sterileId,
|
||||||
|
cycleNumber,
|
||||||
|
lotNumber,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get stringify => true;
|
||||||
|
}
|
||||||
|
|
||||||
|
class LabelFilterObject extends Equatable {
|
||||||
|
final String id;
|
||||||
|
final String cycleNumber;
|
||||||
|
final String sterilizerId;
|
||||||
|
final String hospital;
|
||||||
|
|
||||||
|
LabelFilterObject({
|
||||||
|
required this.id,
|
||||||
|
required this.cycleNumber,
|
||||||
|
required this.sterilizerId,
|
||||||
|
required this.hospital,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id, cycleNumber, sterilizerId, hospital];
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get stringify => true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
|
class MyItemResultObject extends Equatable {
|
||||||
|
final String id;
|
||||||
|
final String name;
|
||||||
|
final String size;
|
||||||
|
final String? userName;
|
||||||
|
final String? fromDate;
|
||||||
|
final String? toDate;
|
||||||
|
|
||||||
|
MyItemResultObject({
|
||||||
|
required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.size,
|
||||||
|
this.userName,
|
||||||
|
this.fromDate,
|
||||||
|
this.toDate,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
size,
|
||||||
|
userName!,
|
||||||
|
fromDate!,
|
||||||
|
toDate!,
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get stringify => true;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyItemFilterObject extends Equatable {
|
||||||
|
final String id;
|
||||||
|
final String name;
|
||||||
|
final String udi;
|
||||||
|
final String size;
|
||||||
|
final String specific;
|
||||||
|
|
||||||
|
MyItemFilterObject({
|
||||||
|
required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.udi,
|
||||||
|
required this.size,
|
||||||
|
required this.specific,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props {
|
||||||
|
return [
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
udi,
|
||||||
|
size,
|
||||||
|
specific,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get stringify => true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
|
class MyPackageResultObject extends Equatable {
|
||||||
|
final String id;
|
||||||
|
final String name;
|
||||||
|
final String? userName;
|
||||||
|
final String? fromDate;
|
||||||
|
final String? toDate;
|
||||||
|
|
||||||
|
MyPackageResultObject({
|
||||||
|
required this.id,
|
||||||
|
required this.name,
|
||||||
|
this.userName,
|
||||||
|
this.fromDate,
|
||||||
|
this.toDate,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
userName!,
|
||||||
|
fromDate!,
|
||||||
|
toDate!,
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get stringify => true;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyPackageFilterObject extends Equatable {
|
||||||
|
final String id;
|
||||||
|
final String name;
|
||||||
|
final String udi;
|
||||||
|
|
||||||
|
MyPackageFilterObject({
|
||||||
|
required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.udi,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props {
|
||||||
|
return [
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
udi,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get stringify => true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
|
class PackageResultObject extends Equatable {
|
||||||
|
final String id;
|
||||||
|
final String createdAt;
|
||||||
|
final String name;
|
||||||
|
|
||||||
|
PackageResultObject({
|
||||||
|
required this.id,
|
||||||
|
required this.createdAt,
|
||||||
|
required this.name,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
createdAt,
|
||||||
|
name,
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get stringify => true;
|
||||||
|
}
|
||||||
|
|
||||||
|
class PackageDetailObject extends Equatable {
|
||||||
|
final String id;
|
||||||
|
final String name;
|
||||||
|
final String description;
|
||||||
|
final String createDate;
|
||||||
|
final String hospitalName;
|
||||||
|
final String udi;
|
||||||
|
final List<String> items;
|
||||||
|
|
||||||
|
PackageDetailObject({
|
||||||
|
required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.description,
|
||||||
|
required this.createDate,
|
||||||
|
required this.hospitalName,
|
||||||
|
required this.udi,
|
||||||
|
required this.items,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props {
|
||||||
|
return [
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
createDate,
|
||||||
|
hospitalName,
|
||||||
|
udi,
|
||||||
|
items,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get stringify => true;
|
||||||
|
}
|
||||||
|
|
||||||
|
class PackageFilterObject extends Equatable {
|
||||||
|
final String id;
|
||||||
|
final String name;
|
||||||
|
final String hospital;
|
||||||
|
final String udi;
|
||||||
|
|
||||||
|
PackageFilterObject({
|
||||||
|
required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.hospital,
|
||||||
|
required this.udi,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props {
|
||||||
|
return [
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
hospital,
|
||||||
|
udi,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get stringify => true;
|
||||||
|
}
|
||||||
@@ -1,41 +1,74 @@
|
|||||||
import 'package:flutter/material.dart';
|
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
class TestResultObject {
|
|
||||||
final String id;
|
class TestResultObject extends Equatable {
|
||||||
final String name;
|
final String id;
|
||||||
final String deviceId;
|
final String name;
|
||||||
final String result;
|
final String deviceId;
|
||||||
final String date;
|
final String result;
|
||||||
final String hospital;
|
final String date;
|
||||||
final String verified;
|
final String hospital;
|
||||||
|
final String verified;
|
||||||
TestResultObject({
|
|
||||||
@required this.id,
|
TestResultObject({
|
||||||
@required this.name,
|
required this.id,
|
||||||
@required this.deviceId,
|
required this.name,
|
||||||
@required this.result,
|
required this.deviceId,
|
||||||
@required this.date,
|
required this.result,
|
||||||
@required this.hospital,
|
required this.date,
|
||||||
@required this.verified,
|
required this.hospital,
|
||||||
});
|
required this.verified,
|
||||||
}
|
});
|
||||||
|
|
||||||
class TestResultFilterObject {
|
@override
|
||||||
final String id;
|
List<Object> get props {
|
||||||
final String labelID;
|
return [
|
||||||
final String userName;
|
id,
|
||||||
final String hospital;
|
name,
|
||||||
final String testType;
|
deviceId,
|
||||||
final String fDate;
|
result,
|
||||||
final String uDate;
|
date,
|
||||||
|
hospital,
|
||||||
TestResultFilterObject({
|
verified,
|
||||||
@required this.id,
|
];
|
||||||
@required this.labelID,
|
}
|
||||||
@required this.userName,
|
|
||||||
@required this.hospital,
|
@override
|
||||||
@required this.testType,
|
bool get stringify => true;
|
||||||
@required this.fDate,
|
}
|
||||||
@required this.uDate,
|
|
||||||
});
|
class TestResultFilterObject extends Equatable {
|
||||||
}
|
final String id;
|
||||||
|
final String labelID;
|
||||||
|
final String userName;
|
||||||
|
final String hospital;
|
||||||
|
final String testType;
|
||||||
|
final String fDate;
|
||||||
|
final String uDate;
|
||||||
|
|
||||||
|
TestResultFilterObject({
|
||||||
|
required this.id,
|
||||||
|
required this.labelID,
|
||||||
|
required this.userName,
|
||||||
|
required this.hospital,
|
||||||
|
required this.testType,
|
||||||
|
required this.fDate,
|
||||||
|
required this.uDate,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props {
|
||||||
|
return [
|
||||||
|
id,
|
||||||
|
labelID,
|
||||||
|
userName,
|
||||||
|
hospital,
|
||||||
|
testType,
|
||||||
|
fDate,
|
||||||
|
uDate,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get stringify => true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
|
class Users extends Equatable {
|
||||||
|
final String id;
|
||||||
|
final String userName;
|
||||||
|
final String phoneNumber;
|
||||||
|
|
||||||
|
const Users({
|
||||||
|
required this.userName,
|
||||||
|
required this.phoneNumber,
|
||||||
|
required this.id,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [
|
||||||
|
userName,
|
||||||
|
phoneNumber,
|
||||||
|
id,
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get stringify => true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,343 @@
|
|||||||
|
import 'package:cssd/config/colors.dart';
|
||||||
|
import 'package:cssd/utils/scan.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../models/cycles_models.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../providers/cycles.dart';
|
||||||
|
import '../../widgets/CycleScreens/Add/add_label_box.dart';
|
||||||
|
import '../../widgets/CycleScreens/Add/date_picker.dart';
|
||||||
|
import '../../widgets/CycleScreens/Add/save_button.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class CycleAddScreen extends StatefulWidget {
|
||||||
|
// static const route = '/CycleAddScreen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
_CycleAddScreenState createState() => _CycleAddScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CycleAddScreenState extends State<CycleAddScreen> {
|
||||||
|
final _cycleNumberFocusNode = FocusNode();
|
||||||
|
final _descriptionFocosNode = FocusNode();
|
||||||
|
TextEditingController descriptionCTRL = new TextEditingController();
|
||||||
|
TextEditingController cycleNumberCTRL = new TextEditingController();
|
||||||
|
TextEditingController striizerIdCTRL = new TextEditingController();
|
||||||
|
TextEditingController dateCTRL = new TextEditingController();
|
||||||
|
DateTime? dateTimeFrom;
|
||||||
|
final _form = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
bool isInit = true;
|
||||||
|
CycleFilterObject? filters;
|
||||||
|
|
||||||
|
List<TextEditingController> labelsCTRL = [TextEditingController()];
|
||||||
|
int curLabelVal = 1;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
descriptionCTRL.text = '';
|
||||||
|
cycleNumberCTRL.text = '';
|
||||||
|
dateCTRL.text = DateFormat('y-M-d').format(DateTime.now());
|
||||||
|
striizerIdCTRL.text = '';
|
||||||
|
// dateValue = DateFormat('y-M-d').format(DateTime.now());
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() async {
|
||||||
|
if (isInit) {
|
||||||
|
// var _id = ModalRoute.of(context).settings.arguments;
|
||||||
|
var cycleProviderObject = Provider.of<CyclesProvider>(context);
|
||||||
|
cycleProviderObject.resetLabelVals();
|
||||||
|
cycleProviderObject.getLabelFilters().then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
// labelValues =
|
||||||
|
// filters.hospital == '' ? labelVals[0] : filters.hospital;
|
||||||
|
isInit = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context,
|
||||||
|
Routes.cycleResultScreen,
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Cycles'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context)
|
||||||
|
.pushReplacementNamed(Routes.cycleResultScreen),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Form(
|
||||||
|
key: _form,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Add a Cycle',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 6 * _deviceBlockSize,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 8,
|
||||||
|
child: TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Strilizer ID required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: striizerIdCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Strilizer ID',
|
||||||
|
contentPadding:
|
||||||
|
EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType:
|
||||||
|
TextInputType.visiblePassword,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context).requestFocus(
|
||||||
|
_cycleNumberFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
print(result);
|
||||||
|
striizerIdCTRL.text = result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Cycle number required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: cycleNumberCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Cycle Number',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _cycleNumberFocusNode,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_descriptionFocosNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
CycleAddDatePicker(
|
||||||
|
dateCTRL: dateCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.symmetric(vertical: 10),
|
||||||
|
child: Text(
|
||||||
|
'Labels included',
|
||||||
|
style: TextStyle(
|
||||||
|
color: kPink,
|
||||||
|
letterSpacing: 2,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Consumer<CyclesProvider>(
|
||||||
|
builder: (ctx, cycleProvider, _) =>
|
||||||
|
ListView.builder(
|
||||||
|
physics: NeverScrollableScrollPhysics(),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemBuilder: (ctx, index) => AddLabelBox(
|
||||||
|
text: 'Select Labels included',
|
||||||
|
iconColor: kPinkSub,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
values:
|
||||||
|
cycleProvider.labelValues[index],
|
||||||
|
vals: cycleProvider.labelVals,
|
||||||
|
initialLabelValue:
|
||||||
|
cycleProvider.initialLabelValue,
|
||||||
|
index: index,
|
||||||
|
),
|
||||||
|
itemCount:
|
||||||
|
cycleProvider.labelValues.length,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: descriptionCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Description',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.multiline,
|
||||||
|
focusNode: _descriptionFocosNode,
|
||||||
|
minLines: 1,
|
||||||
|
maxLines: 5,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
CycleAddSaveButton(
|
||||||
|
form: _form,
|
||||||
|
labelValues: Provider.of<CyclesProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).labelValues,
|
||||||
|
cycleNumberCTRL: cycleNumberCTRL,
|
||||||
|
dateValue: dateCTRL.text,
|
||||||
|
descriptionCTRL: descriptionCTRL,
|
||||||
|
striizerIdCTRL: striizerIdCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
+88
-85
@@ -1,85 +1,88 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '../models/cycles_models.dart';
|
import '../../models/cycles_models.dart';
|
||||||
import '../providers/connectivity.dart';
|
import '../../providers/connectivity.dart';
|
||||||
import '../providers/cycles.dart';
|
import '../../providers/cycles.dart';
|
||||||
import '../widgets/CycleScreens/Details/datas_box.dart';
|
import '../../widgets/CycleScreens/Details/datas_box.dart';
|
||||||
import '../widgets/Global/internet_error.dart';
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
class CycleDetailScreen extends StatefulWidget {
|
class CycleDetailScreen extends StatefulWidget {
|
||||||
// static const route = '/CycleDetailScreen';
|
// static const route = '/CycleDetailScreen';
|
||||||
final String testResultId;
|
final String? testResultId;
|
||||||
|
|
||||||
CycleDetailScreen({this.testResultId});
|
CycleDetailScreen({this.testResultId});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_CycleDetailScreenState createState() => _CycleDetailScreenState();
|
_CycleDetailScreenState createState() => _CycleDetailScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CycleDetailScreenState extends State<CycleDetailScreen> {
|
class _CycleDetailScreenState extends State<CycleDetailScreen> {
|
||||||
bool isInit = true;
|
bool isInit = true;
|
||||||
bool isEmpty = false;
|
bool isEmpty = false;
|
||||||
CycleDetailObject datas;
|
CycleDetailObject? datas;
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() async {
|
void didChangeDependencies() async {
|
||||||
if (isInit) {
|
if (isInit) {
|
||||||
var _id = ModalRoute.of(context).settings.arguments;
|
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||||
await Provider.of<CyclesProvider>(context, listen: false)
|
await Provider.of<CyclesProvider>(context, listen: false)
|
||||||
.showCycleResult(_id.toString())
|
.showCycleResult(_id.toString())
|
||||||
.then(
|
.then(
|
||||||
(result) {
|
(result) {
|
||||||
setState(
|
setState(
|
||||||
() {
|
() {
|
||||||
if (result.id == 'null') {
|
if (result.id == 'null') {
|
||||||
isEmpty = true;
|
isEmpty = true;
|
||||||
}
|
}
|
||||||
datas = result;
|
datas = result;
|
||||||
isInit = false;
|
isInit = false;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final _media = MediaQuery.of(context);
|
final _media = MediaQuery.of(context);
|
||||||
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
final double _devicewidth = _media.size.width;
|
final double _devicewidth = _media.size.width;
|
||||||
final double _deviceBlockSize = _devicewidth / 100;
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
titleSpacing: -10,
|
titleSpacing: -10,
|
||||||
title: Text('Cycles'),
|
title: Text('Cycles'),
|
||||||
leading: IconButton(
|
backgroundColor: Colors.black,
|
||||||
icon: Icon(
|
leading: IconButton(
|
||||||
Icons.keyboard_arrow_left,
|
icon: Icon(
|
||||||
size: 35,
|
Icons.keyboard_arrow_left,
|
||||||
),
|
size: 35,
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
),
|
||||||
),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
),
|
),
|
||||||
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
|
),
|
||||||
return connection.conStatus != 'offline'
|
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
|
||||||
? isInit
|
return connection.conStatus != 'offline'
|
||||||
? Center(
|
? isInit
|
||||||
child: CircularProgressIndicator(),
|
? Center(
|
||||||
)
|
child: CircularProgressIndicator(
|
||||||
: isEmpty
|
color: Colors.black,
|
||||||
? Center(
|
),
|
||||||
child: Text('This Cycle doesnt exists!'),
|
)
|
||||||
)
|
: isEmpty
|
||||||
: CycleDetailsDataBox(
|
? Center(
|
||||||
datas: datas,
|
child: Text('This Cycle doesnt exists!'),
|
||||||
deviceBlockSize: _deviceBlockSize,
|
)
|
||||||
)
|
: CycleDetailsDataBox(
|
||||||
: ConnectionErrorBox();
|
datas: datas!,
|
||||||
}),
|
deviceBlockSize: _deviceBlockSize,
|
||||||
),
|
)
|
||||||
);
|
: ConnectionErrorBox();
|
||||||
}
|
}),
|
||||||
}
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,351 @@
|
|||||||
|
import 'package:cssd/utils/scan.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../models/cycles_models.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../providers/cycles.dart';
|
||||||
|
import '../../widgets/CycleScreens/Filter/date_picker.dart';
|
||||||
|
import '../../widgets/CycleScreens/Filter/save_button.dart';
|
||||||
|
import '../../widgets/CycleScreens/Filter/selector_box.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class CycleFilterScreen extends StatefulWidget {
|
||||||
|
// static const route = '/CycleFilterScreen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
_CycleFilterScreenState createState() => _CycleFilterScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CycleFilterScreenState extends State<CycleFilterScreen> {
|
||||||
|
final _cycleNumberFocusNode = FocusNode();
|
||||||
|
final _strilizerIdFocusNode = FocusNode();
|
||||||
|
TextEditingController cycleIdCTRL = new TextEditingController();
|
||||||
|
TextEditingController cycleNumberCTRL = new TextEditingController();
|
||||||
|
TextEditingController striizerIdCTRL = new TextEditingController();
|
||||||
|
TextEditingController hospitalCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
TextEditingController dateCTRL = new TextEditingController();
|
||||||
|
DateTime? dateTimeFrom;
|
||||||
|
// String dateValue;
|
||||||
|
|
||||||
|
List<Map<String, String>> hospitalVals = [];
|
||||||
|
// String curhospitalVal;
|
||||||
|
bool isInit = true;
|
||||||
|
CycleFilterObject? filters;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
filters = Provider.of<CyclesProvider>(context, listen: false).filters;
|
||||||
|
cycleIdCTRL.text = filters!.id;
|
||||||
|
cycleNumberCTRL.text = filters!.cycleNumber;
|
||||||
|
// dateCTRL.text = DateFormat('y-M-d').format(DateTime.now());
|
||||||
|
dateCTRL.text = '';
|
||||||
|
striizerIdCTRL.text = filters!.sterilizerId;
|
||||||
|
// dateValue = DateFormat('y-M-d').format(DateTime.now());
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() async {
|
||||||
|
if (isInit) {
|
||||||
|
// var _id = ModalRoute.of(context).settings.arguments;
|
||||||
|
await Provider.of<CyclesProvider>(context, listen: false)
|
||||||
|
.getHospitalsFilters()
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
hospitalVals = [
|
||||||
|
{'id': '', 'name': ''}
|
||||||
|
];
|
||||||
|
for (var hospital in result) {
|
||||||
|
hospitalVals.add(hospital);
|
||||||
|
}
|
||||||
|
filters!.hospital == ''
|
||||||
|
? hospitalCTRL.text = hospitalVals[0]['name']!
|
||||||
|
: hospitalVals.forEach(
|
||||||
|
//id convert to name
|
||||||
|
(hospital) {
|
||||||
|
if (hospital['id'] == filters!.hospital) {
|
||||||
|
hospitalCTRL.text = hospital['name']!;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
isInit = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context,
|
||||||
|
Routes.cycleResultScreen,
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Cycles'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context)
|
||||||
|
.pushReplacementNamed(Routes.cycleResultScreen),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Filter Cycles',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 8,
|
||||||
|
child: TextFormField(
|
||||||
|
controller: cycleIdCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Cycle ID',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context).requestFocus(
|
||||||
|
_cycleNumberFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Spacer(),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
print(result);
|
||||||
|
cycleIdCTRL.text = result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: cycleNumberCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Cycle Number',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _cycleNumberFocusNode,
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_strilizerIdFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 8,
|
||||||
|
child: TextField(
|
||||||
|
controller: striizerIdCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Strilizer ID',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _strilizerIdFocusNode,
|
||||||
|
keyboardType:
|
||||||
|
TextInputType.visiblePassword,
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
print(result);
|
||||||
|
striizerIdCTRL.text = result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
FilterHospitalBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
hospitalCTRL: hospitalCTRL,
|
||||||
|
hospitalVals: hospitalVals,
|
||||||
|
label: 'Hospital',
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
CycleFilterDatePicker(
|
||||||
|
dateCTRL: dateCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
CycleFilterSaveButton(
|
||||||
|
hospitalVals: hospitalVals,
|
||||||
|
hospitalCTRL: hospitalCTRL,
|
||||||
|
cycleIdCTRL: cycleIdCTRL,
|
||||||
|
cycleNumberCTRL: cycleNumberCTRL,
|
||||||
|
striizerIdCTRL: striizerIdCTRL,
|
||||||
|
dateCTRL: dateCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,295 @@
|
|||||||
|
import 'package:cssd/config/colors.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/CycleScreens/Result/banner.dart';
|
||||||
|
import '../../widgets/CycleScreens/Result/data_box.dart';
|
||||||
|
import '../../widgets/CycleScreens/Result/filter_objects.dart';
|
||||||
|
import '../../widgets/CycleScreens/Result/search_box.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
import '../../providers/cycles.dart';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class CycleResultScreen extends StatefulWidget {
|
||||||
|
// static const route = '/CycleResultScreen';
|
||||||
|
final bool? isAdmin;
|
||||||
|
|
||||||
|
CycleResultScreen({this.isAdmin});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_CycleResultScreenState createState() => _CycleResultScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CycleResultScreenState extends State<CycleResultScreen> {
|
||||||
|
bool _isInit = true;
|
||||||
|
ScrollController? sc;
|
||||||
|
TextEditingController searchCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
sc = new ScrollController();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
if (_isInit) {
|
||||||
|
var testResults = Provider.of<CyclesProvider>(context);
|
||||||
|
testResults.setLoading();
|
||||||
|
testResults.resetPageNumber();
|
||||||
|
testResults.getCycleResults().then((_) {
|
||||||
|
testResults.resetLoading();
|
||||||
|
sc!.addListener(
|
||||||
|
() {
|
||||||
|
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
||||||
|
searchCTRL.text == '') {
|
||||||
|
var testResults = Provider.of<CyclesProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
);
|
||||||
|
testResults.getCycleResults();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_isInit = false;
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
floatingActionButton: CycleResultFloatingButton(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Home'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 20, right: 20, bottom: 60, left: 20),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
ResultBanner(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
text: 'Cycles',
|
||||||
|
push: Routes.cycleFilterScreen,
|
||||||
|
),
|
||||||
|
Consumer<CyclesProvider>(builder: (ctx, cycle, _) {
|
||||||
|
return Container(
|
||||||
|
height: 50,
|
||||||
|
child: ListView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
shrinkWrap: true,
|
||||||
|
children: <Widget>[
|
||||||
|
cycle.filters!.id != ''
|
||||||
|
? CycleFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'ID',
|
||||||
|
id: '',
|
||||||
|
cycleNumber:
|
||||||
|
cycle.filters!.cycleNumber,
|
||||||
|
sterilizerId:
|
||||||
|
cycle.filters!.sterilizerId,
|
||||||
|
hospital: cycle.filters!.hospital,
|
||||||
|
date: cycle.filters!.date,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
cycle.filters!.cycleNumber != ''
|
||||||
|
? CycleFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Cycle Number',
|
||||||
|
id: cycle.filters!.id,
|
||||||
|
cycleNumber: '',
|
||||||
|
sterilizerId:
|
||||||
|
cycle.filters!.sterilizerId,
|
||||||
|
hospital: cycle.filters!.hospital,
|
||||||
|
date: cycle.filters!.date,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
cycle.filters!.sterilizerId != ''
|
||||||
|
? CycleFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Sterilizer ID',
|
||||||
|
id: cycle.filters!.id,
|
||||||
|
cycleNumber:
|
||||||
|
cycle.filters!.cycleNumber,
|
||||||
|
sterilizerId: '',
|
||||||
|
hospital: cycle.filters!.hospital,
|
||||||
|
date: cycle.filters!.date,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
cycle.filters!.hospital != ''
|
||||||
|
? CycleFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Hospital',
|
||||||
|
id: cycle.filters!.id,
|
||||||
|
cycleNumber:
|
||||||
|
cycle.filters!.cycleNumber,
|
||||||
|
sterilizerId:
|
||||||
|
cycle.filters!.sterilizerId,
|
||||||
|
hospital: '',
|
||||||
|
date: cycle.filters!.date,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
cycle.filters!.date != ''
|
||||||
|
? CycleFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Date',
|
||||||
|
id: cycle.filters!.id,
|
||||||
|
cycleNumber:
|
||||||
|
cycle.filters!.cycleNumber,
|
||||||
|
sterilizerId:
|
||||||
|
cycle.filters!.sterilizerId,
|
||||||
|
hospital: cycle.filters!.hospital,
|
||||||
|
date: '',
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
ResultSearchBox(
|
||||||
|
searchCTRL: searchCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
text: 'cycle',
|
||||||
|
onChanged: (value) {
|
||||||
|
Provider.of<CyclesProvider>(context,
|
||||||
|
listen: false)
|
||||||
|
.search(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Consumer<CyclesProvider>(
|
||||||
|
builder: (context, cycleResults, _) {
|
||||||
|
return cycleResults.isloading
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
controller: sc,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
String labels = '';
|
||||||
|
for (var label in cycleResults
|
||||||
|
.items![index].label) {
|
||||||
|
labels += label;
|
||||||
|
labels += ' , ';
|
||||||
|
}
|
||||||
|
if (labels.length >= 3) {
|
||||||
|
labels = labels.substring(
|
||||||
|
0,
|
||||||
|
labels.length -
|
||||||
|
3); // remove extra ,
|
||||||
|
}
|
||||||
|
return CycleItemBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
item: cycleResults.items?[index],
|
||||||
|
labels: labels,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemCount: cycleResults.items?.length,
|
||||||
|
shrinkWrap: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class CycleResultFloatingButton extends StatelessWidget {
|
||||||
|
const CycleResultFloatingButton({
|
||||||
|
Key? key,
|
||||||
|
required double deviceBlockSize,
|
||||||
|
}) : _deviceBlockSize = deviceBlockSize,
|
||||||
|
super(key: key);
|
||||||
|
|
||||||
|
final double _deviceBlockSize;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: <Widget>[
|
||||||
|
InkWell(
|
||||||
|
customBorder: CircleBorder(),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pushNamed(Routes.cycleScanScreen);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(2.5 * _deviceBlockSize),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 7.1 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 2 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
customBorder: CircleBorder(),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pushReplacementNamed(Routes.cycleAddScreen);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(_deviceBlockSize),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: kPink,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.add,
|
||||||
|
size: 10 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
import 'package:cssd/config/colors.dart';
|
||||||
|
import 'package:cssd/utils/scan.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class CycleScanScreen extends StatefulWidget {
|
||||||
|
// static const route = '/cycleScanScreen';
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() {
|
||||||
|
return _CycleScanScreenState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CycleScanScreenState extends State<CycleScanScreen> {
|
||||||
|
String testCode = "";
|
||||||
|
TextEditingController idCTRL = new TextEditingController();
|
||||||
|
final _form = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Cycles'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? ListView(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(top: 30),
|
||||||
|
child: Text(
|
||||||
|
'Looking for a Cycle?',
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 5.5 * _deviceBlockSize,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.symmetric(vertical: 10),
|
||||||
|
height: 200,
|
||||||
|
decoration: BoxDecoration(border: Border.all()),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'Please Scan The Cycle Barcode',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
launch(
|
||||||
|
'https://cssd-doc.com/Show/Cycle/$result',
|
||||||
|
);
|
||||||
|
// Navigator.of(context).pushNamed(
|
||||||
|
// Routes.cycleDetailScreen,
|
||||||
|
// arguments: result,
|
||||||
|
// );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.0,
|
||||||
|
),
|
||||||
|
Form(
|
||||||
|
key: _form,
|
||||||
|
child: TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Id required!!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: idCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Or enter a cycle ID',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
// borderRadius: BorderRadius.only(Radius.circular(4)),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
if (!_form.currentState!.validate()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
launch(
|
||||||
|
'https://cssd-doc.com/Show/Cycle/${idCTRL.text}',
|
||||||
|
);
|
||||||
|
// Navigator.of(context).pushNamed(
|
||||||
|
// Routes.cycleDetailScreen,
|
||||||
|
// arguments: idCTRL.text,
|
||||||
|
// );
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 5 * _deviceBlockSize,
|
||||||
|
vertical: 10,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
colors: [kPink, kPinkSub],
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(7),
|
||||||
|
),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'Search',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,281 @@
|
|||||||
|
import 'package:cssd/models/cycles_models.dart';
|
||||||
|
import 'package:cssd/providers/cycles.dart';
|
||||||
|
import 'package:cssd/widgets/CycleScreens/Add/cycle_update_button.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:intl/intl.dart' as DateEditor;
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
import '../../widgets/LabelScreens/Add/date_picker.dart';
|
||||||
|
|
||||||
|
class CycleUpdateScreen extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_CycleUpdateScreenState createState() => _CycleUpdateScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CycleUpdateScreenState extends State<CycleUpdateScreen> {
|
||||||
|
final _cycleNumberFocusNode = FocusNode();
|
||||||
|
final _descriptionFocusNode = FocusNode();
|
||||||
|
TextEditingController cycleNumberCTRL = new TextEditingController();
|
||||||
|
TextEditingController sterilizerIdCTRL = new TextEditingController();
|
||||||
|
TextEditingController descriptionCTRL = new TextEditingController();
|
||||||
|
TextEditingController dateCTRL = new TextEditingController();
|
||||||
|
TextEditingController labelCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
final _form = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
// List<Map<String, String>> labelVals = [];
|
||||||
|
// List<String> labelValue = [];
|
||||||
|
bool isEmpty = false;
|
||||||
|
bool isInit = true;
|
||||||
|
CycleDetailObject? datas;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
dateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() async {
|
||||||
|
if (isInit) {
|
||||||
|
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||||
|
await Provider.of<CyclesProvider>(context, listen: false)
|
||||||
|
.showCycleResult(_id.toString())
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
datas = result;
|
||||||
|
cycleNumberCTRL.text = datas!.cycleNumber;
|
||||||
|
sterilizerIdCTRL.text = datas!.sterileId;
|
||||||
|
descriptionCTRL.text = datas!.description;
|
||||||
|
dateCTRL.text = datas!.date;
|
||||||
|
// for (var label in datas!.labels) {
|
||||||
|
// labelCTRL.text = label;
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
await Provider.of<CyclesProvider>(context, listen: false)
|
||||||
|
.getLabelFilters()
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
// labelVals = result;
|
||||||
|
isInit = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context,
|
||||||
|
Routes.cycleResultScreen,
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
title: Text('Cycles'),
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context)
|
||||||
|
.pushReplacementNamed(Routes.cycleResultScreen),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(color: Colors.black),
|
||||||
|
)
|
||||||
|
: Form(
|
||||||
|
key: _form,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Update a Cycle',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 6 * _deviceBlockSize,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Strilizer ID required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: sterilizerIdCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 7 * _deviceBlockSize),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Strilizer ID',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_cycleNumberFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Cycle number required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: cycleNumberCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Cycle Number',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _cycleNumberFocusNode,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_descriptionFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
LabelAddDatePicker(
|
||||||
|
dateCTRL: dateCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Date',
|
||||||
|
),
|
||||||
|
// SizedBox(
|
||||||
|
// height: 20.0,
|
||||||
|
// ),
|
||||||
|
// Consumer<CyclesProvider>(
|
||||||
|
// builder: (ctx, cycleProvider, _) =>
|
||||||
|
// ListView.builder(
|
||||||
|
// physics: NeverScrollableScrollPhysics(),
|
||||||
|
// shrinkWrap: true,
|
||||||
|
// itemBuilder: (ctx, index) => AddLabelBox(
|
||||||
|
// text: 'Select Labels included',
|
||||||
|
// iconColor: kPinkSub,
|
||||||
|
// deviceBlockSize: _deviceBlockSize,
|
||||||
|
// values: cycleProvider.labelValues[index],
|
||||||
|
// vals: cycleProvider.labelVals,
|
||||||
|
// initialLabelValue: labelCTRL.text,
|
||||||
|
// index: index,
|
||||||
|
// ),
|
||||||
|
// itemCount: cycleProvider.labelValues.length,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: descriptionCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Description',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.multiline,
|
||||||
|
focusNode: _descriptionFocusNode,
|
||||||
|
minLines: 1,
|
||||||
|
maxLines: 5,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
CycleUpdateButton(
|
||||||
|
form: _form,
|
||||||
|
id: datas!.id,
|
||||||
|
cycleNumberCTRL: cycleNumberCTRL,
|
||||||
|
dateCTRL: dateCTRL,
|
||||||
|
// labelValue: labelCTRL,
|
||||||
|
striizerIdCTRL: sterilizerIdCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
descriptionCTRL: descriptionCTRL,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,342 @@
|
|||||||
|
import 'package:cssd/models/item_model.dart';
|
||||||
|
import 'package:cssd/providers/items.dart';
|
||||||
|
import 'package:cssd/widgets/ItemScreens/Add/item_save_button.dart';
|
||||||
|
import 'package:cssd/widgets/ItemScreens/Add/upload_image.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:random_string/random_string.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class ItemAddScreen extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_ItemAddScreenState createState() => _ItemAddScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ItemAddScreenState extends State<ItemAddScreen> {
|
||||||
|
final _itemSizeFocusNode = FocusNode();
|
||||||
|
final _itemSpecificFocusNode = FocusNode();
|
||||||
|
final _itemUdiFocusNode = FocusNode();
|
||||||
|
final _descriptionFocusNode = FocusNode();
|
||||||
|
TextEditingController descriptionCTRL = new TextEditingController();
|
||||||
|
TextEditingController udiCTRL = new TextEditingController();
|
||||||
|
TextEditingController nameCTRL = new TextEditingController();
|
||||||
|
TextEditingController specificCTRL = new TextEditingController();
|
||||||
|
TextEditingController sizeCTRL = new TextEditingController();
|
||||||
|
TextEditingController dateCTRL = new TextEditingController();
|
||||||
|
final _form = GlobalKey<FormState>();
|
||||||
|
bool isInit = true;
|
||||||
|
ItemFilterObject? filters;
|
||||||
|
final batchId = randomString(10);
|
||||||
|
|
||||||
|
int curLabelVal = 1;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
descriptionCTRL.text = '';
|
||||||
|
udiCTRL.text = '';
|
||||||
|
nameCTRL.text = '';
|
||||||
|
sizeCTRL.text = '';
|
||||||
|
specificCTRL.text = '';
|
||||||
|
dateCTRL.text = DateFormat('y-M-d').format(DateTime.now());
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() async {
|
||||||
|
if (isInit) {
|
||||||
|
var itemProviderObject = Provider.of<ItemProvider>(context);
|
||||||
|
itemProviderObject.getItemResults().then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
isInit = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
final itemProviderObject = Provider.of<ItemProvider>(context);
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context,
|
||||||
|
Routes.itemResultScreen,
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Items'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context)
|
||||||
|
.pushReplacementNamed(Routes.itemResultScreen),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Form(
|
||||||
|
key: _form,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Add an Item',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 6 * _deviceBlockSize,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Name required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: nameCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Item Name',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_itemSizeFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Size required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: sizeCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Size',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _itemSizeFocusNode,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_itemSpecificFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Specific required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: specificCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Specific',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _itemSpecificFocusNode,
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_itemUdiFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'UDI required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: udiCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'UDI',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _itemUdiFocusNode,
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_descriptionFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: descriptionCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Description',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.multiline,
|
||||||
|
focusNode: _descriptionFocusNode,
|
||||||
|
minLines: 1,
|
||||||
|
maxLines: 5,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30.0,
|
||||||
|
),
|
||||||
|
UploaderImage(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
providerObject: itemProviderObject,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
ItemAddSaveButton(
|
||||||
|
form: _form,
|
||||||
|
nameCTRL: nameCTRL,
|
||||||
|
udiCTRL: udiCTRL,
|
||||||
|
descriptionCTRL: descriptionCTRL,
|
||||||
|
sizeCTRL: sizeCTRL,
|
||||||
|
specificCTRL: specificCTRL,
|
||||||
|
batchId: batchId,
|
||||||
|
dateValue: dateCTRL.text,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
import 'package:cssd/models/item_model.dart';
|
||||||
|
import 'package:cssd/providers/items.dart';
|
||||||
|
import 'package:cssd/widgets/ItemScreens/Details/item_detail_box.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class ItemDetailScreen extends StatefulWidget {
|
||||||
|
final String? testResultId;
|
||||||
|
|
||||||
|
ItemDetailScreen({
|
||||||
|
this.testResultId,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_ItemDetailScreenState createState() => _ItemDetailScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ItemDetailScreenState extends State<ItemDetailScreen> {
|
||||||
|
bool isInit = true;
|
||||||
|
bool isEmpty = false;
|
||||||
|
ItemDetailObject? datas;
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() async {
|
||||||
|
if (isInit) {
|
||||||
|
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||||
|
await Provider.of<ItemProvider>(context, listen: false)
|
||||||
|
.showItemResult(_id.toString())
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
if (result.id == 'null') {
|
||||||
|
isEmpty = true;
|
||||||
|
}
|
||||||
|
datas = result;
|
||||||
|
isInit = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Items'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: isEmpty
|
||||||
|
? Center(
|
||||||
|
child: Text('This Item does\'nt exists!'),
|
||||||
|
)
|
||||||
|
: ItemDetailsDataBox(
|
||||||
|
datas: datas!,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,409 @@
|
|||||||
|
import 'package:cssd/config/colors.dart';
|
||||||
|
import 'package:cssd/models/item_model.dart';
|
||||||
|
import 'package:cssd/providers/items.dart';
|
||||||
|
import 'package:cssd/utils/scan.dart';
|
||||||
|
import 'package:cssd/widgets/ItemScreens/Filter/item_filter_button.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/CycleScreens/Filter/selector_box.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class ItemFilterScreen extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_ItemFilterScreenState createState() => _ItemFilterScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ItemFilterScreenState extends State<ItemFilterScreen> {
|
||||||
|
final _itemSizeFocusNode = FocusNode();
|
||||||
|
final _itemNameFocusNode = FocusNode();
|
||||||
|
final _itemUdiFocusNode = FocusNode();
|
||||||
|
final _itemSpecificFocusNode = FocusNode();
|
||||||
|
TextEditingController idCTRL = new TextEditingController();
|
||||||
|
TextEditingController hospitalCTRL = new TextEditingController();
|
||||||
|
TextEditingController nameCTRL = new TextEditingController();
|
||||||
|
TextEditingController udiCTRL = new TextEditingController();
|
||||||
|
TextEditingController sizeCTRL = new TextEditingController();
|
||||||
|
TextEditingController specificCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
List<Map<String, String>> hospitalVals = [];
|
||||||
|
bool isInit = true;
|
||||||
|
ItemFilterObject? filters;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
filters = Provider.of<ItemProvider>(context, listen: false).filters;
|
||||||
|
idCTRL.text = filters!.id;
|
||||||
|
hospitalCTRL.text = filters!.hospital;
|
||||||
|
nameCTRL.text = filters!.name;
|
||||||
|
sizeCTRL.text = filters!.size;
|
||||||
|
specificCTRL.text = filters!.specific;
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() async {
|
||||||
|
if (isInit) {
|
||||||
|
// var _id = ModalRoute.of(context).settings.arguments;
|
||||||
|
await Provider.of<ItemProvider>(context, listen: false)
|
||||||
|
.getHospitalsFilters()
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
hospitalVals = [
|
||||||
|
{'id': '', 'name': ''}
|
||||||
|
];
|
||||||
|
for (var hospital in result) {
|
||||||
|
hospitalVals.add(hospital);
|
||||||
|
}
|
||||||
|
filters!.hospital == ''
|
||||||
|
? hospitalCTRL.text = hospitalVals[0]['name']!
|
||||||
|
: hospitalVals.forEach(
|
||||||
|
//id convert to name
|
||||||
|
(hospital) {
|
||||||
|
if (hospital['id'] == filters!.hospital) {
|
||||||
|
hospitalCTRL.text = hospital['name']!;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
isInit = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context,
|
||||||
|
Routes.itemResultScreen,
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Items'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context)
|
||||||
|
.pushReplacementNamed(Routes.itemResultScreen),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Filter Items',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 8,
|
||||||
|
child: TextFormField(
|
||||||
|
controller: idCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Item ID',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_itemNameFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Spacer(),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
print(result);
|
||||||
|
idCTRL.text = result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: nameCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Item Name',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _itemNameFocusNode,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_itemUdiFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 8,
|
||||||
|
child: TextFormField(
|
||||||
|
controller: udiCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'UDI',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _itemUdiFocusNode,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_itemSizeFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
print(result);
|
||||||
|
idCTRL.text = result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30.0,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: sizeCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Size',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _itemSizeFocusNode,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_itemSpecificFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: specificCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Specific',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _itemSpecificFocusNode,
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
FilterHospitalBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
hospitalCTRL: hospitalCTRL,
|
||||||
|
hospitalVals: hospitalVals,
|
||||||
|
label: 'Hospital',
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 90,
|
||||||
|
),
|
||||||
|
ItemFilterSaveButton(
|
||||||
|
hospitalVals: hospitalVals,
|
||||||
|
hospitalCTRL: hospitalCTRL,
|
||||||
|
idCTRL: idCTRL,
|
||||||
|
nameCTRL: nameCTRL,
|
||||||
|
udiCTRL: udiCTRL,
|
||||||
|
sizeCTRL: sizeCTRL,
|
||||||
|
specificCTRL: specificCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
firstColor: kBlue,
|
||||||
|
secondColor: kBlueSub,
|
||||||
|
push: Routes.itemResultScreen,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,294 @@
|
|||||||
|
import 'package:cssd/config/colors.dart';
|
||||||
|
import 'package:cssd/providers/items.dart';
|
||||||
|
import 'package:cssd/widgets/ItemScreens/Filter/item_filter_object.dart';
|
||||||
|
import 'package:cssd/widgets/ItemScreens/Result/item_data_box.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/CycleScreens/Result/banner.dart';
|
||||||
|
import '../../widgets/CycleScreens/Result/search_box.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class ItemResultScreen extends StatefulWidget {
|
||||||
|
final bool? isAdmin;
|
||||||
|
|
||||||
|
ItemResultScreen({this.isAdmin});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_ItemResultScreenState createState() => _ItemResultScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ItemResultScreenState extends State<ItemResultScreen> {
|
||||||
|
bool _isInit = true;
|
||||||
|
ScrollController? sc;
|
||||||
|
TextEditingController searchCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
sc = new ScrollController();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
if (_isInit) {
|
||||||
|
var testResults = Provider.of<ItemProvider>(context);
|
||||||
|
testResults.setLoading();
|
||||||
|
testResults.resetPageNumber();
|
||||||
|
testResults.getItemResults().then((_) {
|
||||||
|
testResults.resetLoading();
|
||||||
|
sc!.addListener(
|
||||||
|
() {
|
||||||
|
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
||||||
|
searchCTRL.text == '') {
|
||||||
|
var testResults = Provider.of<ItemProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
);
|
||||||
|
testResults.getItemResults();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_isInit = false;
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
floatingActionButton: ItemResultFloatingButton(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Home'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 20,
|
||||||
|
right: 20,
|
||||||
|
bottom: 60,
|
||||||
|
left: 20,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
ResultBanner(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
text: 'Items',
|
||||||
|
push: Routes.itemFilterScreen,
|
||||||
|
),
|
||||||
|
Consumer<ItemProvider>(
|
||||||
|
builder: (ctx, item, _) {
|
||||||
|
return Container(
|
||||||
|
height: 50,
|
||||||
|
child: ListView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
shrinkWrap: true,
|
||||||
|
children: <Widget>[
|
||||||
|
item.filters!.id != ''
|
||||||
|
? ItemFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'ID',
|
||||||
|
id: '',
|
||||||
|
name: item.filters!.name,
|
||||||
|
udi: item.filters!.udi,
|
||||||
|
hospital: item.filters!.hospital,
|
||||||
|
size: item.filters!.size,
|
||||||
|
specific: item.filters!.specific,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
item.filters!.name != ''
|
||||||
|
? ItemFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Item Name',
|
||||||
|
id: item.filters!.id,
|
||||||
|
name: '',
|
||||||
|
udi: item.filters!.udi,
|
||||||
|
hospital: item.filters!.hospital,
|
||||||
|
size: item.filters!.size,
|
||||||
|
specific: item.filters!.specific,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
item.filters!.udi != ''
|
||||||
|
? ItemFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'UDI',
|
||||||
|
id: item.filters!.id,
|
||||||
|
name: item.filters!.name,
|
||||||
|
udi: '',
|
||||||
|
hospital: item.filters!.hospital,
|
||||||
|
size: item.filters!.size,
|
||||||
|
specific: item.filters!.specific,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
item.filters!.hospital != ''
|
||||||
|
? ItemFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Hospital',
|
||||||
|
id: item.filters!.id,
|
||||||
|
name: item.filters!.name,
|
||||||
|
hospital: '',
|
||||||
|
udi: item.filters!.udi,
|
||||||
|
size: item.filters!.size,
|
||||||
|
specific: item.filters!.specific,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
item.filters!.size != ''
|
||||||
|
? ItemFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Size',
|
||||||
|
id: item.filters!.id,
|
||||||
|
name: item.filters!.name,
|
||||||
|
udi: item.filters!.udi,
|
||||||
|
hospital: item.filters!.hospital,
|
||||||
|
size: '',
|
||||||
|
specific: item.filters!.specific,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
item.filters!.specific != ''
|
||||||
|
? ItemFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Specific',
|
||||||
|
id: item.filters!.id,
|
||||||
|
name: item.filters!.name,
|
||||||
|
udi: item.filters!.udi,
|
||||||
|
hospital: item.filters!.hospital,
|
||||||
|
size: item.filters!.size,
|
||||||
|
specific: '',
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ResultSearchBox(
|
||||||
|
searchCTRL: searchCTRL,
|
||||||
|
text: 'item',
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
onChanged: (value) {
|
||||||
|
Provider.of<ItemProvider>(context, listen: false)
|
||||||
|
.search(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Consumer<ItemProvider>(
|
||||||
|
builder: (context, itemResults, _) {
|
||||||
|
return itemResults.isloading
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
controller: sc,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
// remove extra ,
|
||||||
|
return ItemItemBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
item: itemResults.items?[index],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemCount: itemResults.items?.length,
|
||||||
|
shrinkWrap: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ItemResultFloatingButton extends StatelessWidget {
|
||||||
|
const ItemResultFloatingButton({
|
||||||
|
Key? key,
|
||||||
|
required double deviceBlockSize,
|
||||||
|
}) : _deviceBlockSize = deviceBlockSize,
|
||||||
|
super(key: key);
|
||||||
|
|
||||||
|
final double _deviceBlockSize;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: <Widget>[
|
||||||
|
InkWell(
|
||||||
|
customBorder: CircleBorder(),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pushNamed(Routes.itemScanScreen);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(2.5 * _deviceBlockSize),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 7.1 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 2 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
customBorder: CircleBorder(),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pushReplacementNamed(Routes.itemAddScreen);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(_deviceBlockSize),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: kBlue,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.add,
|
||||||
|
size: 10 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
import 'package:cssd/config/colors.dart';
|
||||||
|
import 'package:cssd/utils/scan.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class ItemScanScreen extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() {
|
||||||
|
return _ItemScanScreenState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ItemScanScreenState extends State<ItemScanScreen> {
|
||||||
|
TextEditingController idCTRL = new TextEditingController();
|
||||||
|
final _form = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Items'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? ListView(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(top: 30),
|
||||||
|
child: Text(
|
||||||
|
'Looking for a Item?',
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 5.5 * _deviceBlockSize,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.symmetric(vertical: 10),
|
||||||
|
height: 200,
|
||||||
|
decoration: BoxDecoration(border: Border.all()),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'Please Scan The Item Barcode',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
launch(
|
||||||
|
'https://cssd-doc.com/Show/Item/$result',
|
||||||
|
);
|
||||||
|
// Navigator.of(context).pushNamed(
|
||||||
|
// Routes.cycleDetailScreen,
|
||||||
|
// arguments: result,
|
||||||
|
// );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.0,
|
||||||
|
),
|
||||||
|
Form(
|
||||||
|
key: _form,
|
||||||
|
child: TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Id required!!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: idCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Or enter a Item ID',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
// borderRadius: BorderRadius.only(Radius.circular(4)),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
if (!_form.currentState!.validate()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
launch(
|
||||||
|
'https://cssd-doc.com/Show/Item/${idCTRL.text}',
|
||||||
|
);
|
||||||
|
// Navigator.of(context).pushNamed(
|
||||||
|
// Routes.cycleDetailScreen,
|
||||||
|
// arguments: idCTRL.text,
|
||||||
|
// );
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 5 * _deviceBlockSize,
|
||||||
|
vertical: 10,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
colors: [kBlue, kBlueSub],
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(7),
|
||||||
|
),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'Search',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,316 @@
|
|||||||
|
import 'package:cssd/models/item_model.dart';
|
||||||
|
import 'package:cssd/providers/items.dart';
|
||||||
|
import 'package:cssd/widgets/ItemScreens/Add/item_update_button.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class ItemUpdateScreen extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_ItemUpdateScreenState createState() => _ItemUpdateScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ItemUpdateScreenState extends State<ItemUpdateScreen> {
|
||||||
|
final _itemSizeFocusNode = FocusNode();
|
||||||
|
final _itemSpecificFocusNode = FocusNode();
|
||||||
|
final _itemUdiFocusNode = FocusNode();
|
||||||
|
final _descriptionFocusNode = FocusNode();
|
||||||
|
TextEditingController descriptionCTRL = new TextEditingController();
|
||||||
|
TextEditingController udiCTRL = new TextEditingController();
|
||||||
|
TextEditingController nameCTRL = new TextEditingController();
|
||||||
|
TextEditingController specificCTRL = new TextEditingController();
|
||||||
|
TextEditingController sizeCTRL = new TextEditingController();
|
||||||
|
TextEditingController dateCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
final _form = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
bool isEmpty = false;
|
||||||
|
bool isInit = true;
|
||||||
|
ItemDetailObject? datas;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() async {
|
||||||
|
if (isInit) {
|
||||||
|
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||||
|
await Provider.of<ItemProvider>(context, listen: false)
|
||||||
|
.showItemResult(_id.toString())
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
datas = result;
|
||||||
|
nameCTRL.text = datas!.name;
|
||||||
|
udiCTRL.text = datas!.udi;
|
||||||
|
descriptionCTRL.text = datas!.description;
|
||||||
|
sizeCTRL.text = datas!.size;
|
||||||
|
specificCTRL.text = datas!.specific;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
await Provider.of<ItemProvider>(context, listen: false)
|
||||||
|
.getItemResults()
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
isInit = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context,
|
||||||
|
Routes.itemResultScreen,
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
title: Text('Items'),
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context)
|
||||||
|
.pushReplacementNamed(Routes.itemResultScreen),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(color: Colors.black),
|
||||||
|
)
|
||||||
|
: Form(
|
||||||
|
key: _form,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Update a Item',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 6 * _deviceBlockSize,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Name required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: nameCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Item Name',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_itemSizeFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Size required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: sizeCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Size',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _itemSizeFocusNode,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_itemSpecificFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: specificCTRL,
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Specific required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Specific',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
focusNode: _itemSpecificFocusNode,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_itemUdiFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: udiCTRL,
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'UDI required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'UDI',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
focusNode: _itemUdiFocusNode,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_descriptionFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: descriptionCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Description',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.multiline,
|
||||||
|
focusNode: _descriptionFocusNode,
|
||||||
|
minLines: 1,
|
||||||
|
maxLines: 5,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
ItemUpdateButton(
|
||||||
|
form: _form,
|
||||||
|
id: datas!.id,
|
||||||
|
nameCTRL: nameCTRL,
|
||||||
|
udiCTRL: udiCTRL,
|
||||||
|
sizeCTRL: sizeCTRL,
|
||||||
|
specificCTRL: specificCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
descriptionCTRL: descriptionCTRL,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,353 @@
|
|||||||
|
import 'package:cssd/config/colors.dart';
|
||||||
|
import 'package:cssd/utils/scan.dart';
|
||||||
|
import 'package:cssd/widgets/LabelScreens/Add/add_package_box.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:intl/intl.dart' as DateEditor;
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../providers/labels.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
import '../../widgets/LabelScreens/Add/date_picker.dart';
|
||||||
|
import '../../widgets/LabelScreens/Add/save_button.dart';
|
||||||
|
|
||||||
|
class LabelAddScreen extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_LabelAddScreenState createState() => _LabelAddScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LabelAddScreenState extends State<LabelAddScreen> {
|
||||||
|
final _cycleNumberFocusNode = FocusNode();
|
||||||
|
TextEditingController lotNumberCTRL = new TextEditingController();
|
||||||
|
TextEditingController cycleNumberCTRL = new TextEditingController();
|
||||||
|
TextEditingController striizerIdCTRL = new TextEditingController();
|
||||||
|
TextEditingController sDateCTRL = new TextEditingController();
|
||||||
|
TextEditingController eDateCTRL = new TextEditingController();
|
||||||
|
TextEditingController packageCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
DateTime? dateTimeS;
|
||||||
|
|
||||||
|
final _form = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
List<Map<String, String>> packageVals = [];
|
||||||
|
List<String> packageValue = [];
|
||||||
|
bool isInit = true;
|
||||||
|
|
||||||
|
List<TextEditingController> labelsCTRL = [TextEditingController()];
|
||||||
|
int curLabelVal = 1;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
sDateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||||
|
eDateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() async {
|
||||||
|
if (isInit) {
|
||||||
|
var labelProviderObject = Provider.of<LabelsProvider>(context);
|
||||||
|
labelProviderObject.resetPackageVals();
|
||||||
|
labelProviderObject.getPackageFilters().then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
isInit = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context,
|
||||||
|
Routes.labelResultScreen,
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Labels'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context)
|
||||||
|
.pushReplacementNamed(Routes.labelResultScreen),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Form(
|
||||||
|
key: _form,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Add a Label',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 6 * _deviceBlockSize,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 8,
|
||||||
|
child: TextFormField(
|
||||||
|
onChanged: (val) {
|
||||||
|
setState(() {
|
||||||
|
lotNumberCTRL.text = val +
|
||||||
|
' - ' +
|
||||||
|
cycleNumberCTRL.text;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Strilizer ID required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: striizerIdCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons
|
||||||
|
.sortNumericDown,
|
||||||
|
size: 7 * _deviceBlockSize),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Strilizer ID',
|
||||||
|
contentPadding:
|
||||||
|
EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType:
|
||||||
|
TextInputType.visiblePassword,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context).requestFocus(
|
||||||
|
_cycleNumberFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
print(result);
|
||||||
|
striizerIdCTRL.text = result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
onChanged: (val) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
lotNumberCTRL.text =
|
||||||
|
striizerIdCTRL.text + ' - ' + val;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Cycle number required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: cycleNumberCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Cycle Number',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _cycleNumberFocusNode,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
readOnly: true,
|
||||||
|
controller: lotNumberCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Lot Number',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.symmetric(vertical: 10),
|
||||||
|
child: Text(
|
||||||
|
'Packages included',
|
||||||
|
style: TextStyle(
|
||||||
|
color: kLightBlue,
|
||||||
|
letterSpacing: 2,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Consumer<LabelsProvider>(
|
||||||
|
builder: (ctx, labelProvider, _) =>
|
||||||
|
ListView.builder(
|
||||||
|
physics: NeverScrollableScrollPhysics(),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemBuilder: (ctx, index) =>
|
||||||
|
AddPackageBox(
|
||||||
|
text: 'Package ID',
|
||||||
|
iconColor: kLightBlueSub,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
values:
|
||||||
|
labelProvider.packageValues[index],
|
||||||
|
vals: labelProvider.packageVals,
|
||||||
|
initialLabelValue:
|
||||||
|
labelProvider.initialPackageValue,
|
||||||
|
index: index,
|
||||||
|
),
|
||||||
|
itemCount:
|
||||||
|
labelProvider.packageValues.length,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
LabelAddDatePicker(
|
||||||
|
dateCTRL: sDateCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Sterile Date',
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
LabelAddDatePicker(
|
||||||
|
dateCTRL: eDateCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Expire Date',
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
LabelAddSaveButton(
|
||||||
|
form: _form,
|
||||||
|
lotNumberCTRL: lotNumberCTRL,
|
||||||
|
cycleNumberCTRL: cycleNumberCTRL,
|
||||||
|
sDateCTRL: sDateCTRL,
|
||||||
|
packageValue: packageValue,
|
||||||
|
eDateCTRL: eDateCTRL,
|
||||||
|
striizerIdCTRL: striizerIdCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
+88
-85
@@ -1,85 +1,88 @@
|
|||||||
import '../models/label_models.dart';
|
import '../../models/label_models.dart';
|
||||||
import '../providers/connectivity.dart';
|
import '../../providers/connectivity.dart';
|
||||||
import '../providers/labels.dart';
|
import '../../providers/labels.dart';
|
||||||
import '../widgets/Global/internet_error.dart';
|
import '../../widgets/Global/internet_error.dart';
|
||||||
import '../widgets/LabelScreens/Detail/datas_box.dart';
|
import '../../widgets/LabelScreens/Detail/datas_box.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class LabelDetailScreen extends StatefulWidget {
|
class LabelDetailScreen extends StatefulWidget {
|
||||||
// static const route = '/LabelDetailScreen';
|
// static const route = '/LabelDetailScreen';
|
||||||
// final String testResultId;
|
// final String testResultId;
|
||||||
|
|
||||||
// LabelDetailScreen({this.testResultId});
|
// LabelDetailScreen({this.testResultId});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_LabelDetailScreenState createState() => _LabelDetailScreenState();
|
_LabelDetailScreenState createState() => _LabelDetailScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _LabelDetailScreenState extends State<LabelDetailScreen> {
|
class _LabelDetailScreenState extends State<LabelDetailScreen> {
|
||||||
bool isEmpty = false;
|
bool isEmpty = false;
|
||||||
bool isInit = true;
|
bool isInit = true;
|
||||||
LabelDetailsObject datas;
|
LabelDetailsObject? datas;
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() async {
|
void didChangeDependencies() async {
|
||||||
if (isInit) {
|
if (isInit) {
|
||||||
var _id = ModalRoute.of(context).settings.arguments;
|
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||||
await Provider.of<LabelsProvider>(context, listen: false)
|
await Provider.of<LabelsProvider>(context, listen: false)
|
||||||
.showLabelResult(_id.toString())
|
.showLabelResult(_id.toString())
|
||||||
.then(
|
.then(
|
||||||
(result) {
|
(result) {
|
||||||
setState(
|
setState(
|
||||||
() {
|
() {
|
||||||
if (result.id == 'null') {
|
if (result.id == 'null') {
|
||||||
isEmpty = true;
|
isEmpty = true;
|
||||||
}
|
}
|
||||||
datas = result;
|
datas = result;
|
||||||
isInit = false;
|
isInit = false;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
// print(datas);
|
// print(datas);
|
||||||
}
|
}
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final _media = MediaQuery.of(context);
|
final _media = MediaQuery.of(context);
|
||||||
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
final double _devicewidth = _media.size.width;
|
final double _devicewidth = _media.size.width;
|
||||||
final double _deviceBlockSize = _devicewidth / 100;
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
titleSpacing: -10,
|
titleSpacing: -10,
|
||||||
title: Text('Labels'),
|
title: Text('Labels'),
|
||||||
leading: IconButton(
|
backgroundColor: Colors.black,
|
||||||
icon: Icon(
|
leading: IconButton(
|
||||||
Icons.keyboard_arrow_left,
|
icon: Icon(
|
||||||
size: 35,
|
Icons.keyboard_arrow_left,
|
||||||
),
|
size: 35,
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
),
|
||||||
),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
),
|
),
|
||||||
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
|
),
|
||||||
return connection.conStatus != 'offline'
|
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
|
||||||
? isInit
|
return connection.conStatus != 'offline'
|
||||||
? Center(
|
? isInit
|
||||||
child: CircularProgressIndicator(),
|
? Center(
|
||||||
)
|
child: CircularProgressIndicator(
|
||||||
: isEmpty
|
color: Colors.black,
|
||||||
? Center(
|
),
|
||||||
child: Text('This Lable doesnt exists!'),
|
)
|
||||||
)
|
: isEmpty
|
||||||
: LabelDetailsDataBox(
|
? Center(
|
||||||
datas: datas,
|
child: Text('This Label dos\'nt exists!'),
|
||||||
deviceBlockSize: _deviceBlockSize,
|
)
|
||||||
)
|
: LabelDetailsDataBox(
|
||||||
: ConnectionErrorBox();
|
datas: datas!,
|
||||||
}),
|
deviceBlockSize: _deviceBlockSize,
|
||||||
),
|
)
|
||||||
);
|
: ConnectionErrorBox();
|
||||||
}
|
}),
|
||||||
}
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,332 @@
|
|||||||
|
import 'package:cssd/utils/scan.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../models/label_models.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../providers/labels.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
import '../../widgets/LabelScreens/Filter/save_button.dart';
|
||||||
|
import '../../widgets/LabelScreens/Filter/selector_box.dart';
|
||||||
|
|
||||||
|
class LabelFilterScreen extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_LabelFilterScreenState createState() => _LabelFilterScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LabelFilterScreenState extends State<LabelFilterScreen> {
|
||||||
|
final _cycleNumberFocusNode = FocusNode();
|
||||||
|
final _strilizerIdFocusNode = FocusNode();
|
||||||
|
|
||||||
|
TextEditingController labelIdCTRl = new TextEditingController();
|
||||||
|
TextEditingController cycleNumberCTRL = new TextEditingController();
|
||||||
|
TextEditingController striizerIdCTRL = new TextEditingController();
|
||||||
|
TextEditingController hospitalCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
TextEditingController dateCTRL = new TextEditingController();
|
||||||
|
DateTime? dateTimeFrom;
|
||||||
|
|
||||||
|
List<Map<String, String>> hospitalVals = [];
|
||||||
|
bool isInit = true;
|
||||||
|
LabelFilterObject? filters;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
filters = Provider.of<LabelsProvider>(context, listen: false).filters;
|
||||||
|
labelIdCTRl.text = filters!.id;
|
||||||
|
cycleNumberCTRL.text = filters!.cycleNumber;
|
||||||
|
striizerIdCTRL.text = filters!.sterilizerId;
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() async {
|
||||||
|
if (isInit) {
|
||||||
|
await Provider.of<LabelsProvider>(context, listen: false)
|
||||||
|
.getHospitalsFilters()
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
hospitalVals = [
|
||||||
|
{'id': '', 'name': ''}
|
||||||
|
];
|
||||||
|
for (var hospital in result) {
|
||||||
|
hospitalVals.add(hospital);
|
||||||
|
}
|
||||||
|
// hospitalVals = result;
|
||||||
|
filters!.hospital == ''
|
||||||
|
? hospitalCTRL.text = hospitalVals[0]['name']!
|
||||||
|
: hospitalVals.forEach(
|
||||||
|
//id convert to name
|
||||||
|
(hospital) {
|
||||||
|
if (hospital['id'] == filters!.hospital)
|
||||||
|
hospitalCTRL.text = hospital['name']!;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
isInit = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context,
|
||||||
|
Routes.labelResultScreen,
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Labels'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context)
|
||||||
|
.pushReplacementNamed(Routes.labelResultScreen),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Filter Labels',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 8,
|
||||||
|
child: TextFormField(
|
||||||
|
controller: labelIdCTRl,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Label ID',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context).requestFocus(
|
||||||
|
_cycleNumberFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
print(result);
|
||||||
|
labelIdCTRl.text = result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: cycleNumberCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Cycle Number',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _cycleNumberFocusNode,
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_strilizerIdFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 8,
|
||||||
|
child: TextFormField(
|
||||||
|
controller: striizerIdCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Strilizer ID',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
|
keyboardType:
|
||||||
|
TextInputType.visiblePassword,
|
||||||
|
focusNode: _strilizerIdFocusNode,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
print(result);
|
||||||
|
striizerIdCTRL.text = result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
LabelFilterSelectorBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
hospitalCTRL: hospitalCTRL,
|
||||||
|
hospitalVals: hospitalVals,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
LabelFilterSaveButton(
|
||||||
|
hospitalVals: hospitalVals,
|
||||||
|
hospitalCTRL: hospitalCTRL,
|
||||||
|
labelIdCTRl: labelIdCTRl,
|
||||||
|
cycleNumberCTRL: cycleNumberCTRL,
|
||||||
|
striizerIdCTRL: striizerIdCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 50,
|
||||||
|
),
|
||||||
|
// DropDownBox(values: ['Washer ID']),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../providers/labels.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
import '../../widgets/Global/page_header.dart';
|
||||||
|
import '../../widgets/LabelScreens/Result/data_box.dart';
|
||||||
|
import '../../widgets/LabelScreens/Result/filter_chip_box.dart';
|
||||||
|
import '../../widgets/LabelScreens/Result/floating_buttons.dart';
|
||||||
|
import '../../widgets/LabelScreens/Result/search_box.dart';
|
||||||
|
|
||||||
|
class LabelResultScreen extends StatefulWidget {
|
||||||
|
// static const route = '/LabelResultScreen';
|
||||||
|
final bool? isAdmin;
|
||||||
|
|
||||||
|
LabelResultScreen({this.isAdmin});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_LabelResultScreenState createState() => _LabelResultScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LabelResultScreenState extends State<LabelResultScreen> {
|
||||||
|
bool _isInit = true;
|
||||||
|
ScrollController? sc;
|
||||||
|
TextEditingController searchCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
sc = new ScrollController();
|
||||||
|
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
if (_isInit) {
|
||||||
|
var labelProviderObject =
|
||||||
|
Provider.of<LabelsProvider>(context, listen: false);
|
||||||
|
labelProviderObject.setLoading();
|
||||||
|
labelProviderObject.resetPageNumber();
|
||||||
|
labelProviderObject.getLabelResults().then((_) {
|
||||||
|
labelProviderObject.resetLoading();
|
||||||
|
sc!.addListener(() {
|
||||||
|
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
||||||
|
searchCTRL.text == '') {
|
||||||
|
var labelProviderObject =
|
||||||
|
Provider.of<LabelsProvider>(context, listen: false);
|
||||||
|
labelProviderObject.getLabelResults();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_isInit = false;
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
floatingActionButton:
|
||||||
|
LabelFloatingButtons(deviceBlockSize: _deviceBlockSize),
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Home'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 20, right: 20, bottom: 60, left: 20),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
PageHeader(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Labels',
|
||||||
|
route: Routes.labelFilterScreen,
|
||||||
|
),
|
||||||
|
Consumer<LabelsProvider>(
|
||||||
|
builder: (context, label, _) {
|
||||||
|
return Container(
|
||||||
|
height: 50,
|
||||||
|
child: ListView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
shrinkWrap: true,
|
||||||
|
children: <Widget>[
|
||||||
|
label.filters.id != ''
|
||||||
|
? LabelFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
id: '',
|
||||||
|
cycleNumber:
|
||||||
|
label.filters.cycleNumber,
|
||||||
|
sterilizerId:
|
||||||
|
label.filters.sterilizerId,
|
||||||
|
hospital: label.filters.hospital,
|
||||||
|
label: 'ID',
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
label.filters.cycleNumber != ''
|
||||||
|
? LabelFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
id: label.filters.id,
|
||||||
|
cycleNumber: '',
|
||||||
|
sterilizerId:
|
||||||
|
label.filters.sterilizerId,
|
||||||
|
hospital: label.filters.hospital,
|
||||||
|
label: 'Cycle Number',
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
label.filters.sterilizerId != ''
|
||||||
|
? LabelFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
id: label.filters.id,
|
||||||
|
cycleNumber:
|
||||||
|
label.filters.cycleNumber,
|
||||||
|
sterilizerId: '',
|
||||||
|
hospital: label.filters.hospital,
|
||||||
|
label: 'Sterilizer ID',
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
label.filters.hospital != ''
|
||||||
|
? LabelFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
id: label.filters.id,
|
||||||
|
cycleNumber:
|
||||||
|
label.filters.cycleNumber,
|
||||||
|
sterilizerId:
|
||||||
|
label.filters.sterilizerId,
|
||||||
|
hospital: '',
|
||||||
|
label: 'Hospital',
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
LabelSearchBox(
|
||||||
|
searchCTRL: searchCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Consumer<LabelsProvider>(
|
||||||
|
builder: (context, labelResults, _) {
|
||||||
|
return labelResults.isloading
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
controller: sc,
|
||||||
|
itemBuilder: (context, index) =>
|
||||||
|
LabelItemBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
item: labelResults.items?[index],
|
||||||
|
),
|
||||||
|
itemCount: labelResults.items?.length,
|
||||||
|
shrinkWrap: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
import '../../widgets/LabelScreens/Scan/input_box.dart';
|
||||||
|
import '../../widgets/LabelScreens/Scan/save_button.dart';
|
||||||
|
import '../../widgets/LabelScreens/Scan/scan_box.dart';
|
||||||
|
// import 'package:flutter/services.dart';
|
||||||
|
// import 'package:barcode_scan2/barcode_scan2.dart';
|
||||||
|
|
||||||
|
class LabelScanScreen extends StatefulWidget {
|
||||||
|
// static const route = '/LabelScanScreen';
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() {
|
||||||
|
return _LabelScanScreenState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LabelScanScreenState extends State<LabelScanScreen> {
|
||||||
|
String testCode = "";
|
||||||
|
TextEditingController idCTRL = new TextEditingController();
|
||||||
|
final _form = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Labels'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? ListView(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(top: 30),
|
||||||
|
child: Text(
|
||||||
|
'Looking for a Label?',
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 5.5 * _deviceBlockSize,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
LabelScanBox(),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Form(
|
||||||
|
key: _form,
|
||||||
|
child: LabelScanInputBox(
|
||||||
|
idCTRL: idCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
FilterScanSaveButton(
|
||||||
|
form: _form,
|
||||||
|
idCTRL: idCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,309 @@
|
|||||||
|
import 'package:cssd/widgets/LabelScreens/Add/selector_box.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:intl/intl.dart' as DateEditor;
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../models/label_models.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../providers/labels.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
import '../../widgets/LabelScreens/Add/date_picker.dart';
|
||||||
|
import '../../widgets/LabelScreens/Add/update_button.dart';
|
||||||
|
|
||||||
|
class LabelUpdateScreen extends StatefulWidget {
|
||||||
|
// static const route = '/LabelUpdateScreen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
_LabelUpdateScreenState createState() => _LabelUpdateScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LabelUpdateScreenState extends State<LabelUpdateScreen> {
|
||||||
|
final _cycleNumberFocusNode = FocusNode();
|
||||||
|
final _lotNumberFocusNode = FocusNode();
|
||||||
|
TextEditingController lotNumberCTRL = new TextEditingController();
|
||||||
|
TextEditingController cycleNumberCTRL = new TextEditingController();
|
||||||
|
TextEditingController striizerIdCTRL = new TextEditingController();
|
||||||
|
TextEditingController sDateCTRL = new TextEditingController();
|
||||||
|
TextEditingController eDateCTRL = new TextEditingController();
|
||||||
|
TextEditingController packageCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
DateTime? dateTimeS;
|
||||||
|
// String sDateValue;
|
||||||
|
// String eDateValue;
|
||||||
|
|
||||||
|
final _form = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
List<Map<String, String>> packageVals = [];
|
||||||
|
List<String> packageValue = [];
|
||||||
|
bool isEmpty = false;
|
||||||
|
bool isInit = true;
|
||||||
|
LabelDetailsObject? datas;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
sDateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||||
|
eDateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() async {
|
||||||
|
if (isInit) {
|
||||||
|
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||||
|
await Provider.of<LabelsProvider>(context, listen: false)
|
||||||
|
.showLabelResult(_id.toString())
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
// if (result.id == 'null') {
|
||||||
|
// isEmpty = true;
|
||||||
|
// }
|
||||||
|
datas = result;
|
||||||
|
lotNumberCTRL.text = datas!.lotNumber;
|
||||||
|
cycleNumberCTRL.text = datas!.cycleNumber;
|
||||||
|
striizerIdCTRL.text = datas!.sterileId;
|
||||||
|
sDateCTRL.text = datas!.sterileDate;
|
||||||
|
eDateCTRL.text = datas!.expireDate;
|
||||||
|
packageValue.add(datas!.packageId);
|
||||||
|
packageValue.add(datas!.package);
|
||||||
|
packageCTRL.text = datas!.package;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
await Provider.of<LabelsProvider>(context, listen: false)
|
||||||
|
.getPackageFilters()
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
// packageVals = result.map((value) => {"name": value}).toList();
|
||||||
|
isInit = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context,
|
||||||
|
Routes.labelResultScreen,
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
title: Text('Labels'),
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context)
|
||||||
|
.pushReplacementNamed(Routes.labelResultScreen),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(color: Colors.black),
|
||||||
|
)
|
||||||
|
: Form(
|
||||||
|
key: _form,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Update a Label',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 6 * _deviceBlockSize,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
onChanged: (val) {
|
||||||
|
setState(() {
|
||||||
|
lotNumberCTRL.text =
|
||||||
|
val + ' - ' + cycleNumberCTRL.text;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Strilizer ID required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: striizerIdCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 7 * _deviceBlockSize),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Strilizer ID',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_cycleNumberFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
onChanged: (val) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
lotNumberCTRL.text =
|
||||||
|
striizerIdCTRL.text + ' - ' + val;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Cycle number required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: cycleNumberCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Cycle Number',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _cycleNumberFocusNode,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_lotNumberFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
readOnly: true,
|
||||||
|
controller: lotNumberCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Lot Number',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
focusNode: _lotNumberFocusNode,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
LabelAddSelectorBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
packageCTRL: packageCTRL,
|
||||||
|
packageVals: packageVals,
|
||||||
|
packageValue: packageValue,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
LabelAddDatePicker(
|
||||||
|
dateCTRL: sDateCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Sterile Date',
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
LabelAddDatePicker(
|
||||||
|
dateCTRL: eDateCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Expire Date',
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
LabelUpdateButton(
|
||||||
|
form: _form,
|
||||||
|
id: datas!.id,
|
||||||
|
lotNumberCTRL: lotNumberCTRL,
|
||||||
|
cycleNumberCTRL: cycleNumberCTRL,
|
||||||
|
sDateCTRL: sDateCTRL,
|
||||||
|
packageValue: packageValue,
|
||||||
|
eDateCTRL: eDateCTRL,
|
||||||
|
striizerIdCTRL: striizerIdCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
+196
-198
@@ -1,198 +1,196 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '../config/routes.dart';
|
import '../../config/routes.dart';
|
||||||
import '../providers/auth.dart';
|
import '../../providers/auth.dart';
|
||||||
import '../providers/connectivity.dart';
|
import '../../providers/connectivity.dart';
|
||||||
import '../widgets/Global/internet_error.dart';
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
class ForgetPassScreen extends StatefulWidget {
|
class ForgetPassScreen extends StatefulWidget {
|
||||||
// static const route = '/HomeScreen';
|
// static const route = '/HomeScreen';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() {
|
State<StatefulWidget> createState() {
|
||||||
return _ForgetPassScreenState();
|
return _ForgetPassScreenState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ForgetPassScreenState extends State<ForgetPassScreen> {
|
class _ForgetPassScreenState extends State<ForgetPassScreen> {
|
||||||
final _form = GlobalKey<FormState>();
|
final _form = GlobalKey<FormState>();
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
final cellNumberController = TextEditingController();
|
final cellNumberController = TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
cellNumberController.text = '';
|
cellNumberController.text = '';
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showDialog(String message) {
|
void _showDialog(String message) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (ctx) => AlertDialog(
|
builder: (ctx) => AlertDialog(
|
||||||
title: Text('Error'),
|
title: Text('Error'),
|
||||||
content: Text(message),
|
content: Text(message),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text('Ok'),
|
child: Text('Ok'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(ctx).pop();
|
Navigator.of(ctx).pop();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _requestCode() async {
|
void _requestCode() async {
|
||||||
if (!_form.currentState.validate()) {
|
if (!_form.currentState!.validate()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_form.currentState.save();
|
_form.currentState!.save();
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
});
|
});
|
||||||
// try {
|
// try {
|
||||||
await Provider.of<Auth>(context, listen: false)
|
await Provider.of<Auth>(context, listen: false)
|
||||||
.requestCode(
|
.requestCode(
|
||||||
cellNumberController.text,
|
cellNumberController.text,
|
||||||
)
|
)
|
||||||
.then(
|
.then(
|
||||||
(result) {
|
(result) {
|
||||||
if (result == 'NotUser') {
|
if (result == 'NotUser') {
|
||||||
_showDialog('User Not Found!!!');
|
_showDialog('User Not Found!!!');
|
||||||
setState(
|
setState(
|
||||||
() {
|
() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// _showDialog('User or password incorrect!');
|
// _showDialog('User or password incorrect!');
|
||||||
Navigator.of(context).popAndPushNamed(Routes.sendCodeScreen);
|
Navigator.of(context).popAndPushNamed(Routes.sendCodeScreen);
|
||||||
// setState(
|
// setState(
|
||||||
// () {
|
// () {
|
||||||
// _isLoading = false;
|
// _isLoading = false;
|
||||||
// },
|
// },
|
||||||
// );
|
// );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final _media = MediaQuery.of(context);
|
final _media = MediaQuery.of(context);
|
||||||
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
final double _devicewidth = _media.size.width;
|
final double _devicewidth = _media.size.width;
|
||||||
final double _deviceBlockSize = _devicewidth / 100;
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
title: Text('CSSD'),
|
title: Text('CSSD'),
|
||||||
),
|
backgroundColor: Colors.black,
|
||||||
body: Selector<ConnectivityProvider, String>(
|
),
|
||||||
builder: (ctx, value, _) => value != 'offline'
|
body: Selector<ConnectivityProvider, String>(
|
||||||
? _isLoading
|
builder: (ctx, value, _) => value != 'offline'
|
||||||
? Center(
|
? _isLoading
|
||||||
child: CircularProgressIndicator(),
|
? Center(
|
||||||
)
|
child: CircularProgressIndicator(
|
||||||
: Form(
|
color: Colors.black,
|
||||||
key: _form,
|
),
|
||||||
child: ListView(
|
)
|
||||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
: Form(
|
||||||
children: <Widget>[
|
key: _form,
|
||||||
Container(
|
child: ListView(
|
||||||
padding: EdgeInsets.symmetric(vertical: 20),
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||||
child: Text(
|
children: <Widget>[
|
||||||
'FORGET PASSWORD',
|
Container(
|
||||||
textAlign: TextAlign.left,
|
padding: EdgeInsets.symmetric(vertical: 20),
|
||||||
style: TextStyle(
|
child: Text(
|
||||||
color: Colors.black,
|
'Forget Password',
|
||||||
fontSize: 5 * _deviceBlockSize,
|
textAlign: TextAlign.left,
|
||||||
letterSpacing: 3,
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w700,
|
color: Colors.black,
|
||||||
),
|
fontSize: 5 * _deviceBlockSize,
|
||||||
),
|
letterSpacing: 3,
|
||||||
),
|
fontWeight: FontWeight.w700,
|
||||||
TextFormField(
|
),
|
||||||
validator: (value) {
|
),
|
||||||
if (value.isEmpty) {
|
),
|
||||||
return 'Cell number is required.';
|
TextFormField(
|
||||||
}
|
validator: (value) {
|
||||||
RegExp regExp =
|
if (value!.isEmpty) {
|
||||||
RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$');
|
return 'Cell number is required.';
|
||||||
if (!regExp.hasMatch(value)) {
|
}
|
||||||
return 'Enter a valid cell number';
|
RegExp regExp =
|
||||||
}
|
RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$');
|
||||||
return null;
|
if (!regExp.hasMatch(value)) {
|
||||||
},
|
return 'Enter a valid cell number';
|
||||||
controller: cellNumberController,
|
}
|
||||||
decoration: InputDecoration(
|
return null;
|
||||||
icon: Icon(
|
},
|
||||||
Icons.call,
|
controller: cellNumberController,
|
||||||
size: 6 * _deviceBlockSize,
|
decoration: InputDecoration(
|
||||||
),
|
icon: Icon(
|
||||||
labelStyle: TextStyle(
|
Icons.call,
|
||||||
fontWeight: FontWeight.w100,
|
size: 6 * _deviceBlockSize,
|
||||||
fontSize: 4 * _deviceBlockSize,
|
),
|
||||||
),
|
labelStyle: TextStyle(
|
||||||
labelText: 'Cell Number',
|
fontWeight: FontWeight.w100,
|
||||||
isDense: true,
|
fontSize: 4 * _deviceBlockSize,
|
||||||
contentPadding: EdgeInsets.symmetric(
|
),
|
||||||
vertical: 2, horizontal: 3),
|
labelText: 'Cell Number',
|
||||||
),
|
isDense: true,
|
||||||
style: TextStyle(
|
contentPadding: EdgeInsets.symmetric(
|
||||||
fontWeight: FontWeight.w700,
|
vertical: 2, horizontal: 3),
|
||||||
fontSize: 5 * _deviceBlockSize,
|
),
|
||||||
),
|
style: TextStyle(
|
||||||
keyboardType: TextInputType.phone,
|
fontWeight: FontWeight.w700,
|
||||||
textInputAction: TextInputAction.next,
|
fontSize: 5 * _deviceBlockSize,
|
||||||
onSaved: (value) {
|
),
|
||||||
cellNumberController.text = value;
|
keyboardType: TextInputType.phone,
|
||||||
},
|
textInputAction: TextInputAction.next,
|
||||||
),
|
onSaved: (value) {
|
||||||
SizedBox(height: 40),
|
cellNumberController.text = value!;
|
||||||
Row(
|
},
|
||||||
children: <Widget>[
|
),
|
||||||
InkWell(
|
SizedBox(height: 40),
|
||||||
onTap: () => _requestCode(),
|
Row(
|
||||||
child: Container(
|
children: <Widget>[
|
||||||
width: 40 * _deviceBlockSize,
|
InkWell(
|
||||||
padding: EdgeInsets.symmetric(
|
onTap: () => _requestCode(),
|
||||||
horizontal: 5 * _deviceBlockSize,
|
child: Container(
|
||||||
vertical: 10,
|
width: 88 * _deviceBlockSize,
|
||||||
),
|
padding: EdgeInsets.all(10),
|
||||||
// margin:
|
decoration: BoxDecoration(
|
||||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
color: Colors.black,
|
||||||
decoration: BoxDecoration(
|
borderRadius: BorderRadius.circular(7),
|
||||||
gradient: LinearGradient(
|
),
|
||||||
colors: [Colors.blue, Colors.green],
|
child: Center(
|
||||||
),
|
child: Text(
|
||||||
borderRadius: BorderRadius.circular(7),
|
'Request Code',
|
||||||
),
|
style: TextStyle(color: Colors.white),
|
||||||
child: Text(
|
),
|
||||||
'Request Code',
|
),
|
||||||
style: TextStyle(color: Colors.white),
|
),
|
||||||
),
|
),
|
||||||
),
|
Spacer(),
|
||||||
),
|
],
|
||||||
Spacer(),
|
),
|
||||||
],
|
SizedBox(height: 10),
|
||||||
),
|
],
|
||||||
SizedBox(height: 10),
|
),
|
||||||
],
|
)
|
||||||
),
|
: ConnectionErrorBox(),
|
||||||
)
|
selector: (_, connectivity) => connectivity.conStatus,
|
||||||
: ConnectionErrorBox(),
|
),
|
||||||
selector: (_, connectivity) => connectivity.conStatus,
|
),
|
||||||
),
|
);
|
||||||
),
|
}
|
||||||
);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,289 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/auth.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class LoginScreen extends StatefulWidget {
|
||||||
|
// static const route = '/HomeScreen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() {
|
||||||
|
return _LoginScreenState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LoginScreenState extends State<LoginScreen> {
|
||||||
|
final _passwordFocusNode = FocusNode();
|
||||||
|
final _form = GlobalKey<FormState>();
|
||||||
|
bool _isLoading = false;
|
||||||
|
final cellNumberController = TextEditingController();
|
||||||
|
final passwordController = TextEditingController();
|
||||||
|
|
||||||
|
bool _hidePass = true;
|
||||||
|
Map<String, dynamic> map = Map<String, dynamic>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
if (map['cellNumber'] != null) {
|
||||||
|
cellNumberController.text = map['cellNumber'];
|
||||||
|
}
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_passwordFocusNode.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showDialog(String message) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (ctx) => AlertDialog(
|
||||||
|
title: Text('Error'),
|
||||||
|
content: Text(message),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: Text('Ok'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(ctx).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _login() async {
|
||||||
|
if (!_form.currentState!.validate()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_form.currentState!.save();
|
||||||
|
setState(() {
|
||||||
|
_isLoading = true;
|
||||||
|
});
|
||||||
|
await Provider.of<Auth>(context, listen: false)
|
||||||
|
.login(
|
||||||
|
map['cellNumber'],
|
||||||
|
map['password'],
|
||||||
|
)
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
if (result == 'error') {
|
||||||
|
_showDialog('Something went wrong!');
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
_isLoading = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else if (result == 'badinput') {
|
||||||
|
_showDialog('User or password incorrect!');
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
_isLoading = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
|
title: Text('CSSD'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
),
|
||||||
|
body: Selector<ConnectivityProvider, String>(
|
||||||
|
builder: (ctx, value, _) => value != 'offline'
|
||||||
|
? _isLoading
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Form(
|
||||||
|
key: _form,
|
||||||
|
child: ListView(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 20),
|
||||||
|
child: Text(
|
||||||
|
'Login',
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 6 * _deviceBlockSize,
|
||||||
|
letterSpacing: 3,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'Call number is required.';
|
||||||
|
}
|
||||||
|
RegExp regExp =
|
||||||
|
RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$');
|
||||||
|
if (!regExp.hasMatch(value)) {
|
||||||
|
return 'Enter a valid cell number';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: cellNumberController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.call,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Call Number',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.phone,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_passwordFocusNode);
|
||||||
|
},
|
||||||
|
onSaved: (value) {
|
||||||
|
map['cellNumber'] = value;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'Password is required.';
|
||||||
|
}
|
||||||
|
if (value.length < 8) {
|
||||||
|
return 'Password at least is 8 characters.';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
obscureText: _hidePass,
|
||||||
|
controller: passwordController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.starOfLife,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Password',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
suffixIcon: InkWell(
|
||||||
|
child: Icon(FontAwesomeIcons.eye),
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
_hidePass = !_hidePass;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
_login();
|
||||||
|
},
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
focusNode: _passwordFocusNode,
|
||||||
|
onSaved: (value) {
|
||||||
|
map['password'] = value;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(height: 40),
|
||||||
|
InkWell(
|
||||||
|
onTap: () => _login(),
|
||||||
|
child: Container(
|
||||||
|
width: _devicewidth,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.black,
|
||||||
|
borderRadius: BorderRadius.circular(7),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
Icon(
|
||||||
|
Icons.exit_to_app,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 5.0,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Login',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 10),
|
||||||
|
TextButton(
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'Forgot Password ?',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black54,
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context)
|
||||||
|
.pushNamed(Routes.forgetPassScreen),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox(),
|
||||||
|
selector: (_, connectivity) => connectivity.conStatus,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,243 +1,239 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '../providers/auth.dart';
|
import '../../providers/auth.dart';
|
||||||
import '../providers/connectivity.dart';
|
import '../../providers/connectivity.dart';
|
||||||
import '../widgets/Global/internet_error.dart';
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
class RePassScreen extends StatefulWidget {
|
class RePassScreen extends StatefulWidget {
|
||||||
// static const route = '/HomeScreen';
|
// static const route = '/HomeScreen';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() {
|
State<StatefulWidget> createState() {
|
||||||
return _RePassScreenState();
|
return _RePassScreenState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _RePassScreenState extends State<RePassScreen> {
|
class _RePassScreenState extends State<RePassScreen> {
|
||||||
final _form = GlobalKey<FormState>();
|
final _form = GlobalKey<FormState>();
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
// final cellNumberController = TextEditingController();
|
// final cellNumberController = TextEditingController();
|
||||||
final passwordController = new TextEditingController();
|
final passwordController = new TextEditingController();
|
||||||
final rePasswordController = new TextEditingController();
|
final rePasswordController = new TextEditingController();
|
||||||
String token = 'Bearer ';
|
String token = 'Bearer ';
|
||||||
// String token = 'Bearer ';
|
// String token = 'Bearer ';
|
||||||
|
|
||||||
bool _hidePass = true;
|
bool _hidePass = true;
|
||||||
bool _hideRePass = true;
|
bool _hideRePass = true;
|
||||||
bool isInit = true;
|
bool isInit = true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
if (isInit) {
|
if (isInit) {
|
||||||
token += ModalRoute.of(context).settings.arguments;
|
token += ModalRoute.of(context)!.settings.arguments.toString();
|
||||||
isInit = false;
|
isInit = false;
|
||||||
}
|
}
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _showDialog(String message) async {
|
Future<void> _showDialog(String message) async {
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (ctx) => AlertDialog(
|
builder: (ctx) => AlertDialog(
|
||||||
content: Text(message),
|
content: Text(message),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text('Ok'),
|
child: Text('Ok'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(ctx).pop();
|
Navigator.of(ctx).pop();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _sendRePass() async {
|
void _sendRePass() async {
|
||||||
if (!_form.currentState.validate()) {
|
if (!_form.currentState!.validate()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_form.currentState.save();
|
_form.currentState!.save();
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
});
|
});
|
||||||
await Provider.of<Auth>(context, listen: false)
|
await Provider.of<Auth>(context, listen: false)
|
||||||
.sendRePass(passwordController.text, token)
|
.sendRePass(passwordController.text, token)
|
||||||
.then((value) async {
|
.then((value) async {
|
||||||
if (value == 'done') {
|
if (value == 'done') {
|
||||||
await _showDialog(
|
await _showDialog(
|
||||||
'Password changed successfully.Now login to your account.');
|
'Password changed successfully.Now login to your account.');
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final _media = MediaQuery.of(context);
|
final _media = MediaQuery.of(context);
|
||||||
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
final double _devicewidth = _media.size.width;
|
final double _devicewidth = _media.size.width;
|
||||||
final double _deviceBlockSize = _devicewidth / 100;
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
title: Text('CSSD'),
|
title: Text('CSSD'),
|
||||||
),
|
backgroundColor: Colors.black,
|
||||||
body: Selector<ConnectivityProvider, String>(
|
),
|
||||||
builder: (ctx, value, _) => value != 'offline'
|
body: Selector<ConnectivityProvider, String>(
|
||||||
? _isLoading
|
builder: (ctx, value, _) => value != 'offline'
|
||||||
? Center(
|
? _isLoading
|
||||||
child: CircularProgressIndicator(),
|
? Center(
|
||||||
)
|
child: CircularProgressIndicator(
|
||||||
: Form(
|
color: Colors.black,
|
||||||
key: _form,
|
),
|
||||||
child: ListView(
|
)
|
||||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
: Form(
|
||||||
children: <Widget>[
|
key: _form,
|
||||||
Container(
|
child: ListView(
|
||||||
padding: EdgeInsets.symmetric(vertical: 20),
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||||
child: Text(
|
children: <Widget>[
|
||||||
'CHANGE PASSWORD',
|
Container(
|
||||||
textAlign: TextAlign.left,
|
padding: EdgeInsets.symmetric(vertical: 20),
|
||||||
style: TextStyle(
|
child: Text(
|
||||||
color: Colors.black,
|
'CHANGE PASSWORD',
|
||||||
fontSize: 6 * _deviceBlockSize,
|
textAlign: TextAlign.left,
|
||||||
letterSpacing: 3,
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w700,
|
color: Colors.black,
|
||||||
),
|
fontSize: 6 * _deviceBlockSize,
|
||||||
),
|
letterSpacing: 3,
|
||||||
),
|
fontWeight: FontWeight.w700,
|
||||||
TextFormField(
|
),
|
||||||
validator: (value) {
|
),
|
||||||
if (value.isEmpty) {
|
),
|
||||||
return 'Password is required.';
|
TextFormField(
|
||||||
}
|
validator: (value) {
|
||||||
if (value.length < 8) {
|
if (value!.isEmpty) {
|
||||||
return 'Password at least is 8 characters.';
|
return 'Password is required.';
|
||||||
}
|
}
|
||||||
return null;
|
if (value.length < 8) {
|
||||||
},
|
return 'Password at least is 8 characters.';
|
||||||
obscureText: _hidePass,
|
}
|
||||||
controller: passwordController,
|
return null;
|
||||||
decoration: InputDecoration(
|
},
|
||||||
icon: Icon(
|
obscureText: _hidePass,
|
||||||
FontAwesomeIcons.starOfLife,
|
controller: passwordController,
|
||||||
size: 6 * _deviceBlockSize,
|
decoration: InputDecoration(
|
||||||
),
|
icon: Icon(
|
||||||
labelStyle: TextStyle(
|
FontAwesomeIcons.starOfLife,
|
||||||
fontWeight: FontWeight.w100,
|
size: 6 * _deviceBlockSize,
|
||||||
fontSize: 4 * _deviceBlockSize,
|
),
|
||||||
),
|
labelStyle: TextStyle(
|
||||||
labelText: 'Password',
|
fontWeight: FontWeight.w100,
|
||||||
isDense: true,
|
fontSize: 4 * _deviceBlockSize,
|
||||||
contentPadding: EdgeInsets.symmetric(
|
),
|
||||||
vertical: 2, horizontal: 3),
|
labelText: 'Password',
|
||||||
suffixIcon: InkWell(
|
isDense: true,
|
||||||
child: Icon(FontAwesomeIcons.eye),
|
contentPadding: EdgeInsets.symmetric(
|
||||||
onTap: () {
|
vertical: 2, horizontal: 3),
|
||||||
setState(() {
|
suffixIcon: InkWell(
|
||||||
_hidePass = !_hidePass;
|
child: Icon(FontAwesomeIcons.eye),
|
||||||
});
|
onTap: () {
|
||||||
},
|
setState(() {
|
||||||
),
|
_hidePass = !_hidePass;
|
||||||
),
|
});
|
||||||
style: TextStyle(
|
},
|
||||||
fontWeight: FontWeight.w700,
|
),
|
||||||
fontSize: 5 * _deviceBlockSize,
|
),
|
||||||
),
|
style: TextStyle(
|
||||||
textInputAction: TextInputAction.done,
|
fontWeight: FontWeight.w700,
|
||||||
onFieldSubmitted: (_) {
|
fontSize: 5 * _deviceBlockSize,
|
||||||
_sendRePass();
|
),
|
||||||
},
|
textInputAction: TextInputAction.done,
|
||||||
keyboardType: TextInputType.visiblePassword,
|
onFieldSubmitted: (_) {
|
||||||
),
|
_sendRePass();
|
||||||
SizedBox(
|
},
|
||||||
height: 30,
|
keyboardType: TextInputType.visiblePassword,
|
||||||
),
|
),
|
||||||
TextFormField(
|
SizedBox(
|
||||||
validator: (value) {
|
height: 30,
|
||||||
if (value.length < 8) {
|
),
|
||||||
return 'Password at least is 8 characters.';
|
TextFormField(
|
||||||
}
|
validator: (value) {
|
||||||
if (value != passwordController.text) {
|
if (value!.length < 8) {
|
||||||
return 'Password doesnt match!';
|
return 'Password at least is 8 characters.';
|
||||||
}
|
}
|
||||||
return null;
|
if (value != passwordController.text) {
|
||||||
},
|
return 'Password doesnt match!';
|
||||||
obscureText: _hideRePass,
|
}
|
||||||
controller: rePasswordController,
|
return null;
|
||||||
decoration: InputDecoration(
|
},
|
||||||
icon: Icon(
|
obscureText: _hideRePass,
|
||||||
FontAwesomeIcons.starOfLife,
|
controller: rePasswordController,
|
||||||
size: 6 * _deviceBlockSize,
|
decoration: InputDecoration(
|
||||||
),
|
icon: Icon(
|
||||||
labelStyle: TextStyle(
|
FontAwesomeIcons.starOfLife,
|
||||||
fontWeight: FontWeight.w100,
|
size: 6 * _deviceBlockSize,
|
||||||
fontSize: 4 * _deviceBlockSize,
|
),
|
||||||
),
|
labelStyle: TextStyle(
|
||||||
labelText: 'Confirm Password',
|
fontWeight: FontWeight.w100,
|
||||||
isDense: true,
|
fontSize: 4 * _deviceBlockSize,
|
||||||
contentPadding: EdgeInsets.symmetric(
|
),
|
||||||
vertical: 2, horizontal: 3),
|
labelText: 'Confirm Password',
|
||||||
suffixIcon: InkWell(
|
isDense: true,
|
||||||
child: Icon(FontAwesomeIcons.eye),
|
contentPadding: EdgeInsets.symmetric(
|
||||||
onTap: () {
|
vertical: 2, horizontal: 3),
|
||||||
setState(() {
|
suffixIcon: InkWell(
|
||||||
_hideRePass = !_hideRePass;
|
child: Icon(FontAwesomeIcons.eye),
|
||||||
});
|
onTap: () {
|
||||||
},
|
setState(() {
|
||||||
),
|
_hideRePass = !_hideRePass;
|
||||||
),
|
});
|
||||||
style: TextStyle(
|
},
|
||||||
fontWeight: FontWeight.w700,
|
),
|
||||||
fontSize: 5 * _deviceBlockSize,
|
),
|
||||||
),
|
style: TextStyle(
|
||||||
textInputAction: TextInputAction.done,
|
fontWeight: FontWeight.w700,
|
||||||
onFieldSubmitted: (_) {
|
fontSize: 5 * _deviceBlockSize,
|
||||||
_sendRePass();
|
),
|
||||||
},
|
textInputAction: TextInputAction.done,
|
||||||
keyboardType: TextInputType.visiblePassword,
|
onFieldSubmitted: (_) {
|
||||||
),
|
_sendRePass();
|
||||||
SizedBox(height: 40),
|
},
|
||||||
Row(
|
keyboardType: TextInputType.visiblePassword,
|
||||||
children: <Widget>[
|
),
|
||||||
InkWell(
|
SizedBox(height: 40),
|
||||||
onTap: () => _sendRePass(),
|
Row(
|
||||||
child: Container(
|
children: <Widget>[
|
||||||
width: 40 * _deviceBlockSize,
|
InkWell(
|
||||||
padding: EdgeInsets.symmetric(
|
onTap: () => _sendRePass(),
|
||||||
horizontal: 5 * _deviceBlockSize,
|
child: Container(
|
||||||
vertical: 10,
|
width: 88 * _deviceBlockSize,
|
||||||
),
|
padding: EdgeInsets.all(10),
|
||||||
// margin:
|
decoration: BoxDecoration(
|
||||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
color: Colors.black,
|
||||||
decoration: BoxDecoration(
|
borderRadius: BorderRadius.circular(7),
|
||||||
gradient: LinearGradient(
|
),
|
||||||
colors: [Colors.blue, Colors.green],
|
child: Text(
|
||||||
),
|
'Change',
|
||||||
borderRadius: BorderRadius.circular(7),
|
style: TextStyle(
|
||||||
),
|
color: Colors.white,
|
||||||
child: Text(
|
),
|
||||||
'Change',
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
),
|
||||||
color: Colors.white,
|
),
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
Spacer(),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
SizedBox(height: 10),
|
||||||
Spacer(),
|
],
|
||||||
],
|
),
|
||||||
),
|
)
|
||||||
SizedBox(height: 10),
|
: ConnectionErrorBox(),
|
||||||
],
|
selector: (_, connectivity) => connectivity.conStatus,
|
||||||
),
|
)),
|
||||||
)
|
);
|
||||||
: ConnectionErrorBox(),
|
}
|
||||||
selector: (_, connectivity) => connectivity.conStatus,
|
}
|
||||||
)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,379 +1,381 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
|
||||||
class Register extends StatefulWidget {
|
class Register extends StatefulWidget {
|
||||||
// static const route = '/RegisterScreen';
|
// static const route = '/RegisterScreen';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() {
|
State<StatefulWidget> createState() {
|
||||||
return _RegisterState();
|
return _RegisterState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _RegisterState extends State<Register> {
|
class _RegisterState extends State<Register> {
|
||||||
final _passwordFocusNode = FocusNode();
|
final _passwordFocusNode = FocusNode();
|
||||||
final _form = GlobalKey<FormState>();
|
final _form = GlobalKey<FormState>();
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
final cellNumberController = TextEditingController();
|
final cellNumberController = TextEditingController();
|
||||||
bool _hidePass = true;
|
bool _hidePass = true;
|
||||||
Map<String, dynamic> map = Map<String, dynamic>();
|
Map<String, dynamic> map = Map<String, dynamic>();
|
||||||
final List<String> hospitalVals = ['Shahid Beheshti', 'None'];
|
final List<String> hospitalVals = ['Shahid Beheshti', 'None'];
|
||||||
String curhospitalVal;
|
String? curhospitalVal;
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
cellNumberController.text = map['cellNumber'];
|
cellNumberController.text = map['cellNumber'];
|
||||||
curhospitalVal = hospitalVals[0];
|
curhospitalVal = hospitalVals[0];
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_passwordFocusNode.dispose();
|
_passwordFocusNode.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// void _showDialog(String message) {
|
// void _showDialog(String message) {
|
||||||
// showDialog(
|
// showDialog(
|
||||||
// context: context,
|
// context: context,
|
||||||
// builder: (ctx) => AlertDialog(
|
// builder: (ctx) => AlertDialog(
|
||||||
// title: Text('error occured'),
|
// title: Text('error occured'),
|
||||||
// content: Text(message),
|
// content: Text(message),
|
||||||
// actions: <Widget>[
|
// actions: <Widget>[
|
||||||
// TextButton(
|
// TextButton(
|
||||||
// child: Text('Ok'),
|
// child: Text('Ok'),
|
||||||
// onPressed: () {
|
// onPressed: () {
|
||||||
// Navigator.of(ctx).pop();
|
// Navigator.of(ctx).pop();
|
||||||
// },
|
// },
|
||||||
// ),
|
// ),
|
||||||
// ],
|
// ],
|
||||||
// ),
|
// ),
|
||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
|
|
||||||
void _register() async {
|
void _register() async {
|
||||||
if (!_form.currentState.validate()) {
|
if (!_form.currentState!.validate()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_form.currentState.save();
|
_form.currentState!.save();
|
||||||
// setState(() {
|
// setState(() {
|
||||||
// _isLoading = true;
|
// _isLoading = true;
|
||||||
// });
|
// });
|
||||||
// try {
|
// try {
|
||||||
// // await Provider.of<Auth>(context).register(
|
// // await Provider.of<Auth>(context).register(
|
||||||
// // map['cellNumber'],
|
// // map['cellNumber'],
|
||||||
// // map['password'],
|
// // map['password'],
|
||||||
// // );
|
// // );
|
||||||
// } catch (error) {
|
// } catch (error) {
|
||||||
// _showDialog('something went wrong!');
|
// _showDialog('something went wrong!');
|
||||||
// setState(() {
|
// setState(() {
|
||||||
// _isLoading = false;
|
// _isLoading = false;
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Navigator.pushReplacement(
|
// Navigator.pushReplacement(
|
||||||
// context,
|
// context,
|
||||||
// MaterialPageRoute(builder: (context) {
|
// MaterialPageRoute(builder: (context) {
|
||||||
// return HomePage();
|
// return HomePage();
|
||||||
// }),
|
// }),
|
||||||
// );
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final _media = MediaQuery.of(context);
|
final _media = MediaQuery.of(context);
|
||||||
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
final double _devicewidth = _media.size.width;
|
final double _devicewidth = _media.size.width;
|
||||||
final double _deviceBlockSize = _devicewidth / 100;
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
titleSpacing: -10,
|
titleSpacing: -10,
|
||||||
title: Text('Login'),
|
title: Text('Login'),
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.keyboard_arrow_left,
|
Icons.keyboard_arrow_left,
|
||||||
size: 35,
|
size: 35,
|
||||||
),
|
),
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: _isLoading
|
body: _isLoading
|
||||||
? Center(
|
? Center(
|
||||||
child: CircularProgressIndicator(),
|
child: CircularProgressIndicator(
|
||||||
)
|
color: Colors.black,
|
||||||
: Form(
|
),
|
||||||
key: _form,
|
)
|
||||||
child: ListView(
|
: Form(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
key: _form,
|
||||||
children: <Widget>[
|
child: ListView(
|
||||||
Container(
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||||
padding: EdgeInsets.symmetric(vertical: 20),
|
children: <Widget>[
|
||||||
child: Text(
|
Container(
|
||||||
'register',
|
padding: EdgeInsets.symmetric(vertical: 20),
|
||||||
textAlign: TextAlign.left,
|
child: Text(
|
||||||
style: TextStyle(
|
'register',
|
||||||
color: Colors.black,
|
textAlign: TextAlign.left,
|
||||||
fontSize: 7 * _deviceBlockSize,
|
style: TextStyle(
|
||||||
letterSpacing: 3,
|
color: Colors.black,
|
||||||
),
|
fontSize: 7 * _deviceBlockSize,
|
||||||
),
|
letterSpacing: 3,
|
||||||
),
|
),
|
||||||
TextFormField(
|
),
|
||||||
validator: (value) {
|
),
|
||||||
if (value.isEmpty) {
|
TextFormField(
|
||||||
return 'Cell number is required.';
|
validator: (value) {
|
||||||
}
|
if (value!.isEmpty) {
|
||||||
RegExp regExp = RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$');
|
return 'Cell number is required.';
|
||||||
if (!regExp.hasMatch(value)) {
|
}
|
||||||
return 'Enter a valid cell number';
|
RegExp regExp = RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$');
|
||||||
}
|
if (!regExp.hasMatch(value)) {
|
||||||
return null;
|
return 'Enter a valid cell number';
|
||||||
},
|
}
|
||||||
style: TextStyle(fontWeight: FontWeight.w700),
|
return null;
|
||||||
keyboardType: TextInputType.phone,
|
},
|
||||||
textInputAction: TextInputAction.next,
|
style: TextStyle(fontWeight: FontWeight.w700),
|
||||||
onFieldSubmitted: (_) {
|
keyboardType: TextInputType.phone,
|
||||||
FocusScope.of(context).requestFocus(_passwordFocusNode);
|
textInputAction: TextInputAction.next,
|
||||||
},
|
onFieldSubmitted: (_) {
|
||||||
controller: cellNumberController,
|
FocusScope.of(context).requestFocus(_passwordFocusNode);
|
||||||
decoration: InputDecoration(
|
},
|
||||||
isDense: true,
|
controller: cellNumberController,
|
||||||
icon: Icon(
|
decoration: InputDecoration(
|
||||||
Icons.call,
|
isDense: true,
|
||||||
color: Colors.grey,
|
icon: Icon(
|
||||||
),
|
Icons.call,
|
||||||
border: UnderlineInputBorder(),
|
color: Colors.grey,
|
||||||
fillColor: Colors.red,
|
),
|
||||||
labelText: 'Cell Number',
|
border: UnderlineInputBorder(),
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 5),
|
fillColor: Colors.red,
|
||||||
),
|
labelText: 'Cell Number',
|
||||||
onSaved: (value) {
|
contentPadding: EdgeInsets.symmetric(vertical: 5),
|
||||||
map['cellNumber'] = value;
|
),
|
||||||
},
|
onSaved: (value) {
|
||||||
),
|
map['cellNumber'] = value;
|
||||||
SizedBox(
|
},
|
||||||
height: 10,
|
),
|
||||||
),
|
SizedBox(
|
||||||
TextFormField(
|
height: 10,
|
||||||
validator: (value) {
|
),
|
||||||
if (value.isEmpty) {
|
TextFormField(
|
||||||
return 'Password is required.';
|
validator: (value) {
|
||||||
}
|
if (value!.isEmpty) {
|
||||||
if (value.length < 8) {
|
return 'Password is required.';
|
||||||
return 'Password at least is 8 characters.';
|
}
|
||||||
}
|
if (value.length < 8) {
|
||||||
return null;
|
return 'Password at least is 8 characters.';
|
||||||
},
|
}
|
||||||
obscureText: _hidePass,
|
return null;
|
||||||
textInputAction: TextInputAction.done,
|
},
|
||||||
onFieldSubmitted: (_) {
|
obscureText: _hidePass,
|
||||||
_register();
|
textInputAction: TextInputAction.done,
|
||||||
},
|
onFieldSubmitted: (_) {
|
||||||
style: TextStyle(fontWeight: FontWeight.w700),
|
_register();
|
||||||
decoration: InputDecoration(
|
},
|
||||||
isDense: true,
|
style: TextStyle(fontWeight: FontWeight.w700),
|
||||||
icon: Icon(
|
decoration: InputDecoration(
|
||||||
FontAwesomeIcons.starOfLife,
|
isDense: true,
|
||||||
color: Colors.grey,
|
icon: Icon(
|
||||||
),
|
FontAwesomeIcons.starOfLife,
|
||||||
border: UnderlineInputBorder(),
|
color: Colors.grey,
|
||||||
fillColor: Colors.red,
|
),
|
||||||
labelText: 'Password',
|
border: UnderlineInputBorder(),
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 5),
|
fillColor: Colors.red,
|
||||||
suffixIcon: InkWell(
|
labelText: 'Password',
|
||||||
child: Icon(FontAwesomeIcons.eye),
|
contentPadding: EdgeInsets.symmetric(vertical: 5),
|
||||||
onTap: () {
|
suffixIcon: InkWell(
|
||||||
setState(() {
|
child: Icon(FontAwesomeIcons.eye),
|
||||||
_hidePass = !_hidePass;
|
onTap: () {
|
||||||
});
|
setState(() {
|
||||||
},
|
_hidePass = !_hidePass;
|
||||||
),
|
});
|
||||||
),
|
},
|
||||||
focusNode: _passwordFocusNode,
|
),
|
||||||
onSaved: (value) {
|
),
|
||||||
map['password'] = value;
|
focusNode: _passwordFocusNode,
|
||||||
},
|
onSaved: (value) {
|
||||||
),
|
map['password'] = value;
|
||||||
SizedBox(
|
},
|
||||||
height: 10,
|
),
|
||||||
),
|
SizedBox(
|
||||||
TextFormField(
|
height: 10,
|
||||||
validator: (value) {
|
),
|
||||||
if (value.isEmpty) {
|
TextFormField(
|
||||||
return 'Full Name is required.';
|
validator: (value) {
|
||||||
}
|
if (value!.isEmpty) {
|
||||||
// RegExp regExp = RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$');
|
return 'Full Name is required.';
|
||||||
// if (!regExp.hasMatch(value)) {
|
}
|
||||||
// return 'Enter a valid cell number';
|
// RegExp regExp = RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$');
|
||||||
// }
|
// if (!regExp.hasMatch(value)) {
|
||||||
return null;
|
// return 'Enter a valid cell number';
|
||||||
},
|
// }
|
||||||
// keyboardType: TextInputType.phone,
|
return null;
|
||||||
// textInputAction: TextInputAction.next,
|
},
|
||||||
// onFieldSubmitted: (_) {
|
// keyboardType: TextInputType.phone,
|
||||||
// FocusScope.of(context).requestFocus(_passwordFocusNode);
|
// textInputAction: TextInputAction.next,
|
||||||
// },
|
// onFieldSubmitted: (_) {
|
||||||
// controller: cellNumberController,
|
// FocusScope.of(context).requestFocus(_passwordFocusNode);
|
||||||
decoration: InputDecoration(
|
// },
|
||||||
isDense: true,
|
// controller: cellNumberController,
|
||||||
icon: Icon(
|
decoration: InputDecoration(
|
||||||
FontAwesomeIcons.sortNumericDown,
|
isDense: true,
|
||||||
color: Colors.grey,
|
icon: Icon(
|
||||||
),
|
FontAwesomeIcons.sortNumericDown,
|
||||||
border: UnderlineInputBorder(),
|
color: Colors.grey,
|
||||||
fillColor: Colors.red,
|
),
|
||||||
labelText: 'Full Name',
|
border: UnderlineInputBorder(),
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 5),
|
fillColor: Colors.red,
|
||||||
),
|
labelText: 'Full Name',
|
||||||
style: TextStyle(fontWeight: FontWeight.w700),
|
contentPadding: EdgeInsets.symmetric(vertical: 5),
|
||||||
// onSaved: (value) {
|
),
|
||||||
// map['cellNumber'] = value;
|
style: TextStyle(fontWeight: FontWeight.w700),
|
||||||
// },
|
// onSaved: (value) {
|
||||||
),
|
// map['cellNumber'] = value;
|
||||||
SizedBox(
|
// },
|
||||||
height: 20,
|
),
|
||||||
),
|
SizedBox(
|
||||||
Row(
|
height: 20,
|
||||||
// width: double.infinity,
|
),
|
||||||
children: <Widget>[
|
Row(
|
||||||
Icon(
|
// width: double.infinity,
|
||||||
FontAwesomeIcons.alignLeft,
|
children: <Widget>[
|
||||||
color: Colors.grey,
|
Icon(
|
||||||
size: 5 * _deviceBlockSize,
|
FontAwesomeIcons.alignLeft,
|
||||||
),
|
color: Colors.grey,
|
||||||
SizedBox(
|
size: 5 * _deviceBlockSize,
|
||||||
width: 3 * _deviceBlockSize,
|
),
|
||||||
),
|
SizedBox(
|
||||||
Expanded(
|
width: 3 * _deviceBlockSize,
|
||||||
// width: MediaQuery.of(context).size.width - 70,
|
),
|
||||||
child: DropdownButton(
|
Expanded(
|
||||||
focusColor: Colors.red,
|
// width: MediaQuery.of(context).size.width - 70,
|
||||||
icon: Icon(FontAwesomeIcons.angleDown),
|
child: DropdownButton(
|
||||||
isExpanded: true,
|
focusColor: Colors.red,
|
||||||
hint: Padding(
|
icon: Icon(FontAwesomeIcons.angleDown),
|
||||||
padding:
|
isExpanded: true,
|
||||||
const EdgeInsets.symmetric(horizontal: 4),
|
hint: Padding(
|
||||||
child: Text(
|
padding:
|
||||||
curhospitalVal,
|
const EdgeInsets.symmetric(horizontal: 4),
|
||||||
style: TextStyle(
|
child: Text(
|
||||||
fontWeight: FontWeight.w700,
|
curhospitalVal!,
|
||||||
color: Colors.black,
|
style: TextStyle(
|
||||||
// color: _mainFontColor,
|
fontWeight: FontWeight.w700,
|
||||||
// fontSize: 5 * _deviceBlockSize,
|
color: Colors.black,
|
||||||
),
|
// color: _mainFontColor,
|
||||||
),
|
// fontSize: 5 * _deviceBlockSize,
|
||||||
),
|
),
|
||||||
isDense: true,
|
),
|
||||||
items: hospitalVals.map((String value) {
|
),
|
||||||
return new DropdownMenuItem<String>(
|
isDense: true,
|
||||||
value: value,
|
items: hospitalVals.map((String value) {
|
||||||
child: Container(
|
return new DropdownMenuItem<String>(
|
||||||
child: Text(
|
value: value,
|
||||||
value,
|
child: Container(
|
||||||
style: TextStyle(
|
child: Text(
|
||||||
// color: _mainFontColor,
|
value,
|
||||||
fontSize: 4 * _deviceBlockSize,
|
style: TextStyle(
|
||||||
),
|
// color: _mainFontColor,
|
||||||
),
|
fontSize: 4 * _deviceBlockSize,
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
}).toList(),
|
),
|
||||||
onChanged: (val) {
|
);
|
||||||
setState(() {
|
}).toList(),
|
||||||
curhospitalVal = val;
|
onChanged: (val) {
|
||||||
});
|
setState(() {
|
||||||
},
|
curhospitalVal = val;
|
||||||
),
|
});
|
||||||
),
|
},
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 40),
|
],
|
||||||
Row(
|
),
|
||||||
children: <Widget>[
|
SizedBox(height: 40),
|
||||||
InkWell(
|
Row(
|
||||||
onTap: () => _register(),
|
children: <Widget>[
|
||||||
child: Container(
|
InkWell(
|
||||||
width: 40 * _deviceBlockSize,
|
onTap: () => _register(),
|
||||||
padding: EdgeInsets.symmetric(
|
child: Container(
|
||||||
horizontal: 5 * _deviceBlockSize,
|
width: 40 * _deviceBlockSize,
|
||||||
vertical: 5,
|
padding: EdgeInsets.symmetric(
|
||||||
),
|
horizontal: 5 * _deviceBlockSize,
|
||||||
// margin:
|
vertical: 5,
|
||||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
),
|
||||||
decoration: BoxDecoration(
|
// margin:
|
||||||
gradient: LinearGradient(
|
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||||
colors: [Colors.blue, Colors.green],
|
decoration: BoxDecoration(
|
||||||
),
|
gradient: LinearGradient(
|
||||||
borderRadius: BorderRadius.circular(7),
|
colors: [Colors.blue, Colors.green],
|
||||||
),
|
),
|
||||||
child: Row(
|
borderRadius: BorderRadius.circular(7),
|
||||||
mainAxisSize: MainAxisSize.min,
|
),
|
||||||
children: <Widget>[
|
child: Row(
|
||||||
Spacer(),
|
mainAxisSize: MainAxisSize.min,
|
||||||
Icon(
|
children: <Widget>[
|
||||||
Icons.add,
|
Spacer(),
|
||||||
color: Colors.white,
|
Icon(
|
||||||
),
|
Icons.add,
|
||||||
Text(
|
color: Colors.white,
|
||||||
'register',
|
),
|
||||||
style: TextStyle(color: Colors.white),
|
Text(
|
||||||
),
|
'register',
|
||||||
Spacer()
|
style: TextStyle(color: Colors.white),
|
||||||
],
|
),
|
||||||
)
|
Spacer()
|
||||||
// TextButton.icon(
|
],
|
||||||
// padding: EdgeInsets.all(0),
|
)
|
||||||
// onPressed: () {
|
// TextButton.icon(
|
||||||
// _register();
|
// padding: EdgeInsets.all(0),
|
||||||
// },
|
// onPressed: () {
|
||||||
// icon: Icon(Icons.exit_to_app,
|
// _register();
|
||||||
// color: Colors.white, size: 17),
|
// },
|
||||||
// label: Text('register',
|
// icon: Icon(Icons.exit_to_app,
|
||||||
// style: TextStyle(color: Colors.white)),
|
// color: Colors.white, size: 17),
|
||||||
// ),
|
// label: Text('register',
|
||||||
),
|
// style: TextStyle(color: Colors.white)),
|
||||||
),
|
// ),
|
||||||
Spacer(),
|
),
|
||||||
InkWell(
|
),
|
||||||
onTap: () {
|
Spacer(),
|
||||||
Navigator.of(context).pop();
|
InkWell(
|
||||||
},
|
onTap: () {
|
||||||
child: Container(
|
Navigator.of(context).pop();
|
||||||
width: 40 * _deviceBlockSize,
|
},
|
||||||
padding: EdgeInsets.symmetric(
|
child: Container(
|
||||||
horizontal: 5 * _deviceBlockSize,
|
width: 40 * _deviceBlockSize,
|
||||||
vertical: 5,
|
padding: EdgeInsets.symmetric(
|
||||||
),
|
horizontal: 5 * _deviceBlockSize,
|
||||||
decoration: BoxDecoration(
|
vertical: 5,
|
||||||
borderRadius: BorderRadius.circular(5),
|
),
|
||||||
border: Border.all(
|
decoration: BoxDecoration(
|
||||||
color: Colors.black,
|
borderRadius: BorderRadius.circular(5),
|
||||||
),
|
border: Border.all(
|
||||||
),
|
color: Colors.black,
|
||||||
child: Row(
|
),
|
||||||
children: <Widget>[
|
),
|
||||||
Spacer(),
|
child: Row(
|
||||||
Icon(
|
children: <Widget>[
|
||||||
Icons.exit_to_app,
|
Spacer(),
|
||||||
// size: 6 * _pixelRatio,
|
Icon(
|
||||||
),
|
Icons.exit_to_app,
|
||||||
Text(
|
// size: 6 * _pixelRatio,
|
||||||
'Login',
|
),
|
||||||
style: TextStyle(
|
Text(
|
||||||
// fontSize: 5.5,
|
'Login',
|
||||||
),
|
style: TextStyle(
|
||||||
),
|
// fontSize: 5.5,
|
||||||
Spacer(),
|
),
|
||||||
],
|
),
|
||||||
),
|
Spacer(),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
}
|
),
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
+194
-196
@@ -1,196 +1,194 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '../config/routes.dart';
|
import '../../config/routes.dart';
|
||||||
import '../providers/auth.dart';
|
import '../../providers/auth.dart';
|
||||||
import '../providers/connectivity.dart';
|
import '../../providers/connectivity.dart';
|
||||||
import '../widgets/Global/internet_error.dart';
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
class VerifyPassScreen extends StatefulWidget {
|
class VerifyPassScreen extends StatefulWidget {
|
||||||
// static const route = '/HomeScreen';
|
// static const route = '/HomeScreen';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() {
|
State<StatefulWidget> createState() {
|
||||||
return _VerifyPassScreenState();
|
return _VerifyPassScreenState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _VerifyPassScreenState extends State<VerifyPassScreen> {
|
class _VerifyPassScreenState extends State<VerifyPassScreen> {
|
||||||
final _form = GlobalKey<FormState>();
|
final _form = GlobalKey<FormState>();
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
final codeCTRL = TextEditingController();
|
final codeCTRL = TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
codeCTRL.text = '';
|
codeCTRL.text = '';
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showDialog(String message) {
|
void _showDialog(String message) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (ctx) => AlertDialog(
|
builder: (ctx) => AlertDialog(
|
||||||
title: Text('Error'),
|
title: Text('Error'),
|
||||||
content: Text(message),
|
content: Text(message),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text('Ok'),
|
child: Text('Ok'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(ctx).pop();
|
Navigator.of(ctx).pop();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _sendCode() async {
|
void _sendCode() async {
|
||||||
if (!_form.currentState.validate()) {
|
if (!_form.currentState!.validate()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_form.currentState.save();
|
_form.currentState!.save();
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
});
|
});
|
||||||
// try {
|
// try {
|
||||||
await Provider.of<Auth>(context, listen: false)
|
await Provider.of<Auth>(context, listen: false)
|
||||||
.sendCode(
|
.sendCode(
|
||||||
codeCTRL.text,
|
codeCTRL.text,
|
||||||
)
|
)
|
||||||
.then(
|
.then(
|
||||||
(result) {
|
(result) {
|
||||||
if (result == 'wrong') {
|
if (result == 'wrong') {
|
||||||
_showDialog('Code is wrong!!!');
|
_showDialog('Code is wrong!!!');
|
||||||
setState(
|
setState(
|
||||||
() {
|
() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Navigator.of(context)
|
Navigator.of(context)
|
||||||
.popAndPushNamed(Routes.rePassScreen, arguments: result);
|
.popAndPushNamed(Routes.rePassScreen, arguments: result);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final _media = MediaQuery.of(context);
|
final _media = MediaQuery.of(context);
|
||||||
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
final double _devicewidth = _media.size.width;
|
final double _devicewidth = _media.size.width;
|
||||||
final double _deviceBlockSize = _devicewidth / 100;
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
title: Text('CSSD'),
|
title: Text('CSSD'),
|
||||||
),
|
backgroundColor: Colors.black,
|
||||||
body: Selector<ConnectivityProvider, String>(
|
),
|
||||||
builder: (ctx, value, _) => value != 'offline'
|
body: Selector<ConnectivityProvider, String>(
|
||||||
? _isLoading
|
builder: (ctx, value, _) => value != 'offline'
|
||||||
? Center(
|
? _isLoading
|
||||||
child: CircularProgressIndicator(),
|
? Center(
|
||||||
)
|
child: CircularProgressIndicator(
|
||||||
: Form(
|
color: Colors.black,
|
||||||
key: _form,
|
),
|
||||||
child: ListView(
|
)
|
||||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
: Form(
|
||||||
children: <Widget>[
|
key: _form,
|
||||||
Container(
|
child: ListView(
|
||||||
padding: EdgeInsets.symmetric(vertical: 20),
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||||
child: Text(
|
children: <Widget>[
|
||||||
'Send Verification Code',
|
Container(
|
||||||
textAlign: TextAlign.left,
|
padding: EdgeInsets.symmetric(vertical: 20),
|
||||||
style: TextStyle(
|
child: Text(
|
||||||
color: Colors.black,
|
'Send Verification Code',
|
||||||
fontSize: 5 * _deviceBlockSize,
|
textAlign: TextAlign.left,
|
||||||
letterSpacing: 3,
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w700,
|
color: Colors.black,
|
||||||
),
|
fontSize: 5 * _deviceBlockSize,
|
||||||
),
|
letterSpacing: 3,
|
||||||
),
|
fontWeight: FontWeight.w700,
|
||||||
TextFormField(
|
),
|
||||||
validator: (value) {
|
),
|
||||||
if (value.isEmpty) {
|
),
|
||||||
return 'Code is required.';
|
TextFormField(
|
||||||
}
|
validator: (value) {
|
||||||
if (value.length != 6) {
|
if (value!.isEmpty) {
|
||||||
return 'Code most be 6 characters';
|
return 'Code is required.';
|
||||||
}
|
}
|
||||||
return null;
|
if (value.length != 6) {
|
||||||
},
|
return 'Code most be 6 characters';
|
||||||
controller: codeCTRL,
|
}
|
||||||
decoration: InputDecoration(
|
return null;
|
||||||
icon: Icon(
|
},
|
||||||
FontAwesomeIcons.starOfLife,
|
controller: codeCTRL,
|
||||||
size: 6 * _deviceBlockSize,
|
decoration: InputDecoration(
|
||||||
),
|
icon: Icon(
|
||||||
labelStyle: TextStyle(
|
FontAwesomeIcons.starOfLife,
|
||||||
fontWeight: FontWeight.w100,
|
size: 6 * _deviceBlockSize,
|
||||||
fontSize: 4 * _deviceBlockSize,
|
),
|
||||||
),
|
labelStyle: TextStyle(
|
||||||
labelText: 'Code',
|
fontWeight: FontWeight.w100,
|
||||||
isDense: true,
|
fontSize: 4 * _deviceBlockSize,
|
||||||
contentPadding: EdgeInsets.symmetric(
|
),
|
||||||
vertical: 2,
|
labelText: 'Code',
|
||||||
horizontal: 3,
|
isDense: true,
|
||||||
),
|
contentPadding: EdgeInsets.symmetric(
|
||||||
),
|
vertical: 2,
|
||||||
style: TextStyle(
|
horizontal: 3,
|
||||||
fontWeight: FontWeight.w700,
|
),
|
||||||
fontSize: 5 * _deviceBlockSize,
|
),
|
||||||
letterSpacing: 3,
|
style: TextStyle(
|
||||||
),
|
fontWeight: FontWeight.w700,
|
||||||
keyboardType: TextInputType.number,
|
fontSize: 5 * _deviceBlockSize,
|
||||||
onSaved: (value) {
|
letterSpacing: 3,
|
||||||
codeCTRL.text = value;
|
),
|
||||||
},
|
keyboardType: TextInputType.number,
|
||||||
maxLength: 6,
|
onSaved: (value) {
|
||||||
),
|
codeCTRL.text = value!;
|
||||||
SizedBox(height: 40),
|
},
|
||||||
Row(
|
maxLength: 6,
|
||||||
children: <Widget>[
|
),
|
||||||
InkWell(
|
SizedBox(height: 40),
|
||||||
onTap: () => _sendCode(),
|
Row(
|
||||||
child: Container(
|
children: <Widget>[
|
||||||
width: 40 * _deviceBlockSize,
|
InkWell(
|
||||||
padding: EdgeInsets.symmetric(
|
onTap: () => _sendCode(),
|
||||||
horizontal: 5 * _deviceBlockSize,
|
child: Container(
|
||||||
vertical: 10,
|
width: 88 * _deviceBlockSize,
|
||||||
),
|
padding: EdgeInsets.all(10),
|
||||||
// margin:
|
// margin:
|
||||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: LinearGradient(
|
color: Colors.black,
|
||||||
colors: [Colors.blue, Colors.green],
|
borderRadius: BorderRadius.circular(7),
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.circular(7),
|
child: Text(
|
||||||
),
|
'Send Code',
|
||||||
child: Text(
|
textAlign: TextAlign.center,
|
||||||
'Send Code',
|
style: TextStyle(color: Colors.white),
|
||||||
textAlign: TextAlign.center,
|
),
|
||||||
style: TextStyle(color: Colors.white),
|
),
|
||||||
),
|
),
|
||||||
),
|
Spacer(),
|
||||||
),
|
],
|
||||||
Spacer(),
|
),
|
||||||
],
|
SizedBox(height: 10),
|
||||||
),
|
],
|
||||||
SizedBox(height: 10),
|
),
|
||||||
],
|
)
|
||||||
),
|
: ConnectionErrorBox(),
|
||||||
)
|
selector: (_, connectivity) => connectivity.conStatus,
|
||||||
: ConnectionErrorBox(),
|
),
|
||||||
selector: (_, connectivity) => connectivity.conStatus,
|
),
|
||||||
),
|
);
|
||||||
),
|
}
|
||||||
);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,257 @@
|
|||||||
|
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||||
|
import 'package:cssd/config/routes.dart';
|
||||||
|
import 'package:cssd/pages/MyItemsPages/my_items_history_screen.dart';
|
||||||
|
import 'package:cssd/providers/auth.dart';
|
||||||
|
import 'package:cssd/providers/connectivity.dart';
|
||||||
|
import 'package:cssd/providers/my_items.dart';
|
||||||
|
import 'package:cssd/widgets/CycleScreens/Result/banner.dart';
|
||||||
|
import 'package:cssd/widgets/CycleScreens/Result/search_box.dart';
|
||||||
|
import 'package:cssd/widgets/Global/internet_error.dart';
|
||||||
|
import 'package:cssd/widgets/MyItemsScreens/Filter/my_items_chip_widget.dart';
|
||||||
|
import 'package:cssd/widgets/MyItemsScreens/Result/my_items_data_box_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class MyItemsMineScreen extends StatefulWidget {
|
||||||
|
final bool? isAdmin;
|
||||||
|
const MyItemsMineScreen({
|
||||||
|
Key? key,
|
||||||
|
this.isAdmin,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MyItemsMineScreen> createState() => _MyItemsMineScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyItemsMineScreenState extends State<MyItemsMineScreen> {
|
||||||
|
bool _isInit = true;
|
||||||
|
ScrollController? sc;
|
||||||
|
TextEditingController searchCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
sc = new ScrollController();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
if (_isInit) {
|
||||||
|
var myItemResults = Provider.of<MyItemProvider>(context);
|
||||||
|
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||||
|
myItemResults.setLoading();
|
||||||
|
myItemResults.resetPageNumber();
|
||||||
|
if (userData['roles']?.contains('User')) {
|
||||||
|
myItemResults.getMyItems().then(
|
||||||
|
(_) {
|
||||||
|
myItemResults.resetLoading();
|
||||||
|
sc!.addListener(
|
||||||
|
() {
|
||||||
|
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
||||||
|
searchCTRL.text == '') {
|
||||||
|
var myItemResults = Provider.of<MyItemProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
);
|
||||||
|
myItemResults.getMyItems();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
myItemResults.getHospitalItems().then((_) {
|
||||||
|
myItemResults.resetLoading();
|
||||||
|
sc!.addListener(
|
||||||
|
() {
|
||||||
|
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
||||||
|
searchCTRL.text == '') {
|
||||||
|
var myItemResults = Provider.of<MyItemProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
);
|
||||||
|
myItemResults.getHospitalItems();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_isInit = false;
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||||
|
return Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 20,
|
||||||
|
right: 20,
|
||||||
|
bottom: 60,
|
||||||
|
left: 20,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
ResultBanner(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
text: 'My Items',
|
||||||
|
push: Routes.myItemsFilterScreen,
|
||||||
|
),
|
||||||
|
Consumer<MyItemProvider>(builder: (ctx, item, _) {
|
||||||
|
return Container(
|
||||||
|
height: 50,
|
||||||
|
child: ListView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
shrinkWrap: true,
|
||||||
|
children: <Widget>[
|
||||||
|
item.filters!.id != ''
|
||||||
|
? MyItemFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'ID',
|
||||||
|
id: '',
|
||||||
|
name: item.filters!.name,
|
||||||
|
udi: item.filters!.udi,
|
||||||
|
size: item.filters!.size,
|
||||||
|
specific: item.filters!.specific,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
item.filters!.name != ''
|
||||||
|
? MyItemFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Item Name',
|
||||||
|
id: item.filters!.id,
|
||||||
|
name: '',
|
||||||
|
udi: item.filters!.udi,
|
||||||
|
size: item.filters!.size,
|
||||||
|
specific: item.filters!.specific,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
item.filters!.udi != ''
|
||||||
|
? MyItemFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'UDI',
|
||||||
|
id: item.filters!.id,
|
||||||
|
name: item.filters!.name,
|
||||||
|
udi: '',
|
||||||
|
size: item.filters!.size,
|
||||||
|
specific: item.filters!.specific,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
item.filters!.size != ''
|
||||||
|
? MyItemFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Size',
|
||||||
|
id: item.filters!.id,
|
||||||
|
name: item.filters!.name,
|
||||||
|
udi: item.filters!.udi,
|
||||||
|
size: '',
|
||||||
|
specific: item.filters!.specific,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
item.filters!.specific != ''
|
||||||
|
? MyItemFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Specific',
|
||||||
|
id: item.filters!.id,
|
||||||
|
name: item.filters!.name,
|
||||||
|
udi: item.filters!.udi,
|
||||||
|
size: item.filters!.size,
|
||||||
|
specific: '',
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
ResultSearchBox(
|
||||||
|
searchCTRL: searchCTRL,
|
||||||
|
text: 'item',
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
onChanged: (value) {
|
||||||
|
if (userData['roles']?.contains('User')) {
|
||||||
|
Provider.of<MyItemProvider>(context, listen: false)
|
||||||
|
.searchMyItems(value);
|
||||||
|
} else {
|
||||||
|
Provider.of<MyItemProvider>(context, listen: false)
|
||||||
|
.searchHospitalItems(value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Consumer<MyItemProvider>(
|
||||||
|
builder: (context, itemResults, _) {
|
||||||
|
return itemResults.isloading
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
controller: sc,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
if (userData['roles']?.contains('User')) {
|
||||||
|
return MyItemsItemDataBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
isAdmin: false,
|
||||||
|
items: itemResults.myItems?[index],
|
||||||
|
push: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: ((context) =>
|
||||||
|
MyItemsHistoryScreen(
|
||||||
|
items: itemResults
|
||||||
|
.myItems?[index],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return MyItemsItemDataBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
isAdmin: true,
|
||||||
|
items:
|
||||||
|
itemResults.hospitalItems?[index],
|
||||||
|
push: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: ((context) =>
|
||||||
|
MyItemsHistoryScreen(
|
||||||
|
items: itemResults
|
||||||
|
.myItems?[index],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
itemCount: userData['roles']?.contains('User')
|
||||||
|
? itemResults.myItems?.length
|
||||||
|
: itemResults.hospitalItems?.length,
|
||||||
|
shrinkWrap: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||||
|
import 'package:cssd/config/routes.dart';
|
||||||
|
import 'package:cssd/providers/auth.dart';
|
||||||
|
import 'package:cssd/providers/connectivity.dart';
|
||||||
|
import 'package:cssd/providers/my_items.dart';
|
||||||
|
import 'package:cssd/widgets/CycleScreens/Result/banner.dart';
|
||||||
|
import 'package:cssd/widgets/Global/internet_error.dart';
|
||||||
|
import 'package:cssd/widgets/MyItemsScreens/Result/item_requests_data_box.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class MyItemsRequestsScreen extends StatefulWidget {
|
||||||
|
final bool? isAdmin;
|
||||||
|
const MyItemsRequestsScreen({
|
||||||
|
Key? key,
|
||||||
|
this.isAdmin,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MyItemsRequestsScreen> createState() => _MyItemsRequestsScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyItemsRequestsScreenState extends State<MyItemsRequestsScreen> {
|
||||||
|
bool _isInit = true;
|
||||||
|
ScrollController? sc;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
if (_isInit) {
|
||||||
|
var itemResults = Provider.of<MyItemProvider>(context);
|
||||||
|
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||||
|
itemResults.setLoading();
|
||||||
|
itemResults.resetPageNumber();
|
||||||
|
if (userData['roles']?.contains('User')) {
|
||||||
|
itemResults.getMyItemRequests().then(
|
||||||
|
(_) {
|
||||||
|
itemResults.resetLoading();
|
||||||
|
sc?.addListener(
|
||||||
|
() {
|
||||||
|
if (sc!.position.pixels == sc!.position.maxScrollExtent) {
|
||||||
|
var itemResults = Provider.of<MyItemProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
);
|
||||||
|
itemResults.getMyItemRequests();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
itemResults.getHospitalItemRequests().then(
|
||||||
|
(_) {
|
||||||
|
itemResults.resetLoading();
|
||||||
|
sc?.addListener(
|
||||||
|
() {
|
||||||
|
if (sc!.position.pixels == sc!.position.maxScrollExtent) {
|
||||||
|
var itemResults = Provider.of<MyItemProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
);
|
||||||
|
itemResults.getHospitalItemRequests();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_isInit = false;
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||||
|
return Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 20,
|
||||||
|
right: 20,
|
||||||
|
bottom: 60,
|
||||||
|
left: 20,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
ResultBanner(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
text: 'My Requests',
|
||||||
|
hasFilterObject: false,
|
||||||
|
push: Routes.myItemsFilterScreen,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Consumer<MyItemProvider>(
|
||||||
|
builder: (context, itemResults, _) {
|
||||||
|
return itemResults.isloading
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
controller: sc,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
if (userData['roles']?.contains('User')) {
|
||||||
|
return RequestsDataBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
isAdmin: false,
|
||||||
|
item: itemResults
|
||||||
|
.originalMyItemsRequests?[index],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return RequestsDataBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
isAdmin: true,
|
||||||
|
item: itemResults
|
||||||
|
.originalHospitalItemsRequests?[
|
||||||
|
index],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
itemCount: userData['roles']?.contains('User')
|
||||||
|
? itemResults
|
||||||
|
.originalMyItemsRequests?.length
|
||||||
|
: itemResults
|
||||||
|
.originalHospitalItemsRequests
|
||||||
|
?.length,
|
||||||
|
shrinkWrap: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
import 'package:cssd/config/colors.dart';
|
||||||
|
import 'package:cssd/pages/MyItemsPages/Result/my_items_mine_screen.dart';
|
||||||
|
import 'package:cssd/pages/MyItemsPages/Result/my_items_requests_screen.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class MyItemsResultScreen extends StatefulWidget {
|
||||||
|
const MyItemsResultScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MyItemsResultScreen> createState() => _MyItemsResultScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyItemsResultScreenState extends State<MyItemsResultScreen>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
late final TabController _tabController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_tabController = TabController(length: 2, vsync: this);
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_tabController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: DefaultTabController(
|
||||||
|
length: 2,
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Home'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
bottom: TabBar(
|
||||||
|
controller: _tabController,
|
||||||
|
indicatorColor: kBlue,
|
||||||
|
tabs: [
|
||||||
|
Tab(
|
||||||
|
text: 'Mine',
|
||||||
|
),
|
||||||
|
Tab(
|
||||||
|
text: 'Requests',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: TabBarView(
|
||||||
|
controller: _tabController,
|
||||||
|
children: [
|
||||||
|
MyItemsMineScreen(),
|
||||||
|
MyItemsRequestsScreen(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
import 'package:cssd/models/item_model.dart';
|
||||||
|
import 'package:cssd/pages/MyItemsPages/my_items_transfer_screen.dart';
|
||||||
|
import 'package:cssd/providers/items.dart';
|
||||||
|
import 'package:cssd/widgets/MyItemsScreens/Detail/my_items_detail_box_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class MyItemsDetailScreen extends StatefulWidget {
|
||||||
|
final String? testResultId;
|
||||||
|
|
||||||
|
MyItemsDetailScreen({
|
||||||
|
this.testResultId,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MyItemsDetailScreenState createState() => _MyItemsDetailScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyItemsDetailScreenState extends State<MyItemsDetailScreen> {
|
||||||
|
bool isInit = true;
|
||||||
|
bool isEmpty = false;
|
||||||
|
ItemDetailObject? datas;
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() async {
|
||||||
|
if (isInit) {
|
||||||
|
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||||
|
await Provider.of<ItemProvider>(context, listen: false)
|
||||||
|
.showItemResult(_id.toString())
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
if (result.id == 'null') {
|
||||||
|
isEmpty = true;
|
||||||
|
}
|
||||||
|
datas = result;
|
||||||
|
isInit = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('My Items'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: isEmpty
|
||||||
|
? Center(
|
||||||
|
child: Text('This Item does\'nt exists!'),
|
||||||
|
)
|
||||||
|
: MyItemsDetailsDataBox(
|
||||||
|
datas: datas!,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
push: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => ItemsTransferScreen(
|
||||||
|
items: datas,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,359 @@
|
|||||||
|
import 'package:cssd/config/colors.dart';
|
||||||
|
import 'package:cssd/models/item_model.dart';
|
||||||
|
import 'package:cssd/providers/items.dart';
|
||||||
|
import 'package:cssd/utils/scan.dart';
|
||||||
|
import 'package:cssd/widgets/MyItemsScreens/Filter/my_items_filter_button.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class MyItemsFilterScreen extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_MyItemsFilterScreenState createState() => _MyItemsFilterScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyItemsFilterScreenState extends State<MyItemsFilterScreen> {
|
||||||
|
final _itemSizeFocusNode = FocusNode();
|
||||||
|
final _itemNameFocusNode = FocusNode();
|
||||||
|
final _itemUdiFocusNode = FocusNode();
|
||||||
|
final _itemSpecificFocusNode = FocusNode();
|
||||||
|
TextEditingController idCTRL = new TextEditingController();
|
||||||
|
TextEditingController nameCTRL = new TextEditingController();
|
||||||
|
TextEditingController udiCTRL = new TextEditingController();
|
||||||
|
TextEditingController sizeCTRL = new TextEditingController();
|
||||||
|
TextEditingController specificCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
bool isInit = true;
|
||||||
|
ItemFilterObject? filters;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
filters = Provider.of<ItemProvider>(context, listen: false).filters;
|
||||||
|
idCTRL.text = filters!.id;
|
||||||
|
nameCTRL.text = filters!.name;
|
||||||
|
sizeCTRL.text = filters!.size;
|
||||||
|
specificCTRL.text = filters!.specific;
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context,
|
||||||
|
Routes.myItemsResultScreen,
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('My Items'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context)
|
||||||
|
.pushReplacementNamed(Routes.myItemsResultScreen),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Filter My Items',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 8,
|
||||||
|
child: TextFormField(
|
||||||
|
controller: idCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Item ID',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_itemNameFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Spacer(),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
print(result);
|
||||||
|
idCTRL.text = result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: nameCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Item Name',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _itemNameFocusNode,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_itemUdiFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 8,
|
||||||
|
child: TextFormField(
|
||||||
|
controller: udiCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'UDI',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _itemUdiFocusNode,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_itemSizeFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
print(result);
|
||||||
|
idCTRL.text = result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30.0,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: sizeCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Size',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _itemSizeFocusNode,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_itemSpecificFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: specificCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Specific',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _itemSpecificFocusNode,
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 90,
|
||||||
|
),
|
||||||
|
MyItemFilterSaveButton(
|
||||||
|
idCTRL: idCTRL,
|
||||||
|
nameCTRL: nameCTRL,
|
||||||
|
udiCTRL: udiCTRL,
|
||||||
|
sizeCTRL: sizeCTRL,
|
||||||
|
specificCTRL: specificCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
firstColor: kDarkBlue,
|
||||||
|
secondColor: kDarkBlueSub,
|
||||||
|
push: Routes.myItemsResultScreen,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,168 @@
|
|||||||
|
import 'package:cssd/models/my_item_model.dart';
|
||||||
|
import 'package:cssd/providers/auth.dart';
|
||||||
|
import 'package:cssd/providers/users.dart';
|
||||||
|
import 'package:cssd/widgets/MyItemsScreens/Detail/transfer_data_box.dart';
|
||||||
|
import 'package:cssd/widgets/MyItemsScreens/History/my_items_history_date_widget.dart';
|
||||||
|
import 'package:cssd/widgets/MyItemsScreens/Result/my_items_data_box_widget.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/CycleScreens/Result/banner.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class MyItemsHistoryScreen extends StatefulWidget {
|
||||||
|
final bool? isAdmin;
|
||||||
|
final MyItemResultObject? items;
|
||||||
|
|
||||||
|
MyItemsHistoryScreen({this.isAdmin, this.items});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MyItemsHistoryScreenState createState() => _MyItemsHistoryScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyItemsHistoryScreenState extends State<MyItemsHistoryScreen> {
|
||||||
|
bool _isInit = true;
|
||||||
|
ScrollController? sc;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
sc = new ScrollController();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
if (_isInit) {
|
||||||
|
var userResults = Provider.of<UsersProvider>(context);
|
||||||
|
userResults.setLoading();
|
||||||
|
userResults
|
||||||
|
.getUsers(userResults.getUserMedicalCenter() as String)
|
||||||
|
.then((_) {
|
||||||
|
userResults.resetLoading();
|
||||||
|
sc?.addListener(
|
||||||
|
() {
|
||||||
|
if (sc!.position.pixels == sc!.position.maxScrollExtent) {
|
||||||
|
var userResults = Provider.of<UsersProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
);
|
||||||
|
userResults
|
||||||
|
.getUsers(userResults.getUserMedicalCenter() as String);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_isInit = false;
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _deviceWidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _deviceWidth / 100;
|
||||||
|
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||||
|
return SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('My Items'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 20,
|
||||||
|
right: 20,
|
||||||
|
bottom: 60,
|
||||||
|
left: 20,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
ResultBanner(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
text: 'Item History',
|
||||||
|
push: Routes.itemFilterScreen,
|
||||||
|
hasFilterObject: false,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
MyItemsItemDataBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
hasHistoryBtn: false,
|
||||||
|
items: MyItemsHistoryScreen().items!,
|
||||||
|
isAdmin: userData['roles']?.contains('User')
|
||||||
|
? false
|
||||||
|
: true,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.0,
|
||||||
|
),
|
||||||
|
Divider(
|
||||||
|
color: Colors.grey,
|
||||||
|
height: 2.0,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.0,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Consumer<UsersProvider>(
|
||||||
|
builder: (context, userResults, child) {
|
||||||
|
return userResults.isLoading
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
controller: sc,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
ItemHistoryDate(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
items:
|
||||||
|
MyItemsHistoryScreen().items!,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.0,
|
||||||
|
),
|
||||||
|
TransferDataBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
user:
|
||||||
|
userResults.usersBox?[index],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemCount: userResults.usersBox?.length,
|
||||||
|
shrinkWrap: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,341 @@
|
|||||||
|
import 'package:cssd/config/colors.dart';
|
||||||
|
import 'package:cssd/config/routes.dart';
|
||||||
|
import 'package:cssd/models/item_model.dart';
|
||||||
|
import 'package:cssd/providers/connectivity.dart';
|
||||||
|
import 'package:cssd/providers/my_items.dart';
|
||||||
|
import 'package:cssd/providers/users.dart';
|
||||||
|
import 'package:cssd/widgets/CycleScreens/Result/banner.dart';
|
||||||
|
import 'package:cssd/widgets/CycleScreens/Result/search_box.dart';
|
||||||
|
import 'package:cssd/widgets/Global/internet_error.dart';
|
||||||
|
import 'package:cssd/widgets/MyItemsScreens/Detail/cancel_transfer_button.dart';
|
||||||
|
import 'package:cssd/widgets/MyItemsScreens/Detail/transfer_data_box.dart';
|
||||||
|
import 'package:cssd/widgets/MyItemsScreens/Detail/transfer_destroy_button.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class ItemsTransferScreen extends StatefulWidget {
|
||||||
|
final bool? isAdmin;
|
||||||
|
final ItemDetailObject? items;
|
||||||
|
const ItemsTransferScreen({
|
||||||
|
super.key,
|
||||||
|
this.isAdmin,
|
||||||
|
this.items,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ItemsTransferScreen> createState() => _ItemsTransferScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ItemsTransferScreenState extends State<ItemsTransferScreen> {
|
||||||
|
bool _isInit = true;
|
||||||
|
ScrollController? sc;
|
||||||
|
TextEditingController searchCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
sc = new ScrollController();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
if (_isInit) {
|
||||||
|
var userResults = Provider.of<UsersProvider>(context);
|
||||||
|
userResults.setLoading();
|
||||||
|
userResults.getUsers(userResults.getUserMedicalCenter() as String).then(
|
||||||
|
(_) {
|
||||||
|
userResults.resetLoading();
|
||||||
|
sc!.addListener(
|
||||||
|
() {
|
||||||
|
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
||||||
|
searchCTRL.text == '') {
|
||||||
|
var userResults = Provider.of<UsersProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
);
|
||||||
|
userResults
|
||||||
|
.getUsers(userResults.getUserMedicalCenter() as String);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
_isInit = false;
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _deviceWidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _deviceWidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Item Details'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 20,
|
||||||
|
right: 20,
|
||||||
|
bottom: 40,
|
||||||
|
left: 20,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
ResultBanner(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
text: 'Transfer to',
|
||||||
|
hasFilterObject: false,
|
||||||
|
push: Routes.myItemsFilterScreen,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.0,
|
||||||
|
),
|
||||||
|
ResultSearchBox(
|
||||||
|
searchCTRL: searchCTRL,
|
||||||
|
text: 'user',
|
||||||
|
text2: 'name',
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
onChanged: (value) {
|
||||||
|
Provider.of<UsersProvider>(context, listen: false)
|
||||||
|
.searchUsers(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Consumer<UsersProvider>(
|
||||||
|
builder: (context, userResults, _) {
|
||||||
|
return userResults.isLoading
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
controller: sc,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return TransferDataBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
user: userResults.usersBox?[index],
|
||||||
|
isClicked:
|
||||||
|
userResults.selectedUserIndex ==
|
||||||
|
index,
|
||||||
|
onTap: (userId) {
|
||||||
|
Provider.of<UsersProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).selectUser(index);
|
||||||
|
print(userId);
|
||||||
|
Provider.of<UsersProvider>(
|
||||||
|
context)
|
||||||
|
.saveUserId = userId;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemCount: userResults.usersBox?.length,
|
||||||
|
shrinkWrap: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TransferDestroyButton(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
firstColor: kDarkBlue,
|
||||||
|
secondColor: kDarkBlueSub,
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(
|
||||||
|
'Are you sure to transfer this Item?',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
content: SizedBox(
|
||||||
|
width: _deviceBlockSize,
|
||||||
|
height: 280,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'By approving, your item will be transferred the specified user. It can be undone unless the user reject the transfer.',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 3 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.0,
|
||||||
|
),
|
||||||
|
ItemCard(_deviceBlockSize),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Spacer(),
|
||||||
|
Text('To'),
|
||||||
|
SizedBox(
|
||||||
|
width: 5.0,
|
||||||
|
),
|
||||||
|
ItemCard(_deviceBlockSize),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.0,
|
||||||
|
),
|
||||||
|
TransferDestroyButton(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
firstColor: kDarkBlue,
|
||||||
|
secondColor: kDarkBlueSub,
|
||||||
|
onTap: () {
|
||||||
|
Provider.of<MyItemProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).transferItems(
|
||||||
|
ItemsTransferScreen().items!.id,
|
||||||
|
Provider.of<UsersProvider>(
|
||||||
|
context,
|
||||||
|
).saveUserId!,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
text: 'Transfer',
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
CancelTransferButton(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
color: kPink,
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
text: 'Transfer',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Container ItemCard(double _deviceBlockSize) {
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.grey),
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(6.0),
|
||||||
|
child: Text(
|
||||||
|
ItemsTransferScreen().items!.id,
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 3 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
// Spacer(),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
width: 40 * _deviceBlockSize,
|
||||||
|
child: Text(
|
||||||
|
ItemsTransferScreen().items!.name,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 3 * _deviceBlockSize,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 30 * _deviceBlockSize,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Size: ',
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 3 * _deviceBlockSize,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
ItemsTransferScreen().items!.size,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 3 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 30 * _deviceBlockSize,
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'User: ',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.grey,
|
||||||
|
fontSize: 3 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
ItemsTransferScreen().items!.userName,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 3 * _deviceBlockSize,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,232 @@
|
|||||||
|
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||||
|
import 'package:cssd/config/routes.dart';
|
||||||
|
import 'package:cssd/pages/MyPackagesPages/my_packages_history_screen.dart';
|
||||||
|
import 'package:cssd/providers/auth.dart';
|
||||||
|
import 'package:cssd/providers/connectivity.dart';
|
||||||
|
import 'package:cssd/providers/my_packages.dart';
|
||||||
|
import 'package:cssd/widgets/CycleScreens/Result/banner.dart';
|
||||||
|
import 'package:cssd/widgets/CycleScreens/Result/search_box.dart';
|
||||||
|
import 'package:cssd/widgets/Global/internet_error.dart';
|
||||||
|
import 'package:cssd/widgets/MyPackagesScreens/Filter/my_packages_chip_widget.dart';
|
||||||
|
import 'package:cssd/widgets/MyPackagesScreens/Result/my_packages_data_box_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class MyPackagesMineScreen extends StatefulWidget {
|
||||||
|
final bool? isAdmin;
|
||||||
|
const MyPackagesMineScreen({
|
||||||
|
Key? key,
|
||||||
|
this.isAdmin,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MyPackagesMineScreen> createState() => _MyPackagesMineScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyPackagesMineScreenState extends State<MyPackagesMineScreen> {
|
||||||
|
bool _isInit = true;
|
||||||
|
ScrollController? sc;
|
||||||
|
TextEditingController searchCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
sc = new ScrollController();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
if (_isInit) {
|
||||||
|
var myPackageResults = Provider.of<MyPackageProvider>(context);
|
||||||
|
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||||
|
myPackageResults.setLoading();
|
||||||
|
myPackageResults.resetPageNumber();
|
||||||
|
if (userData['roles']?.contains('User')) {
|
||||||
|
myPackageResults.getMyPackages().then(
|
||||||
|
(_) {
|
||||||
|
myPackageResults.resetLoading();
|
||||||
|
sc!.addListener(
|
||||||
|
() {
|
||||||
|
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
||||||
|
searchCTRL.text == '') {
|
||||||
|
var myItemResults = Provider.of<MyPackageProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
);
|
||||||
|
myItemResults.getMyPackages();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
myPackageResults.getHospitalPackages().then((_) {
|
||||||
|
myPackageResults.resetLoading();
|
||||||
|
sc!.addListener(
|
||||||
|
() {
|
||||||
|
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
||||||
|
searchCTRL.text == '') {
|
||||||
|
var myPackageResults = Provider.of<MyPackageProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
);
|
||||||
|
myPackageResults.getHospitalPackages();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_isInit = false;
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _deviceWidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _deviceWidth / 100;
|
||||||
|
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||||
|
return Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 20,
|
||||||
|
right: 20,
|
||||||
|
bottom: 60,
|
||||||
|
left: 20,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
ResultBanner(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
text: 'My Packages',
|
||||||
|
push: Routes.myPackagesFilterScreen,
|
||||||
|
),
|
||||||
|
Consumer<MyPackageProvider>(
|
||||||
|
builder: (ctx, package, _) {
|
||||||
|
return Container(
|
||||||
|
height: 50,
|
||||||
|
child: ListView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
shrinkWrap: true,
|
||||||
|
children: <Widget>[
|
||||||
|
package.filters!.id != ''
|
||||||
|
? MyPackageFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'ID',
|
||||||
|
id: '',
|
||||||
|
name: package.filters!.name,
|
||||||
|
udi: package.filters!.udi,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
package.filters!.name != ''
|
||||||
|
? MyPackageFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Package Name',
|
||||||
|
id: package.filters!.id,
|
||||||
|
name: '',
|
||||||
|
udi: package.filters!.udi,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
package.filters!.udi != ''
|
||||||
|
? MyPackageFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'UDI',
|
||||||
|
id: package.filters!.id,
|
||||||
|
name: package.filters!.name,
|
||||||
|
udi: '',
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ResultSearchBox(
|
||||||
|
searchCTRL: searchCTRL,
|
||||||
|
text: 'package',
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
onChanged: (value) {
|
||||||
|
if (userData['roles']?.contains('User')) {
|
||||||
|
Provider.of<MyPackageProvider>(context, listen: false)
|
||||||
|
.searchMyPackages(value);
|
||||||
|
} else {
|
||||||
|
Provider.of<MyPackageProvider>(context, listen: false)
|
||||||
|
.searchHospitalPackages(value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Consumer<MyPackageProvider>(
|
||||||
|
builder: (context, packageResults, _) {
|
||||||
|
return packageResults.isloading
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
controller: sc,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
if (userData['roles']?.contains('User')) {
|
||||||
|
return MyPackagesItemDataBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
isAdmin: false,
|
||||||
|
packages:
|
||||||
|
packageResults.myPackages?[index],
|
||||||
|
push: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: ((context) =>
|
||||||
|
MyPackagesHistoryScreen(
|
||||||
|
packages: packageResults
|
||||||
|
.myPackages?[index],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return MyPackagesItemDataBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
isAdmin: true,
|
||||||
|
packages: packageResults
|
||||||
|
.hospitalPackages?[index],
|
||||||
|
push: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: ((context) =>
|
||||||
|
MyPackagesHistoryScreen(
|
||||||
|
packages: packageResults
|
||||||
|
.myPackages?[index],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
itemCount: userData['roles']?.contains('User')
|
||||||
|
? packageResults.myPackages?.length
|
||||||
|
: packageResults.hospitalPackages?.length,
|
||||||
|
shrinkWrap: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||||
|
import 'package:cssd/config/routes.dart';
|
||||||
|
import 'package:cssd/providers/auth.dart';
|
||||||
|
import 'package:cssd/providers/connectivity.dart';
|
||||||
|
import 'package:cssd/providers/my_packages.dart';
|
||||||
|
import 'package:cssd/widgets/CycleScreens/Result/banner.dart';
|
||||||
|
import 'package:cssd/widgets/Global/internet_error.dart';
|
||||||
|
import 'package:cssd/widgets/MyPackagesScreens/Result/package_requests_data_box.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class MyPackagesRequestsScreen extends StatefulWidget {
|
||||||
|
final bool? isAdmin;
|
||||||
|
const MyPackagesRequestsScreen({
|
||||||
|
Key? key,
|
||||||
|
this.isAdmin,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MyPackagesRequestsScreen> createState() =>
|
||||||
|
_MyPackagesRequestsScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyPackagesRequestsScreenState extends State<MyPackagesRequestsScreen> {
|
||||||
|
bool _isInit = true;
|
||||||
|
ScrollController? sc;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
if (_isInit) {
|
||||||
|
var packageResults = Provider.of<MyPackageProvider>(context);
|
||||||
|
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||||
|
packageResults.setLoading();
|
||||||
|
packageResults.resetPageNumber();
|
||||||
|
if (userData['roles']?.contains('User')) {
|
||||||
|
packageResults.getMyPackageRequests().then(
|
||||||
|
(_) {
|
||||||
|
packageResults.resetLoading();
|
||||||
|
sc?.addListener(
|
||||||
|
() {
|
||||||
|
if (sc!.position.pixels == sc!.position.maxScrollExtent) {
|
||||||
|
var packageResults = Provider.of<MyPackageProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
);
|
||||||
|
packageResults.getMyPackageRequests();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
packageResults.getHospitalPackageRequests().then(
|
||||||
|
(_) {
|
||||||
|
packageResults.resetLoading();
|
||||||
|
sc?.addListener(
|
||||||
|
() {
|
||||||
|
if (sc!.position.pixels == sc!.position.maxScrollExtent) {
|
||||||
|
var packageResults = Provider.of<MyPackageProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
);
|
||||||
|
packageResults.getHospitalPackageRequests();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_isInit = false;
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _deviceWidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _deviceWidth / 100;
|
||||||
|
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||||
|
return Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 20,
|
||||||
|
right: 20,
|
||||||
|
bottom: 60,
|
||||||
|
left: 20,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
ResultBanner(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
text: 'My Requests',
|
||||||
|
hasFilterObject: false,
|
||||||
|
push: Routes.myPackagesFilterScreen,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Consumer<MyPackageProvider>(
|
||||||
|
builder: (context, packageResults, _) {
|
||||||
|
return packageResults.isloading
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
controller: sc,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
if (userData['roles']?.contains('User')) {
|
||||||
|
return PackageRequestsDataBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
isAdmin: false,
|
||||||
|
package: packageResults
|
||||||
|
.originalMyPackagesRequests?[index],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return PackageRequestsDataBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
isAdmin: true,
|
||||||
|
package: packageResults
|
||||||
|
.originalHospitalPackagesRequests?[
|
||||||
|
index],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
itemCount: userData['roles']?.contains('User')
|
||||||
|
? packageResults
|
||||||
|
.originalMyPackagesRequests?.length
|
||||||
|
: packageResults
|
||||||
|
.originalHospitalPackagesRequests
|
||||||
|
?.length,
|
||||||
|
shrinkWrap: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
import 'package:cssd/config/colors.dart';
|
||||||
|
import 'package:cssd/pages/MyPackagesPages/Result/my_packages_mine_screen.dart';
|
||||||
|
import 'package:cssd/pages/MyPackagesPages/Result/my_packages_requests_screen.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class MyPackagesResultScreen extends StatefulWidget {
|
||||||
|
const MyPackagesResultScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MyPackagesResultScreen> createState() => _MyPackagesResultScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyPackagesResultScreenState extends State<MyPackagesResultScreen>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
late final TabController _tabController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_tabController = TabController(length: 2, vsync: this);
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_tabController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: DefaultTabController(
|
||||||
|
length: 2,
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Home'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
bottom: TabBar(
|
||||||
|
controller: _tabController,
|
||||||
|
indicatorColor: kPurple,
|
||||||
|
tabs: [
|
||||||
|
Tab(
|
||||||
|
text: 'Mine',
|
||||||
|
),
|
||||||
|
Tab(
|
||||||
|
text: 'Requests',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: TabBarView(
|
||||||
|
controller: _tabController,
|
||||||
|
children: [
|
||||||
|
MyPackagesMineScreen(),
|
||||||
|
MyPackagesRequestsScreen(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
import 'package:cssd/models/package_model.dart';
|
||||||
|
import 'package:cssd/pages/MyPackagesPages/my_packages_transfer_screen.dart';
|
||||||
|
import 'package:cssd/providers/packages.dart';
|
||||||
|
import 'package:cssd/widgets/MyPackagesScreens/Detail/my_packages_detail_box_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class MyPackagesDetailScreen extends StatefulWidget {
|
||||||
|
final String? testResultId;
|
||||||
|
|
||||||
|
MyPackagesDetailScreen({
|
||||||
|
this.testResultId,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MyPackagesDetailScreenState createState() => _MyPackagesDetailScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyPackagesDetailScreenState extends State<MyPackagesDetailScreen> {
|
||||||
|
bool isInit = true;
|
||||||
|
bool isEmpty = false;
|
||||||
|
PackageDetailObject? datas;
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() async {
|
||||||
|
if (isInit) {
|
||||||
|
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||||
|
await Provider.of<PackageProvider>(context, listen: false)
|
||||||
|
.showPackageResult(_id.toString())
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
if (result.id == 'null') {
|
||||||
|
isEmpty = true;
|
||||||
|
}
|
||||||
|
datas = result;
|
||||||
|
isInit = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _deviceWidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _deviceWidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('My Packages'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: isEmpty
|
||||||
|
? Center(
|
||||||
|
child: Text('This Package does\'nt exists!'),
|
||||||
|
)
|
||||||
|
: MyPackageDetailsDataBox(
|
||||||
|
datas: datas!,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
push: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => PackageTransferScreen(
|
||||||
|
packages: datas,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,253 @@
|
|||||||
|
import 'package:cssd/config/colors.dart';
|
||||||
|
import 'package:cssd/models/package_model.dart';
|
||||||
|
import 'package:cssd/providers/packages.dart';
|
||||||
|
import 'package:cssd/utils/scan.dart';
|
||||||
|
import 'package:cssd/widgets/MyPackagesScreens/Filter/my_packages_filter_button.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class MyPackageFilterScreen extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_MyPackageFilterScreenState createState() => _MyPackageFilterScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyPackageFilterScreenState extends State<MyPackageFilterScreen> {
|
||||||
|
final _nameFocusNode = FocusNode();
|
||||||
|
final _udiFocusNode = FocusNode();
|
||||||
|
TextEditingController idCTRL = new TextEditingController();
|
||||||
|
TextEditingController hospitalCTRL = new TextEditingController();
|
||||||
|
TextEditingController nameCTRL = new TextEditingController();
|
||||||
|
TextEditingController udiCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
bool isInit = true;
|
||||||
|
PackageFilterObject? filters;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
filters = Provider.of<PackageProvider>(context, listen: false).filters;
|
||||||
|
idCTRL.text = filters!.id;
|
||||||
|
hospitalCTRL.text = filters!.hospital;
|
||||||
|
nameCTRL.text = filters!.name;
|
||||||
|
udiCTRL.text = filters!.udi;
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context,
|
||||||
|
Routes.myPackagesResultScreen,
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('My Packages'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context)
|
||||||
|
.pushReplacementNamed(Routes.myPackagesResultScreen),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Filter My Packages',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 8,
|
||||||
|
child: TextFormField(
|
||||||
|
controller: idCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Package ID',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_nameFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Spacer(),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
print(result);
|
||||||
|
idCTRL.text = result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: nameCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Package Name',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _nameFocusNode,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_udiFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: udiCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'UDI',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _udiFocusNode,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 90,
|
||||||
|
),
|
||||||
|
MyPackagesFilterSaveButton(
|
||||||
|
idCTRL: idCTRL,
|
||||||
|
nameCTRL: nameCTRL,
|
||||||
|
udiCTRL: udiCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
firstColor: kDarkPurple,
|
||||||
|
secondColor: kDarkPurpleSub,
|
||||||
|
push: Routes.myPackagesResultScreen,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
import 'package:cssd/models/my_package_model.dart';
|
||||||
|
import 'package:cssd/providers/auth.dart';
|
||||||
|
import 'package:cssd/providers/users.dart';
|
||||||
|
import 'package:cssd/widgets/MyItemsScreens/Detail/transfer_data_box.dart';
|
||||||
|
import 'package:cssd/widgets/MyPackagesScreens/History/my_packages_history_date_widget.dart';
|
||||||
|
import 'package:cssd/widgets/MyPackagesScreens/Result/my_packages_data_box_widget.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/CycleScreens/Result/banner.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class MyPackagesHistoryScreen extends StatefulWidget {
|
||||||
|
final bool? isAdmin;
|
||||||
|
final MyPackageResultObject? packages;
|
||||||
|
|
||||||
|
MyPackagesHistoryScreen({this.isAdmin, this.packages});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MyPackagesHistoryScreenState createState() =>
|
||||||
|
_MyPackagesHistoryScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyPackagesHistoryScreenState extends State<MyPackagesHistoryScreen> {
|
||||||
|
bool _isInit = true;
|
||||||
|
ScrollController? sc;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
sc = new ScrollController();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
if (_isInit) {
|
||||||
|
var userResults = Provider.of<UsersProvider>(context);
|
||||||
|
userResults.setLoading();
|
||||||
|
userResults
|
||||||
|
.getUsers(userResults.getUserMedicalCenter() as String)
|
||||||
|
.then((_) {
|
||||||
|
userResults.resetLoading();
|
||||||
|
sc?.addListener(
|
||||||
|
() {
|
||||||
|
if (sc!.position.pixels == sc!.position.maxScrollExtent) {
|
||||||
|
var userResults = Provider.of<UsersProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
);
|
||||||
|
userResults
|
||||||
|
.getUsers(userResults.getUserMedicalCenter() as String);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_isInit = false;
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _deviceWidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _deviceWidth / 100;
|
||||||
|
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||||
|
return SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('My Packages'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 20,
|
||||||
|
right: 20,
|
||||||
|
bottom: 60,
|
||||||
|
left: 20,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
ResultBanner(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
text: 'Package History',
|
||||||
|
push: Routes.itemFilterScreen,
|
||||||
|
hasFilterObject: false,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
MyPackagesItemDataBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
hasHistoryBtn: false,
|
||||||
|
packages: MyPackagesHistoryScreen().packages!,
|
||||||
|
isAdmin: userData['roles']?.contains('User')
|
||||||
|
? false
|
||||||
|
: true,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.0,
|
||||||
|
),
|
||||||
|
Divider(
|
||||||
|
color: Colors.grey,
|
||||||
|
height: 2.0,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.0,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Consumer<UsersProvider>(
|
||||||
|
builder: (context, userResults, child) {
|
||||||
|
return userResults.isLoading
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
controller: sc,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
PackageHistoryDate(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
packages:
|
||||||
|
MyPackagesHistoryScreen()
|
||||||
|
.packages!,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.0,
|
||||||
|
),
|
||||||
|
TransferDataBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
user:
|
||||||
|
userResults.usersBox?[index],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemCount: userResults.usersBox?.length,
|
||||||
|
shrinkWrap: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,343 @@
|
|||||||
|
import 'package:cssd/config/colors.dart';
|
||||||
|
import 'package:cssd/config/routes.dart';
|
||||||
|
import 'package:cssd/models/package_model.dart';
|
||||||
|
import 'package:cssd/providers/connectivity.dart';
|
||||||
|
import 'package:cssd/providers/my_packages.dart';
|
||||||
|
import 'package:cssd/providers/users.dart';
|
||||||
|
import 'package:cssd/widgets/CycleScreens/Result/banner.dart';
|
||||||
|
import 'package:cssd/widgets/CycleScreens/Result/search_box.dart';
|
||||||
|
import 'package:cssd/widgets/Global/internet_error.dart';
|
||||||
|
import 'package:cssd/widgets/MyItemsScreens/Detail/cancel_transfer_button.dart';
|
||||||
|
import 'package:cssd/widgets/MyItemsScreens/Detail/transfer_data_box.dart';
|
||||||
|
import 'package:cssd/widgets/MyItemsScreens/Detail/transfer_destroy_button.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class PackageTransferScreen extends StatefulWidget {
|
||||||
|
final bool? isAdmin;
|
||||||
|
final PackageDetailObject? packages;
|
||||||
|
const PackageTransferScreen({
|
||||||
|
super.key,
|
||||||
|
this.isAdmin,
|
||||||
|
this.packages,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<PackageTransferScreen> createState() => _PackageTransferScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PackageTransferScreenState extends State<PackageTransferScreen> {
|
||||||
|
bool _isInit = true;
|
||||||
|
ScrollController? sc;
|
||||||
|
TextEditingController searchCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
sc = new ScrollController();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
if (_isInit) {
|
||||||
|
var userResults = Provider.of<UsersProvider>(context);
|
||||||
|
userResults.setLoading();
|
||||||
|
userResults
|
||||||
|
.getUsers(userResults.getUserMedicalCenter() as String)
|
||||||
|
.then((_) {
|
||||||
|
userResults.resetLoading();
|
||||||
|
sc!.addListener(
|
||||||
|
() {
|
||||||
|
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
||||||
|
searchCTRL.text == '') {
|
||||||
|
var userResults = Provider.of<UsersProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
);
|
||||||
|
userResults
|
||||||
|
.getUsers(userResults.getUserMedicalCenter() as String);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_isInit = false;
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _deviceWidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _deviceWidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Package Details'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 20,
|
||||||
|
right: 20,
|
||||||
|
bottom: 40,
|
||||||
|
left: 20,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
ResultBanner(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
text: 'Transfer to',
|
||||||
|
hasFilterObject: false,
|
||||||
|
push: Routes.myItemsFilterScreen,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.0,
|
||||||
|
),
|
||||||
|
ResultSearchBox(
|
||||||
|
searchCTRL: searchCTRL,
|
||||||
|
text: 'user',
|
||||||
|
text2: 'name',
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
onChanged: (value) {
|
||||||
|
Provider.of<UsersProvider>(context, listen: false)
|
||||||
|
.searchUsers(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Consumer<UsersProvider>(
|
||||||
|
builder: (context, userResults, _) {
|
||||||
|
return userResults.isLoading
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
controller: sc,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return TransferDataBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
user: userResults.usersBox?[index],
|
||||||
|
isClicked:
|
||||||
|
userResults.selectedUserIndex ==
|
||||||
|
index,
|
||||||
|
onTap: (userId) {
|
||||||
|
Provider.of<UsersProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).selectUser(index);
|
||||||
|
print(userId);
|
||||||
|
Provider.of<UsersProvider>(
|
||||||
|
context)
|
||||||
|
.saveUserId = userId;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemCount: userResults.usersBox?.length,
|
||||||
|
shrinkWrap: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TransferDestroyButton(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
firstColor: kDarkPurple,
|
||||||
|
secondColor: kDarkPurpleSub,
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(
|
||||||
|
'Are you sure to transfer this Package?',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
content: SizedBox(
|
||||||
|
width: _deviceBlockSize,
|
||||||
|
height: 280,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'By approving, all items in your package will be transferred the specified user. it can be undone unless the user reject the transfer.',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 3 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.0,
|
||||||
|
),
|
||||||
|
PackageCard(_deviceBlockSize),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Spacer(),
|
||||||
|
Text('To'),
|
||||||
|
SizedBox(
|
||||||
|
width: 5.0,
|
||||||
|
),
|
||||||
|
PackageCard(_deviceBlockSize),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.0,
|
||||||
|
),
|
||||||
|
TransferDestroyButton(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
firstColor: kDarkBlue,
|
||||||
|
secondColor: kDarkBlueSub,
|
||||||
|
onTap: () {
|
||||||
|
Provider.of<MyPackageProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).transferPackage(
|
||||||
|
PackageTransferScreen()
|
||||||
|
.packages!
|
||||||
|
.id,
|
||||||
|
Provider.of<UsersProvider>(
|
||||||
|
context,
|
||||||
|
).saveUserId!,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
text: 'Transfer',
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
CancelTransferButton(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
color: kPink,
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
text: 'Transfer',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Container PackageCard(double _deviceBlockSize) {
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.grey),
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(6.0),
|
||||||
|
child: Text(
|
||||||
|
PackageTransferScreen().packages!.id,
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 3 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
// Spacer(),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
width: 40 * _deviceBlockSize,
|
||||||
|
child: Text(
|
||||||
|
PackageTransferScreen().packages!.name,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 3 * _deviceBlockSize,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Container(
|
||||||
|
// width: 30 * _deviceBlockSize,
|
||||||
|
// child: Row(
|
||||||
|
// children: [
|
||||||
|
// Text(
|
||||||
|
// 'Size: ',
|
||||||
|
// overflow: TextOverflow.ellipsis,
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 3 * _deviceBlockSize,
|
||||||
|
// color: Colors.grey,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// Text(
|
||||||
|
// PackageTransferScreen().packages!.size,
|
||||||
|
// overflow: TextOverflow.ellipsis,
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontWeight: FontWeight.w700,
|
||||||
|
// fontSize: 3 * _deviceBlockSize,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// Container(
|
||||||
|
// width: 30 * _deviceBlockSize,
|
||||||
|
// child: Row(
|
||||||
|
// children: <Widget>[
|
||||||
|
// Text(
|
||||||
|
// 'User: ',
|
||||||
|
// style: TextStyle(
|
||||||
|
// color: Colors.grey,
|
||||||
|
// fontSize: 3 * _deviceBlockSize,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// Text(
|
||||||
|
// PackageTransferScreen().packages!.userName,
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 3 * _deviceBlockSize,
|
||||||
|
// fontWeight: FontWeight.w700,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,281 @@
|
|||||||
|
import 'package:cssd/config/colors.dart';
|
||||||
|
import 'package:cssd/models/package_model.dart';
|
||||||
|
import 'package:cssd/providers/packages.dart';
|
||||||
|
import 'package:cssd/widgets/PackageScreens/Add/package_save_button.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/CycleScreens/Add/add_label_box.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class PackageAddScreen extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_PackageAddScreenState createState() => _PackageAddScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PackageAddScreenState extends State<PackageAddScreen> {
|
||||||
|
final _packageUdiFocusNode = FocusNode();
|
||||||
|
final _descriptionFocusNode = FocusNode();
|
||||||
|
TextEditingController descriptionCTRL = new TextEditingController();
|
||||||
|
TextEditingController udiCTRL = new TextEditingController();
|
||||||
|
TextEditingController nameCTRL = new TextEditingController();
|
||||||
|
TextEditingController dateCTRL = new TextEditingController();
|
||||||
|
final _form = GlobalKey<FormState>();
|
||||||
|
bool isInit = true;
|
||||||
|
PackageFilterObject? filters;
|
||||||
|
|
||||||
|
int curLabelVal = 1;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
descriptionCTRL.text = '';
|
||||||
|
udiCTRL.text = '';
|
||||||
|
nameCTRL.text = '';
|
||||||
|
dateCTRL.text = DateFormat('y-M-d').format(DateTime.now());
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() async {
|
||||||
|
if (isInit) {
|
||||||
|
var packageProviderObject = Provider.of<PackageProvider>(context);
|
||||||
|
packageProviderObject.resetItemVals();
|
||||||
|
packageProviderObject.getItemFilters().then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
isInit = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context,
|
||||||
|
Routes.packageResultScreen,
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Packages'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context)
|
||||||
|
.pushReplacementNamed(Routes.packageResultScreen),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Form(
|
||||||
|
key: _form,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Add a Package',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 6 * _deviceBlockSize,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Name required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: nameCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Package Name',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_packageUdiFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'UDI required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: udiCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'UDI',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _packageUdiFocusNode,
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_descriptionFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.symmetric(vertical: 5),
|
||||||
|
child: Text(
|
||||||
|
'Items included',
|
||||||
|
style: TextStyle(
|
||||||
|
color: kPurple,
|
||||||
|
letterSpacing: 2,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Consumer<PackageProvider>(
|
||||||
|
builder: (ctx, packageProvider, _) =>
|
||||||
|
ListView.builder(
|
||||||
|
physics: NeverScrollableScrollPhysics(),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemBuilder: (ctx, index) => AddLabelBox(
|
||||||
|
text: 'Select Items Included',
|
||||||
|
iconColor: kPurpleSub,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
values:
|
||||||
|
packageProvider.itemValues[index],
|
||||||
|
vals: packageProvider.itemVals,
|
||||||
|
initialLabelValue:
|
||||||
|
packageProvider.initialItemValue,
|
||||||
|
index: index,
|
||||||
|
),
|
||||||
|
itemCount:
|
||||||
|
packageProvider.itemValues.length,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: descriptionCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Description',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.multiline,
|
||||||
|
focusNode: _descriptionFocusNode,
|
||||||
|
minLines: 1,
|
||||||
|
maxLines: 5,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
PackageAddSaveButton(
|
||||||
|
form: _form,
|
||||||
|
itemValues: Provider.of<PackageProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).itemValues,
|
||||||
|
nameCTRL: nameCTRL,
|
||||||
|
udiCTRL: udiCTRL,
|
||||||
|
dateValue: dateCTRL.text,
|
||||||
|
descriptionCTRL: descriptionCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
import 'package:cssd/models/package_model.dart';
|
||||||
|
import 'package:cssd/providers/packages.dart';
|
||||||
|
import 'package:cssd/widgets/PackageScreens/Details/package_detail_box.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class PackageDetailScreen extends StatefulWidget {
|
||||||
|
final String? testResultId;
|
||||||
|
|
||||||
|
PackageDetailScreen({
|
||||||
|
this.testResultId,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_PackageDetailScreenState createState() => _PackageDetailScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PackageDetailScreenState extends State<PackageDetailScreen> {
|
||||||
|
bool isInit = true;
|
||||||
|
bool isEmpty = false;
|
||||||
|
PackageDetailObject? datas;
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() async {
|
||||||
|
if (isInit) {
|
||||||
|
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||||
|
await Provider.of<PackageProvider>(context, listen: false)
|
||||||
|
.showPackageResult(_id.toString())
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
if (result.id == 'null') {
|
||||||
|
isEmpty = true;
|
||||||
|
}
|
||||||
|
datas = result;
|
||||||
|
isInit = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Packages'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: isEmpty
|
||||||
|
? Center(
|
||||||
|
child: Text('This Package does\'nt exists!'),
|
||||||
|
)
|
||||||
|
: PackageDetailsDataBox(
|
||||||
|
datas: datas!,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,296 @@
|
|||||||
|
import 'package:cssd/models/package_model.dart';
|
||||||
|
import 'package:cssd/providers/packages.dart';
|
||||||
|
import 'package:cssd/utils/scan.dart';
|
||||||
|
import 'package:cssd/widgets/PackageScreens/Filter/filter_button.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/CycleScreens/Filter/selector_box.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class PackageFilterScreen extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_PackageFilterScreenState createState() => _PackageFilterScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PackageFilterScreenState extends State<PackageFilterScreen> {
|
||||||
|
final _nameFocusNode = FocusNode();
|
||||||
|
final _udiFocusNode = FocusNode();
|
||||||
|
TextEditingController idCTRL = new TextEditingController();
|
||||||
|
TextEditingController hospitalCTRL = new TextEditingController();
|
||||||
|
TextEditingController nameCTRL = new TextEditingController();
|
||||||
|
TextEditingController udiCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
List<Map<String, String>> hospitalVals = [];
|
||||||
|
bool isInit = true;
|
||||||
|
PackageFilterObject? filters;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
filters = Provider.of<PackageProvider>(context, listen: false).filters;
|
||||||
|
idCTRL.text = filters!.id;
|
||||||
|
hospitalCTRL.text = filters!.hospital;
|
||||||
|
nameCTRL.text = filters!.name;
|
||||||
|
udiCTRL.text = filters!.udi;
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() async {
|
||||||
|
if (isInit) {
|
||||||
|
await Provider.of<PackageProvider>(context, listen: false)
|
||||||
|
.getHospitalsFilters()
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
hospitalVals = [
|
||||||
|
{'id': '', 'name': ''}
|
||||||
|
];
|
||||||
|
for (var hospital in result) {
|
||||||
|
hospitalVals.add(hospital);
|
||||||
|
}
|
||||||
|
filters!.hospital == ''
|
||||||
|
? hospitalCTRL.text = hospitalVals[0]['name']!
|
||||||
|
: hospitalVals.forEach(
|
||||||
|
//id convert to name
|
||||||
|
(hospital) {
|
||||||
|
if (hospital['id'] == filters!.hospital) {
|
||||||
|
hospitalCTRL.text = hospital['name']!;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
isInit = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context,
|
||||||
|
Routes.packageResultScreen,
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Packages'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context)
|
||||||
|
.pushReplacementNamed(Routes.packageResultScreen),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Filter Packages',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 8,
|
||||||
|
child: TextFormField(
|
||||||
|
controller: idCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Package ID',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_nameFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Spacer(),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
print(result);
|
||||||
|
idCTRL.text = result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: nameCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Package Name',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _nameFocusNode,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_udiFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: udiCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'UDI',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _udiFocusNode,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30.0,
|
||||||
|
),
|
||||||
|
FilterHospitalBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
hospitalCTRL: hospitalCTRL,
|
||||||
|
hospitalVals: hospitalVals,
|
||||||
|
label: 'Hospital',
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 90,
|
||||||
|
),
|
||||||
|
PackageFilterSaveButton(
|
||||||
|
hospitalVals: hospitalVals,
|
||||||
|
hospitalCTRL: hospitalCTRL,
|
||||||
|
idCTRL: idCTRL,
|
||||||
|
nameCTRL: nameCTRL,
|
||||||
|
udiCTRL: udiCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,269 @@
|
|||||||
|
import 'package:cssd/config/colors.dart';
|
||||||
|
import 'package:cssd/providers/packages.dart';
|
||||||
|
import 'package:cssd/widgets/PackageScreens/Filter/package_filter_object.dart';
|
||||||
|
import 'package:cssd/widgets/PackageScreens/Result/package_data_box.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/CycleScreens/Result/banner.dart';
|
||||||
|
import '../../widgets/CycleScreens/Result/search_box.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class PackageResultScreen extends StatefulWidget {
|
||||||
|
final bool? isAdmin;
|
||||||
|
|
||||||
|
PackageResultScreen({this.isAdmin});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_PackageResultScreenState createState() => _PackageResultScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PackageResultScreenState extends State<PackageResultScreen> {
|
||||||
|
bool _isInit = true;
|
||||||
|
ScrollController? sc;
|
||||||
|
TextEditingController searchCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
sc = new ScrollController();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
if (_isInit) {
|
||||||
|
var testResults = Provider.of<PackageProvider>(context);
|
||||||
|
testResults.setLoading();
|
||||||
|
testResults.resetPageNumber();
|
||||||
|
testResults.getPackageResults().then((_) {
|
||||||
|
testResults.resetLoading();
|
||||||
|
sc!.addListener(
|
||||||
|
() {
|
||||||
|
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
||||||
|
searchCTRL.text == '') {
|
||||||
|
var testResults = Provider.of<PackageProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
);
|
||||||
|
testResults.getPackageResults();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_isInit = false;
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
floatingActionButton: PackageResultFloatingButton(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Home'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 20,
|
||||||
|
right: 20,
|
||||||
|
bottom: 60,
|
||||||
|
left: 20,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
ResultBanner(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
text: 'Packages',
|
||||||
|
push: Routes.packageFilterScreen,
|
||||||
|
),
|
||||||
|
Consumer<PackageProvider>(
|
||||||
|
builder: (ctx, package, _) {
|
||||||
|
return Container(
|
||||||
|
height: 50,
|
||||||
|
child: ListView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
shrinkWrap: true,
|
||||||
|
children: <Widget>[
|
||||||
|
package.filters!.id != ''
|
||||||
|
? PackageFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'ID',
|
||||||
|
id: '',
|
||||||
|
name: package.filters!.name,
|
||||||
|
hospital: package.filters!.hospital,
|
||||||
|
udi: package.filters!.udi,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
package.filters!.name != ''
|
||||||
|
? PackageFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Package Name',
|
||||||
|
id: package.filters!.id,
|
||||||
|
name: '',
|
||||||
|
udi: package.filters!.udi,
|
||||||
|
hospital: package.filters!.hospital,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
package.filters!.hospital != ''
|
||||||
|
? PackageFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Hospital',
|
||||||
|
id: package.filters!.id,
|
||||||
|
name: package.filters!.name,
|
||||||
|
udi: package.filters!.udi,
|
||||||
|
hospital: '',
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
package.filters!.udi != ''
|
||||||
|
? PackageFilterChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'UDI',
|
||||||
|
id: package.filters!.id,
|
||||||
|
name: package.filters!.name,
|
||||||
|
udi: '',
|
||||||
|
hospital: package.filters!.hospital,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ResultSearchBox(
|
||||||
|
searchCTRL: searchCTRL,
|
||||||
|
text: 'package',
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
onChanged: (value) {
|
||||||
|
Provider.of<PackageProvider>(context, listen: false)
|
||||||
|
.search(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Consumer<PackageProvider>(
|
||||||
|
builder: (context, packageResults, _) {
|
||||||
|
return packageResults.isloading
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
controller: sc,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
// String items = '';
|
||||||
|
// for (var item in packageResults
|
||||||
|
// .items![index].items) {
|
||||||
|
// items += item;
|
||||||
|
// items += ' , ';
|
||||||
|
// }
|
||||||
|
// items = items.substring(
|
||||||
|
// 0,
|
||||||
|
// items.length - 3,
|
||||||
|
// ); // remove extra ,
|
||||||
|
return PackageItemBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
item: packageResults.items?[index],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemCount: packageResults.items?.length,
|
||||||
|
shrinkWrap: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PackageResultFloatingButton extends StatelessWidget {
|
||||||
|
const PackageResultFloatingButton({
|
||||||
|
Key? key,
|
||||||
|
required double deviceBlockSize,
|
||||||
|
}) : _deviceBlockSize = deviceBlockSize,
|
||||||
|
super(key: key);
|
||||||
|
|
||||||
|
final double _deviceBlockSize;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
customBorder: CircleBorder(),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pushNamed(Routes.packageScanScreen);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(2.5 * _deviceBlockSize),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 7.1 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 2 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
customBorder: CircleBorder(),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pushReplacementNamed(Routes.packageAddScreen);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(_deviceBlockSize),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: kPurple,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.add,
|
||||||
|
size: 10 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
import 'package:cssd/config/colors.dart';
|
||||||
|
import 'package:cssd/utils/scan.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class PackageScanScreen extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() {
|
||||||
|
return _PackageScanScreenState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PackageScanScreenState extends State<PackageScanScreen> {
|
||||||
|
TextEditingController idCTRL = new TextEditingController();
|
||||||
|
final _form = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Packages'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? ListView(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(top: 30),
|
||||||
|
child: Text(
|
||||||
|
'Looking for a Package?',
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 5.5 * _deviceBlockSize,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.symmetric(vertical: 10),
|
||||||
|
height: 200,
|
||||||
|
decoration: BoxDecoration(border: Border.all()),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'Please Scan The Package Barcode',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
launch(
|
||||||
|
'https://cssd-doc.com/Show/Package/$result',
|
||||||
|
);
|
||||||
|
// Navigator.of(context).pushNamed(
|
||||||
|
// Routes.cycleDetailScreen,
|
||||||
|
// arguments: result,
|
||||||
|
// );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.0,
|
||||||
|
),
|
||||||
|
Form(
|
||||||
|
key: _form,
|
||||||
|
child: TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Id required!!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: idCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Or enter a Package ID',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
// borderRadius: BorderRadius.only(Radius.circular(4)),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
if (!_form.currentState!.validate()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
launch(
|
||||||
|
'https://cssd-doc.com/Show/Package/${idCTRL.text}',
|
||||||
|
);
|
||||||
|
// Navigator.of(context).pushNamed(
|
||||||
|
// Routes.cycleDetailScreen,
|
||||||
|
// arguments: idCTRL.text,
|
||||||
|
// );
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 5 * _deviceBlockSize,
|
||||||
|
vertical: 10,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
colors: [kPurple, kPurpleSub],
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(7),
|
||||||
|
),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'Search',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,240 @@
|
|||||||
|
import 'package:cssd/models/package_model.dart';
|
||||||
|
import 'package:cssd/providers/packages.dart';
|
||||||
|
import 'package:cssd/widgets/PackageScreens/Add/package_update_button.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class PackageUpdateScreen extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_PackageUpdateScreenState createState() => _PackageUpdateScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PackageUpdateScreenState extends State<PackageUpdateScreen> {
|
||||||
|
final _udiFocusNode = FocusNode();
|
||||||
|
final _descriptionFocusNode = FocusNode();
|
||||||
|
TextEditingController nameCTRL = new TextEditingController();
|
||||||
|
TextEditingController udiCTRL = new TextEditingController();
|
||||||
|
TextEditingController descriptionCTRL = new TextEditingController();
|
||||||
|
TextEditingController itemCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
final _form = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
bool isEmpty = false;
|
||||||
|
bool isInit = true;
|
||||||
|
PackageDetailObject? datas;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() async {
|
||||||
|
if (isInit) {
|
||||||
|
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||||
|
await Provider.of<PackageProvider>(context, listen: false)
|
||||||
|
.showPackageResult(_id.toString())
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
datas = result;
|
||||||
|
nameCTRL.text = datas!.name;
|
||||||
|
udiCTRL.text = datas!.udi;
|
||||||
|
descriptionCTRL.text = datas!.description;
|
||||||
|
for (String item in datas!.items) {
|
||||||
|
itemCTRL.text = item;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
await Provider.of<PackageProvider>(context, listen: false)
|
||||||
|
.getItemFilters()
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
isInit = false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context,
|
||||||
|
Routes.packageResultScreen,
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
title: Text('Packages'),
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context)
|
||||||
|
.pushReplacementNamed(Routes.packageResultScreen),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(color: Colors.black),
|
||||||
|
)
|
||||||
|
: Form(
|
||||||
|
key: _form,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Update a Package',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 6 * _deviceBlockSize,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Name required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: nameCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Package Name',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_udiFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'UDI required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: udiCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'UDI',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _udiFocusNode,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(_descriptionFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: descriptionCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Description',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.multiline,
|
||||||
|
focusNode: _descriptionFocusNode,
|
||||||
|
minLines: 1,
|
||||||
|
maxLines: 5,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
PackageUpdateButton(
|
||||||
|
form: _form,
|
||||||
|
id: datas!.id,
|
||||||
|
nameCTRL: nameCTRL,
|
||||||
|
udiCTRL: udiCTRL,
|
||||||
|
itemCTRL: itemCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
descriptionCTRL: descriptionCTRL,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,292 @@
|
|||||||
|
import 'package:barcode_scan2/barcode_scan2.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../providers/test_results.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
import '../../widgets/TestResultScreens/Add/selector_box.dart';
|
||||||
|
|
||||||
|
class TestResultAddScreen extends StatefulWidget {
|
||||||
|
// static const route = '/TestResultAddScreen';
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() {
|
||||||
|
return _TestResultAddScreenState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _TestResultAddScreenState extends State<TestResultAddScreen> {
|
||||||
|
TextEditingController testTypeCTRL = new TextEditingController();
|
||||||
|
final List<String> testTypeVals = [];
|
||||||
|
|
||||||
|
TextEditingController testCodeCTRL = new TextEditingController();
|
||||||
|
bool isInit = true;
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
if (isInit) {
|
||||||
|
var testResultProviderObject =
|
||||||
|
Provider.of<TestResultsProvider>(context, listen: false);
|
||||||
|
testResultProviderObject.getFilterItems().then((result) {
|
||||||
|
for (var testType in result[1].keys) {
|
||||||
|
testTypeVals.add(testType);
|
||||||
|
}
|
||||||
|
testTypeCTRL.text = testTypeVals[0];
|
||||||
|
setState(() {
|
||||||
|
isInit = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context,
|
||||||
|
Routes.testResultScreen,
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Test Results'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
// padding: EdgeInsets.all(0),
|
||||||
|
onPressed: () => Navigator.of(context)
|
||||||
|
.popAndPushNamed(Routes.testResultScreen),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ListView(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 20, vertical: 20),
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 10,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'Add a Test Result',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
letterSpacing: 3,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.only(top: 5, bottom: 30),
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
height: 200,
|
||||||
|
decoration: BoxDecoration(border: Border.all()),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'PLease Scan The Test Barcode',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.grey,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context,
|
||||||
|
Routes.formTestResultScreen,
|
||||||
|
arguments: result,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: <Widget>[
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
width: 70 * _deviceBlockSize,
|
||||||
|
child: TestResultAddSelectorBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
dataCTRL: testTypeCTRL,
|
||||||
|
dataVals: testTypeVals,
|
||||||
|
label: 'Choose a Test Type',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.end,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'OR',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 8 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 50 * _deviceBlockSize,
|
||||||
|
child: TextFormField(
|
||||||
|
onChanged: (val) {
|
||||||
|
if (val != '') {
|
||||||
|
setState(() {
|
||||||
|
testTypeCTRL.text = '';
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
testTypeCTRL.text =
|
||||||
|
testTypeVals[0];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
controller: testCodeCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
isDense: true,
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons
|
||||||
|
.sortNumericDown,
|
||||||
|
),
|
||||||
|
labelText: 'Enter a Test Code',
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontSize: 3 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
contentPadding: EdgeInsets.only(
|
||||||
|
bottom: 5,
|
||||||
|
top: 5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
keyboardType:
|
||||||
|
TextInputType.visiblePassword,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 40.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 5 * _deviceBlockSize,
|
||||||
|
vertical: 10,
|
||||||
|
),
|
||||||
|
width: 50 * _deviceBlockSize,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.black,
|
||||||
|
borderRadius: BorderRadius.circular(7),
|
||||||
|
),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: TextButton(
|
||||||
|
child: Text(
|
||||||
|
'Select',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
if (testCodeCTRL.text != '') {
|
||||||
|
Provider.of<TestResultsProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).testCode = testCodeCTRL.text;
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context,
|
||||||
|
Routes.formTestResultScreen,
|
||||||
|
arguments: testCodeCTRL.text,
|
||||||
|
);
|
||||||
|
} else if (testTypeCTRL.text !=
|
||||||
|
'') {
|
||||||
|
Provider.of<TestResultsProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).testType = testTypeCTRL.text;
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context,
|
||||||
|
Routes.formTestResultScreen,
|
||||||
|
arguments: testTypeCTRL.text,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// print(testCode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<String> scan() async {
|
||||||
|
try {
|
||||||
|
var barcode = await BarcodeScanner.scan();
|
||||||
|
if (barcode.type.name == 'Cancelled') {
|
||||||
|
return 'cancel';
|
||||||
|
} else if (barcode.type.name == 'Failed') {
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
return barcode.rawContent;
|
||||||
|
} on PlatformException catch (_) {
|
||||||
|
return 'access';
|
||||||
|
} catch (_) {
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,75 +1,78 @@
|
|||||||
import '../providers/connectivity.dart';
|
import '../../providers/connectivity.dart';
|
||||||
import '../providers/test_results.dart';
|
import '../../providers/test_results.dart';
|
||||||
import '../widgets/Global/internet_error.dart';
|
import '../../widgets/Global/internet_error.dart';
|
||||||
import '../widgets/TestResultScreens/Details/datas_box.dart';
|
import '../../widgets/TestResultScreens/Details/datas_box.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class TestDetailsScreen extends StatefulWidget {
|
class TestDetailsScreen extends StatefulWidget {
|
||||||
// static const route = '/TestDetailsScreen';
|
// static const route = '/TestDetailsScreen';
|
||||||
final String testResultId;
|
final String? testResultId;
|
||||||
|
|
||||||
TestDetailsScreen({this.testResultId});
|
TestDetailsScreen({this.testResultId});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_TestDetailsScreenState createState() => _TestDetailsScreenState();
|
_TestDetailsScreenState createState() => _TestDetailsScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TestDetailsScreenState extends State<TestDetailsScreen> {
|
class _TestDetailsScreenState extends State<TestDetailsScreen> {
|
||||||
bool isInit = true;
|
bool isInit = true;
|
||||||
Map<String, dynamic> datas;
|
Map<String, Object>? datas;
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() async {
|
void didChangeDependencies() async {
|
||||||
if (isInit) {
|
if (isInit) {
|
||||||
var _id = ModalRoute.of(context).settings.arguments;
|
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||||
await Provider.of<TestResultsProvider>(context, listen: false)
|
await Provider.of<TestResultsProvider>(context, listen: false)
|
||||||
.showTestResult(_id.toString())
|
.showTestResult(_id.toString())
|
||||||
.then((result) {
|
.then((result) {
|
||||||
setState(() {
|
setState(() {
|
||||||
datas = result;
|
datas = result.cast<String, Object>();
|
||||||
isInit = false;
|
isInit = false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// print(datas);
|
// print(datas);
|
||||||
}
|
}
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final _media = MediaQuery.of(context);
|
final _media = MediaQuery.of(context);
|
||||||
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
final double _devicewidth = _media.size.width;
|
final double _devicewidth = _media.size.width;
|
||||||
final double _deviceBlockSize = _devicewidth / 100;
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
// print(datas);
|
// print(datas);
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
titleSpacing: -10,
|
titleSpacing: -10,
|
||||||
title: Text('Test Result Detail'),
|
title: Text('Test Results'),
|
||||||
leading: IconButton(
|
backgroundColor: Colors.black,
|
||||||
icon: Icon(
|
leading: IconButton(
|
||||||
Icons.keyboard_arrow_left,
|
icon: Icon(
|
||||||
size: 35,
|
Icons.keyboard_arrow_left,
|
||||||
),
|
size: 35,
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
),
|
||||||
),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
),
|
),
|
||||||
body: Consumer<ConnectivityProvider>(
|
),
|
||||||
builder: (ct, connection, _) {
|
body: Consumer<ConnectivityProvider>(
|
||||||
return connection.conStatus != 'offline'
|
builder: (ct, connection, _) {
|
||||||
? isInit
|
return connection.conStatus != 'offline'
|
||||||
? Center(
|
? isInit
|
||||||
child: CircularProgressIndicator(),
|
? Center(
|
||||||
)
|
child: CircularProgressIndicator(
|
||||||
: DatasBox(
|
color: Colors.black,
|
||||||
datas: datas,
|
),
|
||||||
deviceBlockSize: _deviceBlockSize,
|
)
|
||||||
)
|
: DatasBox(
|
||||||
: ConnectionErrorBox();
|
datas: datas!,
|
||||||
},
|
deviceBlockSize: _deviceBlockSize,
|
||||||
),
|
)
|
||||||
),
|
: ConnectionErrorBox();
|
||||||
);
|
},
|
||||||
}
|
),
|
||||||
}
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,431 @@
|
|||||||
|
import 'package:barcode_scan2/barcode_scan2.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../models/test_result_models.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../providers/test_results.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
import '../../widgets/TestResultScreens/Filter/date_picker.dart';
|
||||||
|
import '../../widgets/TestResultScreens/Filter/selector_box.dart';
|
||||||
|
|
||||||
|
class TestFilterScreen extends StatefulWidget {
|
||||||
|
// static const route = '/TestFilterScreen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
_TestFilterScreenState createState() => _TestFilterScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _TestFilterScreenState extends State<TestFilterScreen> {
|
||||||
|
TextEditingController idCTRL = new TextEditingController();
|
||||||
|
TextEditingController labelIdCTRL = new TextEditingController();
|
||||||
|
TextEditingController testTypeCTRL = new TextEditingController();
|
||||||
|
TextEditingController hospitalCTRL = new TextEditingController();
|
||||||
|
TextEditingController fDateCTRL = new TextEditingController();
|
||||||
|
TextEditingController uDateCTRL = new TextEditingController();
|
||||||
|
|
||||||
|
TextEditingController usernameCTRL = new TextEditingController();
|
||||||
|
// TextEditingController dateFrom = new TextEditingController();
|
||||||
|
// TextEditingController dateUntil = new TextEditingController();
|
||||||
|
DateTime? dateTimeFrom;
|
||||||
|
DateTime? dateTimeUntil;
|
||||||
|
|
||||||
|
final List<String> labelIDVals = [
|
||||||
|
'',
|
||||||
|
'Washer ID',
|
||||||
|
'Autoclave ID',
|
||||||
|
'Sterilizer ID',
|
||||||
|
'Seal Machine ID',
|
||||||
|
'Patiant ID',
|
||||||
|
'Set/Pack ID',
|
||||||
|
'Medical Device ID',
|
||||||
|
'OR ID',
|
||||||
|
'Insrtument ID',
|
||||||
|
'Basket ID',
|
||||||
|
'Implant ID',
|
||||||
|
// 'None',
|
||||||
|
];
|
||||||
|
// String curLabelIDVal;
|
||||||
|
|
||||||
|
final List<String> testTypeVals = [];
|
||||||
|
Map<String, String>? testTypes;
|
||||||
|
|
||||||
|
final List<String> hospitalVals = [];
|
||||||
|
Map<String, String> hospitals = {};
|
||||||
|
// String curhospitalVal;
|
||||||
|
|
||||||
|
bool isInit = true;
|
||||||
|
// final List<String> labelIDVals = ['Washer ID'];
|
||||||
|
// String curLabelIDVal;
|
||||||
|
|
||||||
|
// final List<String> labelIDVals = ['Washer ID'];
|
||||||
|
// String curLabelIDVal;
|
||||||
|
|
||||||
|
// @override
|
||||||
|
// void initState() {
|
||||||
|
// super.initState();
|
||||||
|
// }
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
if (isInit) {
|
||||||
|
// fDateCTRL.text = DateFormat('y-M-d').format(DateTime.now());
|
||||||
|
// uDateCTRL.text = DateFormat('y-M-d').format(DateTime.now());
|
||||||
|
fDateCTRL.text = '';
|
||||||
|
uDateCTRL.text = '';
|
||||||
|
var testResultProviderObject =
|
||||||
|
Provider.of<TestResultsProvider>(context, listen: false);
|
||||||
|
TestResultFilterObject filters = testResultProviderObject.filters;
|
||||||
|
idCTRL.text = filters.id;
|
||||||
|
usernameCTRL.text = filters.userName;
|
||||||
|
labelIdCTRL.text =
|
||||||
|
filters.labelID == '' ? labelIDVals[0] : filters.labelID;
|
||||||
|
idCTRL.text = filters.id;
|
||||||
|
usernameCTRL.text = filters.userName;
|
||||||
|
testResultProviderObject.getFilterItems().then((result) {
|
||||||
|
hospitals = result[0];
|
||||||
|
testTypes = result[1];
|
||||||
|
hospitalVals.add('');
|
||||||
|
for (var hospital in result[0].keys) {
|
||||||
|
hospitalVals.add(hospital);
|
||||||
|
}
|
||||||
|
testTypeVals.add('');
|
||||||
|
for (var testType in result[1].keys) {
|
||||||
|
testTypeVals.add(testType);
|
||||||
|
}
|
||||||
|
var testTypeKey = testTypes!.keys.firstWhere(
|
||||||
|
(k) => testTypes![k] == filters.testType,
|
||||||
|
orElse: () => ''); // recent testtype name
|
||||||
|
var hospitalKey = hospitals.keys.firstWhere(
|
||||||
|
(k) => hospitals[k] == filters.hospital,
|
||||||
|
orElse: () => ''); // recent testtype name
|
||||||
|
testTypeCTRL.text =
|
||||||
|
filters.testType == '' ? testTypeVals[0] : testTypeKey;
|
||||||
|
hospitalCTRL.text =
|
||||||
|
filters.hospital == '' ? hospitalVals[0] : hospitalKey;
|
||||||
|
// print(result[0]);
|
||||||
|
// print(result[1]);
|
||||||
|
setState(() {
|
||||||
|
isInit = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context,
|
||||||
|
Routes.testResultScreen,
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Test Results'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).popAndPushNamed(
|
||||||
|
Routes.testResultScreen,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Filter Test Results',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 8,
|
||||||
|
child: TextFormField(
|
||||||
|
controller: idCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'ID',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
// onFieldSubmitted: (_) {
|
||||||
|
// FocusScope.of(context)
|
||||||
|
// .requestFocus(_cycleNumberFocusNode);
|
||||||
|
// },
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
print(result);
|
||||||
|
idCTRL.text = result;
|
||||||
|
// Navigator.of(context).pushNamed(
|
||||||
|
// CycleDetailScreen.route,
|
||||||
|
// arguments: result,
|
||||||
|
// );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
SizedBox(
|
||||||
|
height: 25,
|
||||||
|
),
|
||||||
|
TestResultFilterSelectorBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
dataCTRL: labelIdCTRL,
|
||||||
|
dataVals: labelIDVals,
|
||||||
|
label: 'Label ID',
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 25,
|
||||||
|
),
|
||||||
|
|
||||||
|
TextFormField(
|
||||||
|
controller: usernameCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Username',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
// onFieldSubmitted: (_) {
|
||||||
|
// FocusScope.of(context)
|
||||||
|
// .requestFocus(_cycleNumberFocusNode);
|
||||||
|
// },
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 25,
|
||||||
|
),
|
||||||
|
TestResultFilterSelectorBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
dataCTRL: testTypeCTRL,
|
||||||
|
dataVals: testTypeVals,
|
||||||
|
label: 'Test Type',
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 25,
|
||||||
|
),
|
||||||
|
TestResultFilterSelectorBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
dataCTRL: hospitalCTRL,
|
||||||
|
dataVals: hospitalVals,
|
||||||
|
label: 'Hospital',
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 25,
|
||||||
|
),
|
||||||
|
|
||||||
|
TestResultFilterDatePicker(
|
||||||
|
dateCTRL: fDateCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Date From',
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 25,
|
||||||
|
),
|
||||||
|
TestResultFilterDatePicker(
|
||||||
|
dateCTRL: uDateCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Date Until',
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Provider.of<TestResultsProvider>(context,
|
||||||
|
listen: false)
|
||||||
|
.setFilters(
|
||||||
|
idCTRL.text,
|
||||||
|
labelIdCTRL.text != ''
|
||||||
|
? labelIdCTRL.text
|
||||||
|
: '',
|
||||||
|
usernameCTRL.text,
|
||||||
|
testTypeCTRL.text != ''
|
||||||
|
? testTypes![testTypeCTRL.text]
|
||||||
|
: '',
|
||||||
|
hospitalCTRL.text != ''
|
||||||
|
? hospitals[hospitalCTRL.text]
|
||||||
|
: '',
|
||||||
|
fDateCTRL.text,
|
||||||
|
uDateCTRL.text,
|
||||||
|
);
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (ctx) => AlertDialog(
|
||||||
|
content: Text('Filters changed.'),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(ctx).pop();
|
||||||
|
// Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
child: Text('Ok'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
).then(
|
||||||
|
(_) =>
|
||||||
|
Navigator.of(context).popAndPushNamed(
|
||||||
|
Routes.testResultScreen,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 5 * _deviceBlockSize,
|
||||||
|
vertical: 10,
|
||||||
|
),
|
||||||
|
// margin:
|
||||||
|
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
colors: [Colors.black, Colors.black87],
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(7),
|
||||||
|
),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'Filter',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
// DropDownBox(values: ['Washer ID']),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<String> scan() async {
|
||||||
|
try {
|
||||||
|
var barcode = await BarcodeScanner.scan();
|
||||||
|
if (barcode.type.name == 'Cancelled') {
|
||||||
|
return 'cancel';
|
||||||
|
} else if (barcode.type.name == 'Failed') {
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
var id = barcode.rawContent.contains('www.cssd-doc.com')
|
||||||
|
? barcode.rawContent.split('/')[5]
|
||||||
|
: barcode.rawContent;
|
||||||
|
|
||||||
|
return id;
|
||||||
|
} catch (_) {
|
||||||
|
return 'null';
|
||||||
|
}
|
||||||
|
} on PlatformException catch (_) {
|
||||||
|
return 'access';
|
||||||
|
} catch (_) {
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,195 +1,204 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:random_string/random_string.dart';
|
import 'package:random_string/random_string.dart';
|
||||||
|
|
||||||
import '../config/routes.dart';
|
import '../../config/routes.dart';
|
||||||
import '../providers/input.dart';
|
import '../../providers/input.dart';
|
||||||
import '../providers/test_results.dart';
|
import '../../providers/test_results.dart';
|
||||||
import '../widgets/TestResultScreens/Add/form_creator.dart';
|
import '../../widgets/TestResultScreens/Add/form_creator.dart';
|
||||||
|
|
||||||
class FormPage extends StatefulWidget {
|
class FormPage extends StatefulWidget {
|
||||||
final String name;
|
final String? name;
|
||||||
final String uniqueCode;
|
final String? uniqueCode;
|
||||||
final String testResultId;
|
final String? testResultId;
|
||||||
final String testTypeId;
|
final String? testTypeId;
|
||||||
|
|
||||||
FormPage({this.name, this.uniqueCode, this.testResultId, this.testTypeId});
|
FormPage({this.name, this.uniqueCode, this.testResultId, this.testTypeId});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_FormPageState createState() => _FormPageState();
|
_FormPageState createState() => _FormPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _FormPageState extends State<FormPage> {
|
class _FormPageState extends State<FormPage> {
|
||||||
bool _isInit = true;
|
bool _isInit = true;
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
bool isAdding = false;
|
bool isAdding = false;
|
||||||
final _form = GlobalKey<FormState>();
|
final _form = GlobalKey<FormState>();
|
||||||
Map<String, dynamic> values = {};
|
Map<String, dynamic> values = {};
|
||||||
List<Map<String, dynamic>> formInputs;
|
List<Map<String, dynamic>> formInputs = [];
|
||||||
|
|
||||||
void _saveForm() {
|
void _saveForm() {
|
||||||
final batchId = randomString(10);
|
final batchId = randomString(10);
|
||||||
formatData(formInputs);
|
formatData(formInputs);
|
||||||
var prvObject = Provider.of<TestResultsProvider>(context, listen: false);
|
var prvObject = Provider.of<TestResultsProvider>(context, listen: false);
|
||||||
if (this.widget.testResultId != null && this.widget.testResultId != '') {
|
if (this.widget.testResultId != null && this.widget.testResultId != '') {
|
||||||
values['_method'] = 'put';
|
values['_method'] = 'put';
|
||||||
TestResultsProvider.updateTestResult(this.widget.testResultId, values)
|
TestResultsProvider.updateTestResult(this.widget.testResultId!, values)
|
||||||
.then((_) {
|
.then((_) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
});
|
});
|
||||||
prvObject.createTestResult(values, batchId).then((result) {
|
prvObject.createTestResult(values, batchId).then((result) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
if (result == 'done') {
|
if (result == 'done') {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (ctx) => AlertDialog(
|
builder: (ctx) => AlertDialog(
|
||||||
content: Text('Test added.'),
|
content: Text('Test added.'),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(ctx).pop();
|
Navigator.of(ctx).pop();
|
||||||
},
|
},
|
||||||
child: Text('Ok'),
|
child: Text('Ok'),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
).then((value) =>
|
).then((value) =>
|
||||||
Navigator.of(context).popAndPushNamed(Routes.testResultScreen));
|
Navigator.of(context).popAndPushNamed(Routes.testResultScreen));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
if (_isInit) {
|
if (_isInit) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
});
|
});
|
||||||
Provider.of<Inputs>(context, listen: false)
|
String testTypeName = Provider.of<TestResultsProvider>(context).testType;
|
||||||
.getInputs(
|
String testCode = Provider.of<TestResultsProvider>(context).testCode;
|
||||||
testResultId: this.widget.testResultId ?? "",
|
Provider.of<Inputs>(context, listen: false)
|
||||||
name: this.widget.name ?? "",
|
.getInputs(
|
||||||
uniqueCode: this.widget.uniqueCode ?? "",
|
testResultId: '',
|
||||||
testTypeId: this.widget.testTypeId ?? "")
|
name: testTypeName,
|
||||||
.then((_) {
|
uniqueCode: testCode,
|
||||||
setState(() {
|
testTypeId: '',
|
||||||
_isLoading = false;
|
)
|
||||||
});
|
.then((_) {
|
||||||
});
|
setState(() {
|
||||||
}
|
_isLoading = false;
|
||||||
_isInit = false;
|
});
|
||||||
super.didChangeDependencies();
|
});
|
||||||
}
|
}
|
||||||
|
_isInit = false;
|
||||||
@override
|
super.didChangeDependencies();
|
||||||
Widget build(BuildContext context) {
|
}
|
||||||
return WillPopScope(
|
|
||||||
onWillPop: () async {
|
@override
|
||||||
Navigator.pushReplacementNamed(
|
Widget build(BuildContext context) {
|
||||||
context,
|
return WillPopScope(
|
||||||
Routes.testResultAddScreen,
|
onWillPop: () async {
|
||||||
);
|
Navigator.pushReplacementNamed(
|
||||||
return true;
|
context,
|
||||||
},
|
Routes.testResultAddScreen,
|
||||||
child: SafeArea(
|
);
|
||||||
child: Scaffold(
|
return true;
|
||||||
appBar: AppBar(
|
},
|
||||||
centerTitle: true,
|
child: SafeArea(
|
||||||
title: Text('Add Test Result'),
|
child: Scaffold(
|
||||||
actions: <Widget>[
|
appBar: AppBar(
|
||||||
IconButton(
|
centerTitle: true,
|
||||||
icon: Icon(Icons.save),
|
title: Text('Add Test Result'),
|
||||||
onPressed: () {
|
backgroundColor: Colors.black,
|
||||||
_saveForm();
|
actions: <Widget>[
|
||||||
},
|
IconButton(
|
||||||
)
|
icon: Icon(Icons.save),
|
||||||
],
|
onPressed: () {
|
||||||
leading: IconButton(
|
_saveForm();
|
||||||
icon: Icon(
|
},
|
||||||
Icons.keyboard_arrow_left,
|
)
|
||||||
size: 35,
|
],
|
||||||
),
|
leading: IconButton(
|
||||||
onPressed: () {
|
icon: Icon(
|
||||||
Navigator.of(context)
|
Icons.keyboard_arrow_left,
|
||||||
.popAndPushNamed(Routes.testResultScreen);
|
size: 35,
|
||||||
},
|
),
|
||||||
),
|
onPressed: () {
|
||||||
),
|
Navigator.of(context).popAndPushNamed(Routes.testResultScreen);
|
||||||
body: Column(
|
},
|
||||||
children: <Widget>[
|
),
|
||||||
Expanded(
|
),
|
||||||
child: _isLoading
|
body: SingleChildScrollView(
|
||||||
? Center(child: CircularProgressIndicator())
|
child: Column(
|
||||||
: Form(
|
children: <Widget>[
|
||||||
key: _form,
|
_isLoading
|
||||||
child: Consumer<Inputs>(
|
? Center(
|
||||||
builder: (context, inputs, _) {
|
child: CircularProgressIndicator(
|
||||||
formInputs = inputs.inputItems;
|
color: Colors.black,
|
||||||
return formInputs.length != 0
|
),
|
||||||
? FormCreator(
|
)
|
||||||
form: inputs.inputItems,
|
: Form(
|
||||||
onChanged: (value) {
|
key: _form,
|
||||||
formInputs = value;
|
child: Consumer<Inputs>(
|
||||||
},
|
builder: (context, inputs, _) {
|
||||||
)
|
formInputs = inputs.inputItems;
|
||||||
: Center(
|
print(formInputs);
|
||||||
child: Text('An error happen!!!'),
|
return formInputs.length != 0
|
||||||
);
|
? FormCreator(
|
||||||
},
|
form: formInputs,
|
||||||
),
|
onChanged: (value) {
|
||||||
),
|
formInputs = value;
|
||||||
),
|
},
|
||||||
// https://www.cssd-doc.com/api/GetInfo
|
)
|
||||||
// InkWell(
|
: Center(
|
||||||
// onTap: () {
|
child: Text('Something went wrong!!!'),
|
||||||
// _saveForm();
|
);
|
||||||
// },
|
},
|
||||||
// child: Container(
|
),
|
||||||
// padding: EdgeInsets.symmetric(horizontal: 60, vertical: 15),
|
),
|
||||||
// margin: EdgeInsets.symmetric(vertical: 20, horizontal: 50),
|
// https://www.cssd-doc.com/api/GetInfo
|
||||||
// decoration: BoxDecoration(
|
// InkWell(
|
||||||
// gradient: LinearGradient(colors: [Colors.blue, Colors.green]),
|
// onTap: () {
|
||||||
// borderRadius: BorderRadius.circular(10),
|
// _saveForm();
|
||||||
// ),
|
// },
|
||||||
// child: Text(
|
// child: Container(
|
||||||
// 'Save',
|
// padding: EdgeInsets.symmetric(horizontal: 60, vertical: 15),
|
||||||
// style: TextStyle(color: Colors.white, fontSize: 17),
|
// margin: EdgeInsets.symmetric(vertical: 20, horizontal: 50),
|
||||||
// textAlign: TextAlign.center,
|
// decoration: BoxDecoration(
|
||||||
// ),
|
// gradient: LinearGradient(colors: [Colors.blue, Colors.green]),
|
||||||
// ),
|
// borderRadius: BorderRadius.circular(10),
|
||||||
// ),
|
// ),
|
||||||
],
|
// child: Text(
|
||||||
)),
|
// 'Save',
|
||||||
),
|
// style: TextStyle(color: Colors.white, fontSize: 17),
|
||||||
);
|
// textAlign: TextAlign.center,
|
||||||
}
|
// ),
|
||||||
|
// ),
|
||||||
void formatData(inputs) {
|
// ),
|
||||||
for (var input in inputs) {
|
],
|
||||||
if (input['type'] != 'Form') {
|
),
|
||||||
if (input['key'] == 'result') {
|
),
|
||||||
values[input["key"]] = input["value"] ? "Accept" : "Reject";
|
),
|
||||||
// print('${input["key"]} : ${input["value"] ? "Accept" : "Reject"}');
|
),
|
||||||
} else if (input['key'] == 'date') {
|
);
|
||||||
var date = input["value"];
|
}
|
||||||
|
|
||||||
values[input["key"]] = "${date.year}-${date.month}-${date.day}";
|
void formatData(inputs) {
|
||||||
} else {
|
for (var input in inputs) {
|
||||||
values[input["key"]] = input["value"];
|
if (input['type'] != 'Form') {
|
||||||
// print('${input["key"]} : ${input["value"]}');
|
if (input['key'] == 'result') {
|
||||||
}
|
values[input["key"]] = input["value"] ? "Accept" : "Reject";
|
||||||
}
|
// print('${input["key"]} : ${input["value"] ? "Accept" : "Reject"}');
|
||||||
if (input['children'] != null && input['children'].isNotEmpty) {
|
} else if (input['key'] == 'date') {
|
||||||
formatData(input['children']);
|
var date = input["value"];
|
||||||
}
|
|
||||||
}
|
values[input["key"]] = "${date.year}-${date.month}-${date.day}";
|
||||||
// print(values);
|
} else {
|
||||||
}
|
values[input["key"]] = input["value"];
|
||||||
}
|
// print('${input["key"]} : ${input["value"]}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (input['children'] != null && input['children'].isNotEmpty) {
|
||||||
|
formatData(input['children']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// print(values);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,449 @@
|
|||||||
|
// import 'package:cssd/providers/test_result.dart';
|
||||||
|
import 'package:cssd/config/colors.dart';
|
||||||
|
import 'package:cssd/providers/auth.dart';
|
||||||
|
import 'package:cssd/providers/test_results.dart';
|
||||||
|
import 'package:cssd/widgets/Global/internet_error.dart';
|
||||||
|
import 'package:cssd/widgets/TestResultScreens/Main/filter_chip_box.dart';
|
||||||
|
import 'package:cssd/widgets/TestResultScreens/Main/floating_button.dart';
|
||||||
|
import 'package:cssd/widgets/TestResultScreens/Main/search_box.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../models/test_result_models.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
|
||||||
|
class TestResultScreen extends StatefulWidget {
|
||||||
|
// static const route = '/TestResultScreen';
|
||||||
|
final bool? isAdmin;
|
||||||
|
|
||||||
|
TestResultScreen({this.isAdmin});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_TestResultScreenState createState() => _TestResultScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _TestResultScreenState extends State<TestResultScreen> {
|
||||||
|
TextEditingController searchCTRL = new TextEditingController();
|
||||||
|
ScrollController? sc;
|
||||||
|
|
||||||
|
bool _isInit = true;
|
||||||
|
// List<TestResult> _data = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
sc = new ScrollController();
|
||||||
|
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
if (_isInit) {
|
||||||
|
var testResults =
|
||||||
|
Provider.of<TestResultsProvider>(context, listen: false);
|
||||||
|
// testResults.resetFilters();
|
||||||
|
testResults.setLoading();
|
||||||
|
testResults.resetPageNumber();
|
||||||
|
testResults.getTestResults().then((_) {
|
||||||
|
testResults.resetLoading();
|
||||||
|
sc!.addListener(() {
|
||||||
|
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
||||||
|
searchCTRL.text == '') {
|
||||||
|
var labelProviderObject =
|
||||||
|
Provider.of<TestResultsProvider>(context, listen: false);
|
||||||
|
labelProviderObject.getTestResults();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// setState(() {
|
||||||
|
// _isLoading = false;
|
||||||
|
// });
|
||||||
|
});
|
||||||
|
_isInit = false;
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
floatingActionButton:
|
||||||
|
TestResultFloatingButton(deviceBlockSize: _deviceBlockSize),
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Home'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 20, left: 20, right: 20, bottom: 60),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Row(
|
||||||
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
// padding: EdgeInsets.only(top: 20, bottom: 40),
|
||||||
|
child: Text(
|
||||||
|
'My Test Results',
|
||||||
|
// textAlign: TextAlign.left,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 6 * _deviceBlockSize,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
letterSpacing: 2,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context)
|
||||||
|
.popAndPushNamed(Routes.testFilterScreen);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(7),
|
||||||
|
child: Icon(
|
||||||
|
FontAwesomeIcons.filter,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Consumer<TestResultsProvider>(
|
||||||
|
builder: (context, testResult, _) {
|
||||||
|
return Container(
|
||||||
|
height: 50,
|
||||||
|
child: ListView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
shrinkWrap: true,
|
||||||
|
children: <Widget>[
|
||||||
|
testResult.filters.id != ''
|
||||||
|
? TestResultChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'ID',
|
||||||
|
id: '',
|
||||||
|
labelID: testResult.filters.labelID,
|
||||||
|
testType:
|
||||||
|
testResult.filters.testType,
|
||||||
|
hospital:
|
||||||
|
testResult.filters.hospital,
|
||||||
|
username:
|
||||||
|
testResult.filters.userName,
|
||||||
|
fDate: testResult.filters.fDate,
|
||||||
|
uDate: testResult.filters.uDate,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
testResult.filters.labelID != ''
|
||||||
|
? TestResultChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Label ID',
|
||||||
|
id: testResult.filters.id,
|
||||||
|
labelID: '',
|
||||||
|
testType:
|
||||||
|
testResult.filters.testType,
|
||||||
|
hospital:
|
||||||
|
testResult.filters.hospital,
|
||||||
|
username:
|
||||||
|
testResult.filters.userName,
|
||||||
|
fDate: testResult.filters.fDate,
|
||||||
|
uDate: testResult.filters.uDate,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
testResult.filters.testType != ''
|
||||||
|
? TestResultChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Test Type',
|
||||||
|
id: testResult.filters.id,
|
||||||
|
labelID: testResult.filters.labelID,
|
||||||
|
testType: '',
|
||||||
|
hospital:
|
||||||
|
testResult.filters.hospital,
|
||||||
|
username:
|
||||||
|
testResult.filters.userName,
|
||||||
|
fDate: testResult.filters.fDate,
|
||||||
|
uDate: testResult.filters.uDate,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
testResult.filters.hospital != ''
|
||||||
|
? TestResultChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Hospital',
|
||||||
|
id: testResult.filters.id,
|
||||||
|
labelID: testResult.filters.labelID,
|
||||||
|
testType:
|
||||||
|
testResult.filters.testType,
|
||||||
|
hospital: '',
|
||||||
|
username:
|
||||||
|
testResult.filters.userName,
|
||||||
|
fDate: testResult.filters.fDate,
|
||||||
|
uDate: testResult.filters.uDate,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
testResult.filters.userName != ''
|
||||||
|
? TestResultChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Username',
|
||||||
|
id: testResult.filters.id,
|
||||||
|
labelID: testResult.filters.labelID,
|
||||||
|
testType:
|
||||||
|
testResult.filters.testType,
|
||||||
|
hospital:
|
||||||
|
testResult.filters.hospital,
|
||||||
|
username: '',
|
||||||
|
fDate: testResult.filters.fDate,
|
||||||
|
uDate: testResult.filters.uDate,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
testResult.filters.fDate != ''
|
||||||
|
? TestResultChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'From Date',
|
||||||
|
id: testResult.filters.id,
|
||||||
|
labelID: testResult.filters.labelID,
|
||||||
|
testType:
|
||||||
|
testResult.filters.testType,
|
||||||
|
hospital:
|
||||||
|
testResult.filters.hospital,
|
||||||
|
username:
|
||||||
|
testResult.filters.userName,
|
||||||
|
fDate: '',
|
||||||
|
uDate: testResult.filters.uDate,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
testResult.filters.uDate != ''
|
||||||
|
? TestResultChip(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Until Date',
|
||||||
|
id: testResult.filters.id,
|
||||||
|
labelID: testResult.filters.labelID,
|
||||||
|
testType:
|
||||||
|
testResult.filters.testType,
|
||||||
|
hospital:
|
||||||
|
testResult.filters.hospital,
|
||||||
|
username:
|
||||||
|
testResult.filters.userName,
|
||||||
|
fDate: testResult.filters.fDate,
|
||||||
|
uDate: '',
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
TestResultSearchBox(
|
||||||
|
searchCTRL: searchCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Consumer<TestResultsProvider>(
|
||||||
|
builder: (context, testResults, _) {
|
||||||
|
return testResults.isloading
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
controller: sc,
|
||||||
|
itemBuilder: (context, index) =>
|
||||||
|
TestItemBox(
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
item: testResults.items![index],
|
||||||
|
),
|
||||||
|
itemCount: testResults.items?.length,
|
||||||
|
shrinkWrap: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TestItemBox extends StatelessWidget {
|
||||||
|
final TestResultObject? item;
|
||||||
|
const TestItemBox({
|
||||||
|
Key? key,
|
||||||
|
required double deviceBlockSize,
|
||||||
|
required this.item,
|
||||||
|
}) : _deviceBlockSize = deviceBlockSize,
|
||||||
|
super(key: key);
|
||||||
|
|
||||||
|
final double _deviceBlockSize;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
// print(item.result);
|
||||||
|
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () => Navigator.of(context).pushNamed(
|
||||||
|
Routes.testDetailsScreen,
|
||||||
|
arguments: item!.id,
|
||||||
|
),
|
||||||
|
child: Card(
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
width: 57 * _deviceBlockSize,
|
||||||
|
child: Text(
|
||||||
|
item!.name,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
// style: TextStyle(fontSize: 20),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 57 * _deviceBlockSize,
|
||||||
|
child: Text(
|
||||||
|
item!.hospital,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.grey,
|
||||||
|
fontSize: 3 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
item!.result == 'Accepted'
|
||||||
|
? Text(
|
||||||
|
'Accepted',
|
||||||
|
style: TextStyle(
|
||||||
|
color: kLightBlue,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Text(
|
||||||
|
'Rejected',
|
||||||
|
style: TextStyle(
|
||||||
|
color: kPink,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(item!.date),
|
||||||
|
SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: <Widget>[
|
||||||
|
userData['roles']?.contains('User') ?? false
|
||||||
|
? Container()
|
||||||
|
: InkWell(
|
||||||
|
customBorder: CircleBorder(),
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text('Delete'),
|
||||||
|
content: Text(
|
||||||
|
'Are you sure you want delete this Test?'),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: Text('Yes'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Provider.of<TestResultsProvider>(
|
||||||
|
context,
|
||||||
|
listen: false)
|
||||||
|
.removeTestResult(item!.id);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
child: Text('No'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Icon(
|
||||||
|
Icons.delete,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 7.5,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
Routes.testDetailsScreen,
|
||||||
|
arguments: item!.id,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(7),
|
||||||
|
width: 9 * _deviceBlockSize,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
FontAwesomeIcons.fileAlt,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
import 'package:cssd/utils/scan.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class TestScanScreen extends StatefulWidget {
|
||||||
|
// static const route = '/TestScanScreen';
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() {
|
||||||
|
return _TestScanScreenState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _TestScanScreenState extends State<TestScanScreen> {
|
||||||
|
String testCode = "";
|
||||||
|
TextEditingController idCTRL = new TextEditingController();
|
||||||
|
final _form = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text('Test Results'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? ListView(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(top: 30),
|
||||||
|
child: Text(
|
||||||
|
'Looking for a Test Result?',
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 5.5 * _deviceBlockSize,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.symmetric(vertical: 10),
|
||||||
|
height: 200,
|
||||||
|
decoration: BoxDecoration(border: Border.all()),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'Please Scan The Test Result Barcode',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result == 'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result == 'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
launch(
|
||||||
|
'https://cssd-doc.com/Show/TestResult/$result',
|
||||||
|
);
|
||||||
|
// Navigator.of(context).pushNamed(
|
||||||
|
// Routes.cycleDetailScreen,
|
||||||
|
// arguments: result,
|
||||||
|
// );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.0,
|
||||||
|
),
|
||||||
|
Form(
|
||||||
|
key: _form,
|
||||||
|
child: TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Id required!!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: idCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 6 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Or enter a Test Result ID',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
// borderRadius: BorderRadius.only(Radius.circular(4)),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
if (!_form.currentState!.validate()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
launch(
|
||||||
|
'https://cssd-doc.com/Show/TestResult/${idCTRL.text}',
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 5 * _deviceBlockSize,
|
||||||
|
vertical: 10,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
colors: [Colors.black, Colors.black87],
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(7),
|
||||||
|
),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'Search',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user