mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-10 20:28:54 +03:30
beta commit
This commit is contained in:
+37
-37
@@ -1,37 +1,37 @@
|
||||
# Miscellaneous
|
||||
*.class
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in
|
||||
# VS Code which you may wish to be included in version control, so this line
|
||||
# is commented out by default.
|
||||
#.vscode/
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
**/doc/api/
|
||||
.dart_tool/
|
||||
.flutter-plugins
|
||||
.flutter-plugins-dependencies
|
||||
.packages
|
||||
.pub-cache/
|
||||
.pub/
|
||||
/build/
|
||||
|
||||
# Web related
|
||||
lib/generated_plugin_registrant.dart
|
||||
|
||||
# Exceptions to above rules.
|
||||
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
|
||||
# Miscellaneous
|
||||
*.class
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in
|
||||
# VS Code which you may wish to be included in version control, so this line
|
||||
# is commented out by default.
|
||||
#.vscode/
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
**/doc/api/
|
||||
.dart_tool/
|
||||
.flutter-plugins
|
||||
.flutter-plugins-dependencies
|
||||
.packages
|
||||
.pub-cache/
|
||||
.pub/
|
||||
/build/
|
||||
|
||||
# Web related
|
||||
lib/generated_plugin_registrant.dart
|
||||
|
||||
# Exceptions to above rules.
|
||||
!/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.
|
||||
|
||||
version:
|
||||
revision: 9f5ff2306bb3e30b2b98eee79cd231b1336f41f4
|
||||
channel: stable
|
||||
revision: "ead455963c12b453cdb2358cad34969c76daf180"
|
||||
channel: "stable"
|
||||
|
||||
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.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Flutter",
|
||||
"request": "launch",
|
||||
"type": "dart"
|
||||
}
|
||||
]
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Flutter",
|
||||
"request": "launch",
|
||||
"type": "dart"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
# CSSD
|
||||
|
||||
A new Flutter project.
|
||||
|
||||
## Getting Started
|
||||
|
||||
This project is a starting point for a Flutter application.
|
||||
|
||||
A few resources to get you started if this is your first Flutter project:
|
||||
|
||||
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
|
||||
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
|
||||
|
||||
For help getting started with Flutter, view our
|
||||
[online documentation](https://flutter.dev/docs), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
||||
# CSSD
|
||||
|
||||
A new Flutter project.
|
||||
|
||||
## Getting Started
|
||||
|
||||
This project is a starting point for a Flutter application.
|
||||
|
||||
A few resources to get you started if this is your first Flutter project:
|
||||
|
||||
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
|
||||
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
|
||||
|
||||
For help getting started with Flutter, view our
|
||||
[online documentation](https://flutter.dev/docs), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
||||
|
||||
@@ -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
|
||||
/captures/
|
||||
/gradlew
|
||||
/gradlew.bat
|
||||
/local.properties
|
||||
GeneratedPluginRegistrant.java
|
||||
gradle-wrapper.jar
|
||||
/.gradle
|
||||
/captures/
|
||||
/gradlew
|
||||
/gradlew.bat
|
||||
/local.properties
|
||||
GeneratedPluginRegistrant.java
|
||||
|
||||
+68
-67
@@ -1,67 +1,68 @@
|
||||
def localProperties = new Properties()
|
||||
def localPropertiesFile = rootProject.file('local.properties')
|
||||
if (localPropertiesFile.exists()) {
|
||||
localPropertiesFile.withReader('UTF-8') { reader ->
|
||||
localProperties.load(reader)
|
||||
}
|
||||
}
|
||||
|
||||
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
||||
if (flutterRoot == null) {
|
||||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
||||
}
|
||||
|
||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||
if (flutterVersionCode == null) {
|
||||
flutterVersionCode = '1'
|
||||
}
|
||||
|
||||
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
||||
if (flutterVersionName == null) {
|
||||
flutterVersionName = '1.0'
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
disable 'InvalidPackage'
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "com.example.cssd"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 28
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source '../..'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test:runner:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
||||
}
|
||||
def localProperties = new Properties()
|
||||
def localPropertiesFile = rootProject.file('local.properties')
|
||||
if (localPropertiesFile.exists()) {
|
||||
localPropertiesFile.withReader('UTF-8') { reader ->
|
||||
localProperties.load(reader)
|
||||
}
|
||||
}
|
||||
|
||||
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
||||
if (flutterRoot == null) {
|
||||
throw GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
||||
}
|
||||
|
||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||
if (flutterVersionCode == null) {
|
||||
flutterVersionCode = '1'
|
||||
}
|
||||
|
||||
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
||||
if (flutterVersionName == null) {
|
||||
flutterVersionName = '1.0'
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
android {
|
||||
compileSdkVersion 33
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
// disable 'InvalidPackage'
|
||||
baseline(file("lint-baseline.xml"))
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "com.example.cssd"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 28
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source '../..'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test:runner:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
package="com.example.cssd">
|
||||
<!-- Flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.cssd">
|
||||
<!-- Flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.cssd">
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
|
||||
calls FlutterMain.startInitialization(this); in its onCreate method.
|
||||
In most cases you can leave this as-is, but you if you want to provide
|
||||
additional functionality it is fine to subclass or reimplement
|
||||
FlutterApplication and put your custom class here. -->
|
||||
<application
|
||||
android:name="io.flutter.app.FlutterApplication"
|
||||
android:label="CSSD-DOC"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
</application>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.cssd">
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
|
||||
calls FlutterMain.startInitialization(this); in its onCreate method.
|
||||
In most cases you can leave this as-is, but you if you want to provide
|
||||
additional functionality it is fine to subclass or reimplement
|
||||
FlutterApplication and put your custom class here. -->
|
||||
<application
|
||||
android:name="${applicationName}"
|
||||
android:label="CSSD-DOC"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.example.cssd
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
import io.flutter.embedding.engine.FlutterEngine
|
||||
import io.flutter.plugins.GeneratedPluginRegistrant
|
||||
|
||||
class MainActivity: FlutterActivity() {
|
||||
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
|
||||
GeneratedPluginRegistrant.registerWith(flutterEngine);
|
||||
}
|
||||
}
|
||||
package com.example.cssd
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
import io.flutter.embedding.engine.FlutterEngine
|
||||
import io.flutter.plugins.GeneratedPluginRegistrant
|
||||
|
||||
class MainActivity: FlutterActivity() {
|
||||
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
|
||||
GeneratedPluginRegistrant.registerWith(flutterEngine);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@android:color/white" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@android:color/white" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
Flutter draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
</style>
|
||||
</resources>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
Flutter draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.cssd">
|
||||
<!-- Flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.cssd">
|
||||
<!-- Flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.61'
|
||||
ext.kotlin_version = '1.7.10'
|
||||
repositories {
|
||||
// google()
|
||||
maven {
|
||||
@@ -10,7 +10,7 @@ buildscript {
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,6 @@ subprojects {
|
||||
project.evaluationDependsOn(':app')
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
tasks.register("clean", Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
android.enableR8=true
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
android.enableR8=true
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
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'
|
||||
|
||||
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
|
||||
|
||||
def plugins = new Properties()
|
||||
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
|
||||
if (pluginsFile.exists()) {
|
||||
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
|
||||
}
|
||||
|
||||
plugins.each { name, path ->
|
||||
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
|
||||
include ":$name"
|
||||
project(":$name").projectDir = pluginDirectory
|
||||
}
|
||||
include ':app'
|
||||
|
||||
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
|
||||
|
||||
def plugins = new Properties()
|
||||
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
|
||||
if (pluginsFile.exists()) {
|
||||
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
|
||||
}
|
||||
|
||||
plugins.each { name, path ->
|
||||
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
|
||||
include ":$name"
|
||||
project(":$name").projectDir = pluginDirectory
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
include ':app'
|
||||
include ':app'
|
||||
|
||||
+63
-63
@@ -1,63 +1,63 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- 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"
|
||||
viewBox="0 0 512.004 512.004" style="enable-background:new 0 0 512.004 512.004;" xml:space="preserve">
|
||||
<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:#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 "/>
|
||||
<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"/>
|
||||
<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:#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:#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
|
||||
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:#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:#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 "/>
|
||||
<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"/>
|
||||
<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 "/>
|
||||
<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="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 "/>
|
||||
</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>
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- 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"
|
||||
viewBox="0 0 512.004 512.004" style="enable-background:new 0 0 512.004 512.004;" xml:space="preserve">
|
||||
<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:#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 "/>
|
||||
<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"/>
|
||||
<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:#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:#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
|
||||
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:#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:#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 "/>
|
||||
<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"/>
|
||||
<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 "/>
|
||||
<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="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 "/>
|
||||
</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>
|
||||
|
||||
|
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"?>
|
||||
<!-- 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"
|
||||
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
|
||||
<g>
|
||||
<g>
|
||||
<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
|
||||
h432V452z M472,148H40v-48c0-11.028,8.972-20,20-20h24v40h40V80h264v40h40V80h24c11.028,0,20,8.972,20,20V148z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="76" y="230" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="156" y="230" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="236" y="230" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="316" y="230" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="396" y="230" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="76" y="310" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="156" y="310" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="236" y="310" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="316" y="310" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="76" y="390" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="156" y="390" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="236" y="390" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="316" y="390" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<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>
|
||||
</svg>
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- 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"
|
||||
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
|
||||
<g>
|
||||
<g>
|
||||
<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
|
||||
h432V452z M472,148H40v-48c0-11.028,8.972-20,20-20h24v40h40V80h264v40h40V80h24c11.028,0,20,8.972,20,20V148z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="76" y="230" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="156" y="230" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="236" y="230" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="316" y="230" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="396" y="230" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="76" y="310" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="156" y="310" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="236" y="310" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="316" y="310" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="76" y="390" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="156" y="390" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="236" y="390" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="316" y="390" width="40" height="40"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<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>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.9 KiB |
+32
-32
@@ -1,32 +1,32 @@
|
||||
*.mode1v3
|
||||
*.mode2v3
|
||||
*.moved-aside
|
||||
*.pbxuser
|
||||
*.perspectivev3
|
||||
**/*sync/
|
||||
.sconsign.dblite
|
||||
.tags*
|
||||
**/.vagrant/
|
||||
**/DerivedData/
|
||||
Icon?
|
||||
**/Pods/
|
||||
**/.symlinks/
|
||||
profile
|
||||
xcuserdata
|
||||
**/.generated/
|
||||
Flutter/App.framework
|
||||
Flutter/Flutter.framework
|
||||
Flutter/Flutter.podspec
|
||||
Flutter/Generated.xcconfig
|
||||
Flutter/app.flx
|
||||
Flutter/app.zip
|
||||
Flutter/flutter_assets/
|
||||
Flutter/flutter_export_environment.sh
|
||||
ServiceDefinitions.json
|
||||
Runner/GeneratedPluginRegistrant.*
|
||||
|
||||
# Exceptions to above rules.
|
||||
!default.mode1v3
|
||||
!default.mode2v3
|
||||
!default.pbxuser
|
||||
!default.perspectivev3
|
||||
*.mode1v3
|
||||
*.mode2v3
|
||||
*.moved-aside
|
||||
*.pbxuser
|
||||
*.perspectivev3
|
||||
**/*sync/
|
||||
.sconsign.dblite
|
||||
.tags*
|
||||
**/.vagrant/
|
||||
**/DerivedData/
|
||||
Icon?
|
||||
**/Pods/
|
||||
**/.symlinks/
|
||||
profile
|
||||
xcuserdata
|
||||
**/.generated/
|
||||
Flutter/App.framework
|
||||
Flutter/Flutter.framework
|
||||
Flutter/Flutter.podspec
|
||||
Flutter/Generated.xcconfig
|
||||
Flutter/app.flx
|
||||
Flutter/app.zip
|
||||
Flutter/flutter_assets/
|
||||
Flutter/flutter_export_environment.sh
|
||||
ServiceDefinitions.json
|
||||
Runner/GeneratedPluginRegistrant.*
|
||||
|
||||
# Exceptions to above rules.
|
||||
!default.mode1v3
|
||||
!default.mode2v3
|
||||
!default.pbxuser
|
||||
!default.perspectivev3
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>App</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>io.flutter.flutter.app</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>App</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>8.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>App</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>io.flutter.flutter.app</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>App</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>8.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -1 +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"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
||||
@@ -1,91 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1020"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Profile"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1020"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Profile"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
|
||||
+7
-7
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import UIKit
|
||||
import Flutter
|
||||
|
||||
@UIApplicationMain
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
override func application(
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
}
|
||||
}
|
||||
import UIKit
|
||||
import Flutter
|
||||
|
||||
@UIApplicationMain
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
override func application(
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,122 +1,122 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "83.5x83.5",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-83.5x83.5@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "1024x1024",
|
||||
"idiom" : "ios-marketing",
|
||||
"filename" : "Icon-App-1024x1024@1x.png",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "83.5x83.5",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-83.5x83.5@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "1024x1024",
|
||||
"idiom" : "ios-marketing",
|
||||
"filename" : "Icon-App-1024x1024@1x.png",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
||||
+23
-23
@@ -1,23 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Launch Screen Assets
|
||||
|
||||
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
|
||||
|
||||
# Launch Screen Assets
|
||||
|
||||
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
|
||||
|
||||
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
|
||||
@@ -1,37 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="LaunchImage" width="168" height="185"/>
|
||||
</resources>
|
||||
</document>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="LaunchImage" width="168" height="185"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Flutter View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Flutter View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
|
||||
+45
-45
@@ -1,45 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>cssd</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(FLUTTER_BUILD_NAME)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>cssd</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(FLUTTER_BUILD_NAME)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -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 {
|
||||
static const cycleAddScreen = '/CycleAddScreen';
|
||||
static const cycleDetailScreen = '/CycleDetailScreen';
|
||||
static const cycleFilterScreen = '/CycleFilterScreen';
|
||||
static const cycleResultScreen = '/CycleResultScreen';
|
||||
static const cycleScanScreen = '/CycleScanScreen';
|
||||
static const homePage = '/HomePage';
|
||||
static const labelAddScreen = '/LabelAddScreen';
|
||||
static const labelUpdateScreen = '/LabelUpdateScreen';
|
||||
static const labelDetailScreen = '/LabelDetailScreen';
|
||||
static const labelFilterScreen = '/LabelFilterScreen';
|
||||
static const labelResultScreen = '/LabelResultScreen';
|
||||
static const labelScanScreen = '/LabelScanScreen';
|
||||
static const loginScreen = '/LoginScreen';
|
||||
static const forgetPassScreen = '/ForgetPassScreen';
|
||||
static const sendCodeScreen = '/SendCodeScreen';
|
||||
static const rePassScreen = '/RePassScreen';
|
||||
static const myInfoScreen = '/MyInfoScreen';
|
||||
static const testResultAddScreen = '/TestResultAddScreen';
|
||||
static const testDetailsScreen = '/TestDetailsScreen';
|
||||
static const testFilterScreen = '/TestFilterScreen';
|
||||
static const testResultScreen = '/TestResultScreen';
|
||||
static const testVerifyScreen = '/TestVerifyScreen';
|
||||
static const testScanScreen = '/TestScanScreen';
|
||||
static const captureImageScreen = '/captureImageScreen';
|
||||
|
||||
}
|
||||
class Routes {
|
||||
static const cycleAddScreen = '/CycleAddScreen';
|
||||
static const cycleDetailScreen = '/CycleDetailScreen';
|
||||
static const cycleFilterScreen = '/CycleFilterScreen';
|
||||
static const cycleResultScreen = '/CycleResultScreen';
|
||||
static const cycleScanScreen = '/CycleScanScreen';
|
||||
static const homePage = '/HomePage';
|
||||
static const labelAddScreen = '/LabelAddScreen';
|
||||
static const labelUpdateScreen = '/LabelUpdateScreen';
|
||||
static const labelDetailScreen = '/LabelDetailScreen';
|
||||
static const labelFilterScreen = '/LabelFilterScreen';
|
||||
static const labelResultScreen = '/LabelResultScreen';
|
||||
static const labelScanScreen = '/LabelScanScreen';
|
||||
static const loginScreen = '/LoginScreen';
|
||||
static const forgetPassScreen = '/ForgetPassScreen';
|
||||
static const sendCodeScreen = '/SendCodeScreen';
|
||||
static const rePassScreen = '/RePassScreen';
|
||||
static const myInfoScreen = '/MyInfoScreen';
|
||||
static const testResultAddScreen = '/TestResultAddScreen';
|
||||
static const testDetailsScreen = '/TestDetailsScreen';
|
||||
static const testFilterScreen = '/TestFilterScreen';
|
||||
static const testResultScreen = '/TestResultScreen';
|
||||
static const testVerifyScreen = '/TestVerifyScreen';
|
||||
static const testScanScreen = '/TestScanScreen';
|
||||
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 {
|
||||
static const String baseUrl = 'https://www.cssd-doc.com/api';
|
||||
|
||||
static const String login = '$baseUrl/login';
|
||||
|
||||
static const String getInputs = '$baseUrl/GetInputs';
|
||||
|
||||
static const String getUserInfo = '$baseUrl/GetInfo';
|
||||
|
||||
// static const String testResults = '$baseUrl/TestResults';
|
||||
|
||||
static const String filterItems = '$baseUrl/TestResults/ListFilterItems';
|
||||
|
||||
static const String labelItems = '$baseUrl/GetLabels';
|
||||
|
||||
static const String packageItems = '$baseUrl/GetPackages';
|
||||
|
||||
static const String requestResetPass = '$baseUrl/password/phone';
|
||||
|
||||
static const String verifyResetPass = '$baseUrl/password/verifyCode';
|
||||
|
||||
static const String sendResetPass = '$baseUrl/password/reset';
|
||||
|
||||
static const String addImage = '$baseUrl/UploadFile';
|
||||
|
||||
|
||||
|
||||
static String testResults(int id) {
|
||||
return '$baseUrl/TestResults?page=$id';
|
||||
}
|
||||
|
||||
static String testResultVerification(String id,String value) {
|
||||
return '$baseUrl/TestResults/Verify/$id/$value';
|
||||
}
|
||||
|
||||
static String labelResults(int id) {
|
||||
return '$baseUrl/Labels?page=$id';
|
||||
}
|
||||
|
||||
static String cycleResults(int id) {
|
||||
return '$baseUrl/Cycles?page=$id';
|
||||
}
|
||||
|
||||
static String verifyTest(int id) {
|
||||
return '$baseUrl/TestResults/Verify/$id';
|
||||
}
|
||||
|
||||
static String testResultFormValues(String id) {
|
||||
return '$baseUrl/TestResults/$id/edit';
|
||||
}
|
||||
|
||||
static String updateTestResult(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 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';
|
||||
}
|
||||
}
|
||||
class Url {
|
||||
static const String baseUrl = 'https://www.cssd-doc.com/api';
|
||||
|
||||
// https://app.cssd-doc.com
|
||||
|
||||
static const String login = '$baseUrl/login';
|
||||
|
||||
static const String logOut = '$baseUrl/logOut';
|
||||
|
||||
static const String getInputs = '$baseUrl/GetInputs';
|
||||
|
||||
static const String getUserInfo = '$baseUrl/GetInfo';
|
||||
|
||||
// static const String testResults = '$baseUrl/TestResults';
|
||||
|
||||
static const String filterItems = '$baseUrl/TestResults/ListFilterItems';
|
||||
|
||||
static const String labelItems = '$baseUrl/GetLabels';
|
||||
|
||||
static const String packageItems = '$baseUrl/GetPackages';
|
||||
|
||||
static const String itemItems = '$baseUrl/GetItems';
|
||||
|
||||
static const String requestResetPass = '$baseUrl/password/phone';
|
||||
|
||||
static const String verifyResetPass = '$baseUrl/password/verifyCode';
|
||||
|
||||
static const String sendResetPass = '$baseUrl/password/reset';
|
||||
|
||||
static const String addImage = '$baseUrl/UploadFile';
|
||||
|
||||
// static String getUserMedicalCenterId(int id) {
|
||||
// return '$baseUrl/users?medical_center_id=$id';
|
||||
// }
|
||||
|
||||
static String testResults(int id) {
|
||||
return '$baseUrl/TestResults?page=$id';
|
||||
}
|
||||
|
||||
static String labelResults(int id) {
|
||||
return '$baseUrl/Labels?page=$id';
|
||||
}
|
||||
|
||||
static String cycleResults(int id) {
|
||||
return '$baseUrl/Cycles?page=$id';
|
||||
}
|
||||
|
||||
static String packageResults(int id) {
|
||||
return '$baseUrl/Packages?page=$id';
|
||||
}
|
||||
|
||||
static String itemResults(int id) {
|
||||
return '$baseUrl/Items?page=$id';
|
||||
}
|
||||
|
||||
static String verifyTest(int id) {
|
||||
return '$baseUrl/TestResults/Verify/$id';
|
||||
}
|
||||
|
||||
static String testResultFormValues(String id) {
|
||||
return '$baseUrl/TestResults/$id/edit';
|
||||
}
|
||||
|
||||
static String updateTestResult(String id) {
|
||||
return '$baseUrl/TestResults/$id';
|
||||
}
|
||||
|
||||
static String updateCycleResult(String id) {
|
||||
return '$baseUrl/Cycles/$id';
|
||||
}
|
||||
|
||||
static String updatePackageResult(String id) {
|
||||
return '$baseUrl/Packages/$id';
|
||||
}
|
||||
|
||||
static String updateItemResult(String id) {
|
||||
return '$baseUrl/Items/$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 {
|
||||
static String _token;
|
||||
|
||||
static String get token {
|
||||
return 'Bearer ' + User._token;
|
||||
}
|
||||
|
||||
static set token (String token) {
|
||||
User._token = token;
|
||||
}
|
||||
}
|
||||
class User {
|
||||
static String? _token;
|
||||
|
||||
static String get token {
|
||||
return 'Bearer ' + User._token!;
|
||||
}
|
||||
|
||||
static set token(String token) {
|
||||
User._token = token;
|
||||
}
|
||||
}
|
||||
|
||||
+201
-147
@@ -1,147 +1,201 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_phoenix/flutter_phoenix.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'config/routes.dart';
|
||||
import 'pages/cycle_add_screen.dart';
|
||||
import 'pages/cycle_detail_screen.dart';
|
||||
import 'pages/cycle_filter_screen.dart';
|
||||
import 'pages/cycle_result_screen.dart';
|
||||
import 'pages/cycle_scan_screen.dart';
|
||||
import 'pages/forget_pass_screen.dart';
|
||||
import 'pages/home_screen.dart';
|
||||
import 'pages/label_add_screen.dart';
|
||||
import 'pages/label_detail_screen.dart';
|
||||
import 'pages/label_filter_screen.dart';
|
||||
import 'pages/label_result_screen.dart';
|
||||
import 'pages/label_scan_screen.dart';
|
||||
import 'pages/label_update_screen.dart';
|
||||
import 'pages/login_screen.dart';
|
||||
import 'pages/my_info_screen.dart';
|
||||
import 'pages/rePass_screen.dart';
|
||||
import 'pages/test_add_screen.dart';
|
||||
import 'pages/test_detail_screen.dart';
|
||||
import 'pages/test_filter_screen.dart';
|
||||
import 'pages/test_result_screen.dart';
|
||||
import 'pages/test_scan_screen.dart';
|
||||
import 'pages/test_verify_screen.dart';
|
||||
import 'pages/verify_pass_screen.dart';
|
||||
import 'providers/auth.dart';
|
||||
import 'providers/connectivity.dart';
|
||||
import 'providers/cycles.dart';
|
||||
import 'providers/input.dart';
|
||||
import 'providers/labels.dart';
|
||||
import 'providers/my_info.dart';
|
||||
import 'providers/test_results.dart';
|
||||
import 'widgets/Global/splash_screen.dart';
|
||||
import 'widgets/TestResultScreens/Add/capture_image.dart';
|
||||
|
||||
void main() {
|
||||
runApp(Phoenix(child: MyApp()));
|
||||
SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
DeviceOrientation.portraitDown,
|
||||
]);
|
||||
// SystemChrome.setEnabledSystemUIOverlays([]);
|
||||
// SystemChrome.setSystemUIOverlayStyle(
|
||||
// const SystemUiOverlayStyle(
|
||||
// statusBarColor: Colors.red,
|
||||
// systemNavigationBarColor: Colors.red,
|
||||
// systemNavigationBarDividerColor: Colors.blue,
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider.value(
|
||||
value: Auth(),
|
||||
),
|
||||
ChangeNotifierProvider.value(
|
||||
value: TestResultsProvider(),
|
||||
),
|
||||
ChangeNotifierProvider.value(
|
||||
value: Inputs(),
|
||||
),
|
||||
ChangeNotifierProvider.value(
|
||||
value: MyInfoProvider(),
|
||||
),
|
||||
ChangeNotifierProvider.value(
|
||||
value: LabelsProvider(),
|
||||
),
|
||||
ChangeNotifierProvider.value(
|
||||
value: CyclesProvider(),
|
||||
),
|
||||
ChangeNotifierProvider.value(
|
||||
value: ConnectivityProvider(),
|
||||
)
|
||||
],
|
||||
child: Consumer<Auth>(
|
||||
builder: (ctx, auth, _) => Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
connection.checkConnection();
|
||||
print(connection.conStatus);
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
title: 'CSSD-DOC',
|
||||
theme: ThemeData(
|
||||
primaryColor: Colors.black,
|
||||
// cursorColor: Colors.black,
|
||||
fontFamily: 'montserrat',
|
||||
// primaryTextTheme: TextTheme(
|
||||
// body1: TextStyle(
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// )
|
||||
// textTheme: TextTheme(
|
||||
// body2: TextStyle(color: Colors.white, fontSize: 16),
|
||||
// ),
|
||||
),
|
||||
home: auth.isAuth
|
||||
? HomePage()
|
||||
: FutureBuilder(
|
||||
future: auth.tryAutoLogin(),
|
||||
builder: (ctx, authResultSnapshot) =>
|
||||
authResultSnapshot.connectionState ==
|
||||
ConnectionState.waiting
|
||||
? 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.register: (ctx) => Register(),
|
||||
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.cycleAddScreen: (ctx) => CycleAddScreen(),
|
||||
Routes.labelAddScreen: (ctx) => LabelAddScreen(),
|
||||
Routes.labelUpdateScreen: (ctx) => LabelUpdateScreen(),
|
||||
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(),
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:cssd/pages/CyclePages/cycle_update_screen.dart';
|
||||
import 'package:cssd/pages/ItemPages/item_add_screen.dart';
|
||||
import 'package:cssd/pages/ItemPages/item_detail_screen.dart';
|
||||
import 'package:cssd/pages/ItemPages/item_filter_screen.dart';
|
||||
import 'package:cssd/pages/ItemPages/item_result_screen.dart';
|
||||
import 'package:cssd/pages/ItemPages/item_scan_screen.dart';
|
||||
import 'package:cssd/pages/ItemPages/item_update_screen.dart';
|
||||
import 'package:cssd/pages/LabelPages/label_update_screen.dart';
|
||||
import 'package:cssd/pages/MyItemsPages/Result/my_items_result_screen.dart';
|
||||
import 'package:cssd/pages/MyItemsPages/my_items_detail_screen.dart';
|
||||
import 'package:cssd/pages/MyItemsPages/my_items_filter_screen.dart';
|
||||
import 'package:cssd/pages/MyItemsPages/my_items_history_screen.dart';
|
||||
import 'package:cssd/pages/MyItemsPages/my_items_transfer_screen.dart';
|
||||
import 'package:cssd/pages/MyPackagesPages/Result/my_packages_result_screen.dart';
|
||||
import 'package:cssd/pages/MyPackagesPages/my_packages_detail_screen.dart';
|
||||
import 'package:cssd/pages/MyPackagesPages/my_packages_filter_screen.dart';
|
||||
import 'package:cssd/pages/MyPackagesPages/my_packages_history_screen.dart';
|
||||
import 'package:cssd/pages/MyPackagesPages/my_packages_transfer_screen.dart';
|
||||
import 'package:cssd/pages/PackagePages/package_add_screen.dart';
|
||||
import 'package:cssd/pages/PackagePages/package_detail_screen.dart';
|
||||
import 'package:cssd/pages/PackagePages/package_filter_screen.dart';
|
||||
import 'package:cssd/pages/PackagePages/package_result_screen.dart';
|
||||
import 'package:cssd/pages/PackagePages/package_scan_screen.dart';
|
||||
import 'package:cssd/pages/PackagePages/package_update_screen.dart';
|
||||
import 'package:cssd/pages/TestPages/test_form_page.dart';
|
||||
import 'package:cssd/providers/items.dart';
|
||||
import 'package:cssd/providers/my_items.dart';
|
||||
import 'package:cssd/providers/my_packages.dart';
|
||||
import 'package:cssd/providers/packages.dart';
|
||||
import 'package:cssd/providers/users.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_phoenix/flutter_phoenix.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'config/routes.dart';
|
||||
import 'pages/CyclePages/cycle_add_screen.dart';
|
||||
import 'pages/CyclePages/cycle_detail_screen.dart';
|
||||
import 'pages/CyclePages/cycle_filter_screen.dart';
|
||||
import 'pages/CyclePages/cycle_result_screen.dart';
|
||||
import 'pages/CyclePages/cycle_scan_screen.dart';
|
||||
import 'pages/LoginRegisterPages/forget_pass_screen.dart';
|
||||
import 'pages/home_screen.dart';
|
||||
import 'pages/LabelPages/label_add_screen.dart';
|
||||
import 'pages/LabelPages/label_detail_screen.dart';
|
||||
import 'pages/LabelPages/label_filter_screen.dart';
|
||||
import 'pages/LabelPages/label_result_screen.dart';
|
||||
import 'pages/LabelPages/label_scan_screen.dart';
|
||||
import 'pages/LoginRegisterPages/login_screen.dart';
|
||||
import 'pages/my_info_screen.dart';
|
||||
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';
|
||||
import 'pages/TestPages/test_scan_screen.dart';
|
||||
import 'pages/TestPages/test_verify_screen.dart';
|
||||
import 'pages/LoginRegisterPages/verify_pass_screen.dart';
|
||||
import 'providers/auth.dart';
|
||||
import 'providers/connectivity.dart';
|
||||
import 'providers/cycles.dart';
|
||||
import 'providers/input.dart';
|
||||
import 'providers/labels.dart';
|
||||
import 'providers/my_info.dart';
|
||||
import 'providers/test_results.dart';
|
||||
import 'widgets/Global/splash_screen.dart';
|
||||
import 'widgets/TestResultScreens/Add/capture_image.dart';
|
||||
|
||||
void main() {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
DeviceOrientation.portraitDown,
|
||||
]);
|
||||
runApp(Phoenix(child: MyApp()));
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider.value(
|
||||
value: Auth(),
|
||||
),
|
||||
ChangeNotifierProvider.value(
|
||||
value: TestResultsProvider(),
|
||||
),
|
||||
ChangeNotifierProvider.value(
|
||||
value: Inputs(),
|
||||
),
|
||||
ChangeNotifierProvider.value(
|
||||
value: MyInfoProvider(),
|
||||
),
|
||||
ChangeNotifierProvider.value(
|
||||
value: LabelsProvider(),
|
||||
),
|
||||
ChangeNotifierProvider.value(
|
||||
value: CyclesProvider(),
|
||||
),
|
||||
ChangeNotifierProvider.value(
|
||||
value: ConnectivityProvider(),
|
||||
),
|
||||
ChangeNotifierProvider.value(
|
||||
value: PackageProvider(),
|
||||
),
|
||||
ChangeNotifierProvider.value(
|
||||
value: ItemProvider(),
|
||||
),
|
||||
ChangeNotifierProvider.value(
|
||||
value: MyItemProvider(),
|
||||
),
|
||||
ChangeNotifierProvider.value(
|
||||
value: MyPackageProvider(),
|
||||
),
|
||||
ChangeNotifierProvider.value(
|
||||
value: UsersProvider(),
|
||||
),
|
||||
],
|
||||
child: Consumer<Auth>(
|
||||
builder: (ctx, auth, _) => Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
connection.checkConnection();
|
||||
print(connection.conStatus);
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
title: 'CSSD-DOC',
|
||||
theme: ThemeData(
|
||||
primaryColor: Colors.black,
|
||||
fontFamily: 'montserrat',
|
||||
),
|
||||
home: auth.isAuth
|
||||
? HomePage()
|
||||
: FutureBuilder(
|
||||
future: auth.tryAutoLogin(),
|
||||
builder: (ctx, authResultSnapshot) =>
|
||||
authResultSnapshot.connectionState ==
|
||||
ConnectionState.waiting
|
||||
? 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';
|
||||
|
||||
class CycleResultObject {
|
||||
final String id;
|
||||
final List<String> label;
|
||||
final String createdAt;
|
||||
|
||||
CycleResultObject({
|
||||
@required this.id,
|
||||
@required this.label,
|
||||
@required this.createdAt,
|
||||
});
|
||||
}
|
||||
|
||||
class CycleDetailObject {
|
||||
final String id;
|
||||
final String description;
|
||||
final String createDate;
|
||||
final String hospitalName;
|
||||
|
||||
final String date;
|
||||
final String sterileId;
|
||||
final String cycleNumber;
|
||||
final List<String> labels;
|
||||
|
||||
CycleDetailObject({
|
||||
@required this.id,
|
||||
@required this.description,
|
||||
@required this.createDate,
|
||||
@required this.hospitalName,
|
||||
@required this.date,
|
||||
@required this.sterileId,
|
||||
@required this.cycleNumber,
|
||||
@required this.labels,
|
||||
});
|
||||
}
|
||||
|
||||
class CycleFilterObject {
|
||||
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,
|
||||
});
|
||||
}
|
||||
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class CycleResultObject extends Equatable {
|
||||
final String id;
|
||||
final List<String> label;
|
||||
final String createdAt;
|
||||
|
||||
CycleResultObject({
|
||||
required this.id,
|
||||
required this.label,
|
||||
required this.createdAt,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object> get props => [id, label, createdAt];
|
||||
|
||||
@override
|
||||
bool get stringify => true;
|
||||
}
|
||||
|
||||
class CycleDetailObject extends Equatable {
|
||||
final String id;
|
||||
final String description;
|
||||
final String createDate;
|
||||
final String hospitalName;
|
||||
|
||||
final String date;
|
||||
final String sterileId;
|
||||
final String cycleNumber;
|
||||
final List<String> labels;
|
||||
|
||||
CycleDetailObject({
|
||||
required this.id,
|
||||
required this.description,
|
||||
required this.createDate,
|
||||
required this.hospitalName,
|
||||
required this.date,
|
||||
required this.sterileId,
|
||||
required this.cycleNumber,
|
||||
required this.labels,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object> get props {
|
||||
return [
|
||||
id,
|
||||
description,
|
||||
createDate,
|
||||
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';
|
||||
|
||||
class LabelResultObject {
|
||||
final String id;
|
||||
final String package;
|
||||
final String packageId;
|
||||
final String expireDate;
|
||||
|
||||
LabelResultObject({
|
||||
@required this.id,
|
||||
@required this.package,
|
||||
@required this.packageId,
|
||||
@required this.expireDate,
|
||||
});
|
||||
}
|
||||
|
||||
class LabelDetailsObject {
|
||||
final String id;
|
||||
final String package;
|
||||
final String packageId;
|
||||
final String hospitalName;
|
||||
|
||||
final String createDate;
|
||||
final String expireDate;
|
||||
final String sterileDate;
|
||||
final String sterileId;
|
||||
final String cycleNumber;
|
||||
final String lotNumber;
|
||||
|
||||
LabelDetailsObject({
|
||||
@required this.id,
|
||||
@required this.package,
|
||||
@required this.packageId,
|
||||
@required this.hospitalName,
|
||||
@required this.createDate,
|
||||
@required this.expireDate,
|
||||
@required this.sterileDate,
|
||||
@required this.sterileId,
|
||||
@required this.cycleNumber,
|
||||
@required this.lotNumber,
|
||||
});
|
||||
}
|
||||
|
||||
class LabelFilterObject {
|
||||
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,
|
||||
});
|
||||
}
|
||||
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class LabelResultObject extends Equatable {
|
||||
final String id;
|
||||
final String package;
|
||||
final String packageId;
|
||||
final String expireDate;
|
||||
|
||||
LabelResultObject({
|
||||
required this.id,
|
||||
required this.package,
|
||||
required this.packageId,
|
||||
required this.expireDate,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object> get props => [id, package, packageId, expireDate];
|
||||
|
||||
@override
|
||||
bool get stringify => true;
|
||||
}
|
||||
|
||||
class LabelDetailsObject extends Equatable {
|
||||
final String id;
|
||||
final String package;
|
||||
final String packageId;
|
||||
final String hospitalName;
|
||||
|
||||
final String createDate;
|
||||
final String expireDate;
|
||||
final String sterileDate;
|
||||
final String sterileId;
|
||||
final String cycleNumber;
|
||||
final String lotNumber;
|
||||
|
||||
LabelDetailsObject({
|
||||
required this.id,
|
||||
required this.package,
|
||||
required this.packageId,
|
||||
required this.hospitalName,
|
||||
required this.createDate,
|
||||
required this.expireDate,
|
||||
required this.sterileDate,
|
||||
required this.sterileId,
|
||||
required this.cycleNumber,
|
||||
required this.lotNumber,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object> get props {
|
||||
return [
|
||||
id,
|
||||
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';
|
||||
|
||||
class TestResultObject {
|
||||
final String id;
|
||||
final String name;
|
||||
final String deviceId;
|
||||
final String result;
|
||||
final String date;
|
||||
final String hospital;
|
||||
final String verified;
|
||||
|
||||
TestResultObject({
|
||||
@required this.id,
|
||||
@required this.name,
|
||||
@required this.deviceId,
|
||||
@required this.result,
|
||||
@required this.date,
|
||||
@required this.hospital,
|
||||
@required this.verified,
|
||||
});
|
||||
}
|
||||
|
||||
class TestResultFilterObject {
|
||||
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,
|
||||
});
|
||||
}
|
||||
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class TestResultObject extends Equatable {
|
||||
final String id;
|
||||
final String name;
|
||||
final String deviceId;
|
||||
final String result;
|
||||
final String date;
|
||||
final String hospital;
|
||||
final String verified;
|
||||
|
||||
TestResultObject({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.deviceId,
|
||||
required this.result,
|
||||
required this.date,
|
||||
required this.hospital,
|
||||
required this.verified,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object> get props {
|
||||
return [
|
||||
id,
|
||||
name,
|
||||
deviceId,
|
||||
result,
|
||||
date,
|
||||
hospital,
|
||||
verified,
|
||||
];
|
||||
}
|
||||
|
||||
@override
|
||||
bool get stringify => true;
|
||||
}
|
||||
|
||||
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:provider/provider.dart';
|
||||
|
||||
import '../models/cycles_models.dart';
|
||||
import '../providers/connectivity.dart';
|
||||
import '../providers/cycles.dart';
|
||||
import '../widgets/CycleScreens/Details/datas_box.dart';
|
||||
import '../widgets/Global/internet_error.dart';
|
||||
|
||||
class CycleDetailScreen extends StatefulWidget {
|
||||
// static const route = '/CycleDetailScreen';
|
||||
final String testResultId;
|
||||
|
||||
CycleDetailScreen({this.testResultId});
|
||||
|
||||
@override
|
||||
_CycleDetailScreenState createState() => _CycleDetailScreenState();
|
||||
}
|
||||
|
||||
class _CycleDetailScreenState extends State<CycleDetailScreen> {
|
||||
bool isInit = true;
|
||||
bool isEmpty = false;
|
||||
CycleDetailObject datas;
|
||||
@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(
|
||||
() {
|
||||
if (result.id == 'null') {
|
||||
isEmpty = true;
|
||||
}
|
||||
datas = result;
|
||||
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: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text('Cycles'),
|
||||
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(),
|
||||
)
|
||||
: isEmpty
|
||||
? Center(
|
||||
child: Text('This Cycle doesnt exists!'),
|
||||
)
|
||||
: CycleDetailsDataBox(
|
||||
datas: datas,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../models/cycles_models.dart';
|
||||
import '../../providers/connectivity.dart';
|
||||
import '../../providers/cycles.dart';
|
||||
import '../../widgets/CycleScreens/Details/datas_box.dart';
|
||||
import '../../widgets/Global/internet_error.dart';
|
||||
|
||||
class CycleDetailScreen extends StatefulWidget {
|
||||
// static const route = '/CycleDetailScreen';
|
||||
final String? testResultId;
|
||||
|
||||
CycleDetailScreen({this.testResultId});
|
||||
|
||||
@override
|
||||
_CycleDetailScreenState createState() => _CycleDetailScreenState();
|
||||
}
|
||||
|
||||
class _CycleDetailScreenState extends State<CycleDetailScreen> {
|
||||
bool isInit = true;
|
||||
bool isEmpty = false;
|
||||
CycleDetailObject? datas;
|
||||
@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(
|
||||
() {
|
||||
if (result.id == 'null') {
|
||||
isEmpty = true;
|
||||
}
|
||||
datas = result;
|
||||
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: 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'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: isEmpty
|
||||
? Center(
|
||||
child: Text('This Cycle doesnt exists!'),
|
||||
)
|
||||
: CycleDetailsDataBox(
|
||||
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 '../providers/connectivity.dart';
|
||||
import '../providers/labels.dart';
|
||||
import '../widgets/Global/internet_error.dart';
|
||||
import '../widgets/LabelScreens/Detail/datas_box.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class LabelDetailScreen extends StatefulWidget {
|
||||
// static const route = '/LabelDetailScreen';
|
||||
// final String testResultId;
|
||||
|
||||
// LabelDetailScreen({this.testResultId});
|
||||
|
||||
@override
|
||||
_LabelDetailScreenState createState() => _LabelDetailScreenState();
|
||||
}
|
||||
|
||||
class _LabelDetailScreenState extends State<LabelDetailScreen> {
|
||||
bool isEmpty = false;
|
||||
bool isInit = true;
|
||||
LabelDetailsObject datas;
|
||||
@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;
|
||||
isInit = false;
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
// print(datas);
|
||||
}
|
||||
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: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text('Labels'),
|
||||
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(),
|
||||
)
|
||||
: isEmpty
|
||||
? Center(
|
||||
child: Text('This Lable doesnt exists!'),
|
||||
)
|
||||
: LabelDetailsDataBox(
|
||||
datas: datas,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import '../../models/label_models.dart';
|
||||
import '../../providers/connectivity.dart';
|
||||
import '../../providers/labels.dart';
|
||||
import '../../widgets/Global/internet_error.dart';
|
||||
import '../../widgets/LabelScreens/Detail/datas_box.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class LabelDetailScreen extends StatefulWidget {
|
||||
// static const route = '/LabelDetailScreen';
|
||||
// final String testResultId;
|
||||
|
||||
// LabelDetailScreen({this.testResultId});
|
||||
|
||||
@override
|
||||
_LabelDetailScreenState createState() => _LabelDetailScreenState();
|
||||
}
|
||||
|
||||
class _LabelDetailScreenState extends State<LabelDetailScreen> {
|
||||
bool isEmpty = false;
|
||||
bool isInit = true;
|
||||
LabelDetailsObject? datas;
|
||||
@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;
|
||||
isInit = false;
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
// print(datas);
|
||||
}
|
||||
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: 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'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: isEmpty
|
||||
? Center(
|
||||
child: Text('This Label dos\'nt exists!'),
|
||||
)
|
||||
: LabelDetailsDataBox(
|
||||
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:provider/provider.dart';
|
||||
|
||||
import '../config/routes.dart';
|
||||
import '../providers/auth.dart';
|
||||
import '../providers/connectivity.dart';
|
||||
import '../widgets/Global/internet_error.dart';
|
||||
|
||||
class ForgetPassScreen extends StatefulWidget {
|
||||
// static const route = '/HomeScreen';
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _ForgetPassScreenState();
|
||||
}
|
||||
}
|
||||
|
||||
class _ForgetPassScreenState extends State<ForgetPassScreen> {
|
||||
final _form = GlobalKey<FormState>();
|
||||
bool _isLoading = false;
|
||||
final cellNumberController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
cellNumberController.text = '';
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void 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 _requestCode() async {
|
||||
if (!_form.currentState.validate()) {
|
||||
return;
|
||||
}
|
||||
_form.currentState.save();
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
// try {
|
||||
await Provider.of<Auth>(context, listen: false)
|
||||
.requestCode(
|
||||
cellNumberController.text,
|
||||
)
|
||||
.then(
|
||||
(result) {
|
||||
if (result == 'NotUser') {
|
||||
_showDialog('User Not Found!!!');
|
||||
setState(
|
||||
() {
|
||||
_isLoading = false;
|
||||
},
|
||||
);
|
||||
} else {
|
||||
// _showDialog('User or password incorrect!');
|
||||
Navigator.of(context).popAndPushNamed(Routes.sendCodeScreen);
|
||||
// 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: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
title: Text('CSSD'),
|
||||
),
|
||||
body: Selector<ConnectivityProvider, String>(
|
||||
builder: (ctx, value, _) => value != 'offline'
|
||||
? _isLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(),
|
||||
)
|
||||
: Form(
|
||||
key: _form,
|
||||
child: ListView(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 20),
|
||||
child: Text(
|
||||
'FORGET PASSWORD',
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextFormField(
|
||||
validator: (value) {
|
||||
if (value.isEmpty) {
|
||||
return 'Cell 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: 'Cell Number',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.phone,
|
||||
textInputAction: TextInputAction.next,
|
||||
onSaved: (value) {
|
||||
cellNumberController.text = value;
|
||||
},
|
||||
),
|
||||
SizedBox(height: 40),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
onTap: () => _requestCode(),
|
||||
child: Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.blue, Colors.green],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Text(
|
||||
'Request Code',
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
)
|
||||
: ConnectionErrorBox(),
|
||||
selector: (_, connectivity) => connectivity.conStatus,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.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 ForgetPassScreen extends StatefulWidget {
|
||||
// static const route = '/HomeScreen';
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _ForgetPassScreenState();
|
||||
}
|
||||
}
|
||||
|
||||
class _ForgetPassScreenState extends State<ForgetPassScreen> {
|
||||
final _form = GlobalKey<FormState>();
|
||||
bool _isLoading = false;
|
||||
final cellNumberController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
cellNumberController.text = '';
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void 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 _requestCode() async {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
_form.currentState!.save();
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
// try {
|
||||
await Provider.of<Auth>(context, listen: false)
|
||||
.requestCode(
|
||||
cellNumberController.text,
|
||||
)
|
||||
.then(
|
||||
(result) {
|
||||
if (result == 'NotUser') {
|
||||
_showDialog('User Not Found!!!');
|
||||
setState(
|
||||
() {
|
||||
_isLoading = false;
|
||||
},
|
||||
);
|
||||
} else {
|
||||
// _showDialog('User or password incorrect!');
|
||||
Navigator.of(context).popAndPushNamed(Routes.sendCodeScreen);
|
||||
// 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: 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(
|
||||
'Forget Password',
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextFormField(
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Cell 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: 'Cell Number',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.phone,
|
||||
textInputAction: TextInputAction.next,
|
||||
onSaved: (value) {
|
||||
cellNumberController.text = value!;
|
||||
},
|
||||
),
|
||||
SizedBox(height: 40),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
onTap: () => _requestCode(),
|
||||
child: Container(
|
||||
width: 88 * _deviceBlockSize,
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black,
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Request Code',
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
)
|
||||
: 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:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../providers/auth.dart';
|
||||
import '../providers/connectivity.dart';
|
||||
import '../widgets/Global/internet_error.dart';
|
||||
|
||||
class RePassScreen extends StatefulWidget {
|
||||
// static const route = '/HomeScreen';
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _RePassScreenState();
|
||||
}
|
||||
}
|
||||
|
||||
class _RePassScreenState extends State<RePassScreen> {
|
||||
final _form = GlobalKey<FormState>();
|
||||
bool _isLoading = false;
|
||||
// final cellNumberController = TextEditingController();
|
||||
final passwordController = new TextEditingController();
|
||||
final rePasswordController = new TextEditingController();
|
||||
String token = 'Bearer ';
|
||||
// String token = 'Bearer ';
|
||||
|
||||
bool _hidePass = true;
|
||||
bool _hideRePass = true;
|
||||
bool isInit = true;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
if (isInit) {
|
||||
token += ModalRoute.of(context).settings.arguments;
|
||||
isInit = false;
|
||||
}
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
Future<void> _showDialog(String message) async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text(message),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text('Ok'),
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _sendRePass() async {
|
||||
if (!_form.currentState.validate()) {
|
||||
return;
|
||||
}
|
||||
_form.currentState.save();
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
await Provider.of<Auth>(context, listen: false)
|
||||
.sendRePass(passwordController.text, token)
|
||||
.then((value) async {
|
||||
if (value == 'done') {
|
||||
await _showDialog(
|
||||
'Password changed successfully.Now login to your account.');
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@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(
|
||||
centerTitle: true,
|
||||
title: Text('CSSD'),
|
||||
),
|
||||
body: Selector<ConnectivityProvider, String>(
|
||||
builder: (ctx, value, _) => value != 'offline'
|
||||
? _isLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(),
|
||||
)
|
||||
: Form(
|
||||
key: _form,
|
||||
child: ListView(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 20),
|
||||
child: Text(
|
||||
'CHANGE PASSWORD',
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 6 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
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: (_) {
|
||||
_sendRePass();
|
||||
},
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
TextFormField(
|
||||
validator: (value) {
|
||||
if (value.length < 8) {
|
||||
return 'Password at least is 8 characters.';
|
||||
}
|
||||
if (value != passwordController.text) {
|
||||
return 'Password doesnt match!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
obscureText: _hideRePass,
|
||||
controller: rePasswordController,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.starOfLife,
|
||||
size: 6 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
labelText: 'Confirm Password',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
suffixIcon: InkWell(
|
||||
child: Icon(FontAwesomeIcons.eye),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_hideRePass = !_hideRePass;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
textInputAction: TextInputAction.done,
|
||||
onFieldSubmitted: (_) {
|
||||
_sendRePass();
|
||||
},
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
),
|
||||
SizedBox(height: 40),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
onTap: () => _sendRePass(),
|
||||
child: Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.blue, Colors.green],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Text(
|
||||
'Change',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
)
|
||||
: ConnectionErrorBox(),
|
||||
selector: (_, connectivity) => connectivity.conStatus,
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../providers/auth.dart';
|
||||
import '../../providers/connectivity.dart';
|
||||
import '../../widgets/Global/internet_error.dart';
|
||||
|
||||
class RePassScreen extends StatefulWidget {
|
||||
// static const route = '/HomeScreen';
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _RePassScreenState();
|
||||
}
|
||||
}
|
||||
|
||||
class _RePassScreenState extends State<RePassScreen> {
|
||||
final _form = GlobalKey<FormState>();
|
||||
bool _isLoading = false;
|
||||
// final cellNumberController = TextEditingController();
|
||||
final passwordController = new TextEditingController();
|
||||
final rePasswordController = new TextEditingController();
|
||||
String token = 'Bearer ';
|
||||
// String token = 'Bearer ';
|
||||
|
||||
bool _hidePass = true;
|
||||
bool _hideRePass = true;
|
||||
bool isInit = true;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
if (isInit) {
|
||||
token += ModalRoute.of(context)!.settings.arguments.toString();
|
||||
isInit = false;
|
||||
}
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
Future<void> _showDialog(String message) async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text(message),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text('Ok'),
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _sendRePass() async {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
_form.currentState!.save();
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
await Provider.of<Auth>(context, listen: false)
|
||||
.sendRePass(passwordController.text, token)
|
||||
.then((value) async {
|
||||
if (value == 'done') {
|
||||
await _showDialog(
|
||||
'Password changed successfully.Now login to your account.');
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@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(
|
||||
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(
|
||||
'CHANGE PASSWORD',
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 6 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
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: (_) {
|
||||
_sendRePass();
|
||||
},
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
TextFormField(
|
||||
validator: (value) {
|
||||
if (value!.length < 8) {
|
||||
return 'Password at least is 8 characters.';
|
||||
}
|
||||
if (value != passwordController.text) {
|
||||
return 'Password doesnt match!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
obscureText: _hideRePass,
|
||||
controller: rePasswordController,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.starOfLife,
|
||||
size: 6 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
labelText: 'Confirm Password',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
suffixIcon: InkWell(
|
||||
child: Icon(FontAwesomeIcons.eye),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_hideRePass = !_hideRePass;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
textInputAction: TextInputAction.done,
|
||||
onFieldSubmitted: (_) {
|
||||
_sendRePass();
|
||||
},
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
),
|
||||
SizedBox(height: 40),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
onTap: () => _sendRePass(),
|
||||
child: Container(
|
||||
width: 88 * _deviceBlockSize,
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black,
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Text(
|
||||
'Change',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
)
|
||||
: ConnectionErrorBox(),
|
||||
selector: (_, connectivity) => connectivity.conStatus,
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,379 +1,381 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class Register extends StatefulWidget {
|
||||
// static const route = '/RegisterScreen';
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _RegisterState();
|
||||
}
|
||||
}
|
||||
|
||||
class _RegisterState extends State<Register> {
|
||||
final _passwordFocusNode = FocusNode();
|
||||
final _form = GlobalKey<FormState>();
|
||||
bool _isLoading = false;
|
||||
final cellNumberController = TextEditingController();
|
||||
bool _hidePass = true;
|
||||
Map<String, dynamic> map = Map<String, dynamic>();
|
||||
final List<String> hospitalVals = ['Shahid Beheshti', 'None'];
|
||||
String curhospitalVal;
|
||||
@override
|
||||
void initState() {
|
||||
cellNumberController.text = map['cellNumber'];
|
||||
curhospitalVal = hospitalVals[0];
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_passwordFocusNode.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// void _showDialog(String message) {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (ctx) => AlertDialog(
|
||||
// title: Text('error occured'),
|
||||
// content: Text(message),
|
||||
// actions: <Widget>[
|
||||
// TextButton(
|
||||
// child: Text('Ok'),
|
||||
// onPressed: () {
|
||||
// Navigator.of(ctx).pop();
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
|
||||
void _register() async {
|
||||
if (!_form.currentState.validate()) {
|
||||
return;
|
||||
}
|
||||
_form.currentState.save();
|
||||
// setState(() {
|
||||
// _isLoading = true;
|
||||
// });
|
||||
// try {
|
||||
// // await Provider.of<Auth>(context).register(
|
||||
// // map['cellNumber'],
|
||||
// // map['password'],
|
||||
// // );
|
||||
// } catch (error) {
|
||||
// _showDialog('something went wrong!');
|
||||
// setState(() {
|
||||
// _isLoading = false;
|
||||
// });
|
||||
// }
|
||||
|
||||
// Navigator.pushReplacement(
|
||||
// context,
|
||||
// MaterialPageRoute(builder: (context) {
|
||||
// return HomePage();
|
||||
// }),
|
||||
// );
|
||||
}
|
||||
|
||||
@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('Login'),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
),
|
||||
body: _isLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(),
|
||||
)
|
||||
: Form(
|
||||
key: _form,
|
||||
child: ListView(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 20),
|
||||
child: Text(
|
||||
'register',
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 7 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextFormField(
|
||||
validator: (value) {
|
||||
if (value.isEmpty) {
|
||||
return 'Cell 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;
|
||||
},
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
keyboardType: TextInputType.phone,
|
||||
textInputAction: TextInputAction.next,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context).requestFocus(_passwordFocusNode);
|
||||
},
|
||||
controller: cellNumberController,
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
icon: Icon(
|
||||
Icons.call,
|
||||
color: Colors.grey,
|
||||
),
|
||||
border: UnderlineInputBorder(),
|
||||
fillColor: Colors.red,
|
||||
labelText: 'Cell Number',
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 5),
|
||||
),
|
||||
onSaved: (value) {
|
||||
map['cellNumber'] = value;
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
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,
|
||||
textInputAction: TextInputAction.done,
|
||||
onFieldSubmitted: (_) {
|
||||
_register();
|
||||
},
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.starOfLife,
|
||||
color: Colors.grey,
|
||||
),
|
||||
border: UnderlineInputBorder(),
|
||||
fillColor: Colors.red,
|
||||
labelText: 'Password',
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 5),
|
||||
suffixIcon: InkWell(
|
||||
child: Icon(FontAwesomeIcons.eye),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_hidePass = !_hidePass;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
focusNode: _passwordFocusNode,
|
||||
onSaved: (value) {
|
||||
map['password'] = value;
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
TextFormField(
|
||||
validator: (value) {
|
||||
if (value.isEmpty) {
|
||||
return 'Full Name 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;
|
||||
},
|
||||
// keyboardType: TextInputType.phone,
|
||||
// textInputAction: TextInputAction.next,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context).requestFocus(_passwordFocusNode);
|
||||
// },
|
||||
// controller: cellNumberController,
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.sortNumericDown,
|
||||
color: Colors.grey,
|
||||
),
|
||||
border: UnderlineInputBorder(),
|
||||
fillColor: Colors.red,
|
||||
labelText: 'Full Name',
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 5),
|
||||
),
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
// onSaved: (value) {
|
||||
// map['cellNumber'] = value;
|
||||
// },
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
// width: double.infinity,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
color: Colors.grey,
|
||||
size: 5 * _deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
// width: MediaQuery.of(context).size.width - 70,
|
||||
child: DropdownButton(
|
||||
focusColor: Colors.red,
|
||||
icon: Icon(FontAwesomeIcons.angleDown),
|
||||
isExpanded: true,
|
||||
hint: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text(
|
||||
curhospitalVal,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
// color: _mainFontColor,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
isDense: true,
|
||||
items: hospitalVals.map((String value) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Container(
|
||||
child: Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
// color: _mainFontColor,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
curhospitalVal = val;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 40),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
onTap: () => _register(),
|
||||
child: Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 5,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.blue, Colors.green],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Spacer(),
|
||||
Icon(
|
||||
Icons.add,
|
||||
color: Colors.white,
|
||||
),
|
||||
Text(
|
||||
'register',
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
Spacer()
|
||||
],
|
||||
)
|
||||
// TextButton.icon(
|
||||
// padding: EdgeInsets.all(0),
|
||||
// onPressed: () {
|
||||
// _register();
|
||||
// },
|
||||
// icon: Icon(Icons.exit_to_app,
|
||||
// color: Colors.white, size: 17),
|
||||
// label: Text('register',
|
||||
// style: TextStyle(color: Colors.white)),
|
||||
// ),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 5,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Spacer(),
|
||||
Icon(
|
||||
Icons.exit_to_app,
|
||||
// size: 6 * _pixelRatio,
|
||||
),
|
||||
Text(
|
||||
'Login',
|
||||
style: TextStyle(
|
||||
// fontSize: 5.5,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class Register extends StatefulWidget {
|
||||
// static const route = '/RegisterScreen';
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _RegisterState();
|
||||
}
|
||||
}
|
||||
|
||||
class _RegisterState extends State<Register> {
|
||||
final _passwordFocusNode = FocusNode();
|
||||
final _form = GlobalKey<FormState>();
|
||||
bool _isLoading = false;
|
||||
final cellNumberController = TextEditingController();
|
||||
bool _hidePass = true;
|
||||
Map<String, dynamic> map = Map<String, dynamic>();
|
||||
final List<String> hospitalVals = ['Shahid Beheshti', 'None'];
|
||||
String? curhospitalVal;
|
||||
@override
|
||||
void initState() {
|
||||
cellNumberController.text = map['cellNumber'];
|
||||
curhospitalVal = hospitalVals[0];
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_passwordFocusNode.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// void _showDialog(String message) {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (ctx) => AlertDialog(
|
||||
// title: Text('error occured'),
|
||||
// content: Text(message),
|
||||
// actions: <Widget>[
|
||||
// TextButton(
|
||||
// child: Text('Ok'),
|
||||
// onPressed: () {
|
||||
// Navigator.of(ctx).pop();
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
|
||||
void _register() async {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
_form.currentState!.save();
|
||||
// setState(() {
|
||||
// _isLoading = true;
|
||||
// });
|
||||
// try {
|
||||
// // await Provider.of<Auth>(context).register(
|
||||
// // map['cellNumber'],
|
||||
// // map['password'],
|
||||
// // );
|
||||
// } catch (error) {
|
||||
// _showDialog('something went wrong!');
|
||||
// setState(() {
|
||||
// _isLoading = false;
|
||||
// });
|
||||
// }
|
||||
|
||||
// Navigator.pushReplacement(
|
||||
// context,
|
||||
// MaterialPageRoute(builder: (context) {
|
||||
// return HomePage();
|
||||
// }),
|
||||
// );
|
||||
}
|
||||
|
||||
@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('Login'),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
),
|
||||
body: _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(
|
||||
'register',
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 7 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextFormField(
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Cell 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;
|
||||
},
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
keyboardType: TextInputType.phone,
|
||||
textInputAction: TextInputAction.next,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context).requestFocus(_passwordFocusNode);
|
||||
},
|
||||
controller: cellNumberController,
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
icon: Icon(
|
||||
Icons.call,
|
||||
color: Colors.grey,
|
||||
),
|
||||
border: UnderlineInputBorder(),
|
||||
fillColor: Colors.red,
|
||||
labelText: 'Cell Number',
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 5),
|
||||
),
|
||||
onSaved: (value) {
|
||||
map['cellNumber'] = value;
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
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,
|
||||
textInputAction: TextInputAction.done,
|
||||
onFieldSubmitted: (_) {
|
||||
_register();
|
||||
},
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.starOfLife,
|
||||
color: Colors.grey,
|
||||
),
|
||||
border: UnderlineInputBorder(),
|
||||
fillColor: Colors.red,
|
||||
labelText: 'Password',
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 5),
|
||||
suffixIcon: InkWell(
|
||||
child: Icon(FontAwesomeIcons.eye),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_hidePass = !_hidePass;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
focusNode: _passwordFocusNode,
|
||||
onSaved: (value) {
|
||||
map['password'] = value;
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
TextFormField(
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Full Name 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;
|
||||
},
|
||||
// keyboardType: TextInputType.phone,
|
||||
// textInputAction: TextInputAction.next,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context).requestFocus(_passwordFocusNode);
|
||||
// },
|
||||
// controller: cellNumberController,
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.sortNumericDown,
|
||||
color: Colors.grey,
|
||||
),
|
||||
border: UnderlineInputBorder(),
|
||||
fillColor: Colors.red,
|
||||
labelText: 'Full Name',
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 5),
|
||||
),
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
// onSaved: (value) {
|
||||
// map['cellNumber'] = value;
|
||||
// },
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
// width: double.infinity,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
color: Colors.grey,
|
||||
size: 5 * _deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
// width: MediaQuery.of(context).size.width - 70,
|
||||
child: DropdownButton(
|
||||
focusColor: Colors.red,
|
||||
icon: Icon(FontAwesomeIcons.angleDown),
|
||||
isExpanded: true,
|
||||
hint: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text(
|
||||
curhospitalVal!,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
// color: _mainFontColor,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
isDense: true,
|
||||
items: hospitalVals.map((String value) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Container(
|
||||
child: Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
// color: _mainFontColor,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
curhospitalVal = val;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 40),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
onTap: () => _register(),
|
||||
child: Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 5,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.blue, Colors.green],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Spacer(),
|
||||
Icon(
|
||||
Icons.add,
|
||||
color: Colors.white,
|
||||
),
|
||||
Text(
|
||||
'register',
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
Spacer()
|
||||
],
|
||||
)
|
||||
// TextButton.icon(
|
||||
// padding: EdgeInsets.all(0),
|
||||
// onPressed: () {
|
||||
// _register();
|
||||
// },
|
||||
// icon: Icon(Icons.exit_to_app,
|
||||
// color: Colors.white, size: 17),
|
||||
// label: Text('register',
|
||||
// style: TextStyle(color: Colors.white)),
|
||||
// ),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 5,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Spacer(),
|
||||
Icon(
|
||||
Icons.exit_to_app,
|
||||
// size: 6 * _pixelRatio,
|
||||
),
|
||||
Text(
|
||||
'Login',
|
||||
style: TextStyle(
|
||||
// fontSize: 5.5,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
+194
-196
@@ -1,196 +1,194 @@
|
||||
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 VerifyPassScreen extends StatefulWidget {
|
||||
// static const route = '/HomeScreen';
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _VerifyPassScreenState();
|
||||
}
|
||||
}
|
||||
|
||||
class _VerifyPassScreenState extends State<VerifyPassScreen> {
|
||||
final _form = GlobalKey<FormState>();
|
||||
bool _isLoading = false;
|
||||
final codeCTRL = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
codeCTRL.text = '';
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void 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 _sendCode() async {
|
||||
if (!_form.currentState.validate()) {
|
||||
return;
|
||||
}
|
||||
_form.currentState.save();
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
// try {
|
||||
await Provider.of<Auth>(context, listen: false)
|
||||
.sendCode(
|
||||
codeCTRL.text,
|
||||
)
|
||||
.then(
|
||||
(result) {
|
||||
if (result == 'wrong') {
|
||||
_showDialog('Code is wrong!!!');
|
||||
setState(
|
||||
() {
|
||||
_isLoading = false;
|
||||
},
|
||||
);
|
||||
} else {
|
||||
Navigator.of(context)
|
||||
.popAndPushNamed(Routes.rePassScreen, arguments: result);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@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(
|
||||
centerTitle: true,
|
||||
title: Text('CSSD'),
|
||||
),
|
||||
body: Selector<ConnectivityProvider, String>(
|
||||
builder: (ctx, value, _) => value != 'offline'
|
||||
? _isLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(),
|
||||
)
|
||||
: Form(
|
||||
key: _form,
|
||||
child: ListView(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 20),
|
||||
child: Text(
|
||||
'Send Verification Code',
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextFormField(
|
||||
validator: (value) {
|
||||
if (value.isEmpty) {
|
||||
return 'Code is required.';
|
||||
}
|
||||
if (value.length != 6) {
|
||||
return 'Code most be 6 characters';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: codeCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.starOfLife,
|
||||
size: 6 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
labelText: 'Code',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2,
|
||||
horizontal: 3,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
onSaved: (value) {
|
||||
codeCTRL.text = value;
|
||||
},
|
||||
maxLength: 6,
|
||||
),
|
||||
SizedBox(height: 40),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
onTap: () => _sendCode(),
|
||||
child: Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.blue, Colors.green],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Text(
|
||||
'Send Code',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
)
|
||||
: ConnectionErrorBox(),
|
||||
selector: (_, connectivity) => connectivity.conStatus,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
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 VerifyPassScreen extends StatefulWidget {
|
||||
// static const route = '/HomeScreen';
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _VerifyPassScreenState();
|
||||
}
|
||||
}
|
||||
|
||||
class _VerifyPassScreenState extends State<VerifyPassScreen> {
|
||||
final _form = GlobalKey<FormState>();
|
||||
bool _isLoading = false;
|
||||
final codeCTRL = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
codeCTRL.text = '';
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void 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 _sendCode() async {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
_form.currentState!.save();
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
// try {
|
||||
await Provider.of<Auth>(context, listen: false)
|
||||
.sendCode(
|
||||
codeCTRL.text,
|
||||
)
|
||||
.then(
|
||||
(result) {
|
||||
if (result == 'wrong') {
|
||||
_showDialog('Code is wrong!!!');
|
||||
setState(
|
||||
() {
|
||||
_isLoading = false;
|
||||
},
|
||||
);
|
||||
} else {
|
||||
Navigator.of(context)
|
||||
.popAndPushNamed(Routes.rePassScreen, arguments: result);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@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(
|
||||
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(
|
||||
'Send Verification Code',
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextFormField(
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Code is required.';
|
||||
}
|
||||
if (value.length != 6) {
|
||||
return 'Code most be 6 characters';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: codeCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.starOfLife,
|
||||
size: 6 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
labelText: 'Code',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2,
|
||||
horizontal: 3,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
onSaved: (value) {
|
||||
codeCTRL.text = value!;
|
||||
},
|
||||
maxLength: 6,
|
||||
),
|
||||
SizedBox(height: 40),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
onTap: () => _sendCode(),
|
||||
child: Container(
|
||||
width: 88 * _deviceBlockSize,
|
||||
padding: EdgeInsets.all(10),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black,
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Text(
|
||||
'Send Code',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
)
|
||||
: 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/test_results.dart';
|
||||
import '../widgets/Global/internet_error.dart';
|
||||
import '../widgets/TestResultScreens/Details/datas_box.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class TestDetailsScreen extends StatefulWidget {
|
||||
// static const route = '/TestDetailsScreen';
|
||||
final String testResultId;
|
||||
|
||||
TestDetailsScreen({this.testResultId});
|
||||
|
||||
@override
|
||||
_TestDetailsScreenState createState() => _TestDetailsScreenState();
|
||||
}
|
||||
|
||||
class _TestDetailsScreenState extends State<TestDetailsScreen> {
|
||||
bool isInit = true;
|
||||
Map<String, dynamic> datas;
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
var _id = ModalRoute.of(context).settings.arguments;
|
||||
await Provider.of<TestResultsProvider>(context, listen: false)
|
||||
.showTestResult(_id.toString())
|
||||
.then((result) {
|
||||
setState(() {
|
||||
datas = result;
|
||||
isInit = false;
|
||||
});
|
||||
});
|
||||
// print(datas);
|
||||
}
|
||||
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;
|
||||
// print(datas);
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text('Test Result Detail'),
|
||||
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(),
|
||||
)
|
||||
: DatasBox(
|
||||
datas: datas,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import '../../providers/connectivity.dart';
|
||||
import '../../providers/test_results.dart';
|
||||
import '../../widgets/Global/internet_error.dart';
|
||||
import '../../widgets/TestResultScreens/Details/datas_box.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class TestDetailsScreen extends StatefulWidget {
|
||||
// static const route = '/TestDetailsScreen';
|
||||
final String? testResultId;
|
||||
|
||||
TestDetailsScreen({this.testResultId});
|
||||
|
||||
@override
|
||||
_TestDetailsScreenState createState() => _TestDetailsScreenState();
|
||||
}
|
||||
|
||||
class _TestDetailsScreenState extends State<TestDetailsScreen> {
|
||||
bool isInit = true;
|
||||
Map<String, Object>? datas;
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||
await Provider.of<TestResultsProvider>(context, listen: false)
|
||||
.showTestResult(_id.toString())
|
||||
.then((result) {
|
||||
setState(() {
|
||||
datas = result.cast<String, Object>();
|
||||
isInit = false;
|
||||
});
|
||||
});
|
||||
// print(datas);
|
||||
}
|
||||
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;
|
||||
// print(datas);
|
||||
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'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: DatasBox(
|
||||
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:provider/provider.dart';
|
||||
import 'package:random_string/random_string.dart';
|
||||
|
||||
import '../config/routes.dart';
|
||||
import '../providers/input.dart';
|
||||
import '../providers/test_results.dart';
|
||||
import '../widgets/TestResultScreens/Add/form_creator.dart';
|
||||
|
||||
class FormPage extends StatefulWidget {
|
||||
final String name;
|
||||
final String uniqueCode;
|
||||
final String testResultId;
|
||||
final String testTypeId;
|
||||
|
||||
FormPage({this.name, this.uniqueCode, this.testResultId, this.testTypeId});
|
||||
|
||||
@override
|
||||
_FormPageState createState() => _FormPageState();
|
||||
}
|
||||
|
||||
class _FormPageState extends State<FormPage> {
|
||||
bool _isInit = true;
|
||||
bool _isLoading = false;
|
||||
bool isAdding = false;
|
||||
final _form = GlobalKey<FormState>();
|
||||
Map<String, dynamic> values = {};
|
||||
List<Map<String, dynamic>> formInputs;
|
||||
|
||||
void _saveForm() {
|
||||
final batchId = randomString(10);
|
||||
formatData(formInputs);
|
||||
var prvObject = Provider.of<TestResultsProvider>(context, listen: false);
|
||||
if (this.widget.testResultId != null && this.widget.testResultId != '') {
|
||||
values['_method'] = 'put';
|
||||
TestResultsProvider.updateTestResult(this.widget.testResultId, values)
|
||||
.then((_) {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
prvObject.createTestResult(values, batchId).then((result) {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
if (result == 'done') {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Test added.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((value) =>
|
||||
Navigator.of(context).popAndPushNamed(Routes.testResultScreen));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
if (_isInit) {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
Provider.of<Inputs>(context, listen: false)
|
||||
.getInputs(
|
||||
testResultId: this.widget.testResultId ?? "",
|
||||
name: this.widget.name ?? "",
|
||||
uniqueCode: this.widget.uniqueCode ?? "",
|
||||
testTypeId: this.widget.testTypeId ?? "")
|
||||
.then((_) {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
_isInit = false;
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
Routes.testResultAddScreen,
|
||||
);
|
||||
return true;
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
title: Text('Add Test Result'),
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(Icons.save),
|
||||
onPressed: () {
|
||||
_saveForm();
|
||||
},
|
||||
)
|
||||
],
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context)
|
||||
.popAndPushNamed(Routes.testResultScreen);
|
||||
},
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: _isLoading
|
||||
? Center(child: CircularProgressIndicator())
|
||||
: Form(
|
||||
key: _form,
|
||||
child: Consumer<Inputs>(
|
||||
builder: (context, inputs, _) {
|
||||
formInputs = inputs.inputItems;
|
||||
return formInputs.length != 0
|
||||
? FormCreator(
|
||||
form: inputs.inputItems,
|
||||
onChanged: (value) {
|
||||
formInputs = value;
|
||||
},
|
||||
)
|
||||
: Center(
|
||||
child: Text('An error happen!!!'),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
// https://www.cssd-doc.com/api/GetInfo
|
||||
// InkWell(
|
||||
// onTap: () {
|
||||
// _saveForm();
|
||||
// },
|
||||
// child: Container(
|
||||
// padding: EdgeInsets.symmetric(horizontal: 60, vertical: 15),
|
||||
// margin: EdgeInsets.symmetric(vertical: 20, horizontal: 50),
|
||||
// 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}";
|
||||
} else {
|
||||
values[input["key"]] = input["value"];
|
||||
// print('${input["key"]} : ${input["value"]}');
|
||||
}
|
||||
}
|
||||
if (input['children'] != null && input['children'].isNotEmpty) {
|
||||
formatData(input['children']);
|
||||
}
|
||||
}
|
||||
// print(values);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:random_string/random_string.dart';
|
||||
|
||||
import '../../config/routes.dart';
|
||||
import '../../providers/input.dart';
|
||||
import '../../providers/test_results.dart';
|
||||
import '../../widgets/TestResultScreens/Add/form_creator.dart';
|
||||
|
||||
class FormPage extends StatefulWidget {
|
||||
final String? name;
|
||||
final String? uniqueCode;
|
||||
final String? testResultId;
|
||||
final String? testTypeId;
|
||||
|
||||
FormPage({this.name, this.uniqueCode, this.testResultId, this.testTypeId});
|
||||
|
||||
@override
|
||||
_FormPageState createState() => _FormPageState();
|
||||
}
|
||||
|
||||
class _FormPageState extends State<FormPage> {
|
||||
bool _isInit = true;
|
||||
bool _isLoading = false;
|
||||
bool isAdding = false;
|
||||
final _form = GlobalKey<FormState>();
|
||||
Map<String, dynamic> values = {};
|
||||
List<Map<String, dynamic>> formInputs = [];
|
||||
|
||||
void _saveForm() {
|
||||
final batchId = randomString(10);
|
||||
formatData(formInputs);
|
||||
var prvObject = Provider.of<TestResultsProvider>(context, listen: false);
|
||||
if (this.widget.testResultId != null && this.widget.testResultId != '') {
|
||||
values['_method'] = 'put';
|
||||
TestResultsProvider.updateTestResult(this.widget.testResultId!, values)
|
||||
.then((_) {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
prvObject.createTestResult(values, batchId).then((result) {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
if (result == 'done') {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Test added.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((value) =>
|
||||
Navigator.of(context).popAndPushNamed(Routes.testResultScreen));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
if (_isInit) {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
String testTypeName = Provider.of<TestResultsProvider>(context).testType;
|
||||
String testCode = Provider.of<TestResultsProvider>(context).testCode;
|
||||
Provider.of<Inputs>(context, listen: false)
|
||||
.getInputs(
|
||||
testResultId: '',
|
||||
name: testTypeName,
|
||||
uniqueCode: testCode,
|
||||
testTypeId: '',
|
||||
)
|
||||
.then((_) {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
_isInit = false;
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
Routes.testResultAddScreen,
|
||||
);
|
||||
return true;
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
title: Text('Add Test Result'),
|
||||
backgroundColor: Colors.black,
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(Icons.save),
|
||||
onPressed: () {
|
||||
_saveForm();
|
||||
},
|
||||
)
|
||||
],
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).popAndPushNamed(Routes.testResultScreen);
|
||||
},
|
||||
),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
_isLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: Form(
|
||||
key: _form,
|
||||
child: Consumer<Inputs>(
|
||||
builder: (context, inputs, _) {
|
||||
formInputs = inputs.inputItems;
|
||||
print(formInputs);
|
||||
return formInputs.length != 0
|
||||
? FormCreator(
|
||||
form: formInputs,
|
||||
onChanged: (value) {
|
||||
formInputs = value;
|
||||
},
|
||||
)
|
||||
: Center(
|
||||
child: Text('Something went wrong!!!'),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
// https://www.cssd-doc.com/api/GetInfo
|
||||
// InkWell(
|
||||
// onTap: () {
|
||||
// _saveForm();
|
||||
// },
|
||||
// child: Container(
|
||||
// padding: EdgeInsets.symmetric(horizontal: 60, vertical: 15),
|
||||
// margin: EdgeInsets.symmetric(vertical: 20, horizontal: 50),
|
||||
// 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}";
|
||||
} 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