commit 12d8df2eef41ecd57d6b9504fcbff593950c82bd Author: snehalathad Date: Thu Jan 4 12:36:37 2024 +0530 pwa app konectar first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..24476c5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,44 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/.metadata b/.metadata new file mode 100644 index 0000000..30ec6ba --- /dev/null +++ b/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "2e9cb0aa71a386a91f73f7088d115c0d96654829" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829 + base_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829 + - platform: android + create_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829 + base_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829 + + # 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' diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..1ac8c23 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,25 @@ +{ + // 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": "pwa_ios", + "request": "launch", + "type": "dart" + }, + { + "name": "pwa_ios (profile mode)", + "request": "launch", + "type": "dart", + "flutterMode": "profile" + }, + { + "name": "pwa_ios (release mode)", + "request": "launch", + "type": "dart", + "flutterMode": "release" + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..6978d68 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# pwa_ios + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..61b6c4d --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,29 @@ +# 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-lang.github.io/linter/lints/index.html. + # + # 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 diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..6f56801 --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks diff --git a/android/app/build.gradle b/android/app/build.gradle new file mode 100644 index 0000000..1b4733c --- /dev/null +++ b/android/app/build.gradle @@ -0,0 +1,72 @@ +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 { + namespace "com.example.pwa_ios" + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.pwa_ios" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. + minSdkVersion 21 + targetSdkVersion flutter.targetSdkVersion + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + 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" +} diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..835f154 --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/example/pwa_ios/MainActivity.kt b/android/app/src/main/kotlin/com/example/pwa_ios/MainActivity.kt new file mode 100644 index 0000000..d75b3e2 --- /dev/null +++ b/android/app/src/main/kotlin/com/example/pwa_ios/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.pwa_ios + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/build.gradle b/android/build.gradle new file mode 100644 index 0000000..f7eb7f6 --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,31 @@ +buildscript { + ext.kotlin_version = '1.7.10' + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:7.3.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..94adc3a --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..3c472b9 --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/android/settings.gradle b/android/settings.gradle new file mode 100644 index 0000000..44e62bc --- /dev/null +++ b/android/settings.gradle @@ -0,0 +1,11 @@ +include ':app' + +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() + +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/assets/images/interactiondata.json b/assets/images/interactiondata.json new file mode 100644 index 0000000..0c15803 --- /dev/null +++ b/assets/images/interactiondata.json @@ -0,0 +1,260 @@ +{ + "form-attr": [ + + + { + "widgetId": "intlocation_1", + "data" : + [ + + { + "id": "1", + "name": "In office" + }, + { + "id": "2", + "name": "some" + }, + { + "id": "3", + "name": "Internal meetings" + }, + { + "id": "4", + "name": "Internal meetings" + }, + { + "id": "5", + "name": "Out of Office" + }, + { + "id": "6", + "name": "Virtual" + } + ] + }, + + + { + "widgetId": "inttype_11", + "data" : + [ + { + "id": "11", + "name": "Face to Face" + }, + { + "id": "12", + "name": "Lecture" + }, + { + "id": "13", + "name": "Mailing" + }, + { + "id": "14", + "name": "Other" + }, + { + "id": "15", + "name": "Phone" + } + ] + }, + + + { + "widgetId": "intcategory_21", + "data" : + [ + { + "id": "21", + "name": "One to One" + }, + { + "id": "22", + "name": "Group" + } + ] + }, + + + { + "widgetId": "intempname_31", + "data" : + [ + { + "id": "31", + "name": "Sarepta Manager" + }, + { + "id": "32", + "name": "Todd Truesdale" + } + ] + }, + + + { + "widgetId": "intcheck_121", + "data" : + [ + { + "id": "121", + "name": "One to One" + }, + { + "id": "122", + "name": "Group" + } + ] + }, + + { + "widgetId": "discproduct_41", + "data" : + [ + { + "id": "41", + "name": "Product1" + }, + { + "id": "42", + "name": "Product2" + } + ] + + }, + { + "widgetId": "disctype_51", + "data" : + [ + { + "id": "51", + "name": "Face to Face" + }, + { + "id": "52", + "name": "Lecture" + }, + { + "id": "53", + "name": "Mailing" + }, + { + "id": "54", + "name": "Other" + }, + { + "id": "55", + "name": "Phone" + } + ] + }, + + { + "widgetId": "disctopic_61", + "data" : + [ + { + "id": "61", + "name": "Face to Face" + }, + { + "id": "62", + "name": "Lecture" + }, + { + "id": "63", + "name": "Mailing" + }, + { + "id": "64", + "name": "Other" + }, + { + "id": "65", + "name": "Phone" + } + ] + }, + + { + "widgetId": "othercountry_15", + "data" : + [ + + { + "name": "India", + "id": "1" + }, + { + "name": "USA", + "id": "2" + }, + { + "name": "Nepal", + "id": "3" + } + ] + }, + + + { + "widgetId": "otherstate_16", + "data" : + [ + + + { + "name": "Karnataka", + "id": "1", + "pid": "1" + + }, + { + "name": "Maharashtra", + "id": "2", + "pid": "1" + }, + { + "name": "Andhra Pradesh", + "id": "3", + "pid": "1" + }, + { + "name": "Karnataka", + "id": "4", + "pid": "1" + } + ] + }, + + { + "widgetId": "othercity_17", + "data" : + [ + + + + { + "name": "Hubli", + "id": "1", + "pid": "1" + }, + { + "name": "Bangalore", + "id": "2", + "pid": "1" + }, + { + "name": "Belgavi", + "id": "3", + "pid": "1" + } + + + ] + } + ] +} \ No newline at end of file diff --git a/assets/images/interactiondatac2.json b/assets/images/interactiondatac2.json new file mode 100644 index 0000000..326232f --- /dev/null +++ b/assets/images/interactiondatac2.json @@ -0,0 +1,288 @@ +{ + "form-attr": [ + + + { + "widgetId": "intlocation_1", + "data" : + [ + + { + "id": "1", + "name": "In office" + }, + { + "id": "2", + "name": "some" + }, + { + "id": "3", + "name": "Internal meetings" + }, + { + "id": "4", + "name": "Internal meetings" + }, + { + "id": "5", + "name": "Out of Office" + }, + { + "id": "6", + "name": "Virtual" + } + ] + }, + + + { + "widgetId": "inttype_11", + "data" : + [ + { + "id": "11", + "name": "Face to Face" + }, + { + "id": "12", + "name": "Lecture" + }, + { + "id": "13", + "name": "Mailing" + }, + { + "id": "14", + "name": "Other" + }, + { + "id": "15", + "name": "Phone" + } + ] + }, + + { + "widgetId": "cmssponsored_11", + "data" : + [ + { + "id": "112", + "name": "Face to Face" + }, + { + "id": "123", + "name": "Lecture" + }, + { + "id": "134", + "name": "Mailing" + }, + { + "id": "145", + "name": "Other" + }, + { + "id": "156 ", + "name": "Phone" + } + ] + }, + { + "widgetId": "intcategory_21", + "data" : + [ + { + "id": "21", + "name": "One to One" + }, + { + "id": "22", + "name": "Group" + } + ] + }, + + + { + "widgetId": "intempname_31", + "data" : + [ + { + "id": "31", + "name": "Sarepta Manager" + }, + { + "id": "32", + "name": "Todd Truesdale" + } + ] + }, + + + { + "widgetId": "intcheck_121", + "data" : + [ + { + "id": "121", + "name": "One to One" + }, + { + "id": "122", + "name": "Group" + } + ] + }, + + { + "widgetId": "discproduct_41", + "data" : + [ + { + "id": "41", + "name": "Product1" + }, + { + "id": "42", + "name": "Product2" + } + ] + + }, + { + "widgetId": "disctype_51", + "data" : + [ + { + "id": "51", + "name": "Face to Face" + }, + { + "id": "52", + "name": "Lecture" + }, + { + "id": "53", + "name": "Mailing" + }, + { + "id": "54", + "name": "Other" + }, + { + "id": "55", + "name": "Phone" + } + ] + }, + + { + "widgetId": "disctopic_61", + "data" : + [ + { + "id": "61", + "name": "Face to Face" + }, + { + "id": "62", + "name": "Lecture" + }, + { + "id": "63", + "name": "Mailing" + }, + { + "id": "64", + "name": "Other" + }, + { + "id": "65", + "name": "Phone" + } + ] + }, + + { + "widgetId": "othercountry_15", + "data" : + [ + { + "name": "Select country", + "id": "0" + }, + { + "name": "India", + "id": "1" + }, + { + "name": "USA", + "id": "2" + }, + { + "name": "Nepal", + "id": "3" + } + ] + }, + + + { + "widgetId": "otherstate_16", + "data" : + [ + + + { + "name": "Karnataka", + "id": "1", + "pid": "1" + + }, + { + "name": "Maharashtra", + "id": "2", + "pid": "1" + }, + { + "name": "Andhra Pradesh", + "id": "3", + "pid": "1" + }, + { + "name": "Karnataka", + "id": "4", + "pid": "1" + } + ] + }, + + { + "widgetId": "othercity_17", + "data" : + [ + + + + { + "name": "Hubli", + "id": "1", + "pid": "1" + }, + { + "name": "Bangalore", + "id": "2", + "pid": "1" + }, + { + "name": "Belgavi", + "id": "3", + "pid": "1" + } + + + ] + } + ] + } \ No newline at end of file diff --git a/assets/images/interactionform.json b/assets/images/interactionform.json new file mode 100644 index 0000000..e519c54 --- /dev/null +++ b/assets/images/interactionform.json @@ -0,0 +1,566 @@ +{ + "form-fields": [ + { + "sectionName": "Interaction Details", + "multiple": false, + "sectionList": [ + { + "name": "Interaction Date", + "param": "interactionDate", + "id": "intdate_1", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "Date", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Interaction Location", + "param": "interactionLocation", + "id": "intlocation_1", + "selectedValue": [], + "depid": "", + "widget": "dropdown", + "input": "dropdown", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Interaction Type", + "param": "interactionType", + "id": "inttype_11", + "selectedValue": [], + "depid": "", + "widget": "dropdown", + "input": "dropdown", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Interaction Category", + "param": "interactionCategory", + "id": "intcategory_21", + "selectedValue": [], + "depid": "", + "widget": "radio", + "input": "radio", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Number of Attendees", + "param": "numberOfAttendees", + "id": "intattendees_2", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "number", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Employee name", + "param": "employeeName", + "id": "intempname_31", + "selectedValue": [], + "depid": "", + "widget": "dropdown", + "input": "dropdown", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Interaction ", + "param": "interactionCheckbox", + "id": "intcheck_121", + "selectedValue": [], + "depid": "", + "widget": "checkbox", + "input": "checkbox", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Number of Attendees", + "param": "interactionRange", + "id": "intrange_122", + "selectedValue": [], + "depid": "", + "widget": "rangeslider", + "input": "100", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + } + ] + }, + { + "sectionName": "Discussion Topic", + "multiple": true, + "sectionList": [ + { + "name": "Product", + "id": "discproduct_41", + "selectedValue": [], + "depid": "", + "param": "product", + "widget": "dropdown", + "input": "dropdown", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Discussion Type", + "param": "discussionType", + "id": "disctype_51", + "selectedValue": [], + "depid": "", + "widget": "autocomplete", + "input": "autocomplete", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Discussion Topic", + "param": "discussionTopic", + "id": "disctopic_61", + "selectedValue": [], + "depid": "", + "widget": "multiselect", + "input": "multiselect", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + } + ] + }, + { + "sectionName": "Attendees", + "multiple": true, + "sectionList": [ + { + "name": "HCP Name", + "param": "hcpName", + "id": "attendeeshcpname_3", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "text", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Speciality", + "param": "speciality", + "id": "attendeeshcpspeciality_4", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "text", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Title", + "param": "attendeesTitle", + "id": "attendeestitle_5", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "text", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + } + + + ] + }, + { + "sectionName": "Location", + "multiple": false, + "sectionList": [ + { + "name": "Location", + "param": "primaryLocation", + "id": "primarylocation_6", + "selectedValue": [], + "depid": "", + "widget": "label", + "input": "primary", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Address", + "param": "primaryAddress", + "id": "primaryaddress_7", + "selectedValue": [], + "depid": "", + "widget": "label", + "input": "Hubli", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Country", + "param": "primaryCountry", + "id": "primarycountry_8", + "selectedValue": [], + "depid": "", + "widget": "label", + "input": "United states", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "State", + "param": "primaryState", + "id": "primarystate_9", + "selectedValue": [], + "depid": "", + "widget": "label", + "input": "Arizona", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "City", + "param": "primaryCity", + "id": "primarycity_10", + "selectedValue": [], + "depid": "", + "widget": "label", + "input": "Tucson", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + } + ] + }, + { + "sectionName": "Other", + "multiple": false, + "sectionList": [ + { + "name": "Address1", + "param": "otherAddress1", + "id": "otheraddress1_12", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "primary", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Address2", + "param": "otherAddress2", + "id": "otheraddress2_13", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "Hubli", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Postal code", + "param": "otherPostalCode", + "id": "otherpostal_14", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "Hubli", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Country", + "param": "otherCountry", + "id": "othercountry_15", + "selectedValue": [], + "depid": "", + "widget": "dropdown", + "inputList": [ { + "id": 1, + "name": "Select state" + }], + "isRequired": true + }, + { + "name": "State", + "param": "otherState", + "id": "otherstate_16", + "selectedValue": [], + "depid": "othercountry_15", + "widget": "dropdown", + "inputList": [ + { + "id": 1, + "name": "Select state" + } + ], + "isRequired": true + }, + { + "name": "City", + "param": "otherCity", + "widget": "dropdown", + "id": "othercity_17", + "selectedValue": [], + "depid": "otherstate_16", + "inputList": [ + { + "id": 1, + "name": "Select city" + } + ], + "isRequired": true + } + ] + }, + { + "sectionName": "Other Attendees", + "multiple": false, + "sectionList": [ + { + "name": "Attendee Name", + "param": "otherAttendeeName", + "id": "otherattendeename_18", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "text", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Speciality", + "param": "otherAttendeeSpeciality", + "id": "otherattendeespeciality_19", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "text", + "inputList": [ + { + "id": "", + "name": "" + } + ], + + "isRequired": true + }, + { + "name": "Comments", + "param": "otherAttendeeComments", + "id": "otherattendeecom_20", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "text", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + } + ] + }, + { + "sectionName": "Attach Document(s)", + "multiple": true, + "sectionList": [ + { + "name": "Document Name", + "param": "documentName", + "id": "documentName_21", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "text", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Description", + "param": "documentDescription", + "id": "documentDescription_21", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "text", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Choose file", + "param": "chooseFile", + "id": "chooseFile_22", + "selectedValue": [], + "depid": "", + "widget": "button", + "input": "button", + "inputList": [ + { + "id": "", + "name": "" + } + ], + + "isRequired": true + } + + ] + }, + { + "sectionName": "Notes", + "multiple": false, + "sectionList": [ + { + "name": "Comments", + "id": "notescomments_22", + "selectedValue": [], + "depid": "", + "param": "notesComments", + "validation" : "maxchars", + "chars" : "500", + "widget": "text", + "input": "textArea", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + } + ] + } + ] +} \ No newline at end of file diff --git a/assets/images/interactionformc2.json b/assets/images/interactionformc2.json new file mode 100644 index 0000000..704a2ed --- /dev/null +++ b/assets/images/interactionformc2.json @@ -0,0 +1,503 @@ +{ + "form-fields": [ + { + "sectionName": "Interaction Details", + "multiple": false, + "sectionList": [ + { + "name": "Interaction Date", + "param": "interactionDate", + "id": "intdate_1", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "Date", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Interaction Location", + "param": "interactionLocation", + "id": "intlocation_1", + "selectedValue": [], + "depid": "", + "widget": "dropdown", + "input": "dropdown", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Interaction", + "param": "interactionType", + "id": "inttype_11", + "selectedValue": [], + "depid": "", + "widget": "dropdown", + "input": "dropdown", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "CMSU Sponsored", + "param": "cmsusponsored", + "id": "cmssponsored_11", + "selectedValue": [], + "depid": "", + "widget": "dropdown", + "input": "dropdown", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Number of Attendees", + "param": "numberOfAttendees", + "id": "intattendees_2", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "number", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "CMSU Insight", + "param": "cmsuinsight", + "id": "intempname_31", + "selectedValue": [], + "depid": "", + "widget": "dropdown", + "input": "dropdown", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + } + + ] + }, + { + "sectionName": "Konectar Notes", + "multiple": false, + "sectionList": [ + { + "name": "Konectar notes", + "id": "notescomments_22", + "selectedValue": [], + "depid": "", + "param": "notesComments", + "validation" : "maxchars", + "chars" : "500", + "widget": "text", + "input": "textArea", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + } + + ] + }, + { + "sectionName": "Attendees", + "multiple": true, + "sectionList": [ + { + "name": "HCP Name", + "param": "hcpName", + "id": "attendeeshcpname_3", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "text", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Speciality", + "param": "speciality", + "id": "attendeeshcpspeciality_4", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "text", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Title", + "param": "attendeesTitle", + "id": "attendeestitle_5", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "text", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + } + ] + }, + { + "sectionName": "Location", + "multiple": false, + "sectionList": [ + { + "name": "Location", + "param": "primaryLocation", + "id": "primarylocation_6", + "selectedValue": [], + "depid": "", + "widget": "label", + "input": "primary", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Address", + "param": "primaryAddress", + "id": "primaryaddress_7", + "selectedValue": [], + "depid": "", + "widget": "label", + "input": "Hubli", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Country", + "param": "primaryCountry", + "id": "primarycountry_8", + "selectedValue": [], + "depid": "", + "widget": "label", + "input": "United states", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "State", + "param": "primaryState", + "id": "primarystate_9", + "selectedValue": [], + "depid": "", + "widget": "label", + "input": "Arizona", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "City", + "param": "primaryCity", + "id": "primarycity_10", + "selectedValue": [], + "depid": "", + "widget": "label", + "input": "Tucson", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + } + ] + }, + { + "sectionName": "Other", + "multiple": false, + "sectionList": [ + { + "name": "Address1", + "param": "otherAddress1", + "id": "otheraddress1_12", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "primary", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Address2", + "param": "otherAddress2", + "id": "otheraddress2_13", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "Hubli", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Postal code", + "param": "otherPostalCode", + "id": "otherpostal_14", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "Hubli", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Country", + "param": "otherCountry", + "id": "othercountry_15", + "selectedValue": [], + "depid": "", + "widget": "dropdown", + "inputList": [ { + "id": 1, + "name": "Select country" + }], + "isRequired": true + }, + { + "name": "State", + "param": "otherState", + "id": "otherstate_16", + "selectedValue": [], + "depid": "othercountry_15", + "widget": "dropdown", + "inputList": [ + { + "id": 1, + "name": "Select state" + } + ], + "isRequired": true + }, + { + "name": "City", + "param": "otherCity", + "widget": "dropdown", + "id": "othercity_17", + "selectedValue": [], + "depid": "otherstate_16", + "inputList": [ + { + "id": 1, + "name": "Select city" + } + ], + "isRequired": true + } + ] + }, + { + "sectionName": "Other Attendees", + "multiple": false, + "sectionList": [ + { + "name": "Attendee Name", + "param": "otherAttendeeName", + "id": "otherattendeename_18", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "text", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Speciality", + "param": "otherAttendeeSpeciality", + "id": "otherattendeespeciality_19", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "text", + "inputList": [ + { + "id": "", + "name": "" + } + ], + + "isRequired": true + }, + { + "name": "Comments", + "param": "otherAttendeeComments", + "id": "otherattendeecom_20", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "text", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + } + ] + }, + { + "sectionName": "Attach Document(s)", + "multiple": true, + "sectionList": [ + { + "name": "Document Name", + "param": "documentName", + "id": "documentName_21", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "text", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Description", + "param": "documentDescription", + "id": "documentDescription_21", + "selectedValue": [], + "depid": "", + "widget": "text", + "input": "text", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + }, + { + "name": "Choose file", + "param": "chooseFile", + "id": "chooseFile_22", + "selectedValue": [], + "depid": "", + "widget": "button", + "input": "button", + "inputList": [ + { + "id": "", + "name": "" + } + ], + + "isRequired": true + } + ] + }, + { + "sectionName": "Notes", + "multiple": false, + "sectionList": [ + { + "name": "Comments", + "id": "notescomments_22", + "selectedValue": [], + "depid": "", + "param": "notesComments", + "validation" : "maxchars", + "chars" : "500", + "widget": "text", + "input": "textArea", + "inputList": [ + { + "id": "", + "name": "" + } + ], + "isRequired": true + } + ] + } + ] + } \ No newline at end of file diff --git a/assets/images/klogo.svg b/assets/images/klogo.svg new file mode 100644 index 0000000..1ea444d --- /dev/null +++ b/assets/images/klogo.svg @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/konectar.png b/assets/images/konectar.png new file mode 100644 index 0000000..17e6198 Binary files /dev/null and b/assets/images/konectar.png differ diff --git a/assets/images/locationdetailsform.json b/assets/images/locationdetailsform.json new file mode 100644 index 0000000..861c2fe --- /dev/null +++ b/assets/images/locationdetailsform.json @@ -0,0 +1,74 @@ +{ + "location": { + + "country": [ + { + "countryName": "Select country", + "countryId": "0" + }, + { + "countryName": "India", + "countryId": "1" + }, + { + "countryName": "USA", + "countryId": "2" + }, + { + "countryName": "Nepal", + "countryId": "3" + } + ], + "state": [ + + { + "stateName": "Karnataka", + "stateId": "1", + "countryId": "1" + }, + { + "stateName": "Maharashtra", + "stateId": "2", + "countryId": "1" + }, + { + "stateName": "Andhra Pradesh", + "stateId": "3", + "countryId": "1" + }, + { + "stateName": "Karnataka", + "stateId": "4", + "countryId": "1" + } + ], + "city": [ + { + "cityName": "Select city", + "distId": "0", + "stateId": "0", + "countryId": "0" + }, + { + "cityName": "Hubli", + "distId": "1", + "stateId": "1", + "countryId": "1" + }, + { + "cityName": "Bangalore", + "distId": "2", + "stateId": "1", + "countryId": "1" + }, + { + "cityName": "Belgavi", + "distId": "3", + "stateId": "1", + "countryId": "1" + } + ] + + } + + } \ No newline at end of file diff --git a/assets/images/newconfigdata.json b/assets/images/newconfigdata.json new file mode 100644 index 0000000..0f84124 --- /dev/null +++ b/assets/images/newconfigdata.json @@ -0,0 +1,565 @@ +{ + "data": [ + { + "id": "Form1", + "name": "Interaction Form", + "form-fields": [ + { + "sectionName": "Interaction Details", + "multiple": false, + "sectionList": [ + { + "name": "Interaction Date", + "id": "intdate_1", + "depid": "", + "widget": "text", + "input": "Date", + "validation": + { + "isRequired": true + } + + }, + { + "name": "Interaction Location", + "param": "interactionLocation", + "id": "intlocation_1", + "selectedValue": [], + "depid": "", + "widget": "dropdown", + "input": "dropdown", + "inputList": [ + { + "id": "1", + "name": "In office" + }, + { + "id": "2", + "name": "some" + }, + { + "id": "3", + "name": "Internal meetings" + }, + { + "id": "4", + "name": "Internal meetings2" + }, + { + "id": "5", + "name": "Out of Office" + }, + { + "id": "6", + "name": "Virtual" + } + ], + "validation": + { + "isRequired": true + } + + }, + { + "name": "Interaction Type", + "id": "inttype_11", + "depid": "", + "widget": "dropdown", + "input": "dropdown", + "inputList": [ + { + "id": "11", + "name": "Face to Face" + }, + { + "id": "12", + "name": "Lecture" + }, + { + "id": "13", + "name": "Mailing" + }, + { + "id": "14", + "name": "Other" + }, + { + "id": "15", + "name": "Phone" + } + ], + "validation": + { + "isRequired": true + } + + }, + { + "name": "Interaction Category", + "id": "intcategory_21", + "depid": "", + "widget": "radio", + "input": "radio", + "inputList": [ + { + "id": "21", + "name": "One to One" + }, + { + "id": "22", + "name": "Group" + } + ], + "validation": + { + "isRequired": true + } + + }, + { + "name": "Number of Attendees", + "id": "intattendees_2", + "depid": "", + "widget": "text", + "input": "number", + "validation": + { + "isRequired": true + } + + }, + { + "name": "Employee name", + "id": "intempname_31", + "depid": "", + "widget": "dropdown", + "input": "dropdown", + "inputList": [ + { + "id": "31", + "name": "Sarepta Manager" + }, + { + "id": "32", + "name": "Todd Truesdale" + } + ], + "validation": + { + "isRequired": true + } + + }, + { + "name": "Interaction ", + "id": "intcheck_121", + "depid": "", + "widget": "checkbox", + "input": "checkbox", + "inputList": [ + { + "id": "121", + "name": "One to One" + }, + { + "id": "122", + "name": "Group" + } + ], + "validation": + { + "isRequired": true + } + + }, + { + "name": "Number of Attendees", + "id": "intrange_122", + "depid": "", + "widget": "rangeslider", + "max": "100", + "min": "20", + "validation": + { + "isRequired": true + } + + } + ] + }, + { + "sectionName": "Discussion Topic", + "multiple": true, + "sectionList": [ + { + "name": "Product", + "id": "discproduct_41", + "depid": "", + "param": "product", + "widget": "dropdown", + "input": "dropdown", + "inputList": [ + { + "id": "41", + "name": "Product1" + }, + { + "id": "42", + "name": "Product2" + } + ], + "validation": + { + "isRequired": true + } + + }, + { + "name": "Discussion Type", + "id": "disctype_51", + "depid": "", + "widget": "autocomplete", + "input": "autocomplete", + "inputList": [ + { + "id": "51", + "name": "Face to Face" + }, + { + "id": "52", + "name": "Lecture" + }, + { + "id": "53", + "name": "Mailing" + }, + { + "id": "54", + "name": "Other" + }, + { + "id": "55", + "name": "Phone" + } + ], + "validation": + { + "isRequired": true + } + + }, + { + "name": "Discussion Topic", + "id": "disctopic_61", + "depid": "", + "widget": "multiselect", + "input": "multiselect", + "inputList": [ + { + "id": "61", + "name": "Face to Face" + }, + { + "id": "62", + "name": "Lecture" + }, + { + "id": "63", + "name": "Mailing" + }, + { + "id": "64", + "name": "Other" + }, + { + "id": "65", + "name": "Phone" + } + ], + "validation": + { + "isRequired": true + } + + } + ] + }, + { + "sectionName": "Attendees", + "multiple": true, + "sectionList": [ + { + "name": "HCP Name", + "id": "attendeeshcpname_3", + "depid": "", + "widget": "text", + "input": "text", + "validation": + { + "isRequired": true + } + + }, + { + "name": "Speciality", + "id": "attendeeshcpspeciality_4", + "depid": "", + "widget": "text", + "input": "text", + "validation": + { + "isRequired": true + } + + }, + { + "name": "Title", + "id": "attendeestitle_5", + "depid": "", + "widget": "text", + "input": "text", + "validation": + { + "isRequired": true + } + + } + ] + }, + { + "sectionName": "Other", + "multiple": false, + "sectionList": [ + { + "name": "Address1", + "id": "otheraddress1_12", + "depid": "", + "widget": "text", + "input": "primary", + "validation": + { + "isRequired": true + } + + }, + { + "name": "Address2", + "id": "otheraddress2_13", + "depid": "", + "widget": "text", + "input": "Hubli", + "validation": + { + "isRequired": true + } + + }, + { + "name": "Postal code", + "id": "otherpostal_14", + "depid": "", + "widget": "text", + "input": "Hubli", + "validation": + { + "isRequired": true + } + + }, + { + "name": "Country", + "id": "othercountry_15", + "depid": "", + "widget": "dropdown", + "inputList": [ + { + "name": "India", + "id": "1" + }, + { + "name": "USA", + "id": "2" + }, + { + "name": "Nepal", + "id": "3" + } + ], + "validation": + { + "isRequired": true + } + + }, + { + "name": "State", + "id": "otherstate_16", + "depid": "othercountry_15", + "widget": "dropdown", + "inputList": [ + { + "name": "Karnataka", + "id": "1", + "pid": "1" + }, + { + "name": "Maharashtra", + "id": "2", + "pid": "1" + }, + { + "name": "Andhra Pradesh", + "id": "3", + "pid": "1" + }, + { + "name": "Karnataka", + "id": "4", + "pid": "1" + } + ], + "validation": + { + "isRequired": true + } + + }, + { + "name": "City", + "widget": "dropdown", + "id": "othercity_17", + "depid": "otherstate_16", + "inputList": [ + { + "name": "Hubli", + "id": "1", + "pid": "1" + }, + { + "name": "Bangalore", + "id": "2", + "pid": "1" + }, + { + "name": "Belgavi", + "id": "3", + "pid": "1" + } + ], + "validation": + { + "isRequired": true + } + + } + ] + }, + { + "sectionName": "Other Attendees", + "multiple": false, + "sectionList": [ + { + "name": "Attendee Name", + "id": "otherattendeename_18", + "depid": "", + "widget": "text", + "input": "text", + "validation": + { + "isRequired": true + } + + }, + { + "name": "Speciality", + "id": "otherattendeespeciality_19", + "depid": "", + "widget": "text", + "input": "text", + "validation": + { + "isRequired": true + } + + }, + { + "name": "Comments", + "id": "otherattendeecom_20", + "depid": "", + "widget": "text", + "input": "text", + "validation": + { + "isRequired": true + } + + } + ] + }, + { + "sectionName": "Attach Document(s)", + "multiple": true, + "sectionList": [ + { + "name": "Document Name", + "id": "documentName_21", + "depid": "", + "widget": "text", + "input": "text", + "validation": + { + "isRequired": true + } + + }, + { + "name": "Description", + "id": "documentDescription_21", + "depid": "", + "widget": "text", + "input": "text", + "validation": + { + "isRequired": true + } + + }, + { + "name": "Choose file", + "id": "chooseFile_22", + "depid": "", + "widget": "button", + "input": "chooseFile", + "validation": + { + "isRequired": true, + "multipleFiles": true + } + + } + ] + }, + { + "sectionName": "Notes", + "multiple": false, + "sectionList": [ + { + "name": "Comments", + "id": "notescomments_22", + "depid": "", + "widget": "text", + "input": "textArea", + "validation": + { + "type": "maxchars", + "chars": "500", + "isRequired": true + } + + } + ] + } + ] + } + ] +} diff --git a/assets/images/newsavejson.json b/assets/images/newsavejson.json new file mode 100644 index 0000000..28b64a6 --- /dev/null +++ b/assets/images/newsavejson.json @@ -0,0 +1,330 @@ +{ + "Interaction-form1": "Interaction-form1", + "intId": "IN01", + "intName": "InteractionForm1", + "data": { + "save": [ + { + "sectionName": "Interaction Details", + "multipleSectionList": [ + [ + { + "name": "Interaction Date", + "id": "intdate_1", + "selectedValue": [ + "2023-12-12" + ] + }, + { + "name": "Interaction Location", + "id": "intlocation_1", + "selectedValue": [ + "3" + ] + }, + { + "name": "Interaction Type", + "id": "inttype_11", + "selectedValue": [ + "12" + ] + }, + { + "name": "Interaction Category", + "id": "intcategory_21", + "selectedValue": [ + "21", + "22" + ] + }, + { + "name": "Number of Attendees", + "id": "intattendees_2", + "selectedValue": [ + "33" + ] + }, + { + "name": "Employee name", + "id": "intempname_31", + "selectedValue": [ + "32" + ] + }, + { + "name": "Interaction ", + "id": "intcheck_121", + "selectedValue": [ + "121", + "122", + "121" + ] + }, + { + "name": "Number of Attendees", + "id": "intrange_122", + "selectedValue": [ + 26 + ] + } + ] + ] + }, + { + "sectionName": "Discussion Topic", + "multipleSectionList": [ + [ + { + "name": "Product", + "id": "discproduct_41", + "selectedValue": [ + "42" + ] + }, + { + "name": "Discussion Type", + "id": "disctype_51", + "selectedValue": [ + "53" + ] + }, + { + "name": "Discussion Topic", + "id": "disctopic_61", + "selectedValue": [ + "Other", + "Lecture" + ] + } + ], + [ + { + "name": "Product", + "id": "discproduct_41", + "selectedValue": [ + "41" + ] + }, + { + "name": "Discussion Type", + "id": "disctype_51", + "selectedValue": [ + "53" + ] + }, + { + "name": "Discussion Topic", + "id": "disctopic_61", + "selectedValue": [ + "Mailing", + "Face to Face" + ] + } + ] + ] + }, + { + "sectionName": "Attendees", + "multipleSectionList": [ + [ + { + "name": "HCP Name", + "id": "attendeeshcpname_3", + "selectedValue": [ + "hcp2" + ] + }, + { + "name": "Speciality", + "id": "attendeeshcpspeciality_4", + "selectedValue": [ + "spec2" + ] + }, + { + "name": "Title", + "id": "attendeestitle_5", + "selectedValue": [ + "title2" + ] + } + ], + [ + { + "name": "HCP Name", + "id": "attendeeshcpname_3", + "selectedValue": [ + "hcp1" + ] + }, + { + "name": "Speciality", + "id": "attendeeshcpspeciality_4", + "selectedValue": [ + "spec1" + ] + }, + { + "name": "Title", + "id": "attendeestitle_5", + "selectedValue": [ + "title1" + ] + } + ] + ] + }, + { + "sectionName": "Location", + "multipleSectionList": [ + [ + { + "name": "Location", + "id": "primarylocation_6", + "selectedValue": [] + }, + { + "name": "Address", + "id": "primaryaddress_7", + "selectedValue": [] + }, + { + "name": "Country", + "id": "primarycountry_8", + "selectedValue": [] + }, + { + "name": "State", + "id": "primarystate_9", + "selectedValue": [] + }, + { + "name": "City", + "id": "primarycity_10", + "selectedValue": [] + } + ] + ] + }, + { + "sectionName": "Other", + "multipleSectionList": [ + [ + { + "name": "Address1", + "id": "otheraddress1_12", + "selectedValue": [ + "addr1" + ] + }, + { + "name": "Address2", + "id": "otheraddress2_13", + "selectedValue": [ + "addr2" + ] + }, + { + "name": "Postal code", + "id": "otherpostal_14", + "selectedValue": [ + "580021" + ] + }, + { + "name": "Country", + "id": "othercountry_15", + "selectedValue": [ + "1" + ] + }, + { + "name": "State", + "id": "otherstate_16", + "selectedValue": [ + "1" + ] + }, + { + "name": "City", + "id": "othercity_17", + "selectedValue": [ + "1" + ] + } + ] + ] + }, + { + "sectionName": "Other Attendees", + "multipleSectionList": [ + [ + { + "name": "Attendee Name", + "id": "otherattendeename_18", + "selectedValue": [ + "att1" + ] + }, + { + "name": "Speciality", + "id": "otherattendeespeciality_19", + "selectedValue": [ + "spec1" + ] + }, + { + "name": "Comments", + "id": "otherattendeecom_20", + "selectedValue": [ + "comments" + ] + } + ] + ] + }, + { + "sectionName": "Attach Document(s)", + "multipleSectionList": [ + [ + { + "name": "Document Name", + "id": "documentName_21", + "selectedValue": [ + "doc1" + ] + }, + { + "name": "Description", + "id": "documentDescription_21", + "selectedValue": [ + "dec1" + ] + }, + { + "name": "Choose file", + "id": "chooseFile_22", + "selectedValue": [ + "/Users/aissel/Library/Developer/CoreSimulator/Devices/1E435121-7E65-45C6-9E0B-411C8B9915F5/data/Containers/Data/Application/A4BBADD3-F511-4541-AC04-19F8F0776B18/tmp/Flutter Questionaire.pdf" + ] + } + ] + ] + }, + { + "sectionName": "Notes", + "multipleSectionList": [ + [ + { + "name": "Comments", + "id": "notescomments_22", + "selectedValue": [ + "djkndjkwenjkfndejwfnjewbfjewbfje" + ] + } + ] + ] + } + ] + } + } \ No newline at end of file diff --git a/assets/images/p1.jpg b/assets/images/p1.jpg new file mode 100644 index 0000000..81e1b39 Binary files /dev/null and b/assets/images/p1.jpg differ diff --git a/assets/images/saveinteractiondata.json b/assets/images/saveinteractiondata.json new file mode 100644 index 0000000..103729c --- /dev/null +++ b/assets/images/saveinteractiondata.json @@ -0,0 +1,192 @@ +{ + "save": [ + { + "sectionName": "Interaction Details", + "multiple": [], + "sectionList": [ + { + "param": "interactionDate", + "id": "intdate_1", + "selectedValue": [] + }, + { + "param": "interactionLocation", + "id": "intlocation_1", + "selectedValue": [] + }, + { + "param": "interactionType", + "id": "inttype_11", + "selectedValue": [] + }, + { + "param": "interactionCategory", + "id": "intcategory_21", + "selectedValue": [] + }, + { + "param": "numberOfAttendees", + "id": "intattendees_2", + "selectedValue": [] + }, + { + "param": "employeeName", + "id": "intempname_31", + "selectedValue": [] + }, + { + "param": "interactionCheckbox", + "id": "intcheck_121", + "selectedValue": [] + } + ] + }, + { + "sectionName": "Discussion Topic", + "multiple": [], + "sectionList": [ + { + "id": "discproduct_41", + "selectedValue": [], + "param": "product" + }, + { + "param": "discussionType", + "id": "disctype_51", + "selectedValue": [] + }, + { + "param": "discussionTopic", + "id": "disctopic_61", + "selectedValue": [] + }, + { + "param": "add", + "id": "discadd", + "selectedValue": [] + } + ] + }, + { + "sectionName": "Attendees", + "multiple": [], + "sectionList": [ + { + "param": "hcpName", + "id": "attendeeshcpname_3", + "selectedValue": [] + }, + { + "param": "speciality", + "id": "attendeeshcpspeciality_4", + "selectedValue": [] + }, + { + "param": "attendeesTitle", + "id": "attendeestitle_5", + "selectedValue": [] + } + ] + }, + { + "sectionName": "Location", + "multiple": [], + "sectionList": [ + { + "param": "primaryLocation", + "id": "primarylocation_6", + "selectedValue": [] + }, + { + "param": "primaryAddress", + "id": "primaryaddress_7", + "selectedValue": [] + }, + { + "param": "primaryCountry", + "id": "primarycountry_8", + "selectedValue": [] + }, + { + "param": "primaryState", + "id": "primarystate_9", + "selectedValue": [] + }, + { + "param": "primaryCity", + "id": "primarycity_10", + "selectedValue": [] + } + ] + }, + { + "sectionName": "Other", + "multiple": [], + "sectionList": [ + { + "param": "otherAddress1", + "id": "otheraddress1_12", + "selectedValue": [] + }, + { + "param": "otherAddress2", + "id": "otheraddress2_13", + "selectedValue": [] + }, + { + "param": "otherPostalCode", + "id": "otherpostal_14", + "selectedValue": [] + }, + { + "param": "otherCountry", + "id": "othercountry_15", + "selectedValue": [] + }, + { + "param": "otherState", + "id": "otherstate_16", + "selectedValue": [] + }, + { + "param": "otherCity", + "widget": "dropdown", + "id": "othercity_17", + "selectedValue": [] + } + ] + }, + { + "sectionName": "Other Attendees", + "multiple": [], + "sectionList": [ + { + "param": "otherAttendeeName", + "id": "otherattendeename_18", + "selectedValue": [] + }, + { + "param": "otherAttendeeSpeciality", + "id": "otherattendeespeciality_19", + "selectedValue": [] + }, + { + "param": "otherAttendeeComments", + "id": "otherattendeecom_20", + "selectedValue": [] + } + ] + }, + { + "sectionName": "Notes", + "multiple": [], + "sectionList": [ + { + "id": "notescomments_22", + "selectedValue": [], + "param": "notesComments" + } + ] + } + ] + } \ No newline at end of file diff --git a/assets/images/saveobject.json b/assets/images/saveobject.json new file mode 100644 index 0000000..2ea33a2 --- /dev/null +++ b/assets/images/saveobject.json @@ -0,0 +1,270 @@ +{ + "save": [ + { + "sectionName": "Interaction Details", + "multiple": false, + "sectionList": [ + { + "name": "Interaction Date", + "id": "intdate_1", + "selectedValue": [ + "23-11-2023" + ] + + }, + { + "name": "Interaction Location", + "id": "intlocation_1", + "selectedValue": [ + 1 + ] + }, + { + "name": "Interaction Type", + "id": "inttype_11", + "selectedValue": [ + 13 + ] + }, + { + "name": "Interaction Category", + "id": "intcategory_21", + "selectedValue": [ + 22 + ] + }, + { + "name": "Number of Attendees", + "id": "intattendees_2", + "selectedValue": [ + "12" + ] + + }, + { + "name": "Employee name", + "id": "intempname_31", + "selectedValue": [ + "abcd" + ] + }, + { + "name": "Interaction ", + "id": "intcheck_121", + "selectedValue": [ + 122 + ] + }, + { + "name": "Number of Attendees", + "param": "interactionRange", + "id": "intrange_122", + "selectedValue": [ + "22" + ] + } + ] + }, + { + "sectionName": "Discussion Topic", + "multiple": true, + "sectionList": { + "0": [ + { + "name": "Product", + "id": "discproduct_41", + "selectedValue": [42] + + }, + { + "name": "Discussion Type", + + "id": "disctype_51", + "selectedValue": [52] + + }, + { + "name": "Discussion Topic", + + "id": "disctopic_61", + "selectedValue": [61,63] + + } + ], + "1" :[{ + "name": "Product", + "id": "discproduct_41", + "selectedValue": [41] + + }, + { + "name": "Discussion Type", + + "id": "disctype_51", + "selectedValue": [51] + + }, + { + "name": "Discussion Topic", + + "id": "disctopic_61", + "selectedValue": [64,65] + + } + ] + } + }, + { + "sectionName": "Attendees", + "multiple": true, + "sectionList": { + "0": [ + + { + "name": "HCP Name", + + "id": "attendeeshcpname_3", + "selectedValue": ["hcp1"] + + }, + { + "name": "Speciality", + + "id": "attendeeshcpspeciality_4", + "selectedValue": ["speciality1"] + + }, + { + "name": "Title", + + "id": "attendeestitle_5", + "selectedValue": ["Title1"] + + } + ] + } + }, + + { + "sectionName": "Other", + "multiple": false, + "sectionList": [ + { + "name": "Address1", + + "id": "otheraddress1_12", + "selectedValue": ["address1"] + + }, + { + "name": "Address2", + + "id": "otheraddress2_13", + "selectedValue": ["address2"] + + }, + { + "name": "Postal code", + + "id": "otherpostal_14", + "selectedValue": ["580029"] + + }, + { + "name": "Country", + + "id": "othercountry_15", + "selectedValue": [1] + + }, + { + "name": "State", + + "id": "otherstate_16", + "selectedValue": [1], + "depid": "othercountry_15" + + }, + { + "name": "City", + + "widget": "dropdown", + "id": "othercity_17", + "selectedValue": [2], + "depid": "otherstate_16" + } + ] + }, + { + "sectionName": "Other Attendees", + "multiple": false, + "sectionList": [ + { + "name": "Attendee Name", + + "id": "otherattendeename_18", + "selectedValue": ["attendee1"] + + + }, + { + "name": "Speciality", + + "id": "otherattendeespeciality_19", + "selectedValue": ["speciality1"] + + }, + { + "name": "Comments", + + "id": "otherattendeecom_20", + "selectedValue": ["comments"] + + } + ] + }, + { + "sectionName": "Attach Document(s)", + "multiple": true, + "sectionList": { + "0": [ + { + "name": "Document Name", + "id": "documentName_21", + "selectedValue": ["doc1"] + + }, + { + "name": "Description", + + "id": "documentDescription_21", + "selectedValue": ["desc1"] + + }, + { + "name": "Choose file", + + "id": "chooseFile_22", + "selectedValue": [] + + } + + ] + } + }, + { + "sectionName": "Notes", + "multiple": false, + "sectionList": [ + { + "name": "Comments", + "id": "notescomments_22", + "selectedValue": ["notesss"] + + + + } + ] + } + ] + } \ No newline at end of file diff --git a/ios/.gitignore b/ios/.gitignore new file mode 100644 index 0000000..7a7f987 --- /dev/null +++ b/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000..9625e10 --- /dev/null +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 11.0 + + diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..ec97fc6 --- /dev/null +++ b/ios/Flutter/Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..c4855bf --- /dev/null +++ b/ios/Flutter/Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/ios/Podfile b/ios/Podfile new file mode 100644 index 0000000..f293a49 --- /dev/null +++ b/ios/Podfile @@ -0,0 +1,51 @@ +# 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) + target.build_configurations.each do |config| + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ + '$(inherited)', + ##comment dart: PermissionGroup.camera + 'PERMISSION_CAMERA=1' + ] + end + end + end diff --git a/ios/Podfile.lock b/ios/Podfile.lock new file mode 100644 index 0000000..e617c0e --- /dev/null +++ b/ios/Podfile.lock @@ -0,0 +1,143 @@ +PODS: + - asset_webview (0.0.1): + - Flutter + - connectivity_plus (0.0.1): + - Flutter + - ReachabilitySwift + - device_info_plus (0.0.1): + - Flutter + - DKImagePickerController/Core (4.3.4): + - DKImagePickerController/ImageDataManager + - DKImagePickerController/Resource + - DKImagePickerController/ImageDataManager (4.3.4) + - DKImagePickerController/PhotoGallery (4.3.4): + - DKImagePickerController/Core + - DKPhotoGallery + - DKImagePickerController/Resource (4.3.4) + - DKPhotoGallery (0.0.17): + - DKPhotoGallery/Core (= 0.0.17) + - DKPhotoGallery/Model (= 0.0.17) + - DKPhotoGallery/Preview (= 0.0.17) + - DKPhotoGallery/Resource (= 0.0.17) + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Core (0.0.17): + - DKPhotoGallery/Model + - DKPhotoGallery/Preview + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Model (0.0.17): + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Preview (0.0.17): + - DKPhotoGallery/Model + - DKPhotoGallery/Resource + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Resource (0.0.17): + - SDWebImage + - SwiftyGif + - file_picker (0.0.1): + - DKImagePickerController/PhotoGallery + - Flutter + - Flutter (1.0.0) + - flutter_inappwebview (0.0.1): + - Flutter + - flutter_inappwebview/Core (= 0.0.1) + - OrderedSet (~> 5.0) + - flutter_inappwebview/Core (0.0.1): + - Flutter + - OrderedSet (~> 5.0) + - image_picker_ios (0.0.1): + - Flutter + - OrderedSet (5.0.0) + - package_info_plus (0.4.5): + - Flutter + - path_provider_foundation (0.0.1): + - Flutter + - FlutterMacOS + - permission_handler_apple (9.1.1): + - Flutter + - ReachabilitySwift (5.0.0) + - SDWebImage (5.18.3): + - SDWebImage/Core (= 5.18.3) + - SDWebImage/Core (5.18.3) + - shared_preferences_foundation (0.0.1): + - Flutter + - FlutterMacOS + - SwiftyGif (5.4.4) + - url_launcher_ios (0.0.1): + - Flutter + +DEPENDENCIES: + - asset_webview (from `.symlinks/plugins/asset_webview/ios`) + - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) + - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) + - file_picker (from `.symlinks/plugins/file_picker/ios`) + - Flutter (from `Flutter`) + - flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`) + - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) + - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) + - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) + - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) + - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) + - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) + +SPEC REPOS: + trunk: + - DKImagePickerController + - DKPhotoGallery + - OrderedSet + - ReachabilitySwift + - SDWebImage + - SwiftyGif + +EXTERNAL SOURCES: + asset_webview: + :path: ".symlinks/plugins/asset_webview/ios" + connectivity_plus: + :path: ".symlinks/plugins/connectivity_plus/ios" + device_info_plus: + :path: ".symlinks/plugins/device_info_plus/ios" + file_picker: + :path: ".symlinks/plugins/file_picker/ios" + Flutter: + :path: Flutter + flutter_inappwebview: + :path: ".symlinks/plugins/flutter_inappwebview/ios" + image_picker_ios: + :path: ".symlinks/plugins/image_picker_ios/ios" + package_info_plus: + :path: ".symlinks/plugins/package_info_plus/ios" + path_provider_foundation: + :path: ".symlinks/plugins/path_provider_foundation/darwin" + permission_handler_apple: + :path: ".symlinks/plugins/permission_handler_apple/ios" + shared_preferences_foundation: + :path: ".symlinks/plugins/shared_preferences_foundation/darwin" + url_launcher_ios: + :path: ".symlinks/plugins/url_launcher_ios/ios" + +SPEC CHECKSUMS: + asset_webview: 6ea3e602c34e111b4d808f8c09b8d31fbe5c27e4 + connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e + device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea + DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac + DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 + file_picker: 15fd9539e4eb735dc54bae8c0534a7a9511a03de + Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 + flutter_inappwebview: 50b55a88f5dddadc9e741a7caf72f378116e2156 + image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5 + OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c + package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7 + path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 + permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6 + ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 + SDWebImage: 96e0c18ef14010b7485210e92fac888587ebb958 + shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 + SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f + url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4 + +PODFILE CHECKSUM: 108feb553cebadca4bc232556afce4dd4c21da4c + +COCOAPODS: 1.12.1 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..b239ca9 --- /dev/null +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,723 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + C31E35EEB2398B4F234A1E75 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1FC98C2E0DBCD9E3535A9E9 /* Pods_RunnerTests.framework */; }; + D1BA9C581F7955A86CF464FE /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F1ACEE8435625DFEA91E510 /* Pods_Runner.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 3F1ACEE8435625DFEA91E510 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 61802FB87C6ED83EA17D2748 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 6F29B9E8E3A67DDCDA737B63 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B18AA3F7D02500A1D439FFAE /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + C8D652D42F730B2FE61546DB /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + E80C17FFDE772FFF55A639AA /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + EBE1ED2020E310FBF3EE5F71 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + F1FC98C2E0DBCD9E3535A9E9 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 64F90FA7C647ED29DA000BE4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C31E35EEB2398B4F234A1E75 /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D1BA9C581F7955A86CF464FE /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 76284D4CC7269E839E1A4BB7 /* Pods */ = { + isa = PBXGroup; + children = ( + 6F29B9E8E3A67DDCDA737B63 /* Pods-Runner.debug.xcconfig */, + C8D652D42F730B2FE61546DB /* Pods-Runner.release.xcconfig */, + 61802FB87C6ED83EA17D2748 /* Pods-Runner.profile.xcconfig */, + EBE1ED2020E310FBF3EE5F71 /* Pods-RunnerTests.debug.xcconfig */, + E80C17FFDE772FFF55A639AA /* Pods-RunnerTests.release.xcconfig */, + B18AA3F7D02500A1D439FFAE /* Pods-RunnerTests.profile.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 331C8082294A63A400263BE5 /* RunnerTests */, + 76284D4CC7269E839E1A4BB7 /* Pods */, + D7728823995CFB99C9458C06 /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; + D7728823995CFB99C9458C06 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 3F1ACEE8435625DFEA91E510 /* Pods_Runner.framework */, + F1FC98C2E0DBCD9E3535A9E9 /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 36644340C24CC868C6738EFD /* [CP] Check Pods Manifest.lock */, + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + 64F90FA7C647ED29DA000BE4 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + CB8DB5C6BEBB5C81A0C8FEBF /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + A15ED1C91FF7A51D13A38E8F /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1430; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 36644340C24CC868C6738EFD /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; + A15ED1C91FF7A51D13A38E8F /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + CB8DB5C6BEBB5C81A0C8FEBF /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 69ERN967NS; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.pwaIos; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = EBE1ED2020E310FBF3EE5F71 /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.pwaIos.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E80C17FFDE772FFF55A639AA /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.pwaIos.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = B18AA3F7D02500A1D439FFAE /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.pwaIos.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 69ERN967NS; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.pwaIos; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 69ERN967NS; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.pwaIos; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..87131a0 --- /dev/null +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..21a3cc1 --- /dev/null +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..70693e4 --- /dev/null +++ b/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d36b1fa --- /dev/null +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000..dc9ada4 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..7353c41 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..6ed2d93 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..4cd7b00 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..fe73094 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..321773c Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..502f463 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..e9f5fea Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..84ac32a Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..8953cba Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..0467bf1 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..0bedcf2 --- /dev/null +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000..89c2725 --- /dev/null +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/ios/Runner/Base.lproj/LaunchScreen.storyboard b/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f2e259c --- /dev/null +++ b/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f3c2851 --- /dev/null +++ b/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist new file mode 100644 index 0000000..0e21ab3 --- /dev/null +++ b/ios/Runner/Info.plist @@ -0,0 +1,68 @@ + + + + + + + CADisableMinimumFrameDurationOnPhone + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Pwa Ios + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + pwa_ios + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + NSCameraUsageDescription + Upload image from camera for screen background + NSMicrophoneUsageDescription + Post videos to profile + NSPhotoLibraryUsageDescription + Upload images for screen background + UIApplicationSupportsIndirectInputEvents + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + UIInterfaceOrientationPortrait + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + io.flutter.embedded_views_preview + YES + LSSupportsOpeningDocumentsInPlace + + UIFileSharingEnabled + + + diff --git a/ios/Runner/Runner-Bridging-Header.h b/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..308a2a5 --- /dev/null +++ b/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/ios/RunnerTests/RunnerTests.swift b/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..86a7c3b --- /dev/null +++ b/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..788a21e --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,290 @@ +import 'dart:async'; +import 'dart:convert'; + +import 'dart:io'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_inappwebview/flutter_inappwebview.dart'; +import 'package:hive_flutter/hive_flutter.dart'; +import 'package:path_provider/path_provider.dart'; +import 'package:provider/provider.dart'; +import 'package:pwa_ios/model/interaction_config_data.dart'; +import 'package:pwa_ios/model/interaction_data.dart'; + +import 'package:pwa_ios/model/json_form_data.dart'; +import 'package:pwa_ios/model/save_interaction.dart'; + +import 'package:pwa_ios/model/userdata_model.dart'; +import 'package:pwa_ios/repository/hive_repository.dart'; +import 'package:pwa_ios/utils/mockapi.dart'; +import 'package:pwa_ios/utils/sessionmanager.dart'; +import 'package:pwa_ios/utils/util.dart'; +import 'package:pwa_ios/viewmodel/configprovider.dart'; +import 'package:pwa_ios/viewmodel/interactionprovider.dart'; +import 'package:pwa_ios/viewmodel/loginprovider.dart'; +import 'package:pwa_ios/viewmodel/viewinteractionprovider.dart'; +import 'package:pwa_ios/views/home_screen.dart'; +import 'package:pwa_ios/views/konectarpage.dart'; +import 'package:pwa_ios/views/login.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:openid_client/openid_client.dart'; +import 'package:flutter_web_plugins/url_strategy.dart'; +import 'package:internet_connection_checker/internet_connection_checker.dart'; +//import 'openid/openid_io.dart' if (dart.library.html) 'openid_browser.dart'; + +const keycloakUri = 'https://sso.konectar.io/auth/realms/konectar'; +const scopes = ['profile']; + +Credential? credential; + +late final Client client; +UserInfo? userInfo; +Timer? mytimer; +// Future getClient() async { +// var uri = Uri.parse(keycloakUri); +// if (!kIsWeb && Platform.isAndroid) + +// var clientId = 'appwildcard'; + +// var issuer = await Issuer.discover(uri); +// return Client(issuer, clientId); +// } + +// _asyncMethod() async { +// //client = await getClient(); +// var credential = await authenticate(client, scopes: scopes); +// userInfo = await credential.getUserInfo(); +// // setState(() { + +// // }); +// } + +Future main() async { + WidgetsFlutterBinding.ensureInitialized(); + //await execute(InternetConnectionChecker()); + + // Create customized instance which can be registered via dependency injection + // final InternetConnectionChecker customInstance = + // InternetConnectionChecker.createInstance( + // checkTimeout: const Duration(milliseconds: 1), + // checkInterval: const Duration(milliseconds: 1), + // ); + + // // Check internet connection with created instance + // await execute(customInstance); + await Hive.initFlutter(); + + Hive.registerAdapter(SaveInteractionAdapter()); + Hive.registerAdapter(InteractionConfigDataAdapter()); + + Hive.registerAdapter(InteractionResultDataAdapter()); + Hive.registerAdapter(FormFieldDataAdapter()); + Hive.registerAdapter(ValidationAdapter()); + Hive.registerAdapter(SectionListAdapter()); + Hive.registerAdapter(InputClassAdapter()); + Hive.registerAdapter(InteractionWidgetAdapter()); + + Hive.registerAdapter(UserDataAdapter()); + Hive.registerAdapter(SendSaveJsonAdapter()); + Hive.registerAdapter(MultipleSectionListAdapter()); + Hive.registerAdapter(SaveAdapter()); + Hive.registerAdapter(SaveInteractionFormJsonAdapter()); + // await Hive.openBox('InteractionDataBox'); + // await Hive.openBox("UserDataBox"); + //await Hive.openBox('InteractionConfigDataBox'); + + await Hive.openBox('InteractionConfigDataBox'); + // final ConfigDataProvider configDataProvider = ConfigDataProvider(); + final ConfigDataProvider configDataProvider = ConfigDataProvider(); + //configDataProvider = fetchInteactionConfigData(); + // final ViewInteractionProvider viewInteractionProvider = + // ViewInteractionProvider(); + // List savedList = + // await viewInteractionProvider.getAllRecords(); + + // SendSavedDataJson json = SendSavedDataJson(data: savedList); + // print(json.toString()); + // await MockApiCall().postFormData(json).then((value) async { + // await configDataProvider.initConfigUIData().then((value) { + // // activateTimer(); + // }); + // }); + await configDataProvider.initConfigUIData(); + // activateTimer(); + + // await provider.initConfigUIData(); + if (!kIsWeb && + kDebugMode && + defaultTargetPlatform == TargetPlatform.android) { + await InAppWebViewController.setWebContentsDebuggingEnabled(kDebugMode); + } + // await initDirectory(); + + // await PushNotificationService().setupInteractedMessage(); + + // RemoteMessage? initialMessage = + // await FirebaseMessaging.instance.getInitialMessage(); +// if (initialMessage != null) { +// // App received a notification when it was killed +// } + WidgetsFlutterBinding.ensureInitialized(); +// FirebaseMessaging.instance.getToken().then((value) { +// String? token = value; +// print("token: $token"); +// }); + usePathUrlStrategy(); + // client = await getClient(); + // //credential = await getRedirectResult(client, scopes: scopes); + // credential = await authenticate(client, scopes: scopes); + // userInfo = await credential!.getUserInfo(); + //runApp(const MyApp()); + SharedPreferences.getInstance().then((instance) { + //StorageService().sharedPreferencesInstance = instance; + bool isloggedIn = instance.getBool('isloggedin') ?? false; + + runApp( + MultiProvider( + providers: [ + ChangeNotifierProvider(create: (_) => InteractionProvider()), + ChangeNotifierProvider(create: (_) => LoginProvider()), + ChangeNotifierProvider(create: (_) => ViewInteractionProvider()), + ChangeNotifierProvider(create: (_) => ConfigDataProvider()), + ChangeNotifierProvider( + create: (_) => HiveDataRepository( + Hive.box('InteractionConfigDataBox'))), + ], + child: MaterialApp( + debugShowCheckedModeBanner: false, + title: 'Dynamic Links Example', + initialRoute: '/', + routes: { + '/': (BuildContext context) => FutureBuilder( + future: SessionManager().isLoggedIn(), + builder: (context, snapshot) { + print("Data_is : $snapshot"); + if (snapshot.connectionState == ConnectionState.waiting) { + return CircularProgressIndicator(); + } else if (snapshot.hasError) { + return Text('Error: ${snapshot.error}'); + } else { + final isLoggedIn = snapshot.data ?? false; + print("isLoggedIn_is : $isLoggedIn"); + + return isLoggedIn ? HomeScreen() : LoginScreen(); + } + }, + ), //userInfo != null ? const Home() : OpenidScreen(credential: credential,), + // '/details': (BuildContext context) => const HomeScreen(), + }, + ), + ), + ); + }); +} + +cancelTimer() { + mytimer?.cancel(); +} + +activateTimer() { + mytimer = Timer.periodic(const Duration(minutes: 5), (timer) async { + //code to run on every 2 minutes 5 seconds + final ConfigDataProvider configDataProvider = ConfigDataProvider(); + final ViewInteractionProvider viewInteractionProvider = + ViewInteractionProvider(); + List savedList = + await viewInteractionProvider.getAllRecords(); + + SendSavedDataJson json = SendSavedDataJson(data: savedList); + print(json.toString()); + await MockApiCall().postFormData(json).then((value) async { + await configDataProvider.initConfigUIData().then((value) { + // activateTimer(); + }); + }); + print("Interval called 2 mins"); + }); + print("timer"); + print(mytimer?.isActive); +} + +Future execute( + InternetConnectionChecker internetConnectionChecker, +) async { + // Simple check to see if we have Internet + // ignore: avoid_print + print('''The statement 'this machine is connected to the Internet' is: '''); + final bool isConnected = await InternetConnectionChecker().hasConnection; + // ignore: avoid_print + print( + isConnected.toString(), + ); + // returns a bool + + // We can also get an enum instead of a bool + // ignore: avoid_print + print( + 'Current status: ${await InternetConnectionChecker().connectionStatus}', + ); + // Prints either InternetConnectionStatus.connected + // or InternetConnectionStatus.disconnected + + // actively listen for status updates + final StreamSubscription listener = + InternetConnectionChecker().onStatusChange.listen( + (InternetConnectionStatus status) { + switch (status) { + case InternetConnectionStatus.connected: + // ignore: avoid_print + print('Data connection is available.'); + break; + case InternetConnectionStatus.disconnected: + // ignore: avoid_print + print('You are disconnected from the internet.'); + break; + } + }, + ); + + // close listener after 30 seconds, so the program doesn't run forever + await Future.delayed(const Duration(seconds: 30)); + await listener.cancel(); +} + +class Home extends StatefulWidget { + const Home({Key? key}) : super(key: key); + + @override + State createState() => _HomeState(); +} + +class _HomeState extends State with WidgetsBindingObserver { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + child: Center( + child: TextButton( + onPressed: () { + // Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (context) => MyApp())); + Navigator.push( + context, + MaterialPageRoute(builder: (context) => const MyApp()), + ); + }, + child: Text('click'), + ), + ), + ), + ); + } + + @override + void dispose() { + Hive.close(); + super.dispose(); + } +} diff --git a/lib/model/interaction_config_data.dart b/lib/model/interaction_config_data.dart new file mode 100644 index 0000000..15a2d3a --- /dev/null +++ b/lib/model/interaction_config_data.dart @@ -0,0 +1,48 @@ +import 'package:hive_flutter/hive_flutter.dart'; +import 'package:pwa_ios/model/interaction_data.dart'; + +part 'interaction_config_data.g.dart'; + +class UIDataResponse { + bool success; + String message; + + List formFields; + + UIDataResponse({ + required this.success, + required this.message, + required this.formFields, + }); + + factory UIDataResponse.fromJson(Map json) => UIDataResponse( + success: json["success"], + message: json["message"], + formFields: List.from( + json["form-fields"].map((x) => FormFieldData.fromJson(x))), + ); + + Map toJson() => { + "success": success, + "message": message, + "form-fields": List.from(formFields.map((x) => x.toJson())), + }; +} + +@HiveType(typeId: 19) +class InteractionConfigData { + @HiveField(1) + InteractionResultData widgets; + @HiveField(2) + String id; + @HiveField(3) + String name; + + InteractionConfigData({ + required this.widgets, + required this.id, + required this.name, + }); + + Map toJson() => {"widgets": widgets}; +} diff --git a/lib/model/interaction_config_data.g.dart b/lib/model/interaction_config_data.g.dart new file mode 100644 index 0000000..52bf8aa --- /dev/null +++ b/lib/model/interaction_config_data.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'interaction_config_data.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class InteractionConfigDataAdapter extends TypeAdapter { + @override + final int typeId = 19; + + @override + InteractionConfigData read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return InteractionConfigData( + widgets: fields[1] as InteractionResultData, + id: fields[2] as String, + name: fields[3] as String, + ); + } + + @override + void write(BinaryWriter writer, InteractionConfigData obj) { + writer + ..writeByte(3) + ..writeByte(1) + ..write(obj.widgets) + ..writeByte(2) + ..write(obj.id) + ..writeByte(3) + ..write(obj.name); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is InteractionConfigDataAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} diff --git a/lib/model/interaction_data.dart b/lib/model/interaction_data.dart new file mode 100644 index 0000000..bd8d32f --- /dev/null +++ b/lib/model/interaction_data.dart @@ -0,0 +1,330 @@ +// To parse this JSON data, do +// +// final welcome = welcomeFromJson(jsonString); + +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:hive_flutter/hive_flutter.dart'; +import 'package:pwa_ios/model/json_form_data.dart'; +part 'interaction_data.g.dart'; + +// InteractionResultData welcomeFromJson(String str) => +// InteractionResultData.fromJson(json.decode(str)); + +// String welcomeToJson(InteractionResultData data) => json.encode(data.toJson()); + +ResponseData ResponseDataFromJson(Map str) => + ResponseData.fromJson(str); + +String ResponseDataToJson(ResponseData data) => json.encode(data.toJson()); + +class ResponseData { + List data; + + ResponseData({ + required this.data, + }); + + factory ResponseData.fromJson(Map json) => ResponseData( + data: List.from( + json["data"].map((x) => InteractionResultData.fromJson(x))), + ); + + Map toJson() => { + "data": List.from(data.map((x) => x.toJson())), + }; +} + +@HiveType(typeId: 11) +class InteractionResultData { + @HiveField(0) + List result; + @HiveField(1) + String id; + @HiveField(2) + String name; + InteractionResultData( + {required this.result, required this.id, required this.name}); + + factory InteractionResultData.fromJson(Map json) => + InteractionResultData( + result: List.from( + json["form-fields"].map((x) => FormFieldData.fromJson(x))), + id: json["id"], + name: json["name"], + ); + + Map toJson() => { + "id": id, + "name": name, + "result": List.from(result.map((x) => x.toJson())), + }; + + Map saveToJson() => { + "save": List.from(result.map((x) => x.saveToJson())), + }; +} + +@HiveType(typeId: 4) +class FormFieldData { + @HiveField(0) + String sectionName; + @HiveField(1) + bool multiple; + @HiveField(2) + List sectionList; + @HiveField(3) + List? multipleList; + + FormFieldData({ + required this.sectionName, + required this.multiple, + required this.sectionList, + this.multipleList, + }); + + factory FormFieldData.fromJson(Map json) => FormFieldData( + sectionName: json["sectionName"], + multiple: json["multiple"], + sectionList: List.from( + json["sectionList"].map((x) => SectionList.fromJson(x))), + ); + + Map toJson() => { + "sectionName": sectionName, + "multiple": multiple, + "sectionList": List.from(sectionList.map((x) => x.toJson())), + }; + Map saveToJson() => { + "sectionName": sectionName, + }; +} + +@HiveType(typeId: 5) +class SectionList { + @HiveField(0) + String name; + @HiveField(1) + String? param; + @HiveField(2) + String id; + @HiveField(3) + int? gid; + @HiveField(4) + List? selectedValue; + @HiveField(5) + String? depid; + @HiveField(6) + InteractionWidget? widget; + @HiveField(7) + String? input; + @HiveField(8) + List? inputList; + @HiveField(9) + bool? isRequired; + + TextEditingController? controller; + @HiveField(10) + String? value; + @HiveField(11) + String? selectedId; + @HiveField(12) + InputClass? selectedObject; + @HiveField(13) + Validation? validation; + @HiveField(14) + String? chars; + @HiveField(15) + List? extension; + @HiveField(16) + List? fileName; + @HiveField(17) + List? tempselectedValue; + @HiveField(18) + String? max; + @HiveField(19) + String? min; + + SectionList( + {required this.name, + this.param, + required this.id, + this.selectedValue, + this.depid, + this.widget, + this.input, + this.gid, + this.inputList, + this.isRequired, + this.controller, + this.selectedObject, + this.selectedId, + this.validation, + this.chars, + this.extension, + this.fileName, + this.tempselectedValue, + this.max, + this.min, + this.value}); + + factory SectionList.fromJson(Map json) => SectionList( + name: json["name"], + // param: json["param"], + id: json["id"], + // selectedValue: List.from(json["selectedValue"].map((x) => x)), + depid: json["depid"], + widget: widgetValues.map[json["widget"]]!, + input: json["input"], + inputList: json["inputList"] == null + ? [] + : List.from( + json["inputList"]!.map((x) => InputClass.fromJson(x))), + + validation: Validation.fromJson(json["validation"]), + + // chars: json["chars"], + max: json["max"], + min: json["min"], + ); + + Map toJson() => { + "name": name, + "param": param, + "id": id, + "selectedValue": List.from(selectedValue!.map((x) => x)), + "depid": depid, + "widget": widgetValues.reverse[widget], + "input": input, + "inputList": inputList == null + ? [] + : List.from(inputList!.map((x) => x.toJson())), + "isRequired": isRequired, + "chars": chars, + "fileName": List.from(fileName!.map((x) => x)), + "extension": List.from(extension!.map((x) => x)), + "max": max, + "min": min, + }; + Map saveToJson() => { + "name": name, + "param": param, + "id": id, + "selectedValue": List.from(selectedValue!.map((x) => x)), + }; +} + +@HiveType(typeId: 6) +class InputClass { + @HiveField(0) + dynamic id; + @HiveField(1) + String name; + @HiveField(2) + bool? ischecked; + @HiveField(3) + String? selectedId; + @HiveField(4) + String? selectedName; + @HiveField(5) + List? selectedItems; + @HiveField(6) + String? pid; + InputClass( + {required this.id, + required this.name, + this.ischecked, + this.pid, + this.selectedId, + this.selectedItems, + this.selectedName}); + + factory InputClass.fromJson(Map json) => InputClass( + id: json["id"], + name: json["name"], + pid: json["pid"], + ); + + Map toJson() => {"id": id, "name": name, "pid": pid}; +} + +@HiveType(typeId: 18) +class Validation { + @HiveField(0) + bool isRequired; + @HiveField(1) + bool? multipleFiles; + @HiveField(2) + String? type; + @HiveField(3) + String? chars; + + Validation({ + required this.isRequired, + this.multipleFiles, + this.type, + this.chars, + }); + + factory Validation.fromJson(Map json) => Validation( + isRequired: json["isRequired"], + multipleFiles: json["multipleFiles"], + type: json["type"], + chars: json["chars"], + ); + + Map toJson() => { + "isRequired": isRequired, + "multipleFiles": multipleFiles, + "type": type, + "chars": chars, + }; +} + +@HiveType(typeId: 12) +enum InteractionWidget { + @HiveField(0) + CHECKBOX, + @HiveField(1) + DROPDOWN, + @HiveField(2) + LABEL, + @HiveField(3) + RADIO, + @HiveField(4) + TEXT, + @HiveField(5) + BUTTON, + @HiveField(6) + AUTOCOMPLETE, + @HiveField(7) + MULTISELECT, + @HiveField(8) + RANGESLIDER +} + +final widgetValues = EnumValues({ + "checkbox": InteractionWidget.CHECKBOX, + "dropdown": InteractionWidget.DROPDOWN, + "label": InteractionWidget.LABEL, + "radio": InteractionWidget.RADIO, + "text": InteractionWidget.TEXT, + "button": InteractionWidget.BUTTON, + "autocomplete": InteractionWidget.AUTOCOMPLETE, + "multiselect": InteractionWidget.MULTISELECT, + "rangeslider": InteractionWidget.RANGESLIDER +}); + +class EnumValues { + Map map; + + late Map reverseMap; + + EnumValues(this.map); + + Map get reverse { + reverseMap = map.map((k, v) => MapEntry(v, k)); + return reverseMap; + } +} diff --git a/lib/model/interaction_data.g.dart b/lib/model/interaction_data.g.dart new file mode 100644 index 0000000..94b01d4 --- /dev/null +++ b/lib/model/interaction_data.g.dart @@ -0,0 +1,350 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'interaction_data.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class InteractionResultDataAdapter extends TypeAdapter { + @override + final int typeId = 11; + + @override + InteractionResultData read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return InteractionResultData( + result: (fields[0] as List).cast(), + id: fields[1] as String, + name: fields[2] as String, + ); + } + + @override + void write(BinaryWriter writer, InteractionResultData obj) { + writer + ..writeByte(3) + ..writeByte(0) + ..write(obj.result) + ..writeByte(1) + ..write(obj.id) + ..writeByte(2) + ..write(obj.name); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is InteractionResultDataAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} + +class FormFieldDataAdapter extends TypeAdapter { + @override + final int typeId = 4; + + @override + FormFieldData read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return FormFieldData( + sectionName: fields[0] as String, + multiple: fields[1] as bool, + sectionList: (fields[2] as List).cast(), + multipleList: (fields[3] as List?)?.cast(), + ); + } + + @override + void write(BinaryWriter writer, FormFieldData obj) { + writer + ..writeByte(4) + ..writeByte(0) + ..write(obj.sectionName) + ..writeByte(1) + ..write(obj.multiple) + ..writeByte(2) + ..write(obj.sectionList) + ..writeByte(3) + ..write(obj.multipleList); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is FormFieldDataAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} + +class SectionListAdapter extends TypeAdapter { + @override + final int typeId = 5; + + @override + SectionList read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return SectionList( + name: fields[0] as String, + param: fields[1] as String?, + id: fields[2] as String, + selectedValue: (fields[4] as List?)?.cast(), + depid: fields[5] as String?, + widget: fields[6] as InteractionWidget?, + input: fields[7] as String?, + gid: fields[3] as int?, + inputList: (fields[8] as List?)?.cast(), + isRequired: fields[9] as bool?, + selectedObject: fields[12] as InputClass?, + selectedId: fields[11] as String?, + validation: fields[13] as Validation?, + chars: fields[14] as String?, + extension: (fields[15] as List?)?.cast(), + fileName: (fields[16] as List?)?.cast(), + tempselectedValue: (fields[17] as List?)?.cast(), + max: fields[18] as String?, + min: fields[19] as String?, + value: fields[10] as String?, + ); + } + + @override + void write(BinaryWriter writer, SectionList obj) { + writer + ..writeByte(20) + ..writeByte(0) + ..write(obj.name) + ..writeByte(1) + ..write(obj.param) + ..writeByte(2) + ..write(obj.id) + ..writeByte(3) + ..write(obj.gid) + ..writeByte(4) + ..write(obj.selectedValue) + ..writeByte(5) + ..write(obj.depid) + ..writeByte(6) + ..write(obj.widget) + ..writeByte(7) + ..write(obj.input) + ..writeByte(8) + ..write(obj.inputList) + ..writeByte(9) + ..write(obj.isRequired) + ..writeByte(10) + ..write(obj.value) + ..writeByte(11) + ..write(obj.selectedId) + ..writeByte(12) + ..write(obj.selectedObject) + ..writeByte(13) + ..write(obj.validation) + ..writeByte(14) + ..write(obj.chars) + ..writeByte(15) + ..write(obj.extension) + ..writeByte(16) + ..write(obj.fileName) + ..writeByte(17) + ..write(obj.tempselectedValue) + ..writeByte(18) + ..write(obj.max) + ..writeByte(19) + ..write(obj.min); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is SectionListAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} + +class InputClassAdapter extends TypeAdapter { + @override + final int typeId = 6; + + @override + InputClass read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return InputClass( + id: fields[0] as dynamic, + name: fields[1] as String, + ischecked: fields[2] as bool?, + pid: fields[6] as String?, + selectedId: fields[3] as String?, + selectedItems: (fields[5] as List?)?.cast(), + selectedName: fields[4] as String?, + ); + } + + @override + void write(BinaryWriter writer, InputClass obj) { + writer + ..writeByte(7) + ..writeByte(0) + ..write(obj.id) + ..writeByte(1) + ..write(obj.name) + ..writeByte(2) + ..write(obj.ischecked) + ..writeByte(3) + ..write(obj.selectedId) + ..writeByte(4) + ..write(obj.selectedName) + ..writeByte(5) + ..write(obj.selectedItems) + ..writeByte(6) + ..write(obj.pid); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is InputClassAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} + +class ValidationAdapter extends TypeAdapter { + @override + final int typeId = 18; + + @override + Validation read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return Validation( + isRequired: fields[0] as bool, + multipleFiles: fields[1] as bool?, + type: fields[2] as String?, + chars: fields[3] as String?, + ); + } + + @override + void write(BinaryWriter writer, Validation obj) { + writer + ..writeByte(4) + ..writeByte(0) + ..write(obj.isRequired) + ..writeByte(1) + ..write(obj.multipleFiles) + ..writeByte(2) + ..write(obj.type) + ..writeByte(3) + ..write(obj.chars); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ValidationAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} + +class InteractionWidgetAdapter extends TypeAdapter { + @override + final int typeId = 12; + + @override + InteractionWidget read(BinaryReader reader) { + switch (reader.readByte()) { + case 0: + return InteractionWidget.CHECKBOX; + case 1: + return InteractionWidget.DROPDOWN; + case 2: + return InteractionWidget.LABEL; + case 3: + return InteractionWidget.RADIO; + case 4: + return InteractionWidget.TEXT; + case 5: + return InteractionWidget.BUTTON; + case 6: + return InteractionWidget.AUTOCOMPLETE; + case 7: + return InteractionWidget.MULTISELECT; + case 8: + return InteractionWidget.RANGESLIDER; + default: + return InteractionWidget.CHECKBOX; + } + } + + @override + void write(BinaryWriter writer, InteractionWidget obj) { + switch (obj) { + case InteractionWidget.CHECKBOX: + writer.writeByte(0); + break; + case InteractionWidget.DROPDOWN: + writer.writeByte(1); + break; + case InteractionWidget.LABEL: + writer.writeByte(2); + break; + case InteractionWidget.RADIO: + writer.writeByte(3); + break; + case InteractionWidget.TEXT: + writer.writeByte(4); + break; + case InteractionWidget.BUTTON: + writer.writeByte(5); + break; + case InteractionWidget.AUTOCOMPLETE: + writer.writeByte(6); + break; + case InteractionWidget.MULTISELECT: + writer.writeByte(7); + break; + case InteractionWidget.RANGESLIDER: + writer.writeByte(8); + break; + } + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is InteractionWidgetAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} diff --git a/lib/model/json_form_data.dart b/lib/model/json_form_data.dart new file mode 100644 index 0000000..386b8ff --- /dev/null +++ b/lib/model/json_form_data.dart @@ -0,0 +1,135 @@ +// To parse this JSON data, do +// +// final saveInteractionFormJson = saveInteractionFormJsonFromJson(jsonString); + +import 'dart:convert'; + +import 'package:hive_flutter/hive_flutter.dart'; +part 'json_form_data.g.dart'; + +SaveInteractionFormJson saveInteractionFormJsonFromJson(String str) => + SaveInteractionFormJson.fromJson(json.decode(str)); + +String saveInteractionFormJsonToJson(DataJson data) => + json.encode(data.toJson()); + +String saveFormJsonToJson(SendSaveJson data) => json.encode(data.toJson()); + +class DataJson { + SendSaveJson sendSaveJson; + DataJson({required this.sendSaveJson}); + factory DataJson.fromJson(Map json) => DataJson( + sendSaveJson: json["data"], + ); + Map toJson() => { + "data": sendSaveJson, + }; +} + +@HiveType(typeId: 14) +class SendSaveJson { + @HiveField(0) + List savedList; + SendSaveJson({required this.savedList}); + factory SendSaveJson.fromJson(Map json) => SendSaveJson( + savedList: List.from( + json["data"].map((x) => SaveInteractionFormJson.fromJson(x))), + ); + Map toJson() => { + "data": List.from(savedList.map((x) => x.toJson())), + }; +} + +@HiveType(typeId: 15) +class SaveInteractionFormJson { + @HiveField(0) + String interactionForm1; + @HiveField(1) + String intId; + @HiveField(2) + String intName; + @HiveField(3) + List save; + + SaveInteractionFormJson({ + required this.interactionForm1, + required this.intId, + required this.intName, + required this.save, + }); + + factory SaveInteractionFormJson.fromJson(Map json) => + SaveInteractionFormJson( + interactionForm1: json["Interaction-form1"], + intId: json["intId"], + intName: json["intName"], + save: List.from(json["data"].map((x) => Save.fromJson(x))), + ); + + Map toJson() => { + "id": intId, + "page": intName, + "data": List.from(save.map((x) => x.toJson())), + }; +} + +@HiveType(typeId: 16) +class Save { + @HiveField(0) + String sectionName; + @HiveField(1) + List> multipleSectionList; + + Save({ + required this.sectionName, + required this.multipleSectionList, + }); + + factory Save.fromJson(Map json) => Save( + sectionName: json["sectionName"], + multipleSectionList: List>.from( + json["multipleSectionList"].map((x) => + List.from( + x.map((x) => MultipleSectionList.fromJson(x))))), + ); + + Map toJson() => { + "sectionName": sectionName, + "multipleSectionList": List.from(multipleSectionList + .map((x) => List.from(x.map((x) => x.toJson())))), + }; +} + +@HiveType(typeId: 17) +class MultipleSectionList { + @HiveField(0) + String id; + @HiveField(1) + List selectedValue; + @HiveField(2) + List? fileName; + @HiveField(3) + List? extension; + + MultipleSectionList( + {required this.id, + required this.selectedValue, + this.extension, + this.fileName}); + + factory MultipleSectionList.fromJson(Map json) => + MultipleSectionList( + id: json["id"], + selectedValue: List.from(json["selectedValue"].map((x) => x)), + ); + + Map toJson() => { + "id": id, + "selectedValue": List.from(selectedValue.map((x) => x)), + "extension": extension != null + ? List.from(extension!.map((x) => x)) + : [], + "fileName": + fileName != null ? List.from(fileName!.map((x) => x)) : [], + }; +} diff --git a/lib/model/json_form_data.g.dart b/lib/model/json_form_data.g.dart new file mode 100644 index 0000000..7c55c41 --- /dev/null +++ b/lib/model/json_form_data.g.dart @@ -0,0 +1,167 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'json_form_data.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class SendSaveJsonAdapter extends TypeAdapter { + @override + final int typeId = 14; + + @override + SendSaveJson read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return SendSaveJson( + savedList: (fields[0] as List).cast(), + ); + } + + @override + void write(BinaryWriter writer, SendSaveJson obj) { + writer + ..writeByte(1) + ..writeByte(0) + ..write(obj.savedList); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is SendSaveJsonAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} + +class SaveInteractionFormJsonAdapter + extends TypeAdapter { + @override + final int typeId = 15; + + @override + SaveInteractionFormJson read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return SaveInteractionFormJson( + interactionForm1: fields[0] as String, + intId: fields[1] as String, + intName: fields[2] as String, + save: (fields[3] as List).cast(), + ); + } + + @override + void write(BinaryWriter writer, SaveInteractionFormJson obj) { + writer + ..writeByte(4) + ..writeByte(0) + ..write(obj.interactionForm1) + ..writeByte(1) + ..write(obj.intId) + ..writeByte(2) + ..write(obj.intName) + ..writeByte(3) + ..write(obj.save); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is SaveInteractionFormJsonAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} + +class SaveAdapter extends TypeAdapter { + @override + final int typeId = 16; + + @override + Save read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return Save( + sectionName: fields[0] as String, + multipleSectionList: (fields[1] as List) + .map((dynamic e) => (e as List).cast()) + .toList(), + ); + } + + @override + void write(BinaryWriter writer, Save obj) { + writer + ..writeByte(2) + ..writeByte(0) + ..write(obj.sectionName) + ..writeByte(1) + ..write(obj.multipleSectionList); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is SaveAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} + +class MultipleSectionListAdapter extends TypeAdapter { + @override + final int typeId = 17; + + @override + MultipleSectionList read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return MultipleSectionList( + id: fields[0] as String, + selectedValue: (fields[1] as List).cast(), + extension: (fields[3] as List?)?.cast(), + fileName: (fields[2] as List?)?.cast(), + ); + } + + @override + void write(BinaryWriter writer, MultipleSectionList obj) { + writer + ..writeByte(4) + ..writeByte(0) + ..write(obj.id) + ..writeByte(1) + ..write(obj.selectedValue) + ..writeByte(2) + ..write(obj.fileName) + ..writeByte(3) + ..write(obj.extension); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is MultipleSectionListAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} diff --git a/lib/model/location_model.dart b/lib/model/location_model.dart new file mode 100644 index 0000000..2b8964b --- /dev/null +++ b/lib/model/location_model.dart @@ -0,0 +1,122 @@ +// To parse this JSON data, do +// +// final welcome = welcomeFromJson(jsonString); + +import 'dart:convert'; + +Locations welcomeFromJson(String str) => Locations.fromJson(json.decode(str)); + +String welcomeToJson(Locations data) => json.encode(data.toJson()); + +class Locations { + Location location; + + Locations({ + required this.location, + }); + + factory Locations.fromJson(Map json) => Locations( + location: Location.fromJson(json["location"]), + ); + + Map toJson() => { + "location": location.toJson(), + }; +} + +class Location { + List country; + List state; + List city; + + Location({ + required this.country, + required this.state, + required this.city, + }); + + factory Location.fromJson(Map json) => Location( + country: + List.from(json["country"].map((x) => Country.fromJson(x))), + state: List.from(json["state"].map((x) => States.fromJson(x))), + city: List.from(json["city"].map((x) => City.fromJson(x))), + ); + + Map toJson() => { + "country": List.from(country.map((x) => x.toJson())), + "state": List.from(state.map((x) => x.toJson())), + "city": List.from(city.map((x) => x.toJson())), + }; +} + +class City { + String cityName; + String distId; + String stateId; + String countryId; + + City({ + required this.cityName, + required this.distId, + required this.stateId, + required this.countryId, + }); + + factory City.fromJson(Map json) => City( + cityName: json["cityName"], + distId: json["distId"], + stateId: json["stateId"], + countryId: json["countryId"], + ); + + Map toJson() => { + "cityName": cityName, + "distId": distId, + "stateId": stateId, + "countryId": countryId, + }; +} + +class Country { + String countryName; + String countryId; + + Country({ + required this.countryName, + required this.countryId, + }); + + factory Country.fromJson(Map json) => Country( + countryName: json["countryName"], + countryId: json["countryId"], + ); + + Map toJson() => { + "countryName": countryName, + "countryId": countryId, + }; +} + +class States { + String stateName; + String stateId; + String countryId; + + States({ + required this.stateName, + required this.stateId, + required this.countryId, + }); + + factory States.fromJson(Map json) => States( + stateName: json["stateName"], + stateId: json["stateId"], + countryId: json["countryId"], + ); + + Map toJson() => { + "stateName": stateName, + "stateId": stateId, + "countryId": countryId, + }; +} diff --git a/lib/model/save_interaction.dart b/lib/model/save_interaction.dart new file mode 100644 index 0000000..e474c75 --- /dev/null +++ b/lib/model/save_interaction.dart @@ -0,0 +1,144 @@ +// To parse this JSON data, do +// +// final welcome = welcomeFromJson(jsonString); + +import 'dart:convert'; + +import 'package:hive_flutter/hive_flutter.dart'; +import 'package:pwa_ios/model/interaction_data.dart'; +import 'package:pwa_ios/model/json_form_data.dart'; +part 'save_interaction.g.dart'; + +SaveInteraction welcomeFromJson(String str) => + SaveInteraction.fromJson(json.decode(str)); + +String welcomeToJson(SaveInteraction data) => json.encode(data.toJson()); + +class SendSavedDataJson { + List data; + SendSavedDataJson({required this.data}); + Map toJson() => { + "data": List.from(data.map((x) => x.toJson())), + }; +} + +@HiveType(typeId: 3) +class SaveInteraction { + @HiveField(0) + String id; + + @HiveField(1) + List save; + @HiveField(2) + String? form; + @HiveField(3) + String? updatedTime; + @HiveField(4) + String intId; + @HiveField(5) + String intName; + + SaveInteraction( + {required this.save, + required this.id, + this.form, + this.updatedTime, + required this.intId, + required this.intName}); + + factory SaveInteraction.fromJson(Map json) => + SaveInteraction( + save: List.from( + json["save"].map((x) => SaveData.fromJson(x))), + intId: 'intId', + intName: 'intName', + id: 'id'); + + Map toJson() => { + "save": List.from(save.map((x) => x.toJson())), + }; + + Map savetoJson() => { + "form": form, + "intId": intId, + }; +} + +class JsonFormat {} + +class SaveInteractionJson { + @HiveField(0) + int? id; + @HiveField(1) + List save; + + SaveInteractionJson({ + required this.save, + }); + + factory SaveInteractionJson.fromJson(Map json) => + SaveInteractionJson( + save: + List.from(json["save"].map((x) => SaveData.fromJson(x))), + ); + + Map toJson() => { + "save": List.from(save.map((x) => x.toJson())), + }; +} + +class SaveData { + String sectionName; + List multiple; + List sectionList; + List>? multiplesectionList; + + SaveData({ + required this.sectionName, + required this.multiple, + required this.sectionList, + this.multiplesectionList, + }); + + factory SaveData.fromJson(Map json) => SaveData( + sectionName: json["sectionName"], + multiple: List.from(json["multiple"].map((x) => x)), + sectionList: List.from( + json["sectionList"].map((x) => SaveSectionList.fromJson(x))), + ); + + Map toJson() => { + "sectionName": sectionName, + "multiple": List.from(multiple.map((x) => x)), + "sectionList": List.from(sectionList.map((x) => x.toJson())), + }; +} + +class SaveSectionList { + String param; + String id; + List selectedValue; + String? widget; + + SaveSectionList({ + required this.param, + required this.id, + required this.selectedValue, + this.widget, + }); + + factory SaveSectionList.fromJson(Map json) => + SaveSectionList( + param: json["param"], + id: json["id"], + selectedValue: List.from(json["selectedValue"].map((x) => x)), + widget: json["widget"], + ); + + Map toJson() => { + "param": param, + "id": id, + "selectedValue": List.from(selectedValue.map((x) => x)), + "widget": widget, + }; +} diff --git a/lib/model/save_interaction.g.dart b/lib/model/save_interaction.g.dart new file mode 100644 index 0000000..fb41995 --- /dev/null +++ b/lib/model/save_interaction.g.dart @@ -0,0 +1,56 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'save_interaction.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class SaveInteractionAdapter extends TypeAdapter { + @override + final int typeId = 3; + + @override + SaveInteraction read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return SaveInteraction( + save: (fields[1] as List).cast(), + id: fields[0] as String, + form: fields[2] as String?, + updatedTime: fields[3] as String?, + intId: fields[4] as String, + intName: fields[5] as String, + ); + } + + @override + void write(BinaryWriter writer, SaveInteraction obj) { + writer + ..writeByte(6) + ..writeByte(0) + ..write(obj.id) + ..writeByte(1) + ..write(obj.save) + ..writeByte(2) + ..write(obj.form) + ..writeByte(3) + ..write(obj.updatedTime) + ..writeByte(4) + ..write(obj.intId) + ..writeByte(5) + ..write(obj.intName); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is SaveInteractionAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} diff --git a/lib/model/userdata_model.dart b/lib/model/userdata_model.dart new file mode 100644 index 0000000..e3baaf5 --- /dev/null +++ b/lib/model/userdata_model.dart @@ -0,0 +1,25 @@ +import 'dart:core'; + +import 'package:hive_flutter/hive_flutter.dart'; +part 'userdata_model.g.dart'; + +@HiveType(typeId: 13) +class UserData { + @HiveField(0) + String? name; + @HiveField(1) + String? email; + @HiveField(2) + String? domainUrl; + @HiveField(3) + String? secretkey; + @HiveField(4) + String? imageBytes; + + UserData( + {required this.email, + required this.name, + required this.domainUrl, + this.imageBytes, + required this.secretkey}); +} diff --git a/lib/model/userdata_model.g.dart b/lib/model/userdata_model.g.dart new file mode 100644 index 0000000..537d326 --- /dev/null +++ b/lib/model/userdata_model.g.dart @@ -0,0 +1,53 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'userdata_model.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class UserDataAdapter extends TypeAdapter { + @override + final int typeId = 13; + + @override + UserData read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return UserData( + email: fields[1] as String?, + name: fields[0] as String?, + domainUrl: fields[2] as String?, + imageBytes: fields[4] as String?, + secretkey: fields[3] as String?, + ); + } + + @override + void write(BinaryWriter writer, UserData obj) { + writer + ..writeByte(5) + ..writeByte(0) + ..write(obj.name) + ..writeByte(1) + ..write(obj.email) + ..writeByte(2) + ..write(obj.domainUrl) + ..writeByte(3) + ..write(obj.secretkey) + ..writeByte(4) + ..write(obj.imageBytes); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is UserDataAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} diff --git a/lib/openid/openid_browser.dart b/lib/openid/openid_browser.dart new file mode 100644 index 0000000..8c17a9c --- /dev/null +++ b/lib/openid/openid_browser.dart @@ -0,0 +1,26 @@ +import 'package:openid_client/openid_client.dart'; +import 'package:openid_client/openid_client_browser.dart' as browser; + +Future authenticate(Client client, + {List scopes = const []}) async { + var authenticator = browser.Authenticator( + client, + scopes: scopes, + ); + + authenticator.authorize(); + + throw Exception('Will never reach here'); +} + +Future getRedirectResult(Client client, + {List scopes = const []}) async { + var authenticator = browser.Authenticator( + client, + scopes: scopes, + ); + + var c = await authenticator.credential; + + return c; +} diff --git a/lib/openid/openid_io.dart b/lib/openid/openid_io.dart new file mode 100644 index 0000000..88fb6d9 --- /dev/null +++ b/lib/openid/openid_io.dart @@ -0,0 +1,36 @@ +import 'dart:io'; + +import 'package:openid_client/openid_client.dart'; +import 'package:url_launcher/url_launcher.dart'; +import 'package:openid_client/openid_client_io.dart' as io; + +Future authenticate(Client client, + {List scopes = const []}) async { + // create a function to open a browser with an url + urlLauncher(String url) async { + var uri = Uri.parse(url); + if (await canLaunchUrl(uri) || Platform.isAndroid) { + await launchUrl(uri); + } else { + throw 'Could not launch $url'; + } + } + + // create an authenticator + var authenticator = io.Authenticator(client, + scopes: scopes, port: 3000, urlLancher: urlLauncher, redirectMessage: 'Logged In..' ); + + var c = await authenticator.authorize(); + + // close the webview when finished + if (Platform.isAndroid || Platform.isIOS) { + closeInAppWebView(); + } + + return c; +} + +Future getRedirectResult(Client client, + {List scopes = const []}) async { + return null; +} \ No newline at end of file diff --git a/lib/openid/openid_screen.dart b/lib/openid/openid_screen.dart new file mode 100644 index 0000000..b1a3bf7 --- /dev/null +++ b/lib/openid/openid_screen.dart @@ -0,0 +1,160 @@ +import 'dart:async'; +import 'dart:io'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +//import 'package:flutter_login_test/openid_browser.dart'; +import 'package:openid_client/openid_client.dart'; +import 'package:pwa_ios/views/konectarpage.dart'; + +import 'openid_io.dart' if (dart.library.html) 'openid_browser.dart'; + +const keycloakUri = 'https://sso.konectar.io/auth/realms/konectar'; +const scopes = ['profile']; + +late final Client client; + +class OpenidScreen extends StatelessWidget { + OpenidScreen({super.key, this.credential}); + Credential? credential; + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'openid_client demo', + home: LoginPage( + title: 'Login', + credential: credential, + ), + ); + } +} + +class LoginPage extends StatefulWidget { + LoginPage({super.key, required this.title, required this.credential}); + Credential? credential; + + final String title; + + @override + State createState() => _LoginPageState(); +} + +class _LoginPageState extends State { + UserInfo? userInfo; + + Future getClient() async { + var uri = Uri.parse(keycloakUri); + if (!kIsWeb && Platform.isAndroid) + uri = uri.replace(host: 'sso.konectar.io'); + var clientId = 'appwildcard'; + + var issuer = await Issuer.discover(uri); + return Client(issuer, clientId); + } + + _asyncMethod() async { + client = await getClient(); + var credential = await authenticate(client, scopes: scopes); + var userInfo = await credential.getUserInfo(); + setState(() { + this.userInfo = userInfo; + Timer.run(() { + // import 'dart:async: + Navigator.of(context).pushReplacement( + MaterialPageRoute(builder: (context) => const MyApp())); + }); + }); + } + + @override + void initState() { + if (widget.credential != null) { + widget.credential!.getUserInfo().then((userInfo) { + setState(() { + this.userInfo = userInfo; +// Timer.run(() { // import 'dart:async: +// Navigator.of(context).pushNamed('/details'); +// }); + }); + }); + } else { + WidgetsBinding.instance.addPostFrameCallback((_) { + _asyncMethod(); + }); + } + + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text(widget.title), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (userInfo != null) ...[ + Text('Hello ${userInfo!.name}'), + Text(userInfo!.email ?? ''), + OutlinedButton( + child: const Text('Logout'), + onPressed: () async { + setState(() { + userInfo = null; + }); + }) + ], + if (userInfo == null) + const CircularProgressIndicator( + backgroundColor: Colors.blue, + semanticsLabel: 'Please wait..', + ) + // OutlinedButton( + // child: const Text('Login'), + // onPressed: () async { + // var credential = await authenticate(client, scopes: scopes); + // var userInfo = await credential.getUserInfo(); + // setState(() { + // this.userInfo = userInfo; + // }); + // }), + ], + ), + ), + ); + } +} +// import 'firebase_options.dart'; + +// Future main() async { +// WidgetsFlutterBinding.ensureInitialized(); +// // iOS requires you run in release mode to test dynamic links ("flutter run --release"). +// await Firebase.initializeApp( +// // options: DefaultFirebaseOptions.currentPlatform, +// ); + +// // runApp( +// // MaterialApp( +// // title: 'Dynamic Links Example', +// // routes: { +// // '/': (BuildContext context) => _MainScreen(), +// // '/helloworld': (BuildContext context) => _DynamicLinkScreen(), +// // }, +// // ), +// // ); + +// runApp( +// MaterialApp( +// title: 'Dynamic Links Example', +// routes: { +// '/': (BuildContext context) => Login(), +// '/details': (BuildContext context) => Login(), +// }, +// ), +// ); + +// //runApp(MaterialApp.router(routerConfig: router)); +// } diff --git a/lib/repository/hive_repository.dart b/lib/repository/hive_repository.dart new file mode 100644 index 0000000..b708bf6 --- /dev/null +++ b/lib/repository/hive_repository.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; + +import 'package:hive/hive.dart'; +import 'package:pwa_ios/model/interaction_config_data.dart'; +import 'package:pwa_ios/model/save_interaction.dart'; + +class HiveDataRepository extends ChangeNotifier { + Box _hiveBox; // Use the correct type for your Hive box + + HiveDataRepository(this._hiveBox); + + List getAllDataFromHive() { + print("Stored_ALL_valuesssss : ${_hiveBox.values.toList()}"); + print( + "Stored_ALL_valuesssss_leangthhh : ${_hiveBox.values.toList().length}"); + + return _hiveBox.values.toList(); + } + + Future openHiveBox() async { + _hiveBox = + await Hive.openBox('InteractionConfigDataBox'); + } + + Future closeHiveBox() async { + _hiveBox.close(); + } + + List getAllofflineData() { + return _hiveBox.values.toList(); + } + + Future addOfflineData(InteractionConfigData data, int id) async { + // _hiveBox = await Hive.openBox('InteractionDataBox'); + + await _hiveBox.put(id, data); + + notifyListeners(); + } + + Future getNextAutoIncrementValue() async { + var counterBox = await Hive.openBox('counterBox'); + if (!counterBox.containsKey('counter')) { + counterBox.put('counter', 0); + } + + int? counter = counterBox.get('counter'); + counterBox.put('counter', counter! + 1); + + await counterBox.close(); + + return counter; + } +} diff --git a/lib/utils/apicall.dart b/lib/utils/apicall.dart new file mode 100644 index 0000000..49a5113 --- /dev/null +++ b/lib/utils/apicall.dart @@ -0,0 +1,55 @@ +import 'dart:io'; + +import 'package:dio/dio.dart'; +import 'package:dio/io.dart'; + +class ApiCall { + final dio = Dio(); + + Future parseInfo() async { + Dio dio = Dio(); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + Response response; + response = await dio.putUri( + Uri.parse( + 'https://cardio-staging.konectar.io/nested_logins/verify_key'), + data: { + "key": + "\$2a\$08\$u5DKCL4ir88CPKUhGFqbnuoXcibLZnxs/qi/48miKAuNJM/5.WGWy", + "email": "scheepu@tikamobile.com", + "name": "Scheepu", + }); + print("response here "); + print(response.data.toString()); + return response.data; + } + + //https://cardio-staging.konectar.io/notifications/list_all_notifications + Future listnotifications() async { + Dio dio = Dio(); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + Response response; + response = await dio.post( + 'https://cardio-staging.konectar.io/requested_kols/list_my_pending_approvals/', + options: Options( + followRedirects: false, + validateStatus: (status) { + return status! < 500; + }, + headers: {'Content-type': 'application/json; charset=UTF-8'}), + data: {"rows": "10", "page": "1", "sidx": "name", "sord": "desc"}); + print("response user settings here "); + print(response.data.toString()); + return response.data; + } +} diff --git a/lib/utils/constants.dart b/lib/utils/constants.dart new file mode 100644 index 0000000..24e71a9 --- /dev/null +++ b/lib/utils/constants.dart @@ -0,0 +1,1541 @@ +import 'package:flutter_inappwebview/flutter_inappwebview.dart'; + +// PWA Url +//https://mdn.github.io/pwa-examples/js13kpwa/ +//final kPwaUri = WebUri('http://192.168.2.83/static'); +//http://192.168.2.83/ci3/index.php/Nestedsso +//https://192.168.2.127/konectar-sandbox/nested_logins/verify_url +// "key": +// "\$2a\$08\$u5DKCL4ir88CPKUhGFqbnuoXcibLZnxs/qi/48miKAuNJM/5.WGWy", +// "email": "scheepu@tikamobile.com", +// "name": "scheepu", +final kPwaUri = + WebUri('https://cardio-staging.konectar.io/nested_logins/verify_key'); +final kPwaHost = kPwaUri.host; +final notificationUri = + WebUri('https://cardio-staging.konectar.io/notifications/'); + +final String publicKey = + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyZWYiOiIxZTIxMTkyZS1jYTkyLTRlNDktYjY5Zi0yM2YzZTdiOWY1ODAiLCJhbm9uX2tleSI6ImVkZTgzYjg3LTljNGUtNDcyYS04MGEzLTQxNGU1NjE1YWExMSIsImlhdCI6MTY5NTk5MDY2NiwiZXhwIjoxNzI3NTQ4MjY2LCJpc3MiOiJodHRwczovL2J1aWxkd2l0aHRoZXRhLmNvbSJ9.nFjrMCr2swrkN9-JTqZOqsSOdUgJpH0LiRBFBpe2ceA"; + +// Custom HTML Error Page. +const kHTMLErrorPage = """ + + + +

Not connected to Internet :(

+ + +"""; + +// Custom HTML Error Page if the App has not been installed correctly the first time. +const kHTMLErrorPageNotInstalled = """ + + + +

You must be connected to Internet at least one time to install correctly the App.

+ + +"""; + +extension EmailValidator on String { + bool isValidEmail() { + return RegExp( + r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$') + .hasMatch(this); + } +} + +const htmlPage = """ + + + + + + + Konectar + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

Contacts

+ +
+ + +
+
+
+
+
+
+ Profile +

Dr. Kevin Anderson

+

Hematology/Oncology

+
Florida Hospital Medical Group Inc
+

4100 BEECHER RD B, Flint, Michigan 48532-3661, United States

+
+ +
+
+ PROFILE SUMMARY +
    +
  • 38 Years of experience
  • +
  • Studied in Università Degli Studi Di Firenze Facoltà Di Medicina E Chirurgia
  • +
  • Texas Cardiac Arrhythmia, California Pacific Medical Ctr-pacific Campus Hosp and 110 other affiliations
  • +
  • Speaker in 1064 sessions in conferences
  • +
  • 474 Publications with 186 articles as lead author
  • +
  • Received payments from Abbott Laboratories, Acutus Medical, Inc., Amgen Inc. and 28 other companies
  • +
  • Have state license(s) to practice in MI, TX and OH
  • +
+
+ +
+
+ +
+ +
+
+
+
+
+
Top Event Topics
+ + + +
+
+
+
+
+
+
Top Publication Topics
+ + + +
+
+
+
+
+
+
Top Products Discussed
+ + + +
+
+
+
+
+
+
+
+
+
+
DRUGS PRESCRIBED
+ + + +
+
+
+
+
+
+
+
+
CONDITIONS TREATED
+ + + + + + + +
+
+
+
+
+ +
+
+
Comments/Notes
+
+
+
+
+
+
+

+ +

+ +
+
+
+
+
+
+
+
+ +
+
+
+
SENTIMENT
+
+ + +
+
+
+
+

+ +

+ +
+
+
+
+
+
+
+
+ + +
+
+
+
Related Details
+ +
+
+
+

+ +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#NamePositionAgeStart Date
1Brandon JacobDesigner282016-05-25
2Bridie KesslerDeveloper352014-12-05
3Ashleigh LangoshFinance452011-08-12
4Angus GradyHR342012-06-11
5Raheem LehnerDynamic Division Officer472011-04-19
+ +
+
+
+
+

+ +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#NamePositionAgeStart Date
1Brandon JacobDesigner282016-05-25
2Bridie KesslerDeveloper352014-12-05
3Ashleigh LangoshFinance452011-08-12
4Angus GradyHR342012-06-11
5Raheem LehnerDynamic Division Officer472011-04-19
+ +
+
+
+
+

+ +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#NamePositionAgeStart Date
1Brandon JacobDesigner282016-05-25
2Bridie KesslerDeveloper352014-12-05
3Ashleigh LangoshFinance452011-08-12
4Angus GradyHR342012-06-11
5Raheem LehnerDynamic Division Officer472011-04-19
+ +
+
+
+
+

+ +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#NamePositionAgeStart Date
1Brandon JacobDesigner282016-05-25
2Bridie KesslerDeveloper352014-12-05
3Ashleigh LangoshFinance452011-08-12
4Angus GradyHR342012-06-11
5Raheem LehnerDynamic Division Officer472011-04-19
+ +
+
+
+
+

+ +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#NamePositionAgeStart Date
1Brandon JacobDesigner282016-05-25
2Bridie KesslerDeveloper352014-12-05
3Ashleigh LangoshFinance452011-08-12
4Angus GradyHR342012-06-11
5Raheem LehnerDynamic Division Officer472011-04-19
+ +
+
+
+
+
+
+
+
+
+
Engagement Details
+ +
+
+
+

+ +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#NamePositionAgeStart Date
1Brandon JacobDesigner282016-05-25
2Bridie KesslerDeveloper352014-12-05
3Ashleigh LangoshFinance452011-08-12
4Angus GradyHR342012-06-11
5Raheem LehnerDynamic Division Officer472011-04-19
+ +
+
+
+
+

+ +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#NamePositionAgeStart Date
1Brandon JacobDesigner282016-05-25
2Bridie KesslerDeveloper352014-12-05
3Ashleigh LangoshFinance452011-08-12
4Angus GradyHR342012-06-11
5Raheem LehnerDynamic Division Officer472011-04-19
+ +
+
+
+
+

+ +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#NamePositionAgeStart Date
1Brandon JacobDesigner282016-05-25
2Bridie KesslerDeveloper352014-12-05
3Ashleigh LangoshFinance452011-08-12
4Angus GradyHR342012-06-11
5Raheem LehnerDynamic Division Officer472011-04-19
+ +
+
+
+
+

+ +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#NamePositionAgeStart Date
1Brandon JacobDesigner282016-05-25
2Bridie KesslerDeveloper352014-12-05
3Ashleigh LangoshFinance452011-08-12
4Angus GradyHR342012-06-11
5Raheem LehnerDynamic Division Officer472011-04-19
+ +
+
+
+
+

+ +

+
+
+
+
+
+
+

+ +

+
+
+
+
+
+
+

+ +

+
+
+
+
+
+
+
+
+
+
+
+
Activity Details
+ +
+
+
+

+ +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#NamePositionAgeStart Date
1Brandon JacobDesigner282016-05-25
2Bridie KesslerDeveloper352014-12-05
3Ashleigh LangoshFinance452011-08-12
4Angus GradyHR342012-06-11
5Raheem LehnerDynamic Division Officer472011-04-19
+ +
+
+
+
+

+ +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#NamePositionAgeStart Date
1Brandon JacobDesigner282016-05-25
2Bridie KesslerDeveloper352014-12-05
3Ashleigh LangoshFinance452011-08-12
4Angus GradyHR342012-06-11
5Raheem LehnerDynamic Division Officer472011-04-19
+ +
+
+
+
+

+ +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#NamePositionAgeStart Date
1Brandon JacobDesigner282016-05-25
2Bridie KesslerDeveloper352014-12-05
3Ashleigh LangoshFinance452011-08-12
4Angus GradyHR342012-06-11
5Raheem LehnerDynamic Division Officer472011-04-19
+ +
+
+
+
+

+ +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#NamePositionAgeStart Date
1Brandon JacobDesigner282016-05-25
2Bridie KesslerDeveloper352014-12-05
3Ashleigh LangoshFinance452011-08-12
4Angus GradyHR342012-06-11
5Raheem LehnerDynamic Division Officer472011-04-19
+ +
+
+
+
+
+
+
+
+
Similar HCPs
+
+
+

+ +

+ +
+
+
+
+
+
+

+ +

+ +
+
+
+
+
+
+

+ +

+ +
+
+
+
+
+
+
+
+
+
+
Social Media
+
+
+

+ +

+ +
+
+
+
+
+
+

+ +

+ +
+
+
+
+
+ +
+
+
+ + + + +
+ +
+ + + +
+ +
+ Powered by Aissel +
+
+ + + + + + + + + + + + + +"""; diff --git a/lib/utils/exceptions.dart b/lib/utils/exceptions.dart new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lib/utils/exceptions.dart @@ -0,0 +1 @@ + diff --git a/lib/utils/fileupload.dart b/lib/utils/fileupload.dart new file mode 100644 index 0000000..e9cba4f --- /dev/null +++ b/lib/utils/fileupload.dart @@ -0,0 +1,45 @@ +import 'dart:developer'; +import 'dart:io'; + +import 'package:dio/dio.dart'; + +class FileUpload { + Future uploadFileAndJsonData( + {required File empFace, required String empCode}) async { + final url = 'My API URL'; + try { + var formData = FormData.fromMap({ + "files": [ + MultipartFile.fromFileSync("./example/upload.txt", + filename: "upload.txt"), + MultipartFile.fromFileSync("./example/upload.txt", + filename: "upload.txt"), + ] + }); + final response = await Dio().post( + url, + data: formData, + ); + if (response.statusCode == 200) { + var map = response.data as Map; + print('success'); + if (map['status'] == 'Successfully registered') { + return true; + } else { + return false; + } + } else if (response.statusCode == 200) { + //BotToast is a package for toasts available on pub.dev + // BotToast.showText(text: 'Validation Error Occurs'); + return false; + } + } on DioException catch (error) { + log(error.message!); + throw 'Something Went Wrong'; + } catch (_) { + log(_.toString()); + throw 'Something Went Wrong'; + } + return false; + } +} diff --git a/lib/utils/mockapi.dart b/lib/utils/mockapi.dart new file mode 100644 index 0000000..7e9c778 --- /dev/null +++ b/lib/utils/mockapi.dart @@ -0,0 +1,211 @@ +import 'dart:convert'; +import 'dart:developer'; +import 'dart:io'; + +import 'package:dio/dio.dart'; +import 'package:dio/io.dart'; +import 'package:flutter/services.dart'; +import 'package:http_mock_adapter/http_mock_adapter.dart'; +import 'package:path_provider/path_provider.dart'; +import 'package:pwa_ios/model/interaction_config_data.dart'; + +class MockApiCall { + Future getConfigData() async { + // final dio = Dio(BaseOptions()); + final dio = Dio(); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + //final dioAdapter = DioAdapter(dio: dio); + dynamic jsonResult = jsonDecode( + await rootBundle.loadString("assets/images/interactiondata.json")); + // Set up a mock response for GET requests to "https://example.com" + // dio.get('192.168.2.64/passvault/public/forms' + // (server) => server.reply( + // 200, + // jsonResult, + // // Delay the response by 1 second + // delay: const Duration(seconds: 1), + // ), + // ); + // Send a GET request to "https://example.com" using Dio + final response = + await dio.get('http://192.168.2.64/konectar-app/public/forms'); + + UIDataResponse dataResponse = UIDataResponse.fromJson(response.data); + // The response should contain the mock data we registered + print("response"); + print(response.data); + return dataResponse; + } + + Future postConfigData(var jsonObj) async { + // final dio = Dio(BaseOptions()); + final dio = Dio(); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + //final dioAdapter = DioAdapter(dio: dio); + dynamic jsonResult = jsonDecode( + await rootBundle.loadString("assets/images/interactiondata.json")); + // Set up a mock response for GET requests to "https://example.com" + // dio.get('192.168.2.64/passvault/public/forms' + // (server) => server.reply( + // 200, + // jsonResult, + // // Delay the response by 1 second + // delay: const Duration(seconds: 1), + // ), + // ); + // Send a GET request to "https://example.com" using Dio + final response = await dio + .post('http://192.168.2.64/konectar-app/public/forms', data: jsonObj); + + UIDataResponse dataResponse = UIDataResponse.fromJson(response.data); + // The response should contain the mock data we registered + print("response"); + print(response.data); + return dataResponse; + } + + Future getConfigWidgetData() async { + final dio = Dio(BaseOptions()); + final dioAdapter = DioAdapter(dio: dio); + dynamic jsonResult = jsonDecode( + await rootBundle.loadString("assets/images/interactiondata.json")); + // Set up a mock response for GET requests to "https://example.com" + dioAdapter.onGet( + 'https://example.com', + (server) => server.reply( + 200, + jsonResult, + // Delay the response by 1 second + delay: const Duration(seconds: 1), + ), + ); + // Send a GET request to "https://example.com" using Dio + final response = await dio.get('https://example.com'); + // The response should contain the mock data we registered + print(response.data); // {messa + } + + Future postFormData(var jsonObj) async { + final dio = Dio(BaseOptions()); + final dioAdapter = DioAdapter(dio: dio); + // final body = json.decode(jsonObj.toString()); + // print(body); + // Set up a mock response for GET requests to "https://example.com" + dioAdapter.onPost( + 'https://example.com', + data: jsonObj, + (server) => server.reply( + 200, + {"message": "success"}, + // Delay the response by 1 second + delay: const Duration(seconds: 1), + ), + ); + // Send a GET request to "https://example.com" using Dio + final response = await dio.post( + 'http://192.168.2.64/konectar-app/public/push_data', + data: jsonObj); + // The response should contain the mock data we registered + print(response.data); // {messa + } + + Future postSavedData(var jsonObj, String filepath) async { + // final dio = Dio(BaseOptions()); + final dio = Dio(); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + // MultipartFile.fromFileSync("/Users/aissel/Library/Developer/CoreSimulator/Devices/1E435121-7E65-45C6-9E0B-411C8B9915F5/data/Containers/Data/Application/3CBC1CFF-79AD-49FA-A6E0-13D0AA2959D2/tmp/Flutter Questionaire.pdf", + // filename: "upload.txt"),\ + // File file = File(filepath); + + // String fileName = file.path.split('/').last; + // // Get the application folder directory + // Directory? directory = Platform.isAndroid + // ? await getExternalStorageDirectory() //FOR ANDROID + // : await getApplicationSupportDirectory(); //FOR ios + + // // Copy file to the directory + + // // if (directory != null) { + // File newFile = await file.copy('${directory!.path}/$fileName'); + + // // File file = File(filepath); + // List imageBytes = await newFile.readAsBytes(); + // Uint8List imageUint8List = Uint8List.fromList(imageBytes); + // String base64Image = base64Encode(imageUint8List); + // var formData = FormData.fromMap({ + // "files": [await MultipartFile.fromFile(filepath)], + // "data": jsonObj + // }); + + // Send a GET request to "https://example.com" using Dio + final response = await dio.get( + 'http://192.168.2.64/konectar-app/public/push_data', + data: jsonObj); + + //UIDataResponse dataResponse = UIDataResponse.fromJson(response.data); + // The response should contain the mock data we registered + print("response"); + print(response.data); + return response.data; + } + + Future uploadFileAndJsonData(var jsonObj) async { + // {required File empFace, required String empCode} + final url = 'http://192.168.2.64/konectar-app/public/push_data'; + try { + var formData = FormData.fromMap({ + "files": [ + MultipartFile.fromFileSync( + "/Users/aissel/Library/Developer/CoreSimulator/Devices/1E435121-7E65-45C6-9E0B-411C8B9915F5/data/Containers/Data/Application/3CBC1CFF-79AD-49FA-A6E0-13D0AA2959D2/tmp/Flutter Questionaire.pdf", + filename: "upload.txt"), + MultipartFile.fromFileSync("./example/upload.txt", + filename: "upload.txt"), + ], + "data": jsonObj + }); + final response = await Dio().post( + url, + data: jsonObj, + ); + if (response.statusCode == 200) { + var map = response.data as Map; + print("result $map"); + print('success'); + if (map['status'] == 'Successfully registered') { + return true; + } else { + return false; + } + } else if (response.statusCode != 200) { + var map = response.data as Map; + print("result $map"); + //BotToast is a package for toasts available on pub.dev + // BotToast.showText(text: 'Validation Error Occurs'); + return false; + } + } on DioException catch (error) { + log(error.message!); + + throw 'Something Went Wrong'; + } catch (_) { + log(_.toString()); + throw 'Something Went Wrong'; + } + return false; + } +} diff --git a/lib/utils/sessionmanager.dart b/lib/utils/sessionmanager.dart new file mode 100644 index 0000000..984fdf7 --- /dev/null +++ b/lib/utils/sessionmanager.dart @@ -0,0 +1,27 @@ +import 'package:shared_preferences/shared_preferences.dart'; + +class SessionManager { + static final SessionManager _instance = SessionManager._(); + static const String _loggedInKey = 'loggedIn'; + + factory SessionManager() { + return _instance; + } + + SessionManager._(); + + Future setLoggedIn(bool value) async { + final prefs = await SharedPreferences.getInstance(); + await prefs.setBool(_loggedInKey, value); + } + + Future isLoggedIn() async { + final prefs = await SharedPreferences.getInstance(); + return prefs.getBool(_loggedInKey) ?? false; + } + + Future clearSession() async { + final prefs = await SharedPreferences.getInstance(); + await prefs.clear(); + } +} diff --git a/lib/utils/util.dart b/lib/utils/util.dart new file mode 100644 index 0000000..e2a48ca --- /dev/null +++ b/lib/utils/util.dart @@ -0,0 +1,78 @@ +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:hive_flutter/hive_flutter.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +Future isNetworkAvailable() async { + // check if there is a valid network connection + final connectivityResult = await Connectivity().checkConnectivity(); + if (connectivityResult != ConnectivityResult.mobile && + connectivityResult != ConnectivityResult.wifi) { + return false; + } + + // check if the network is really connected to Internet + try { + final result = await InternetAddress.lookup('example.com'); + if (result.isEmpty || result[0].rawAddress.isEmpty) { + return false; + } + } on SocketException catch (_) { + return false; + } + + return true; +} + +Future isPWAInstalled() async { + final prefs = await SharedPreferences.getInstance(); + return prefs.getBool('isInstalled') ?? false; +} + +void setPWAInstalled({bool installed = true}) async { + final prefs = await SharedPreferences.getInstance(); + await prefs.setBool('isInstalled', installed); +} + +bool get isTablet { + final firstView = WidgetsBinding.instance.platformDispatcher.views.first; + final logicalShortestSide = + firstView.physicalSize.shortestSide / firstView.devicePixelRatio; +// print("size:${logicalShortestSide > 600} tablet "); + return logicalShortestSide > 600; +} + +Future getNextAutoIncrementValue() async { + var counterBox = await Hive.openBox('counterBox'); + if (!counterBox.containsKey('counter')) { + counterBox.put('counter', 0); + } + + int? counter = counterBox.get('counter'); + counterBox.put('counter', counter! + 1); + + await counterBox.close(); + + return counter; +} + +class HexColor extends Color { + static int _getColorFromHex(String hexColor) { + hexColor = hexColor.toUpperCase().replaceAll("#", ""); + if (hexColor.length == 6) { + hexColor = "FF$hexColor"; + } + return int.parse(hexColor, radix: 16); + } + + HexColor(final String hexColor) : super(_getColorFromHex(hexColor)); +} + +extension Iterables on Iterable { + Map> groupBy(K Function(E) keyFunction) => fold( + >{}, + (Map> map, E element) => + map..putIfAbsent(keyFunction(element), () => []).add(element)); +} diff --git a/lib/utils/validations.dart b/lib/utils/validations.dart new file mode 100644 index 0000000..4e3b9b5 --- /dev/null +++ b/lib/utils/validations.dart @@ -0,0 +1,50 @@ +import 'package:pwa_ios/utils/constants.dart'; + +class FieldValidation { + static String validateEmail(String email) { + if (email.isEmpty) { + return 'Please enter email'; + } else if (!email.isValidEmail()) { + return 'Please enter valid email'; + } else { + return ''; + } + } + + static String validateMeetingId(String meetingId) { + if (meetingId.isEmpty) { + return 'Please enter meeting id or url'; + } else { + return ''; + } + } + + static String validateName(String name) { + if (name.isEmpty) { + return 'Please enter name'; + } else { + return ''; + } + } + + static String validateSecretKey(String domain) { + if (domain.isEmpty) { + return 'Please enter secret key'; + } else { + return ''; + } + } + + static String validateUrl(String url) { + if (url.isEmpty) { + return 'Please enter application url'; + } else { + bool isURLValid = Uri.parse(url).host.isNotEmpty; + if (isURLValid) { + return ''; + } else { + return 'Please enter valid application url'; + } + } + } +} diff --git a/lib/viewmodel/configprovider.dart b/lib/viewmodel/configprovider.dart new file mode 100644 index 0000000..8a8a541 --- /dev/null +++ b/lib/viewmodel/configprovider.dart @@ -0,0 +1,92 @@ +import 'dart:convert'; +import 'dart:ffi'; +import 'dart:io'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; +import 'package:hive_flutter/hive_flutter.dart'; +import 'package:path_provider/path_provider.dart'; +import 'package:pwa_ios/model/interaction_config_data.dart'; +import 'package:pwa_ios/model/interaction_data.dart'; + +import 'package:pwa_ios/utils/mockapi.dart'; +import 'package:pwa_ios/utils/util.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:file_picker/file_picker.dart'; + +class ConfigDataProvider extends ChangeNotifier { + Future initConfigUIData() async { + // dynamic jsonResult = await MockApiCall().getConfigData(); + List interactionConfigData = []; + // interactionConfigData = await fetchInteactionConfigData(); + //interactionConfigData = fetchInteactionUIConfigData(jsonResult); + interactionConfigData = await fetchLocalInteactionConfigData(); + var box = + await Hive.openBox('InteractionConfigDataBox'); + if (box.isEmpty) { + for (InteractionConfigData data in interactionConfigData) { + box.put(await getNextAutoIncrementValue(), data); + } + } else { + box.clear(); + + for (InteractionConfigData data in interactionConfigData) { + box.put(await getNextAutoIncrementValue(), data); + } + } + notifyListeners(); + } + + Future> fetchLocalInteactionConfigData() async { + dynamic jsonResult = jsonDecode( + await rootBundle.loadString("assets/images/interactiondata.json")); + + // dynamic jsonResultc2 = jsonDecode( + // await rootBundle.loadString("assets/images/interactiondatac2.json")); + // // for (var value in jsonResult) { + + // InteractionDataSet interactionDataSet2 = + // InteractionDataSet.fromJson(jsonResultc2); + + // dynamic jsonResult2 = jsonDecode( + // await rootBundle.loadString("assets/images/interactionform.json")); + dynamic jsonResult2c2 = jsonDecode( + await rootBundle.loadString("assets/images/newconfigdata.json")); + List interactionConfigData = []; + // for (var value in jsonResult) { + + // InteractionResultData interactionConfig = + // InteractionResultData.fromJson(jsonResult2); + ResponseData responseData = ResponseDataFromJson(jsonResult2c2); + for (InteractionResultData obj in responseData.data) { + // InteractionResultData interactionConfigc2 = + // InteractionResultData.fromJson(obj); + + interactionConfigData.add( + // InteractionConfigData( + // dataSet: interactionDataSet, + // widgets: interactionConfig, + // id: "IN01", + // name: "InteractionForm1")); + // interactionConfigData.add( + InteractionConfigData(widgets: obj, id: obj.id, name: obj.name)); + } + return interactionConfigData; + } + + // List fetchInteactionUIConfigData(UIDataResponse data) { + // //final data = json.decode(jsonResult); + + // InteractionDataSet interactionDataSet = + // InteractionDataSet(data: data.formAttr); + // InteractionResultData interactionConfig = + // InteractionResultData(result: data.formFields, id: data.id , name: ''); + // List interactionConfigData = []; + // interactionConfigData.add(InteractionConfigData( + // dataSet: interactionDataSet, + // widgets: interactionConfig, + // id: "IN01", + // name: "InteractionForm1")); + // return interactionConfigData; + // } +} diff --git a/lib/viewmodel/interactionprovider.dart b/lib/viewmodel/interactionprovider.dart new file mode 100644 index 0000000..1bd40d1 --- /dev/null +++ b/lib/viewmodel/interactionprovider.dart @@ -0,0 +1,686 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; +import 'package:hive_flutter/hive_flutter.dart'; +import 'package:provider/provider.dart'; +import 'package:pwa_ios/model/interaction_config_data.dart'; + +import 'package:pwa_ios/model/interaction_data.dart'; + +import 'package:pwa_ios/model/json_form_data.dart'; +import 'package:pwa_ios/model/location_model.dart'; +import 'package:pwa_ios/model/save_interaction.dart'; +import 'package:pwa_ios/repository/hive_repository.dart'; +import 'package:pwa_ios/utils/mockapi.dart'; + +import '../utils/util.dart'; + +class InteractionProvider extends ChangeNotifier { + List interactionReponseList = []; + // List sectionList = []; + List sectionList = []; + late Location locationList; + List textEditingControllerList = []; + List multipletextEditingControllerList = []; + int textfieldIndex = 0; + + List checkboxlist = []; + + String radioValue = ''; + bool checkboxValue = false; + + //List data = []; + List newList = []; + String sectionName = ''; + late String selectedCity = 'Selected City', selectedState = 'Selected State'; + + String? selectedValue; + List selectedItems = []; + InputClass? selectedObj; + List savedList = []; + List intConfigDataList = []; + String? intId, intName; + final HiveDataRepository _hiveprovider = HiveDataRepository( + Hive.box('InteractionConfigDataBox')); + + initConfigData() async { + _hiveprovider.openHiveBox(); + intConfigDataList = _hiveprovider.getAllDataFromHive(); + } + + Future getRecords() async { + var box = await Hive.openBox('InteractionDataBox'); + savedList = box.values.toList(); + notifyListeners(); + } + + init(int index) async { + // _hiveprovider = HiveDataRepository( + // Hive.box('InteractionConfigDataBox')); + // intConfigDataList = _hiveprovider.getAllDataFromHive(); + dynamic jsonResult = jsonDecode( + await rootBundle.loadString("assets/images/interactiondata.json")); + + InteractionConfigData interactionConfigData = intConfigDataList[index]; + intId = intConfigDataList[index].id; + intName = intConfigDataList[index].name; + + radioValue = ''; + print("data $intConfigDataList"); + // await fetchSaveDataJson(); + // await fetchDataSet(); + await fetchData(interactionConfigData.widgets); + //await fetchLocationData(); + notifyListeners(); + } + + initSavedForm(SaveInteraction saveInteractiondata) { + interactionReponseList = saveInteractiondata.save + .map((e) => FormFieldData( + multipleList: e.multipleList == null + ? [] + : e.multipleList! + .map((mobj) => SectionList( + depid: mobj.depid, + id: mobj.id, + inputList: mobj.inputList, + isRequired: mobj.isRequired, + name: mobj.name, + param: mobj.param, + selectedValue: mobj.selectedValue, + fileName: mobj.fileName, + extension: mobj.extension, + widget: mobj.widget, + controller: mobj.controller, + gid: mobj.gid, + input: mobj.input, + selectedId: mobj.selectedId, + value: mobj.value)) + .toList(), + sectionList: e.sectionList + .map((obj) => SectionList( + depid: obj.depid, + id: obj.id, + inputList: obj.inputList, + isRequired: obj.isRequired, + name: obj.name, + param: obj.param, + fileName: obj.fileName, + extension: obj.extension, + selectedValue: obj.selectedValue, + widget: obj.widget, + controller: obj.controller, + gid: obj.gid, + input: obj.input, + selectedId: obj.selectedId, + value: obj.value, + )) + .toList(), + sectionName: e.sectionName, + multiple: e.multiple)) + .toList(); + + textEditingControllerList.clear(); + + for (var item in interactionReponseList) { + sectionList = item.sectionList; + for (var sectionItem in item.sectionList) { + if (sectionItem.widget == InteractionWidget.TEXT) { + var textEditingController = TextEditingController(); + + textEditingControllerList.add(textEditingController); + sectionItem.controller = textEditingControllerList.last; + } + if (sectionItem.widget == InteractionWidget.DROPDOWN || + sectionItem.widget == InteractionWidget.AUTOCOMPLETE || + sectionItem.widget == InteractionWidget.MULTISELECT) { + // int index = data + // .indexWhere((element) => element.widgetId == sectionItem.id); + // List list = data[index].data; + List list = sectionItem.inputList!; + sectionItem.value = list[0].id; + print("value : ${list.first} "); + } + } + } + print(interactionReponseList); + print("check textcontrollers ${textEditingControllerList.length}"); + } + + // List getData(String widgetId) { + // List list = []; + // if (data.isNotEmpty) { + // for (InteractionDatum obj in data) { + // // List list = + // if (obj.widgetId == widgetId) { + // list = obj.data; + // } + // } + // } + // return list; + // } + + String getDataValue(String widgetId, String id) { + if (id != "") { + List list = []; + String value = ' '; + + for (FormFieldData obj1 in interactionReponseList) { + // List list = + for (SectionList obj in obj1.sectionList) { + if (obj.id == widgetId) { + list = obj.inputList!; + } + } + } + + if (list.isNotEmpty) { + int index = list.indexWhere((element) => element.id.toString() == id); + + if (index != -1) { + value = list[index].name; + } + } + + return value; + } else { + return " "; + } + } + +// TODO: Search for widget with depid and check if selected is not null and by selected id get the data of current widget + + List getData2(SectionList sectionItem) { + List list = []; + // if (sectionItem.inputList != null) { + list = sectionItem.inputList!; + if (sectionItem.depid != "") { + // print("check depid : ${sectionItem.depid}"); + int i = 0; + for (var obj in interactionReponseList) { + i = obj.sectionList + .indexWhere((element) => element.id == sectionItem.depid); + // print("check depid index: $i"); + if (i != -1) { + //print("check depid value: ${obj.sectionList[i].value}"); + if (obj.sectionList[i].value != null) { + if (list + .where((element) => element.pid == obj.sectionList[i].value) + .isNotEmpty) { + list = list + .where((element) => element.pid == obj.sectionList[i].value) + .toList(); + + sectionItem.selectedObject = list[0]; + } else { + // InputClass obj = InputClass( + // id: "obj.sectionList[i].value", + // name: "Select ${sectionItem.name}"); + list = []; + // list.add(obj); + sectionItem.selectedObject = null; + } + } else { + // int index = obj.sectionList + // .indexWhere((element) => element.id == sectionItem.id); + + // list = obj.sectionList[index].inputList; + } + } + } + + // int index = data[i].data.indexWhere((element) => element.) + } + // } + return list; + } + + setDropDownValue(String value, SectionList sectionItem, bool multiple) { + int i = 0; + print("selected $value"); + for (var obj in interactionReponseList) { + if (multiple && obj.multipleList != null) { + i = obj.multipleList! + .indexWhere((element) => element.id == sectionItem.id); + if (i != -1) { + obj.multipleList![i].value = value; + obj.multipleList![i].selectedValue!.add(value); + } + } else { + i = obj.sectionList + .indexWhere((element) => element.id == sectionItem.id); + if (i != -1) { + obj.sectionList[i].value = value; + obj.sectionList[i].selectedValue!.add(value); + } + } + } + notifyListeners(); + } + + setTextValue(String value, SectionList sectionItem, bool multiple) { + int i = 0; + for (var obj in interactionReponseList) { + if (multiple && obj.multipleList != null) { + i = obj.multipleList! + .indexWhere((element) => element.id == sectionItem.id); + if (i != -1) { + obj.multipleList![i].value = value; + obj.multipleList![i].selectedValue!.add(value); + } + } else { + i = obj.sectionList + .indexWhere((element) => element.id == sectionItem.id); + if (i != -1) { + obj.sectionList[i].value = value; + obj.sectionList[i].selectedValue!.add(value); + } + } + } + notifyListeners(); + } + + setAutoCompleteValue(String value, SectionList sectionItem, bool multiple) { + int i = 0; + for (var obj in interactionReponseList) { + if (multiple && obj.multipleList != null) { + i = obj.multipleList! + .indexWhere((element) => element.id == sectionItem.id); + if (i != -1) { + obj.multipleList![i].value = value; + obj.multipleList![i].selectedValue!.add(value); + } + } else { + i = obj.sectionList + .indexWhere((element) => element.id == sectionItem.id); + if (i != -1) { + obj.sectionList[i].value = value; + obj.sectionList[i].selectedValue!.add(value); + } + } + } + notifyListeners(); + } + + Future fetchData(InteractionResultData interactionResultData) async { + InteractionResultData interactionConfig = interactionResultData; + + print("itemCategoryModel Item = + ${interactionConfig.result}"); + // } + interactionReponseList = interactionConfig.result; + print("check stored: $interactionReponseList"); + + textEditingControllerList.clear(); + + for (var item in interactionReponseList) { + sectionList = item.sectionList; + for (var sectionItem in item.sectionList) { + sectionItem.selectedValue = []; + if (sectionItem.widget == InteractionWidget.TEXT) { + var textEditingController = TextEditingController(); + + textEditingControllerList.add(textEditingController); + sectionItem.controller = textEditingControllerList.last; + } + if (sectionItem.widget == InteractionWidget.DROPDOWN || + sectionItem.widget == InteractionWidget.AUTOCOMPLETE || + sectionItem.widget == InteractionWidget.MULTISELECT) { + // int index = data + // .indexWhere((element) => element.widgetId == sectionItem.id); + // List list = data[index].data; + List list = sectionItem.inputList!; + sectionItem.value = list[0].id; + if (sectionItem.widget == InteractionWidget.MULTISELECT) { + sectionItem.selectedValue!.add(list[0].name); + } else { + sectionItem.selectedValue!.add(list[0].id); + } + + sectionItem.selectedObject = list[0]; + print("value : ${list.first} "); + } else if (sectionItem.widget == InteractionWidget.CHECKBOX) { + List list = sectionItem.inputList!; + if (list.isNotEmpty) { + sectionItem.inputList!.forEach((element) { + element.ischecked = false; + }); + } + // sectionItem.value = list[0].id; + // sectionItem.selectedValue!.add(list[0].id); + } + } + } + print(interactionReponseList); + print("check textcontrollers ${textEditingControllerList.length}"); + notifyListeners(); + + return "success"; + } + + resetAllWidgetsData() { + textEditingControllerList.clear(); + + for (var item in interactionReponseList) { + item.multipleList = []; + sectionList = item.sectionList; + for (var sectionItem in item.sectionList) { + sectionItem.selectedValue = []; + // sectionItem.value = ''; + // sectionItem.selectedObject = InputClass(id: '', name: ''); + if (sectionItem.widget == InteractionWidget.TEXT) { + var textEditingController = TextEditingController(); + + textEditingControllerList.add(textEditingController); + sectionItem.controller = textEditingControllerList.last; + } + if (item.sectionName != "Other") { + if (sectionItem.widget == InteractionWidget.DROPDOWN || + sectionItem.widget == InteractionWidget.AUTOCOMPLETE || + sectionItem.widget == InteractionWidget.MULTISELECT) { + // int index = data + // .indexWhere((element) => element.widgetId == sectionItem.id); + print("Selected widget : ${sectionItem.id}"); + List list = sectionItem.inputList!; + sectionItem.value = list[0].id; + sectionItem.selectedObject = list[0]; + print("value : ${list.first.name} "); + } + } + } + } + print(interactionReponseList); + print("check textcontrollers ${textEditingControllerList.length}"); + notifyListeners(); + } + + setRadioValue(SectionList sectionItem) { + List list = (sectionItem.input as List) + .map((itemWord) => InputClass.fromJson(itemWord)) + .toList(); + radioValue = list[0].name; + + notifyListeners(); + } + + setcheckBoxValue(SectionList sectionItem, String sectionName, bool newValue, + String id, bool multiple) { + int index = + sectionItem.inputList!.indexWhere((element) => element.id == id); + sectionItem.inputList![index].ischecked = newValue; + // sectionItem.selectedValue.add(data[i].data[index].id); + int index2 = 0; + for (var obj in interactionReponseList) { + if (multiple && obj.multipleList != null) { + index2 = obj.multipleList! + .indexWhere((element) => element.id == sectionItem.id); + if (index2 != -1) { + obj.multipleList![index2].value = sectionItem.inputList![index].id; + obj.multipleList![index2].selectedValue! + .add(sectionItem.inputList![index].id); + } + } else { + index2 = obj.sectionList + .indexWhere((element) => element.id == sectionItem.id); + if (index2 != -1) { + obj.sectionList[index2].value = sectionItem.inputList![index].id; + obj.sectionList[index2].selectedValue! + .add(sectionItem.inputList![index].id); + } + } + } + notifyListeners(); + } + + getSectionItem(String sectionName) { + newList = []; + List addList = []; + int index = interactionReponseList + .indexWhere((element) => element.sectionName == sectionName); + + addList = interactionReponseList[index] + .sectionList + .map((e) => SectionList( + depid: e.depid, + id: e.id, + inputList: e.inputList, + isRequired: e.isRequired, + name: e.name, + param: e.param, + selectedValue: [], + widget: e.widget, + controller: e.controller, + gid: e.gid, + input: e.input, + selectedId: e.selectedId, + value: e.value)) + .toList(); + SectionList delItem = SectionList( + name: "delete", + param: "deletebtn", + id: "deletebtn", + selectedValue: [], + depid: "", + widget: InteractionWidget.BUTTON, + inputList: [], + isRequired: true); + + addList.add(delItem); + + // if (interactionReponseList[index].multipleList!.isEmpty) { + // newList = addList; + // } else { + if (interactionReponseList[index].multipleList == null) { + interactionReponseList[index].multipleList = addList; + } else { + interactionReponseList[index].multipleList = + interactionReponseList[index].multipleList! + addList; + } + + newList = interactionReponseList[index].multipleList!; + // newList = newList + addList; + // } + if (interactionReponseList[index].multipleList != null) { + for (SectionList obj in interactionReponseList[index].multipleList!) { + obj.gid = obj.gid ?? interactionReponseList[index].multipleList!.length; + if (obj.widget == InteractionWidget.TEXT) { + var textEditingController = TextEditingController(); + + multipletextEditingControllerList.add(textEditingController); + obj.controller = multipletextEditingControllerList.last; + } + // newList.add(obj); + } + } + + print( + "check length : ${interactionReponseList[index].multipleList!.length}"); + notifyListeners(); + } + + deleteMultipleRows( + int gid, SectionList sectionItem, String selectedSectionName) { + int index = interactionReponseList + .indexWhere((element) => element.sectionName == selectedSectionName); + // for (var obj in interactionReponseList[index].multipleList!) { + // if (obj.widget == InteractionWidget.TEXT) { + // print("controllerssssss"); + // multipletextEditingControllerList.remove(obj.controller); + // } + // } + print("controllerssssss : ${multipletextEditingControllerList.length}"); + interactionReponseList[index] + .multipleList! + .removeWhere((item) => item.gid == gid); + + notifyListeners(); + } + + bool validateMultipleRows() { + for (var obj in interactionReponseList) { + if (obj.multipleList != null) { + for (var mulobj in obj.multipleList!) { + if (mulobj.widget == InteractionWidget.TEXT) { + if (mulobj.controller!.text.isEmpty) { + return true; + } + } + } + } + } + return false; + } + + bool validateTextFields() { + for (var obj in interactionReponseList) { + for (var mulobj in obj.sectionList) { + if (mulobj.widget == InteractionWidget.TEXT) { + if (mulobj.controller!.text.isEmpty) { + return true; + } + } + } + } + return false; + } + + Future saveJsonObject(BuildContext context, String form, + {bool isEdit = false}) async { + List resultData = interactionReponseList + .map((e) => FormFieldData( + multipleList: e.multipleList == null + ? [] + : e.multipleList! + .map((mobj) => SectionList( + depid: mobj.depid, + id: mobj.id, + inputList: mobj.inputList, + isRequired: mobj.isRequired, + name: mobj.name, + param: mobj.param, + selectedValue: mobj.selectedValue, + extension: mobj.extension, + fileName: mobj.fileName, + widget: mobj.widget, + // controller: mobj.controller, + gid: mobj.gid, + input: mobj.input, + selectedId: mobj.selectedId, + value: mobj.value)) + .toList(), + sectionList: e.sectionList + .map((obj) => SectionList( + depid: obj.depid, + id: obj.id, + inputList: obj.inputList, + isRequired: obj.isRequired, + name: obj.name, + param: obj.param, + selectedValue: obj.selectedValue, + widget: obj.widget, + controller: obj.controller, + gid: obj.gid, + input: obj.input, + extension: obj.extension, + fileName: obj.fileName, + selectedId: obj.selectedId, + value: obj.value)) + .toList(), + sectionName: e.sectionName, + multiple: e.multiple)) + .toList(); + + String generateId = '${intId}R${await getNextAutoIncrementValue()}'; + + final data = SaveInteraction( + save: resultData, + id: generateId, + updatedTime: DateTime.now().toString(), + form: form, + intId: intId ?? "id", + intName: intName ?? "name"); + + final box = await Hive.openBox('InteractionDataBox'); + + await box.put(await getNextAutoIncrementValue(), data); + box.close(); + return generateId; + // await MockApiCall().postFormData(data); + // await prov.addOfflineData(data); + } + + List getModifiedList(List sectionList) { + List newSectionList = []; + for (var obj in sectionList) { + if (obj.id != 'deletebtn') { + if (obj.input == 'chooseFile') { + MultipleSectionList newobj = MultipleSectionList( + id: obj.id, + selectedValue: obj.selectedValue!, + extension: obj.extension!, + fileName: obj.fileName!, + ); + + newSectionList.add(newobj); + } else { + MultipleSectionList newobj = MultipleSectionList( + id: obj.id, + selectedValue: obj.selectedValue!, + ); + newSectionList.add(newobj); + } + } + } + return newSectionList; + } + + List> getMultipleSectionList( + List sectionList, List multipleList) { + List> list = []; + List> listing = []; + List _secList = getModifiedList(sectionList); + List _multipleList = getModifiedList(multipleList); + list.add(_secList); + listing.add(_secList); + // List listing = []; + if (multipleList.isNotEmpty) { + final releaseDateMap = multipleList.groupBy((m) => m.gid); + print("see map : $releaseDateMap"); + + if (releaseDateMap.isNotEmpty) { + listing = []; + List> mulList = + releaseDateMap.values.toList(growable: true); + for (var item in mulList) { + listing.add(getModifiedList(item)); + } + listing.add(_secList); + list = [...listing]; + + //}); + } + } + return list; + } + + SaveInteractionFormJson formJson(SaveInteraction saveInteraction) { + List saveList = []; + for (var obj in saveInteraction.save) { + Save saveobj = Save( + sectionName: obj.sectionName, + multipleSectionList: + getMultipleSectionList(obj.sectionList, obj.multipleList!)); + saveList.add(saveobj); + } + + SaveInteractionFormJson saveInteractionFormJson = SaveInteractionFormJson( + interactionForm1: saveInteraction.form!, + intId: saveInteraction.id, + intName: saveInteraction.intName, + save: saveList); + return saveInteractionFormJson; + } +} diff --git a/lib/viewmodel/loginprovider.dart b/lib/viewmodel/loginprovider.dart new file mode 100644 index 0000000..708f247 --- /dev/null +++ b/lib/viewmodel/loginprovider.dart @@ -0,0 +1,37 @@ +import 'package:flutter/foundation.dart'; +import 'package:hive_flutter/hive_flutter.dart'; +import 'package:pwa_ios/model/save_interaction.dart'; +import 'package:pwa_ios/model/userdata_model.dart'; + +class LoginProvider extends ChangeNotifier { + late Box box; + init() {} + Future saveUserData(UserData userData) async { + box = await Hive.openBox('UserDataBox'); + + box.add(userData); + UserData userData2 = await getUserData(); + print(userData2.imageBytes); + } + + Future getUserData() async { + box = await Hive.openBox('UserDataBox'); + Iterable data = box.values; + UserData userData = UserData( + email: '', name: '', domainUrl: '', secretkey: '', imageBytes: ''); + for (var obj in data) { + userData = UserData( + email: obj.email, + name: obj.name, + domainUrl: obj.domainUrl, + imageBytes: obj.imageBytes, + secretkey: obj.secretkey); + } + return userData; + } + + Future deleteUserData() async { + box = await Hive.openBox('UserDataBox'); + box.clear(); + } +} diff --git a/lib/viewmodel/viewinteractionprovider.dart b/lib/viewmodel/viewinteractionprovider.dart new file mode 100644 index 0000000..44109da --- /dev/null +++ b/lib/viewmodel/viewinteractionprovider.dart @@ -0,0 +1,814 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; +import 'package:hive_flutter/hive_flutter.dart'; +import 'package:provider/provider.dart'; +import 'package:pwa_ios/model/interaction_config_data.dart'; + +import 'package:pwa_ios/model/interaction_data.dart'; + +import 'package:pwa_ios/model/json_form_data.dart'; +import 'package:pwa_ios/model/location_model.dart'; +import 'package:pwa_ios/model/save_interaction.dart'; +import 'package:pwa_ios/repository/hive_repository.dart'; +import 'package:pwa_ios/utils/mockapi.dart'; +import 'package:pwa_ios/viewmodel/interactionprovider.dart'; + +import '../utils/util.dart'; + +class ViewInteractionProvider extends ChangeNotifier { + List interactionReponseList = []; + // List sectionList = []; + List sectionList = []; + late Location locationList; + List textEditingControllerList = []; + List multipletextEditingControllerList = []; + int textfieldIndex = 0; + List countryList = []; + List stateList = []; + List cityList = []; + List checkboxlist = []; + String selectedCountry = 'Selected Country'; + String radioValue = ''; + bool checkboxValue = false; + + late SaveInteraction saveInteraction; + List saveData = []; + + List newList = []; + String sectionName = ''; + late String selectedCity = 'Selected City', selectedState = 'Selected State'; + String customdropdownValue = ''; + String? selectedValue; + List selectedItems = []; + InputClass? selectedObj; + List savedList = []; + List intConfigDataList = []; + String? intId, intName; + final HiveDataRepository _hiveprovider = HiveDataRepository( + Hive.box('InteractionConfigDataBox')); + + late final InteractionProvider interactionProvider; + initConfigData() async { + intConfigDataList = _hiveprovider.getAllDataFromHive(); + notifyListeners(); + } + + Future getRecords(String formname) async { + var box = await Hive.openBox('InteractionDataBox'); + savedList = box.values.toList(); + savedList = savedList + .where( + (element) => element.form == formname, + ) + .toList(); + notifyListeners(); + } + + Future> getAllRecords() async { + var box = await Hive.openBox('InteractionDataBox'); + List savedList = box.values.toList(); + + return savedList; + } + + init(int index) async { + // _hiveprovider = HiveDataRepository( + // Hive.box('InteractionConfigDataBox')); + // intConfigDataList = _hiveprovider.getAllDataFromHive(); + InteractionConfigData interactionConfigData = intConfigDataList[index]; + intId = intConfigDataList[index].id; + intName = intConfigDataList[index].name; + + print("data $intConfigDataList"); + // await fetchSaveDataJson(); + // await fetchDataSet(); + await fetchData(interactionConfigData.widgets); + await fetchLocationData(); + } + + initSavedForm(SaveInteraction saveInteractiondata) { + int index = intConfigDataList + .indexWhere((element) => element.id == saveInteractiondata.intId); + InteractionConfigData interactionConfigData = intConfigDataList[index]; + + interactionReponseList = saveInteractiondata.save + .map((e) => FormFieldData( + multipleList: e.multipleList == null + ? [] + : e.multipleList! + .map((mobj) => SectionList( + depid: mobj.depid, + id: mobj.id, + inputList: mobj.inputList, + isRequired: mobj.isRequired, + extension: mobj.extension, + fileName: mobj.fileName, + selectedObject: mobj.selectedObject, + name: mobj.name, + param: mobj.param, + selectedValue: mobj.selectedValue, + widget: mobj.widget, + controller: mobj.controller, + gid: mobj.gid, + input: mobj.input, + selectedId: mobj.selectedId, + value: mobj.value)) + .toList(), + sectionList: e.sectionList + .map((obj) => SectionList( + depid: obj.depid, + id: obj.id, + inputList: obj.inputList, + isRequired: obj.isRequired, + extension: obj.extension, + fileName: obj.fileName, + name: obj.name, + param: obj.param, + selectedObject: obj.selectedObject, + selectedValue: obj.selectedValue, + widget: obj.widget, + controller: obj.controller, + gid: obj.gid, + input: obj.input, + selectedId: obj.selectedId, + value: obj.value)) + .toList(), + sectionName: e.sectionName, + multiple: e.multiple)) + .toList(); + + textEditingControllerList.clear(); + + for (var item in interactionReponseList) { + sectionList = item.sectionList; + + for (SectionList obj in item.multipleList!) { + obj.gid = obj.gid ?? item.multipleList!.length; + if (obj.widget == InteractionWidget.TEXT) { + var textEditingController = TextEditingController(); + textEditingController.text = obj.selectedValue!.isNotEmpty + ? obj.selectedValue!.last ?? "" + : ""; + multipletextEditingControllerList.add(textEditingController); + obj.controller = multipletextEditingControllerList.last; + // obj.controller = obj.selectedValue.last ?? " "; + } + if (obj.widget == InteractionWidget.DROPDOWN || + obj.widget == InteractionWidget.AUTOCOMPLETE || + obj.widget == InteractionWidget.MULTISELECT) { + List list = obj.inputList!; + if (obj.selectedObject != null) { + } else { + obj.selectedObject = obj.selectedValue!.isNotEmpty + ? getDataObject(obj.id, obj.selectedValue!.last, list) + : list[0]; + } + + print("value : ${list.first.name} "); + } + if (obj.widget == InteractionWidget.CHECKBOX) { + List selectedvalues = []; + if (obj.selectedValue!.isNotEmpty) { + for (var id in obj.selectedValue!) { + int ind = + obj.inputList!.indexWhere((element) => element.id == id); + if (ind != -1) { + obj.inputList![ind].ischecked = true; + selectedvalues.add(obj.inputList![ind].name); + } + } + } + } + if (obj.widget == InteractionWidget.RADIO) { + List list = obj.inputList!; + + if (obj.selectedValue!.isNotEmpty) { + int ind = list + .indexWhere((element) => element.id == obj.selectedValue!.last); + if (ind != -1) { + obj.inputList![ind].ischecked = true; + radioValue = obj.inputList![ind].name; + } + } + } + // newList.add(obj); + } + for (var sectionItem in item.sectionList) { + if (sectionItem.widget == InteractionWidget.TEXT) { + var textEditingController = TextEditingController(); + textEditingController.text = sectionItem.selectedValue!.isNotEmpty + ? sectionItem.selectedValue!.last ?? "empty" + : "empty"; + textEditingControllerList.add(textEditingController); + + sectionItem.controller = textEditingControllerList.last; + } + if (sectionItem.widget == InteractionWidget.DROPDOWN) { + List list = sectionItem.inputList!; + if (sectionItem.selectedObject != null) { + print("not null"); + } else { + sectionItem.selectedObject = sectionItem.selectedValue!.isNotEmpty + ? getDataObject( + sectionItem.id, sectionItem.selectedValue!.last, list) + : list[0]; + } + + print("valuesssss : ${sectionItem.selectedObject!.name} "); + } + + if (sectionItem.widget == InteractionWidget.AUTOCOMPLETE || + sectionItem.widget == InteractionWidget.MULTISELECT) { + List list = sectionItem.inputList!; + if (sectionItem.selectedObject != null) { + } else { + sectionItem.selectedObject = sectionItem.selectedValue!.isNotEmpty + ? getDataObject( + sectionItem.id, sectionItem.selectedValue!.last, list) + : list[0]; + } + + print("value : ${list.first.name} "); + } + if (sectionItem.widget == InteractionWidget.CHECKBOX) { + List selectedvalues = []; + if (sectionItem.selectedValue!.isNotEmpty) { + for (var id in sectionItem.selectedValue!) { + int ind = sectionItem.inputList! + .indexWhere((element) => element.id == id); + if (ind != -1) { + sectionItem.inputList![ind].ischecked = true; + selectedvalues.add(sectionItem.inputList![ind].name); + } + } + } + } + if (sectionItem.widget == InteractionWidget.RADIO) { + List list = sectionItem.inputList!; + + if (sectionItem.selectedValue!.isNotEmpty) { + int ind = list.indexWhere( + (element) => element.id == sectionItem.selectedValue!.last); + if (ind != -1) { + sectionItem.inputList![ind].ischecked = true; + radioValue = sectionItem.inputList![ind].name; + } + } + } + if (sectionItem.widget == InteractionWidget.BUTTON && + sectionItem.param == 'chooseFile' && + sectionItem.selectedValue!.isNotEmpty) { + print("choosed file"); + print(sectionItem.selectedValue!.last); + } + } + } + print(interactionReponseList); + print("check textcontrollers ${textEditingControllerList.length}"); + } + + // Future fetchSaveDataJson() async { + // dynamic jsonResult = jsonDecode( + // await rootBundle.loadString("assets/images/saveinteractiondata.json")); + + // // for (var value in jsonResult) { + // saveInteraction = SaveInteraction.fromJson(jsonResult); + // saveData = saveInteraction.save; + // await fetchLocationData(); + // return "success"; + // } + + Future fetchDataSet() async { + dynamic jsonResult = jsonDecode( + await rootBundle.loadString("assets/images/interactiondata.json")); + // for (var value in jsonResult) { + + List list = getData("intlocation_1"); + print(list); + return "success"; + } + + List getData(String widgetId) { + List list = []; + + return list; + } + + InputClass getDataObject(String widgetId, String id, List list) { + // if (id != "") { + // List list = []; + InputClass value = InputClass(id: '', name: ''); + + if (list.isNotEmpty) { + int index = list.indexWhere((element) => element.id.toString() == id); + + if (index != -1) { + value = list[index]; + } + } + + return value; + } + +// TODO: Search for widget with depid and check if selected is not null and by selected id get the data of current widget + List getData2(SectionList sectionItem) { + List list = []; + // if (sectionItem.inputList != null) { + list = sectionItem.inputList!; + if (sectionItem.depid != "") { + // print("check depid : ${sectionItem.depid}"); + int i = 0; + for (var obj in interactionReponseList) { + i = obj.sectionList + .indexWhere((element) => element.id == sectionItem.depid); + // print("check depid index: $i"); + if (i != -1) { + //print("check depid value: ${obj.sectionList[i].value}"); + if (obj.sectionList[i].value != null) { + if (list + .where((element) => element.pid == obj.sectionList[i].value) + .isNotEmpty) { + list = list + .where((element) => element.pid == obj.sectionList[i].value) + .toList(); + + sectionItem.selectedObject = list[0]; + } else { + // InputClass obj = InputClass( + // id: "obj.sectionList[i].value", + // name: "Select ${sectionItem.name}"); + list = []; + // list.add(obj); + sectionItem.selectedObject = null; + } + } else { + // int index = obj.sectionList + // .indexWhere((element) => element.id == sectionItem.id); + + // list = obj.sectionList[index].inputList; + } + } + } + + // int index = data[i].data.indexWhere((element) => element.) + } + // } + return list; + } + + setDropDownValue(String value, SectionList sectionItem, bool multiple, + InputClass selectedObject) { + int i = 0; + for (var obj in interactionReponseList) { + if (multiple && obj.multipleList != null) { + i = obj.multipleList! + .indexWhere((element) => element.id == sectionItem.id); + if (i != -1) { + obj.multipleList![i].value = value; + obj.multipleList![i].tempselectedValue = []; + obj.multipleList![i].tempselectedValue!.add(value); + // obj.multipleList![i].selectedObject = selectedObj; + } + } else { + i = obj.sectionList + .indexWhere((element) => element.id == sectionItem.id); + if (i != -1) { + obj.sectionList[i].value = value; + obj.sectionList[i].tempselectedValue = []; + obj.sectionList[i].tempselectedValue!.add(value); + // obj.sectionList[i].selectedObject = selectedObj; + } + } + } + notifyListeners(); + } + + Future disposeValues() async { + print("dispose called"); + await _hiveprovider.closeHiveBox(); + for (var obj in interactionReponseList) { + obj.multipleList!.clear(); + // for (var obj2 in obj.sectionList) { + // obj2.selectedObject = null; + // } + + obj.sectionList.clear(); + } + interactionReponseList.clear(); + } + + setTextValue(String value, SectionList sectionItem, bool multiple) { + int i = 0; + for (var obj in interactionReponseList) { + if (multiple && obj.multipleList != null) { + i = obj.multipleList! + .indexWhere((element) => element.id == sectionItem.id); + if (i != -1) { + obj.multipleList![i].value = value; + obj.multipleList![i].selectedValue!.add(value); + } + } else { + i = obj.sectionList + .indexWhere((element) => element.id == sectionItem.id); + if (i != -1) { + obj.sectionList[i].value = value; + obj.sectionList[i].selectedValue!.add(value); + } + } + } + notifyListeners(); + } + + setAutoCompleteValue(String value, SectionList sectionItem, bool multiple) { + int i = 0; + for (var obj in interactionReponseList) { + if (multiple && obj.multipleList != null) { + i = obj.multipleList! + .indexWhere((element) => element.id == sectionItem.id); + if (i != -1) { + obj.multipleList![i].value = value; + obj.multipleList![i].tempselectedValue = []; + obj.multipleList![i].tempselectedValue!.add(value); + } + } else { + i = obj.sectionList + .indexWhere((element) => element.id == sectionItem.id); + if (i != -1) { + obj.sectionList[i].value = value; + obj.sectionList[i].tempselectedValue = []; + obj.sectionList[i].tempselectedValue!.add(value); + } + } + } + notifyListeners(); + } + + String getDropDownValue( + String value, SectionList sectionItem, List list) { + int i = 0; + String svalue = ''; + + i = list.indexWhere((element) => element.id == value); + if (i != -1) { + svalue = list[i].name; + } else { + svalue = list[0].name; + } + + return svalue; + } + + Future fetchData(InteractionResultData interactionResultData) async { + dynamic jsonResult = jsonDecode( + await rootBundle.loadString("assets/images/interactionform.json")); + + InteractionResultData interactionConfig = interactionResultData; + + print("itemCategoryModel Item = + ${interactionConfig.result}"); + + interactionReponseList = interactionConfig.result; + print("check stored: $interactionReponseList"); + textEditingControllerList.clear(); + + for (var item in interactionReponseList) { + sectionList = item.sectionList; + for (var sectionItem in item.sectionList) { + if (sectionItem.widget == InteractionWidget.TEXT) { + var textEditingController = TextEditingController(); + + textEditingControllerList.add(textEditingController); + sectionItem.controller = textEditingControllerList.last; + } + if (sectionItem.widget == InteractionWidget.DROPDOWN || + sectionItem.widget == InteractionWidget.AUTOCOMPLETE || + sectionItem.widget == InteractionWidget.MULTISELECT) { + List list = sectionItem.inputList!; + sectionItem.value = list[0].name; + print("value : ${list.first} "); + } + } + } + print(interactionReponseList); + print("check textcontrollers ${textEditingControllerList.length}"); + + return "success"; + } + + Future fetchLocationData() async { + var data = + await rootBundle.loadString("assets/images/locationdetailsform.json"); + + Locations loc = + Locations(location: Location.fromJson(json.decode(data)["location"])); + locationList = loc.location; + countryList = locationList.country; + stateList = locationList.state; + cityList = locationList.city; + + print(locationList); + notifyListeners(); + return "success"; + } + + List getState(String cid) { + List states = + stateList.where((element) => element.countryId == cid).toList(); + + return states; + } + + List getCity(String sid) { + List city = + cityList.where((element) => element.stateId == sid).toList(); + + return city; + } + + String getCountryId(String name) { + if (countryList.isNotEmpty) { + int i = countryList.indexWhere((element) => element.countryName == name); + return countryList[i].countryId; + } + return ''; + } + + String getStateId(String name) { + if (stateList.isNotEmpty) { + int i = stateList.indexWhere((element) => element.stateName == name); + return stateList[i].stateId; + } + return ''; + } + + String getCityId(String name) { + if (cityList.isNotEmpty) { + int i = cityList.indexWhere((element) => element.cityName == name); + return cityList[i].distId; + } + return ''; + } + + setRadioValue(SectionList sectionItem) { + List list = (sectionItem.input as List) + .map((itemWord) => InputClass.fromJson(itemWord)) + .toList(); + radioValue = list[0].name; + + notifyListeners(); + } + + setcheckBoxValue(SectionList sectionItem, String sectionName, bool newValue, + String id, bool multiple) { + int index = + sectionItem.inputList!.indexWhere((element) => element.id == id); + sectionItem.inputList![index].ischecked = newValue; + // sectionItem.selectedValue.add(data[i].data[index].id); + int index2 = 0; + for (var obj in interactionReponseList) { + if (multiple && obj.multipleList != null) { + index2 = obj.multipleList! + .indexWhere((element) => element.id == sectionItem.id); + if (index2 != -1) { + obj.multipleList![index2].value = sectionItem.inputList![index].id; + obj.multipleList![index2].selectedValue! + .add(sectionItem.inputList![index].id); + } + } else { + index2 = obj.sectionList + .indexWhere((element) => element.id == sectionItem.id); + if (index2 != -1) { + obj.sectionList[index2].value = sectionItem.inputList![index].id; + obj.sectionList[index2].selectedValue! + .add(sectionItem.inputList![index].id); + } + } + } + notifyListeners(); + } + + getSectionItem(String sectionName) { + newList = []; + List addList = []; + int index = interactionReponseList + .indexWhere((element) => element.sectionName == sectionName); + + addList = interactionReponseList[index] + .sectionList + .map((e) => SectionList( + depid: e.depid, + id: e.id, + inputList: e.inputList, + isRequired: e.isRequired, + name: e.name, + param: e.param, + selectedValue: [], + widget: e.widget, + controller: e.controller, + gid: e.gid, + input: e.input, + selectedId: e.selectedId, + value: e.value)) + .toList(); + SectionList delItem = SectionList( + name: "delete", + param: "deletebtn", + id: "deletebtn", + selectedValue: [], + depid: "", + widget: InteractionWidget.BUTTON, + inputList: [], + isRequired: true); + + addList.add(delItem); + + // if (interactionReponseList[index].multipleList!.isEmpty) { + // newList = addList; + // } else { + if (interactionReponseList[index].multipleList == null) { + interactionReponseList[index].multipleList = addList; + } else { + interactionReponseList[index].multipleList = + interactionReponseList[index].multipleList! + addList; + } + + newList = interactionReponseList[index].multipleList!; + // newList = newList + addList; + // } + if (interactionReponseList[index].multipleList != null) { + for (SectionList obj in interactionReponseList[index].multipleList!) { + obj.gid = obj.gid ?? interactionReponseList[index].multipleList!.length; + if (obj.widget == InteractionWidget.TEXT) { + var textEditingController = TextEditingController(); + + multipletextEditingControllerList.add(textEditingController); + obj.controller = multipletextEditingControllerList.last; + obj.controller!.text = + obj.selectedValue != null && obj.selectedValue!.isNotEmpty + ? obj.selectedValue!.last + : ''; + } + // newList.add(obj); + } + } + + print( + "check length : ${interactionReponseList[index].multipleList!.length}"); + notifyListeners(); + } + + deleteMultipleRows( + int gid, SectionList sectionItem, String selectedSectionName) { + int index = interactionReponseList + .indexWhere((element) => element.sectionName == selectedSectionName); + interactionReponseList[index] + .multipleList! + .removeWhere((item) => item.gid == gid); + + notifyListeners(); + } + + saveJsonObject(BuildContext context, String form, + SaveInteraction saveInteraction) async { + List resultData = interactionReponseList + .map((e) => FormFieldData( + multipleList: e.multipleList == null + ? [] + : e.multipleList! + .map((mobj) => SectionList( + depid: mobj.depid, + id: mobj.id, + inputList: mobj.inputList, + isRequired: mobj.isRequired, + extension: mobj.extension, + fileName: mobj.fileName, + name: mobj.name, + param: mobj.param, + selectedValue: + mobj.tempselectedValue ?? mobj.selectedValue, + widget: mobj.widget, + gid: mobj.gid, + input: mobj.input, + selectedId: mobj.selectedId, + value: mobj.value)) + .toList(), + sectionList: e.sectionList + .map((obj) => SectionList( + depid: obj.depid, + id: obj.id, + inputList: obj.inputList, + extension: obj.extension, + fileName: obj.fileName, + isRequired: obj.isRequired, + name: obj.name, + param: obj.param, + selectedValue: obj.tempselectedValue ?? obj.selectedValue, + widget: obj.widget, + controller: obj.controller, + gid: obj.gid, + input: obj.input, + selectedId: obj.selectedId, + value: obj.value)) + .toList(), + sectionName: e.sectionName, + multiple: e.multiple, + )) + .toList(); + + final data = SaveInteraction( + save: resultData, + id: saveInteraction.id, + updatedTime: DateTime.now().toString(), + form: saveInteraction.form, + intId: saveInteraction.intId, + intName: saveInteraction.intName, + ); + + var box = await Hive.openBox('InteractionDataBox'); + // box.put(await getNextAutoIncrementValue(), data); + + int index = + box.values.toList().indexWhere((element) => element.id == data.id); + + box.putAt(index, data); + await getRecords(saveInteraction.form!); + box.close(); + + // await MockApiCall().postFormData(data); + } + + Future deleteRecord(SaveInteraction saveInteraction) async { + var box = await Hive.openBox('InteractionDataBox'); + final Map deliveriesmap = box.toMap(); + dynamic deleteKey; + deliveriesmap.forEach((key, value) { + if (value.id == saveInteraction.id) { + deleteKey = key; + } + }); + box.delete(deleteKey); + await getRecords(saveInteraction.form!); + box.close(); + } + + List getModifiedList(List sectionList) { + List newSectionList = []; + for (var obj in sectionList) { + if (obj.id != 'deletebtn') { + if (obj.id == 'chooseFile') { + List files = []; + if (obj.selectedValue!.isNotEmpty && obj.selectedValue != null) { + for (var file in obj.selectedValue!) { + files.add(MultipartFile.fromFileSync(file)); + } + } + MultipleSectionList newobj = MultipleSectionList( + id: obj.id, + selectedValue: files, + ); + + newSectionList.add(newobj); + } else { + MultipleSectionList newobj = MultipleSectionList( + id: obj.id, + selectedValue: obj.selectedValue!, + ); + newSectionList.add(newobj); + } + } + } + return newSectionList; + } + + bool validateMultipleRows() { + for (var obj in interactionReponseList) { + if (obj.multipleList != null) { + for (var mulobj in obj.multipleList!) { + if (mulobj.widget == InteractionWidget.TEXT) { + if (mulobj.controller!.text.isEmpty) { + return true; + } + } + } + } + } + return false; + } + + bool validateTextFields() { + for (var obj in interactionReponseList) { + for (var mulobj in obj.sectionList) { + if (mulobj.widget == InteractionWidget.TEXT) { + if (mulobj.controller!.text.isEmpty) { + return true; + } + } + } + } + return false; + } +} diff --git a/lib/views/home_screen.dart b/lib/views/home_screen.dart new file mode 100644 index 0000000..fd23d2d --- /dev/null +++ b/lib/views/home_screen.dart @@ -0,0 +1,98 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:pwa_ios/utils/apicall.dart'; +import 'package:pwa_ios/main.dart'; +import 'package:pwa_ios/views/interaction_module/interaction_screen.dart'; +import 'package:pwa_ios/views/interaction_module/interactionlistscreen.dart'; +import 'package:pwa_ios/views/konectarpage.dart'; +import 'package:pwa_ios/views/notification_screen.dart'; +import 'package:pwa_ios/views/notifications.dart'; +import 'package:pwa_ios/views/profile.dart'; +import 'package:pwa_ios/views/webview_example.dart'; + +class HomeScreen extends StatefulWidget { + const HomeScreen({super.key}); + + @override + State createState() => _HomeScreenState(); +} + +class _HomeScreenState extends State { + int _selectedIndex = 0; + + void _onItemTapped(int index) { + setState(() { + _selectedIndex = index; + }); + } + + @override + void initState() { + // TODO: implement initState + super.initState(); + // WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + // init(); + // }); + } + + init() async { + await ApiCall().parseInfo(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + bottomNavigationBar: BottomNavigationBar( + type: BottomNavigationBarType.fixed, + currentIndex: _selectedIndex, + //backgroundColor: Color.fromARGB(255, 35, 79, 150), + selectedItemColor: Color.fromARGB(255, 35, 79, 150), + unselectedItemColor: Color.fromARGB(255, 153, 153, 163), + iconSize: 40, + onTap: _onItemTapped, + elevation: 1, + items: [ + BottomNavigationBarItem( + icon: Container( + width: 30, + height: 30, + child: Image.asset( + "assets/images/konectar.png", + ), + ), + label: 'Konectar', + backgroundColor: Color.fromARGB(255, 168, 170, 173)), + // const BottomNavigationBarItem( + // icon: Icon( + // Icons.notifications, + // size: 30, + // ), + // label: 'Notifications', + // backgroundColor: Colors.blue, + // ), + const BottomNavigationBarItem( + icon: Icon( + Icons.edit_document, + size: 30, + ), + label: 'Add Record', + backgroundColor: Colors.blue, + ), + const BottomNavigationBarItem( + icon: Icon( + Icons.settings, + size: 30, + ), + label: 'Settings', + backgroundColor: Color.fromARGB(255, 168, 170, 173), + ), + ]), + body: _selectedIndex == 0 + ? const MyApp() + : _selectedIndex == 1 + ? const InteractionListScreen() + : const ProfileScreen(), + ); + } +} diff --git a/lib/views/htmlpage.dart b/lib/views/htmlpage.dart new file mode 100644 index 0000000..f034c10 --- /dev/null +++ b/lib/views/htmlpage.dart @@ -0,0 +1,313 @@ +class HtmlPage { + static const htmlCode = """ + + +W3.CSS Template + + + + + + + + + + + + + +
+ + +
+ + +
+ + +
+

My Portfolio

+
+ Filter: + + + + +
+
+
+ + +
+
+ Norway +
+

Lorem Ipsum

+

Praesent tincidunt sed tellus ut rutrum. Sed vitae justo condimentum, porta lectus vitae, ultricies congue gravida diam non fringilla.

+
+
+
+ Norway +
+

Lorem Ipsum

+

Praesent tincidunt sed tellus ut rutrum. Sed vitae justo condimentum, porta lectus vitae, ultricies congue gravida diam non fringilla.

+
+
+
+ Norway +
+

Lorem Ipsum

+

Praesent tincidunt sed tellus ut rutrum. Sed vitae justo condimentum, porta lectus vitae, ultricies congue gravida diam non fringilla.

+
+
+
+ + +
+
+ Norway +
+

Lorem Ipsum

+

Praesent tincidunt sed tellus ut rutrum. Sed vitae justo condimentum, porta lectus vitae, ultricies congue gravida diam non fringilla.

+
+
+
+ Norway +
+

Lorem Ipsum

+

Praesent tincidunt sed tellus ut rutrum. Sed vitae justo condimentum, porta lectus vitae, ultricies congue gravida diam non fringilla.

+
+
+
+ Norway +
+

Lorem Ipsum

+

Praesent tincidunt sed tellus ut rutrum. Sed vitae justo condimentum, porta lectus vitae, ultricies congue gravida diam non fringilla.

+
+
+
+ + +
+
+ « + 1 + 2 + 3 + 4 + » +
+
+ + +
+
+ Me +
+
+ Me +
+
+ +
+

About Me

+

Just me, myself and I, exploring the universe of unknownment. I have a heart of love and an interest of lorem ipsum and mauris neque quam blog. I want to share my world with you. Praesent tincidunt sed tellus ut rutrum. Sed vitae justo condimentum, porta lectus vitae, ultricies congue gravida diam non fringilla. Praesent tincidunt sed tellus ut rutrum. Sed vitae justo condimentum, porta lectus vitae, ultricies congue gravida diam non fringilla.

+
+ +

Technical Skills

+ +

Photography

+
+
95%
+
+

Web Design

+
+
85%
+
+

Photoshop

+
+
80%
+
+

+ +

+
+ +

How much I charge

+ +
+
+
    +
  • Basic
  • +
  • Web Design
  • +
  • Photography
  • +
  • 1GB Storage
  • +
  • Mail Support
  • +
  • +

    \$ 10

    + per month +
  • +
  • + +
  • +
+
+ +
+
    +
  • Pro
  • +
  • Web Design
  • +
  • Photography
  • +
  • 50GB Storage
  • +
  • Endless Support
  • +
  • +

    \$ 25

    + per month +
  • +
  • + +
  • +
+
+ +
+
    +
  • Premium
  • +
  • Web Design
  • +
  • Photography
  • +
  • Unlimited Storage
  • +
  • Endless Support
  • +
  • +

    \$ 25

    + per month +
  • +
  • + +
  • +
+
+
+
+ + +
+

Contact Me

+
+
+

+

email@email.com

+
+
+

+

Chicago, US

+
+
+

+

512312311

+
+
+
+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+ + +
+
+
+

FOOTER

+

Praesent tincidunt sed tellus ut rutrum. Sed vitae justo condimentum, porta lectus vitae, ultricies congue gravida diam non fringilla.

+

Powered by w3.css

+
+ +
+

BLOG POSTS

+
    +
  • + + Lorem
    + Sed mattis nunc +
  • +
  • + + Ipsum
    + Praes tinci sed +
  • +
+
+ +
+

POPULAR TAGS

+

+ Travel New York London + IKEA NORWAY DIY + Ideas Baby Family + News Clothing Shopping + Sports Games +

+
+ +
+
+ +
Powered by w3.css
+ + +
+ + + + + +"""; +} diff --git a/lib/views/interaction_module/edit_interaction_screen.dart b/lib/views/interaction_module/edit_interaction_screen.dart new file mode 100644 index 0000000..c577483 --- /dev/null +++ b/lib/views/interaction_module/edit_interaction_screen.dart @@ -0,0 +1,1221 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:intl/intl.dart'; +import 'package:path_provider/path_provider.dart'; +import 'package:provider/provider.dart'; +import 'package:dropdown_button2/dropdown_button2.dart'; +import 'package:pwa_ios/model/interaction_data.dart'; +import 'package:pwa_ios/model/save_interaction.dart'; +import 'package:pwa_ios/utils/util.dart'; +import 'package:pwa_ios/viewmodel/viewinteractionprovider.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:pwa_ios/widgets/custombutton.dart'; +import 'package:pwa_ios/widgets/customrangeslider.dart'; +import 'package:pwa_ios/widgets/interatciontextfield.dart'; +import 'package:file_picker/file_picker.dart'; +import 'package:pwa_ios/widgets/responsive_ext.dart'; +import 'package:path/path.dart' as p; + +class EditInteractionScreen extends StatefulWidget { + // int index; + // String form; + SaveInteraction saveInteraction; + EditInteractionScreen( + {super.key, + // required this.index, + // required this.form, + required this.saveInteraction}); + + @override + State createState() => _EditInteractionScreenState(); +} + +class _EditInteractionScreenState extends State { + List interactionReponseList = []; + List sectionList = []; + List textEditingControllerList = []; + int textfieldIndex = 0; + String dropdownvalue = 'Select value'; + String? fileName; + final TextEditingController textEditingController = TextEditingController(); + + @override + void dispose() { + super.dispose(); + + // WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + // Provider.of(context, listen: false).dispose(); + // }); + } + + @override + void initState() { + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + // initConfig(); + init(); + }); + + super.initState(); + } + + initConfig() async { + // await Provider.of(context, listen: false) + // .init(widget.index); + await Provider.of(context, listen: false) + .initConfigData(); + + // setState(() {}); + } + + init() async { + // await Provider.of(context, listen: false) + // .init(widget.index); + + await Provider.of(context, listen: false) + .initSavedForm(widget.saveInteraction); + setState(() {}); + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (BuildContext context, provider, Widget? child) { + // print("build context"); + // print("${provider.interactionReponseList}"); + return GestureDetector( + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: OrientationBuilder(builder: (context, orientation) { + return Scaffold( + //resizeToAvoidBottomInset: false, + appBar: AppBar( + title: Text( + '${widget.saveInteraction.id}', + style: TextStyle( + fontSize: isTablet ? 22 : 14, color: Colors.white), + ), + backgroundColor: const Color(0xFF2b9af3), + automaticallyImplyLeading: false, + actions: [saveActions(provider)], + leading: InkWell( + onTap: () async { + await provider.disposeValues().then((value) { + Navigator.pop(context); + }); + }, + child: const Icon( + Icons.arrow_back_ios, + color: Colors.white, + ), + ), + ), + body: Column( + children: [ + Expanded( + child: ListView.builder( + itemCount: provider.interactionReponseList.length, + padding: EdgeInsets.zero, + cacheExtent: double.parse( + provider.interactionReponseList.length.toString()), + itemBuilder: (context, index) { + var item = provider.interactionReponseList[index]; + sectionList = item.sectionList; + return Card( + child: ExpansionTile( + maintainState: true, + // backgroundColor: Colors.white, + // collapsedBackgroundColor: Color(0xFF2b9af3), + initiallyExpanded: true, + title: Stack( + alignment: AlignmentDirectional.center, + children: [ + Container( + // height: double.infinity, + width: double.infinity, + padding: const EdgeInsets.all(8.0), + decoration: const BoxDecoration( + color: Color(0xFF2b9af3), + ), + child: Text( + item.sectionName, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 18.0), + )), + item.multiple + ? Align( + alignment: Alignment.centerRight, + child: IconButton( + onPressed: () { + provider.getSectionItem( + item.sectionName); + // print("index is $listIndex"); + setState(() { + // for (var item + }); + }, + icon: const Icon( + Icons.add_circle_outline, + size: 30, + color: Colors.white, + ), + ), + ) + : const SizedBox.shrink() + ]), + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + const SizedBox( + height: 20, + ), + + Padding( + padding: isTablet + ? const EdgeInsets.only(left: 14.0) + : const EdgeInsets.only( + left: 12.0, right: 12.0), + child: GridView.count( + physics: + const NeverScrollableScrollPhysics(), + crossAxisCount: + context.responsive( + 1, + sm: 1, // small + md: 1, // medium + lg: sectionList.length == 1 + ? 1 + : 4, // large + xl: 3, // extra large screen + ), + mainAxisSpacing: + sectionList.length == 1 || + !isTablet + ? 1 + : 3.5, + shrinkWrap: true, + padding: EdgeInsets.zero, + childAspectRatio: + sectionList.length == 1 || + !isTablet + ? orientation == + Orientation.landscape + ? 10 + : 3.8 + : 2.4, + children: List.generate( + sectionList.length, + (i) { + // print(sectionList); + SectionList sectionItem = + sectionList[i]; + dropdownvalue = sectionItem + .widget == + InteractionWidget.DROPDOWN + ? sectionItem.value ?? + "Select" + : ' '; + List< + InputClass> list = sectionItem + .widget == + InteractionWidget + .DROPDOWN || + sectionItem.widget == + InteractionWidget + .AUTOCOMPLETE || + sectionItem.widget == + InteractionWidget + .MULTISELECT + ? provider + .getData2(sectionItem) + : []; + provider.checkboxlist = + sectionItem.widget == + InteractionWidget + .CHECKBOX + ? provider + .getData2(sectionItem) + : []; + + return Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + sectionItem.widget == + InteractionWidget + .BUTTON && + sectionItem.input == + 'add' + ? const SizedBox.shrink() + : Text( + '${sectionItem.name}:*', + style: TextStyle( + color: Colors.orange + .shade800, + fontSize: isTablet + ? 18 + : 12, + ), + ), + SizedBox( + height: isTablet ? 15 : 5, + ), + returnWidget( + sectionItem: sectionItem, + item: item, + provider: provider, + list: list, + gridIndex: i, + listIndex: index, + widgetData: + sectionItem.widget!, + multiple: false), + // SizedBox( + // height: isTablet ? 15 : 5, + // ), + ], + ); + }, + ), + ), + ), + SizedBox( + height: isTablet ? 15 : 5, + ), + item.multiple + ? gridViewWidget( + provider, + item.sectionName, + item.multipleList ?? [], + orientation, + item, + index) + : const SizedBox.shrink(), + provider.interactionReponseList.length == + index - 1 + ? saveActions(provider) + : const SizedBox.shrink() + //const Spacer(), + ], + ), + ), + ]), + ); + }, + ), + ), + // const Spacer(), + // saveActions(provider), + ], + )); + }), + ); + }); + } + + Widget returnWidget({ + required SectionList sectionItem, + required FormFieldData item, + required ViewInteractionProvider provider, + required List list, + required int gridIndex, + required int listIndex, + required InteractionWidget widgetData, + required bool multiple, + }) { + switch (widgetData) { + case InteractionWidget.CHECKBOX: + return buildCheckbox(sectionItem, item.sectionName, provider, multiple); + + case InteractionWidget.AUTOCOMPLETE: + return customAutoCompletedropdown( + sectionItem, provider, list, multiple); + + case InteractionWidget.MULTISELECT: + return customMultiselectDropdown(sectionItem, provider, list, multiple); + + case InteractionWidget.RADIO: + return buildRadio(sectionItem, provider); + + case InteractionWidget.LABEL: + return Text(sectionItem.input!); + + case InteractionWidget.RANGESLIDER: + return CustomRangeSlider( + sliderPos: sectionItem.selectedValue!.isNotEmpty + ? double.parse(sectionItem.selectedValue!.last.toString()) + : 10.0, + onChanged: (val) { + setState(() { + sectionItem.selectedValue = []; + sectionItem.selectedId = val.toString(); + sectionItem.selectedValue!.add(val.toInt()); + }); + }, + ); + + case InteractionWidget.BUTTON: + return sectionItem.input == 'add' + ? const Offstage( + offstage: true, + child: Text("Visible"), + ) + : Row( + children: [ + CustomButton( + backgroundColor: const Color.fromARGB(255, 233, 229, 229), + onPressed: () async { + if (sectionItem.selectedValue!.isNotEmpty) { + showFilesAlertDialog(context, + sectionItem.fileName!.join(','), sectionItem); + } else { + sectionItem.selectedValue = []; + sectionItem.extension = []; + sectionItem.fileName = []; + await getEncodedFile(sectionItem); + } + + setState(() {}); + }, + width: 120, + height: 40, + fontsize: 12, + textColor: Colors.black, + title: sectionItem.name), + const SizedBox( + width: 5, + ), + Text( + sectionItem.selectedValue!.isNotEmpty + ? 'File Uploaded' + : 'No file uploaded', + style: TextStyle( + color: sectionItem.selectedValue!.isNotEmpty + ? Colors.green + : Colors.red), + ), + ], + ); + + case InteractionWidget.TEXT: + return sectionItem.input == 'Date' + ? buildDateWidget(sectionItem) + : sectionItem.input == "textArea" + ? Expanded( + child: InteractionTextField( + maxchars: int.parse(sectionItem.chars ?? "0"), + controller: sectionItem.controller!, + labelText: sectionItem.name, + maxlines: 4, + minlines: 3, + onChanged: (val) { + sectionItem.selectedValue = []; + setState(() {}); + + sectionItem.selectedValue!.add(val); + }, + ), + ) + : SizedBox( + width: isTablet ? 200 : MediaQuery.of(context).size.width, + height: isTablet ? 50 : 40, + child: InteractionTextField( + maxchars: int.parse(sectionItem.chars ?? "0"), + controller: sectionItem.controller!, + inputType: sectionItem.input == "number" + ? TextInputType.number + : TextInputType.none, + labelText: sectionItem.name, + onChanged: (val) { + sectionItem.selectedValue = []; + provider.setTextValue(val, sectionItem, multiple); + }, + ), + ); + default: + return customdropdown(sectionItem, provider, list, multiple); + } + } + + Widget buildDateWidget(SectionList sectionItem) { + return SizedBox( + width: isTablet ? 200 : MediaQuery.of(context).size.width, + height: isTablet ? 50 : 40, + child: TextField( + controller: + sectionItem.controller, //editing controller of this TextField + decoration: InputDecoration( + // border: OutlineInputBorder(), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10.0), + ), + labelStyle: TextStyle(fontSize: 16), + suffixIcon: Icon(Icons.calendar_today), //icon of text field + labelText: "Enter Date" //label text of field + ), + readOnly: true, //set it true, so that user will not able to edit text + onTap: () async { + DateTime? pickedDate = await showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime( + 2000), //DateTime.now() - not to allow to choose before today. + lastDate: DateTime(2101)); + + if (pickedDate != null) { + print( + pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000 + String formattedDate = DateFormat('yyyy-MM-dd').format(pickedDate); + print( + formattedDate); //formatted date output using intl package => 2021-03-16 + //you can implement different kind of Date Format here according to your requirement + + setState(() { + sectionItem.controller!.text = formattedDate; + sectionItem.selectedValue = []; + sectionItem.selectedValue! + .add(formattedDate); //set output date to TextField value. + }); + } else { + print("Date is not selected"); + } + }, + ), + ); + } + + Widget saveActions(ViewInteractionProvider provider) { + return Align( + alignment: Alignment.centerRight, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + CustomButton( + backgroundColor: Colors.green.shade900, + onPressed: () async { + if (textFieldsValidation(provider).isEmpty) { + await provider.saveJsonObject(context, + widget.saveInteraction.intId, widget.saveInteraction); + showAlertDialog(context, widget.saveInteraction.id!); + } else { + _displaySnackBar(textFieldsValidation(provider)); + } + }, + textColor: Colors.white, + title: "Update", + height: 40, + width: isTablet ? 120 : 80, + fontsize: isTablet ? 15 : 12, + ), + SizedBox( + width: isTablet ? 20 : 2, + ), + ], + ), + ); + } + + Widget buildRadio(SectionList sectionItem, ViewInteractionProvider provider) { + List list = provider.getData2(sectionItem); + // .map((itemWord) => InputClass.fromJson(itemWord)) + // .toList(); + return SizedBox( + width: isTablet ? 250 : MediaQuery.of(context).size.width, + child: Row( + children: [ + for (InputClass value in list) + Row( + children: [ + Radio( + value: value.name, + activeColor: Colors.black, + groupValue: provider.radioValue, + onChanged: (String? value) { + setState(() { + // print(value); + provider.radioValue = value!; + int index = + list.indexWhere((element) => element.name == value); + sectionItem.selectedValue!.add(list[index].id); + }); + }, + ), + Text('${value.name}'), + ], + ), + ], + ), + ); + } + + Widget buildCheckbox(SectionList sectionItem, String sectionName, + ViewInteractionProvider provider, bool multiple) { + return SizedBox( + width: 250, + child: Row( + children: [ + for (var value in provider.checkboxlist) + Row( + children: [ + Checkbox( + value: value.ischecked ?? false, + activeColor: Colors.black, + checkColor: Colors.white, + onChanged: (bool? newvalue) { + value.ischecked = newvalue!; + provider.setcheckBoxValue( + sectionItem, sectionName, newvalue, value.id, multiple); + //setState(() {}); + }, + ), + Text('${value.name}'), + ], + ), + ], + ), + ); + } + + Widget customdropdown(SectionList sectionItem, + ViewInteractionProvider provider, List list, bool multiple) { + // sectionItem.value = ''; + + if (list.isEmpty) { + list = []; + InputClass inputClass = + InputClass(id: "no value", name: "Select ${sectionItem.name}"); + list.add(inputClass); + sectionItem.selectedObject = list[0]; + } + // InputClass selectedObj = list[0]; + return SizedBox( + width: isTablet ? 200 : MediaQuery.of(context).size.width, + height: isTablet ? 60 : 40, + child: DropdownButtonFormField2( + isExpanded: true, + decoration: InputDecoration( + // Add Horizontal padding using menuItemStyleData.padding so it matches + // the menu padding when button's width is not specified. + contentPadding: const EdgeInsets.symmetric(vertical: 5), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15), + ), + // Add more decoration.. + ), + hint: Text( + 'Select ${sectionItem.name}', + style: TextStyle(fontSize: 14), + ), + items: list + .map((item) => DropdownMenuItem( + value: item, + child: Text( + item.name, + style: const TextStyle( + fontSize: 14, + ), + ), + )) + .toList(), + value: sectionItem.selectedObject ?? list[0], + // // provider.getDropDownValue(sectionItem.value!, sectionItem, list) + // sectionItem.value ?? list[0].name, + validator: (value) { + if (value == null) { + return 'Please select ${sectionItem.name}'; + } + return null; + }, + onChanged: (value) { + //Do something when selected item is changed. + sectionItem.selectedObject = value!; + sectionItem.value = value.id; + provider.setDropDownValue(value.id, sectionItem, multiple, value); + print("selected ${sectionItem.value}"); + // setState(() {}); + }, + onSaved: (value) { + sectionItem.selectedObject = value!; + sectionItem.value = value.id; + provider.setDropDownValue(value.id, sectionItem, multiple, value); + // setState(() {}); + }, + buttonStyleData: const ButtonStyleData( + padding: EdgeInsets.only(right: 8), + ), + iconStyleData: const IconStyleData( + icon: Icon( + Icons.arrow_drop_down, + color: Colors.black45, + ), + iconSize: 24, + ), + dropdownStyleData: DropdownStyleData( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + ), + ), + menuItemStyleData: const MenuItemStyleData( + padding: EdgeInsets.symmetric(horizontal: 16), + ), + ), + ); + } + + Widget customAutoCompletedropdown(SectionList sectionItem, + ViewInteractionProvider provider, List list, bool multiple) { + // sectionItem.value = list[0].name; + if (list.isEmpty) { + list = sectionItem.inputList!; + } + //InputClass selectedObj = list[0]; + return SizedBox( + width: isTablet ? 200 : MediaQuery.of(context).size.width, + height: isTablet ? 60 : 40, + child: DropdownButtonHideUnderline( + child: DropdownButtonFormField2( + isExpanded: true, + decoration: InputDecoration( + // Add Horizontal padding using menuItemStyleData.padding so it matches + // the menu padding when button's width is not specified. + contentPadding: const EdgeInsets.symmetric(vertical: 5), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15), + ), + // Add more decoration.. + ), + hint: Text( + 'Select Item', + style: TextStyle( + fontSize: 14, + color: Theme.of(context).hintColor, + ), + ), + items: list + .map((item) => DropdownMenuItem( + value: item, + child: Text( + item.name, + style: const TextStyle( + fontSize: 14, + ), + ), + )) + .toList(), + value: sectionItem.selectedObject, + onSaved: (value) { + sectionItem.selectedObject = value!; + provider.setAutoCompleteValue(value.id, sectionItem, multiple); + sectionItem.value = value.name; + }, + onChanged: (value) { + // setState(() { + sectionItem.selectedObject = value!; + provider.setAutoCompleteValue(value.id, sectionItem, multiple); + sectionItem.value = value.name; + // setState(() {}); + //}); + }, + + buttonStyleData: const ButtonStyleData( + padding: EdgeInsets.symmetric(horizontal: 16), + height: 40, + width: 200, + ), + dropdownStyleData: const DropdownStyleData( + maxHeight: 200, + ), + menuItemStyleData: const MenuItemStyleData( + height: 40, + ), + dropdownSearchData: DropdownSearchData( + searchController: textEditingController, + searchInnerWidgetHeight: 50, + searchInnerWidget: Container( + height: 50, + padding: const EdgeInsets.only( + top: 8, + bottom: 4, + right: 8, + left: 8, + ), + child: TextFormField( + expands: true, + maxLines: null, + controller: textEditingController, + decoration: InputDecoration( + isDense: true, + contentPadding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), + hintText: 'Search for an item...', + hintStyle: const TextStyle(fontSize: 12), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(8), + ), + ), + ), + ), + searchMatchFn: (item, searchValue) { + return item.value!.name.toString().contains(searchValue); + }, + ), + //This to clear the search value when you close the menu + onMenuStateChange: (isOpen) { + if (!isOpen) { + textEditingController.clear(); + } + }, + ), + ), + ); + } + + Widget customMultiselectDropdown(SectionList sectionItem, + ViewInteractionProvider provider, List list, bool multiple) { + if (list.isEmpty) { + list = sectionItem.inputList!; + } + InputClass selectedObj = list[0]; + + return SizedBox( + width: isTablet ? 200 : MediaQuery.of(context).size.width, + height: isTablet ? 60 : 40, + child: DropdownButtonHideUnderline( + child: DropdownButtonFormField2( + isExpanded: true, + decoration: InputDecoration( + // Add Horizontal padding using menuItemStyleData.padding so it matches + // the menu padding when button's width is not specified. + contentPadding: const EdgeInsets.symmetric(vertical: 5), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15), + ), + // Add more decoration.. + ), + hint: Text( + 'Select Items', + style: TextStyle( + fontSize: 14, + color: Theme.of(context).hintColor, + ), + ), + items: list.map((item) { + return DropdownMenuItem( + value: item, + //disable default onTap to avoid closing menu when selecting an item + enabled: false, + child: StatefulBuilder( + builder: (context, menuSetState) { + final isSelected = + sectionItem.selectedValue!.contains(item.name); + return InkWell( + onTap: () { + isSelected + ? sectionItem.selectedValue!.remove(item.name) + : sectionItem.selectedValue!.add(item.name); + //This rebuilds the StatefulWidget to update the button's text + setState(() {}); + //This rebuilds the dropdownMenu Widget to update the check mark + menuSetState(() {}); + }, + child: Container( + height: double.infinity, + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: Row( + children: [ + if (isSelected) + const Icon(Icons.check_box_outlined) + else + const Icon(Icons.check_box_outline_blank), + const SizedBox(width: 16), + Expanded( + child: Text( + item.name, + style: const TextStyle( + fontSize: 14, + ), + ), + ), + ], + ), + ), + ); + }, + ), + ); + }).toList(), + //Use last selected item as the current value so if we've limited menu height, it scroll to last item. + value: selectedObj, + // ? null + // : provider.selectedItems.last, + onChanged: (value) { + selectedObj = value!; + provider.setAutoCompleteValue(value.id, sectionItem, multiple); + sectionItem.value = value.name; + }, + onSaved: (value) { + selectedObj = value!; + provider.setAutoCompleteValue(value.id, sectionItem, multiple); + sectionItem.value = value.name; + }, + selectedItemBuilder: (context) { + return list.map( + (item) { + return Container( + alignment: AlignmentDirectional.center, + child: Text( + sectionItem.selectedValue!.join(', '), + style: const TextStyle( + fontSize: 14, + overflow: TextOverflow.ellipsis, + ), + maxLines: 1, + ), + ); + }, + ).toList(); + }, + buttonStyleData: const ButtonStyleData( + padding: EdgeInsets.only(left: 16, right: 8), + height: 40, + width: 140, + ), + menuItemStyleData: const MenuItemStyleData( + height: 40, + padding: EdgeInsets.zero, + ), + ), + ), + ); + } + + Widget gridViewWidget( + ViewInteractionProvider provider, + String sectionName, + List sectionList, + Orientation orientation, + FormFieldData item, + int listIndex) { + return Padding( + padding: isTablet + ? EdgeInsets.only(left: 8.0) + : EdgeInsets.only(left: 12.0, right: 12.0), + child: GridView.count( + physics: const NeverScrollableScrollPhysics(), + crossAxisCount: context.responsive( + 1, // default + sm: 1, // small + md: 1, // medium + lg: sectionList.length == 1 ? 1 : 4, // large + xl: 5, // extra large screen + ), + mainAxisSpacing: sectionList.length == 1 || !isTablet ? 1 : 2, + shrinkWrap: true, + padding: EdgeInsets.zero, + childAspectRatio: sectionList.length == 1 || !isTablet + ? orientation == Orientation.landscape + ? 10 + : 4.2 + : 1.8, + children: List.generate( + sectionList.length, + (i) { + // print(sectionList); + SectionList sectionItem = sectionList[i]; + dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN + ? sectionItem.value ?? "Select" + : ' '; + List list = + sectionItem.widget == InteractionWidget.DROPDOWN || + sectionItem.widget == InteractionWidget.AUTOCOMPLETE || + sectionItem.widget == InteractionWidget.MULTISELECT + ? provider.getData2(sectionItem) + : []; + provider.checkboxlist = + sectionItem.widget == InteractionWidget.CHECKBOX + ? provider.getData2(sectionItem) + : []; + + return Wrap(children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sectionItem.widget == InteractionWidget.BUTTON && + sectionItem.param == 'add' || + sectionItem.param == 'deletebtn' + ? const SizedBox.shrink() + : Text( + '${sectionItem.name}:*', + style: TextStyle( + color: Colors.orange.shade800, + fontSize: isTablet ? 18 : 14, + ), + ), + const SizedBox( + height: 15, + ), + sectionItem.widget == InteractionWidget.BUTTON + ? sectionItem.input == 'chooseFile' + ? Row( + children: [ + CustomButton( + backgroundColor: const Color.fromARGB( + 255, 233, 229, 229), + onPressed: () async { + if (sectionItem + .selectedValue!.isNotEmpty) { + showFilesAlertDialog( + context, + sectionItem.fileName!.join(','), + sectionItem); + } else { + sectionItem.selectedValue = []; + sectionItem.extension = []; + sectionItem.fileName = []; + await getEncodedFile(sectionItem); + } + setState(() {}); + }, + width: 120, + height: 40, + fontsize: 12, + textColor: Colors.black, + title: sectionItem.name), + const SizedBox( + width: 5, + ), + Text( + sectionItem.selectedValue!.isNotEmpty + ? 'File uploaded' + : 'No file uploaded', + style: TextStyle( + color: + sectionItem.selectedValue!.isNotEmpty + ? Colors.green + : Colors.red), + ), + ], + ) + : isTablet + ? IconButton( + onPressed: () { + provider.deleteMultipleRows( + sectionItem.gid!, + sectionList[i], + sectionName); + + setState(() {}); + }, + icon: const Icon( + Icons.cancel, + size: 30, + color: Color.fromARGB(255, 8, 39, 92), + ), + ) + : Padding( + padding: + const EdgeInsets.only(left: 3.0, top: 5), + child: CustomButton( + backgroundColor: + Color.fromARGB(255, 233, 75, 75), + onPressed: () { + provider.deleteMultipleRows( + sectionItem.gid!, + sectionList[i], + sectionName); + + setState(() {}); + }, + width: 80, + height: 30, + fontsize: 12, + textColor: Colors.white, + title: "Delete"), + ) + : returnWidget( + sectionItem: sectionItem, + item: item, + provider: provider, + list: list, + gridIndex: i, + listIndex: listIndex, + widgetData: sectionItem.widget!, + multiple: true), + ], + ), + ]); + }, + ), + ), + ); + } + + String textFieldsValidation(ViewInteractionProvider provider) { + if (provider.sectionList + .any((element) => element.controller!.text.isEmpty)) { + return 'Fields cannot be empty'; + } + if (provider.textEditingControllerList.isNotEmpty) { + if (provider.validateTextFields()) { + return 'Fields cannot be empty'; + } + } + if (provider.multipletextEditingControllerList.isNotEmpty) { + if (provider.validateMultipleRows()) { + return 'Fields cannot be empty'; + } + } + + return ''; + } + + _displaySnackBar(String msg) { + final snackBar = SnackBar( + content: Text( + msg, + style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), + )); + ScaffoldMessenger.of(context).showSnackBar(snackBar); + //scaffoldKeyLogin.currentState!.showSnackBar(snackBar); + } + + Future getEncodedFile(SectionList sectionItem) async { + String base64Image = ''; + var status = Platform.isAndroid + ? await Permission.manageExternalStorage.status + : await Permission.storage.status; + if (status.isGranted) { + FilePickerResult? result = + await FilePicker.platform.pickFiles(allowMultiple: true); + + if (result != null) { + print(result.files.first.path); + print(result.files.last.path); + for (var files in result.files) { + File file = File(files.path!); + print("check file path : ${file.path}"); + fileName = file.path.split('/').last; + // Get the application folder directory + Directory? directory = Platform.isAndroid + ? await getExternalStorageDirectory() //FOR ANDROID + : await getApplicationDocumentsDirectory(); + String newPath = ""; //FOR ios + String convertedDirectoryPath = (directory?.path).toString(); + + print("see the converted directory path $convertedDirectoryPath"); + + newPath = convertedDirectoryPath + "/konectar/files"; + print("new path :$newPath"); + directory = Directory(newPath); + if (!await directory.exists()) { + await directory.create(recursive: true); + } + File newFile = await file.copy('${directory.path}/$fileName'); + print("new path is ${newFile.path}"); + final extension = p.extension(newFile.path); + List imageBytes = await newFile.readAsBytes(); + Uint8List imageUint8List = Uint8List.fromList(imageBytes); + base64Image = base64Encode(imageUint8List); + sectionItem.selectedValue!.add(base64Image); + sectionItem.extension!.add(extension); + sectionItem.fileName!.add(fileName); + } + } + } else { + print("not permitted"); + await requestPermission(Platform.isAndroid + ? Permission.manageExternalStorage + : Permission.storage); + } + } + + Future requestPermission(Permission permission) async { + final status = await permission.request(); + + setState(() { + print(status); + }); + } + + showAlertDialog(BuildContext context, String record) { + // set up the buttons + // ViewInteractionProvider provider = + // Provider.of(context, listen: false); + Widget cancelButton = TextButton( + child: Text("Ok"), + onPressed: () async { + Navigator.of(context).pop(); + Navigator.of(context).pop(); + }, + ); + + // set up the AlertDialog + AlertDialog alert = AlertDialog( + title: const Text(""), + content: Text("Form $record Updated Successfully!"), + actions: [ + cancelButton, + ], + ); + + // show the dialog + showDialog( + context: context, + builder: (BuildContext context) { + return alert; + }, + ); + } + + showFilesAlertDialog( + BuildContext context, String files, SectionList sectionItem) { + // set up the buttons + // ViewInteractionProvider provider = + // Provider.of(context, listen: false); + Widget cancelButton = TextButton( + child: Text("Upload"), + onPressed: () async { + Navigator.of(context).pop(); + sectionItem.selectedValue = []; + sectionItem.extension = []; + sectionItem.fileName = []; + await getEncodedFile(sectionItem); + }, + ); + Widget okButton = TextButton( + child: Text("Cancel"), + onPressed: () async { + Navigator.of(context).pop(); + }, + ); + // set up the AlertDialog + AlertDialog alert = AlertDialog( + title: const Text(""), + content: Text( + "Following File(s) $files uploaded .Do you still want to upload files ?", + style: TextStyle(fontSize: 15), + ), + actions: [cancelButton, okButton], + ); + + // show the dialog + showDialog( + context: context, + builder: (BuildContext context) { + return alert; + }, + ); + } +} diff --git a/lib/views/interaction_module/interaction_screen.dart b/lib/views/interaction_module/interaction_screen.dart new file mode 100644 index 0000000..d72300e --- /dev/null +++ b/lib/views/interaction_module/interaction_screen.dart @@ -0,0 +1,1158 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:intl/intl.dart'; +import 'package:path_provider/path_provider.dart'; +import 'package:provider/provider.dart'; +import 'package:dropdown_button2/dropdown_button2.dart'; +import 'package:pwa_ios/model/interaction_data.dart'; +import 'package:pwa_ios/utils/mockapi.dart'; +import 'package:pwa_ios/utils/util.dart'; +import 'package:pwa_ios/viewmodel/configprovider.dart'; +import 'package:pwa_ios/viewmodel/interactionprovider.dart'; +import 'package:pwa_ios/widgets/custombutton.dart'; +import 'package:pwa_ios/widgets/customrangeslider.dart'; +import 'package:pwa_ios/widgets/interatciontextfield.dart'; +import 'package:file_picker/file_picker.dart'; +import 'package:pwa_ios/widgets/responsive_ext.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:path/path.dart' as p; + +class InteractionScreen extends StatefulWidget { + int index; + String form; + InteractionScreen({super.key, required this.index, required this.form}); + + @override + State createState() => _InteractionScreenState(); +} + +class _InteractionScreenState extends State { + List interactionReponseList = []; + List sectionList = []; + List textEditingControllerList = []; + int textfieldIndex = 0; + String dropdownvalue = 'Select value'; + String? fileName; + final TextEditingController textEditingController = TextEditingController(); + @override + void initState() { + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + init(); + }); + + super.initState(); + } + + init() async { + await Provider.of(context, listen: false) + .init(widget.index); + setState(() {}); + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (BuildContext context, provider, Widget? child) { + return GestureDetector( + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: OrientationBuilder(builder: (context, orientation) { + return Scaffold( + //resizeToAvoidBottomInset: false, + appBar: AppBar( + title: Text( + 'Record New Interaction', + style: TextStyle( + fontSize: isTablet ? 22 : 14, color: Colors.white), + ), + backgroundColor: const Color(0xFF2b9af3), + automaticallyImplyLeading: false, + actions: [saveActions(provider)], + leading: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: const Icon( + Icons.arrow_back_ios, + color: Colors.white, + ), + ), + ), + body: Column( + children: [ + Expanded( + child: ListView.builder( + itemCount: provider.interactionReponseList.length, + padding: EdgeInsets.zero, + cacheExtent: double.parse( + provider.interactionReponseList.length.toString()), + itemBuilder: (context, index) { + var item = provider.interactionReponseList[index]; + sectionList = item.sectionList; + return ExpansionTile( + maintainState: true, + // backgroundColor: Colors.white, + // collapsedBackgroundColor: Color(0xFF2b9af3), + initiallyExpanded: true, + title: Stack( + alignment: AlignmentDirectional.center, + children: [ + Container( + // height: double.infinity, + width: double.infinity, + padding: const EdgeInsets.all(8.0), + decoration: const BoxDecoration( + color: Color(0xFF2b9af3), + ), + child: Text( + item.sectionName, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: isTablet ? 18 : 14), + )), + item.multiple + ? Align( + alignment: Alignment.centerRight, + child: IconButton( + onPressed: () { + provider.getSectionItem( + item.sectionName); + // print("index is $listIndex"); + setState(() { + // for (var item + }); + }, + icon: const Icon( + Icons.add_circle_outline, + size: 30, + color: Colors.white, + ), + ), + ) + : const SizedBox.shrink() + ]), + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox( + height: 20, + ), + + Padding( + padding: isTablet + ? const EdgeInsets.only(left: 14.0) + : const EdgeInsets.only( + left: 12.0, right: 12.0), + child: GridView.count( + physics: + const NeverScrollableScrollPhysics(), + crossAxisCount: context.responsive( + 1, + sm: 1, // small + md: 1, // medium + lg: sectionList.length == 1 + ? 1 + : 4, // large + xl: 3, // extra large screen + ), + mainAxisSpacing: + sectionList.length == 1 || !isTablet + ? 1 + : 3.5, + shrinkWrap: true, + padding: EdgeInsets.zero, + childAspectRatio: + sectionList.length == 1 || !isTablet + ? orientation == + Orientation.landscape + ? 10 + : 3.8 + : 2.4, + children: List.generate( + sectionList.length, + (i) { + SectionList sectionItem = + sectionList[i]; + dropdownvalue = sectionItem + .widget == + InteractionWidget.DROPDOWN + ? sectionItem.value ?? "Select" + : ' '; + List list = sectionItem + .widget == + InteractionWidget + .DROPDOWN || + sectionItem.widget == + InteractionWidget + .AUTOCOMPLETE || + sectionItem.widget == + InteractionWidget + .MULTISELECT + ? provider.getData2(sectionItem) + : []; + provider.checkboxlist = sectionItem + .widget == + InteractionWidget.CHECKBOX + ? provider.getData2(sectionItem) + : []; + + return Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + sectionItem.widget == + InteractionWidget + .BUTTON && + sectionItem.input == + 'add' + ? const SizedBox.shrink() + : Text( + '${sectionItem.name}:*', + style: TextStyle( + color: Colors + .orange.shade800, + fontSize: isTablet + ? 18 + : 12, + ), + ), + SizedBox( + height: isTablet ? 15 : 5, + ), + returnWidget( + sectionItem: sectionItem, + item: item, + provider: provider, + list: list, + gridIndex: i, + listIndex: index, + widgetData: + sectionItem.widget!, + multiple: false), + // SizedBox( + // height: isTablet ? 15 : 5, + // ), + ], + ); + }, + ), + ), + ), + SizedBox( + height: isTablet ? 15 : 5, + ), + item.multiple + ? gridViewWidget( + provider, + item.sectionName, + item.multipleList ?? [], + orientation, + item, + index) + : const SizedBox.shrink(), + provider.interactionReponseList.length == + index - 1 + ? saveActions(provider) + : const SizedBox.shrink() + //const Spacer(), + ], + ), + ), + ]); + }, + ), + ), + // const Spacer(), + // saveActions(provider), + ], + )); + }), + ); + }); + } + + Widget returnWidget({ + required SectionList sectionItem, + required FormFieldData item, + required InteractionProvider provider, + required List list, + required int gridIndex, + required int listIndex, + required InteractionWidget widgetData, + required bool multiple, + }) { + switch (widgetData) { + case InteractionWidget.CHECKBOX: + return buildCheckbox(sectionItem, item.sectionName, provider, multiple); + + case InteractionWidget.AUTOCOMPLETE: + return customAutoCompletedropdown( + sectionItem, provider, list, multiple); + + case InteractionWidget.MULTISELECT: + return customMultiselectDropdown(sectionItem, provider, list, multiple); + + case InteractionWidget.RADIO: + return buildRadio(sectionItem, provider); + + case InteractionWidget.LABEL: + return Text(sectionItem.input!); + + case InteractionWidget.RANGESLIDER: + return CustomRangeSlider( + max: double.parse(sectionItem.max!), + min: double.parse(sectionItem.min!), + sliderPos: sectionItem.selectedValue!.isNotEmpty + ? double.parse(sectionItem.selectedValue!.last.toString()) + : double.parse(sectionItem.min!), + onChanged: (val) { + setState(() { + sectionItem.selectedValue = []; + sectionItem.selectedId = val.toString(); + sectionItem.selectedValue!.add(val.toInt()); + }); + }, + ); + + case InteractionWidget.BUTTON: + return sectionItem.input == 'add' + ? const Offstage( + offstage: true, + child: Text("Visible"), + ) + : Row( + children: [ + CustomButton( + backgroundColor: const Color.fromARGB(255, 233, 229, 229), + onPressed: () async { + sectionItem.selectedValue = []; + sectionItem.extension = []; + sectionItem.fileName = []; + await getEncodedFile(sectionItem); + + setState(() {}); + }, + width: 120, + height: 40, + fontsize: 12, + textColor: Colors.black, + title: sectionItem.name), + const SizedBox( + width: 5, + ), + Text( + sectionItem.selectedValue!.isNotEmpty + ? sectionItem.selectedValue!.length > 1 + ? 'Files uploaded' + : "File Uploaded" + : 'No file uploaded', + style: TextStyle( + color: sectionItem.selectedValue!.isNotEmpty + ? Colors.green + : Colors.red), + ), + ], + ); + + case InteractionWidget.TEXT: + return sectionItem.input == 'Date' + ? buildDateWidget(sectionItem) + : sectionItem.input == "textArea" + ? Expanded( + child: InteractionTextField( + maxchars: int.parse(sectionItem.validation!.chars ?? "0"), + controller: sectionItem.controller!, + labelText: sectionItem.name, + maxlines: 4, + minlines: 3, + onChanged: (val) { + sectionItem.selectedValue = []; + setState(() {}); + + sectionItem.selectedValue!.add(val); + }, + ), + ) + : SizedBox( + width: isTablet ? 200 : MediaQuery.of(context).size.width, + height: isTablet ? 50 : 40, + child: InteractionTextField( + inputType: sectionItem.input == "number" + ? TextInputType.number + : TextInputType.none, + maxchars: int.parse(sectionItem.chars ?? "0"), + controller: sectionItem.controller!, + labelText: sectionItem.name, + onChanged: (val) { + sectionItem.selectedValue = []; + provider.setTextValue(val, sectionItem, multiple); + }, + ), + ); + case InteractionWidget.DROPDOWN: + return customdropdown(sectionItem, provider, list, multiple); + } + } + + Future requestPermission(Permission permission) async { + final status = await permission.request(); + + setState(() { + print(status); + // _permissionStatus = status; + // print(_permissionStatus); + }); + } + + Widget buildDateWidget(SectionList sectionItem) { + return SizedBox( + width: isTablet ? 200 : MediaQuery.of(context).size.width, + height: isTablet ? 50 : 40, + child: TextField( + controller: + sectionItem.controller, //editing controller of this TextField + decoration: InputDecoration( + // border: OutlineInputBorder(), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10.0), + ), + labelStyle: const TextStyle(fontSize: 16), + suffixIcon: const Icon(Icons.calendar_today), //icon of text field + labelText: "Enter Date" //label text of field + ), + readOnly: true, //set it true, so that user will not able to edit text + onTap: () async { + DateTime? pickedDate = await showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime( + 2000), //DateTime.now() - not to allow to choose before today. + lastDate: DateTime(2101)); + + if (pickedDate != null) { + print( + pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000 + String formattedDate = DateFormat('yyyy-MM-dd').format(pickedDate); + print( + formattedDate); //formatted date output using intl package => 2021-03-16 + //you can implement different kind of Date Format here according to your requirement + + setState(() { + sectionItem.controller!.text = formattedDate; + sectionItem.selectedValue = []; + sectionItem.selectedValue! + .add(formattedDate); //set output date to TextField value. + }); + } else { + print("Date is not selected"); + } + }, + ), + ); + } + + Widget saveActions(InteractionProvider provider) { + return Align( + alignment: Alignment.centerRight, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + CustomButton( + backgroundColor: Colors.red.shade800, + onPressed: () { + //showDeleteProfileAlertDialog(context); + for (var textcontrollers in provider.textEditingControllerList) { + textcontrollers.text = ''; + } + + setState(() { + provider.resetAllWidgetsData(); + }); + }, + textColor: Colors.white, + title: "Reset", + height: 40, + width: isTablet ? 100 : 80, + fontsize: isTablet ? 15 : 10.2, + ), + SizedBox( + width: isTablet ? 20 : 4, + ), + CustomButton( + backgroundColor: Colors.green.shade900, + onPressed: () async { + if (textFieldsValidation(provider).isEmpty) { + String record = + await provider.saveJsonObject(context, widget.form); + showAlertDialog(context, record); + } else { + _displaySnackBar(textFieldsValidation(provider)); + } + }, + textColor: Colors.white, + title: "Save", + height: 40, + width: isTablet ? 100 : 80, + fontsize: isTablet ? 16 : 12, + ), + SizedBox( + width: isTablet ? 20 : 2, + ), + ], + ), + ); + } + + Widget buildRadio(SectionList sectionItem, InteractionProvider provider) { + List list = provider.getData2(sectionItem); + // .map((itemWord) => InputClass.fromJson(itemWord)) + // .toList(); + return SizedBox( + width: isTablet ? 250 : MediaQuery.of(context).size.width, + child: Row( + children: [ + for (InputClass value in list) + Row( + children: [ + Radio( + value: value.name, + activeColor: Colors.black, + groupValue: provider.radioValue, + onChanged: (String? value) { + setState(() { + print(value); + provider.radioValue = value!; + int index = + list.indexWhere((element) => element.name == value); + sectionItem.selectedValue!.add(list[index].id); + }); + }, + ), + Text('${value.name}'), + ], + ), + ], + ), + ); + } + + Widget buildCheckbox(SectionList sectionItem, String sectionName, + InteractionProvider provider, bool multiple) { + return SizedBox( + width: 250, + child: Row( + children: [ + for (var value in provider.checkboxlist) + Row( + children: [ + Checkbox( + value: value.ischecked ?? false, + activeColor: Colors.black, + checkColor: Colors.white, + onChanged: (bool? newvalue) { + value.ischecked = newvalue!; + provider.setcheckBoxValue( + sectionItem, sectionName, newvalue, value.id, multiple); + //setState(() {}); + }, + ), + Text('${value.name}'), + ], + ), + ], + ), + ); + } + + Widget customdropdown(SectionList sectionItem, InteractionProvider provider, + List list, bool multiple) { + // sectionItem.value = ''; + + if (list.isEmpty) { + list = []; + InputClass inputClass = + InputClass(id: "no value", name: "Select ${sectionItem.name}"); + list.add(inputClass); + sectionItem.selectedObject = list[0]; + } + // InputClass selectedObj = list[0]; + return SizedBox( + width: isTablet ? 200 : MediaQuery.of(context).size.width, + height: isTablet ? 60 : 40, + child: DropdownButtonFormField2( + isExpanded: true, + decoration: InputDecoration( + // Add Horizontal padding using menuItemStyleData.padding so it matches + // the menu padding when button's width is not specified. + contentPadding: const EdgeInsets.symmetric(vertical: 5), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15), + ), + // Add more decoration.. + ), + hint: Text( + 'Select ${sectionItem.name}', + style: TextStyle(fontSize: 14), + ), + items: list + .map((item) => DropdownMenuItem( + value: item, + child: Text( + item.name, + style: const TextStyle( + fontSize: 14, + ), + ), + )) + .toList(), + value: sectionItem.selectedObject ?? list[0], + // // provider.getDropDownValue(sectionItem.value!, sectionItem, list) + // sectionItem.value ?? list[0].name, + validator: (value) { + if (value == null) { + return 'Please select ${sectionItem.name}'; + } + return null; + }, + onChanged: (value) { + //Do something when selected item is changed. + sectionItem.selectedObject = value!; + sectionItem.value = value.id; + provider.setDropDownValue(value.id, sectionItem, multiple); + print("selected ${sectionItem.value}"); + // setState(() {}); + }, + onSaved: (value) { + sectionItem.selectedObject = value!; + sectionItem.value = value.id; + provider.setDropDownValue(value.id, sectionItem, multiple); + // setState(() {}); + }, + buttonStyleData: const ButtonStyleData( + padding: EdgeInsets.only(right: 8), + ), + iconStyleData: const IconStyleData( + icon: Icon( + Icons.arrow_drop_down, + color: Colors.black45, + ), + iconSize: 24, + ), + dropdownStyleData: DropdownStyleData( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + ), + ), + menuItemStyleData: const MenuItemStyleData( + padding: EdgeInsets.symmetric(horizontal: 16), + ), + ), + ); + } + + Widget customAutoCompletedropdown(SectionList sectionItem, + InteractionProvider provider, List list, bool multiple) { + // sectionItem.value = list[0].name; + + // if (list.isEmpty) { + // print("list is empty"); + list = sectionItem.inputList!; + //} + //InputClass selectedObj = list[0]; + return SizedBox( + width: isTablet ? 200 : MediaQuery.of(context).size.width, + height: isTablet ? 60 : 40, + child: DropdownButtonHideUnderline( + child: DropdownButtonFormField2( + isExpanded: true, + decoration: InputDecoration( + // Add Horizontal padding using menuItemStyleData.padding so it matches + // the menu padding when button's width is not specified. + contentPadding: const EdgeInsets.symmetric(vertical: 5), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15), + ), + // Add more decoration.. + ), + hint: Text( + 'Select Item', + style: TextStyle( + fontSize: 14, + color: Theme.of(context).hintColor, + ), + ), + items: list + .map((item) => DropdownMenuItem( + value: item, + child: Text( + item.name, + style: const TextStyle( + fontSize: 14, + ), + ), + )) + .toList(), + value: sectionItem.selectedObject, + onSaved: (value) { + sectionItem.selectedObject = value!; + provider.setAutoCompleteValue(value.id, sectionItem, multiple); + sectionItem.value = value.name; + }, + onChanged: (value) { + // setState(() { + sectionItem.selectedObject = value!; + provider.setAutoCompleteValue(value.id, sectionItem, multiple); + sectionItem.value = value.name; + // setState(() {}); + //}); + }, + + buttonStyleData: const ButtonStyleData( + padding: EdgeInsets.symmetric(horizontal: 16), + height: 40, + width: 200, + ), + dropdownStyleData: const DropdownStyleData( + maxHeight: 200, + ), + menuItemStyleData: const MenuItemStyleData( + height: 40, + ), + dropdownSearchData: DropdownSearchData( + searchController: textEditingController, + searchInnerWidgetHeight: 50, + searchInnerWidget: Container( + height: 50, + padding: const EdgeInsets.only( + top: 8, + bottom: 4, + right: 8, + left: 8, + ), + child: TextFormField( + expands: true, + maxLines: null, + controller: textEditingController, + decoration: InputDecoration( + isDense: true, + contentPadding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), + hintText: 'Search for an item...', + hintStyle: const TextStyle(fontSize: 12), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(8), + ), + ), + ), + ), + searchMatchFn: (item, searchValue) { + return item.value!.name.toString().contains(searchValue); + }, + ), + //This to clear the search value when you close the menu + onMenuStateChange: (isOpen) { + if (!isOpen) { + textEditingController.clear(); + } + }, + ), + ), + ); + } + + Widget customMultiselectDropdown(SectionList sectionItem, + InteractionProvider provider, List list, bool multiple) { + if (list.isEmpty) { + list = sectionItem.inputList!; + } + InputClass selectedObj = list[0]; + + return SizedBox( + width: isTablet ? 200 : MediaQuery.of(context).size.width, + height: isTablet ? 60 : 40, + child: DropdownButtonHideUnderline( + child: DropdownButtonFormField2( + isExpanded: true, + decoration: InputDecoration( + // Add Horizontal padding using menuItemStyleData.padding so it matches + // the menu padding when button's width is not specified. + contentPadding: const EdgeInsets.symmetric(vertical: 5), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15), + ), + // Add more decoration.. + ), + hint: Text( + 'Select Items', + style: TextStyle( + fontSize: 14, + color: Theme.of(context).hintColor, + ), + ), + items: list.map((item) { + return DropdownMenuItem( + value: item, + //disable default onTap to avoid closing menu when selecting an item + enabled: false, + child: StatefulBuilder( + builder: (context, menuSetState) { + final isSelected = + sectionItem.selectedValue!.contains(item.name); + return InkWell( + onTap: () { + isSelected + ? sectionItem.selectedValue!.remove(item.name) + : sectionItem.selectedValue!.add(item.name); + //This rebuilds the StatefulWidget to update the button's text + setState(() {}); + //This rebuilds the dropdownMenu Widget to update the check mark + menuSetState(() {}); + }, + child: Container( + height: double.infinity, + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: Row( + children: [ + if (isSelected) + const Icon(Icons.check_box_outlined) + else + const Icon(Icons.check_box_outline_blank), + const SizedBox(width: 16), + Expanded( + child: Text( + item.name, + style: const TextStyle( + fontSize: 14, + ), + ), + ), + ], + ), + ), + ); + }, + ), + ); + }).toList(), + //Use last selected item as the current value so if we've limited menu height, it scroll to last item. + value: selectedObj, + // ? null + // : provider.selectedItems.last, + onChanged: (value) { + selectedObj = value!; + provider.setAutoCompleteValue(value.id, sectionItem, multiple); + sectionItem.value = value.name; + }, + onSaved: (value) { + selectedObj = value!; + provider.setAutoCompleteValue(value.id, sectionItem, multiple); + sectionItem.value = value.name; + }, + selectedItemBuilder: (context) { + return list.map( + (item) { + return Container( + alignment: AlignmentDirectional.center, + child: Text( + sectionItem.selectedValue!.join(', '), + style: const TextStyle( + fontSize: 14, + overflow: TextOverflow.ellipsis, + ), + maxLines: 1, + ), + ); + }, + ).toList(); + }, + buttonStyleData: const ButtonStyleData( + padding: EdgeInsets.only(left: 16, right: 8), + height: 40, + width: 140, + ), + menuItemStyleData: const MenuItemStyleData( + height: 40, + padding: EdgeInsets.zero, + ), + ), + ), + ); + } + + Widget gridViewWidget( + InteractionProvider provider, + String sectionName, + List sectionList, + Orientation orientation, + FormFieldData item, + int listIndex) { + return Padding( + padding: isTablet + ? EdgeInsets.only(left: 8.0) + : EdgeInsets.only(left: 12.0, right: 12.0), + child: GridView.count( + physics: const NeverScrollableScrollPhysics(), + crossAxisCount: context.responsive( + 1, // default + sm: 1, // small + md: 1, // medium + lg: sectionList.length == 1 ? 1 : 4, // large + xl: 5, // extra large screen + ), + mainAxisSpacing: sectionList.length == 1 || !isTablet ? 1 : 2, + shrinkWrap: true, + padding: EdgeInsets.zero, + childAspectRatio: sectionList.length == 1 || !isTablet + ? orientation == Orientation.landscape + ? 10 + : 4.2 + : 1.8, + children: List.generate( + sectionList.length, + (i) { + print(sectionList); + SectionList sectionItem = sectionList[i]; + dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN + ? sectionItem.value ?? "Select" + : ' '; + List list = + sectionItem.widget == InteractionWidget.DROPDOWN || + sectionItem.widget == InteractionWidget.AUTOCOMPLETE || + sectionItem.widget == InteractionWidget.MULTISELECT + ? provider.getData2(sectionItem) + : []; + provider.checkboxlist = + sectionItem.widget == InteractionWidget.CHECKBOX + ? provider.getData2(sectionItem) + : []; + + return Wrap(children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sectionItem.widget == InteractionWidget.BUTTON && + sectionItem.input == 'add' || + sectionItem.input == 'deletebtn' + ? const SizedBox.shrink() + : Text( + '${sectionItem.name}:*', + style: TextStyle( + color: Colors.orange.shade800, + fontSize: isTablet ? 18 : 14, + ), + ), + const SizedBox( + height: 15, + ), + sectionItem.widget == InteractionWidget.BUTTON + ? sectionItem.input == 'chooseFile' + ? Row( + children: [ + CustomButton( + backgroundColor: const Color.fromARGB( + 255, 233, 229, 229), + onPressed: () async { + sectionItem.selectedValue = []; + sectionItem.extension = []; + sectionItem.fileName = []; + await getEncodedFile(sectionItem); + + setState(() {}); + }, + width: 120, + height: 40, + fontsize: 12, + textColor: Colors.black, + title: sectionItem.name), + const SizedBox( + width: 5, + ), + Text( + sectionItem.selectedValue!.isNotEmpty + ? sectionItem.selectedValue!.length > 0 + ? 'File uploaded' + : "Files Uploaded" + : 'No file uploaded', + style: TextStyle( + color: + sectionItem.selectedValue!.isNotEmpty + ? Colors.green + : Colors.red), + ), + ], + ) + : isTablet + ? IconButton( + onPressed: () { + provider.deleteMultipleRows( + sectionItem.gid!, + sectionList[i], + sectionName); + + setState(() {}); + }, + icon: const Icon( + Icons.cancel, + size: 30, + color: Color.fromARGB(255, 8, 39, 92), + ), + ) + : Padding( + padding: + const EdgeInsets.only(left: 3.0, top: 5), + child: CustomButton( + backgroundColor: + Color.fromARGB(255, 233, 75, 75), + onPressed: () { + provider.deleteMultipleRows( + sectionItem.gid!, + sectionList[i], + sectionName); + + setState(() {}); + }, + width: 80, + height: 30, + fontsize: 12, + textColor: Colors.white, + title: "Delete"), + ) + : returnWidget( + sectionItem: sectionItem, + item: item, + provider: provider, + list: list, + gridIndex: i, + listIndex: listIndex, + widgetData: sectionItem.widget!, + multiple: true), + ], + ), + ]); + }, + ), + ), + ); + } + + String textFieldsValidation(InteractionProvider provider) { + if (provider.sectionList + .any((element) => element.controller!.text.isEmpty)) { + return 'Fields cannot be empty'; + } + if (provider.textEditingControllerList.isNotEmpty) { + if (provider.validateTextFields()) { + return 'Fields cannot be empty'; + } + } + + if (provider.multipletextEditingControllerList.isNotEmpty) { + if (provider.validateMultipleRows()) { + return 'Fields cannot be empty'; + } + } + + return ''; + } + + _displaySnackBar(String msg) { + final snackBar = SnackBar( + content: Text( + msg, + style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), + )); + ScaffoldMessenger.of(context).showSnackBar(snackBar); + //scaffoldKeyLogin.currentState!.showSnackBar(snackBar); + } + + Future getEncodedFile(SectionList sectionItem) async { + String base64Image = ''; + var status = Platform.isAndroid + ? await Permission.manageExternalStorage.status + : await Permission.storage.status; + if (status.isGranted) { + FilePickerResult? result = + await FilePicker.platform.pickFiles(allowMultiple: true); + + if (result != null) { + print(result.files.first.path); + print(result.files.last.path); + for (var files in result.files) { + File file = File(files.path!); + print("check file path : ${file.path}"); + fileName = file.path.split('/').last; + // Get the application folder directory + Directory? directory = Platform.isAndroid + ? await getExternalStorageDirectory() //FOR ANDROID + : await getApplicationDocumentsDirectory(); + String newPath = ""; //FOR ios + String convertedDirectoryPath = (directory?.path).toString(); + + print("see the converted directory path $convertedDirectoryPath"); + + newPath = convertedDirectoryPath + "/konectar/files"; + print("new path :$newPath"); + directory = Directory(newPath); + if (!await directory.exists()) { + await directory.create(recursive: true); + } + File newFile = await file.copy('${directory.path}/$fileName'); + print("new path is ${newFile.path}"); + final extension = p.extension(newFile.path); + List imageBytes = await newFile.readAsBytes(); + Uint8List imageUint8List = Uint8List.fromList(imageBytes); + base64Image = base64Encode(imageUint8List); + sectionItem.selectedValue!.add(base64Image); + sectionItem.extension!.add(extension); + sectionItem.fileName!.add(fileName); + } + } + } else { + print("not permitted"); + await requestPermission(Platform.isAndroid + ? Permission.manageExternalStorage + : Permission.storage); + } + } + + showAlertDialog(BuildContext context, String record) { + // set up the buttons + // ViewInteractionProvider provider = + // Provider.of(context, listen: false); + Widget cancelButton = TextButton( + child: Text("Ok"), + onPressed: () async { + Navigator.of(context).pop(); + Navigator.of(context).pop(); + }, + ); + + // set up the AlertDialog + AlertDialog alert = AlertDialog( + title: const Text(""), + content: Text("Form $record Saved Successfully!"), + actions: [ + cancelButton, + ], + ); + + // show the dialog + showDialog( + context: context, + builder: (BuildContext context) { + return alert; + }, + ); + } +} diff --git a/lib/views/interaction_module/interaction_screen_old.dart b/lib/views/interaction_module/interaction_screen_old.dart new file mode 100644 index 0000000..b487e79 --- /dev/null +++ b/lib/views/interaction_module/interaction_screen_old.dart @@ -0,0 +1,1097 @@ +// import 'dart:convert'; +// import 'dart:io'; + +// import 'package:flutter/material.dart'; +// import 'package:flutter/services.dart'; +// import 'package:intl/intl.dart'; +// import 'package:provider/provider.dart'; +// import 'package:dropdown_button2/dropdown_button2.dart'; +// import 'package:pwa_ios/model/interaction_data.dart'; +// import 'package:pwa_ios/utils/util.dart'; +// import 'package:pwa_ios/viewmodel/interactionprovider.dart'; +// import 'package:pwa_ios/widgets/custombutton.dart'; +// import 'package:pwa_ios/widgets/customrangeslider.dart'; +// import 'package:pwa_ios/widgets/interatciontextfield.dart'; +// import 'package:file_picker/file_picker.dart'; +// import 'package:pwa_ios/widgets/responsive_ext.dart'; + +// class InteractionScreenOld extends StatefulWidget { +// int index; +// InteractionScreenOld({super.key, required this.index}); + +// @override +// State createState() => _InteractionScreenOldState(); +// } + +// class _InteractionScreenOldState extends State { +// List interactionReponseList = []; +// List sectionList = []; +// List textEditingControllerList = []; +// int textfieldIndex = 0; +// String dropdownvalue = 'Select value'; +// String? fileName; +// final TextEditingController textEditingController = TextEditingController(); +// @override +// void initState() { +// WidgetsBinding.instance.addPostFrameCallback((timeStamp) { +// init(); +// }); + +// super.initState(); +// } + +// init() async { +// await Provider.of(context, listen: false) +// .init(widget.index); +// setState(() {}); +// } + +// Future loadData() async { +// var data = +// await rootBundle.loadString("assets/images/interactionform.json"); +// setState(() { +// interactionReponseList = json.decode(data)["result"]; +// for (var item in interactionReponseList) { +// for (var sectionItem in item["sectionList"]) { +// if (sectionItem['widget'] == 'text') { +// var textEditingController = TextEditingController(); + +// textEditingControllerList.add(textEditingController); +// sectionItem["controller"] = textEditingControllerList.last; +// } +// if (sectionItem['widget'] == 'dropdown') { +// List list = List.from(sectionItem['input']); +// sectionItem['value'] = list[0]; +// } +// } +// } +// print(interactionReponseList); +// print("check textcontrollers ${textEditingControllerList.length}"); +// }); +// return "success"; +// } + +// @override +// Widget build(BuildContext context) { +// return Consumer( +// builder: (BuildContext context, provider, Widget? child) { +// print("build context"); +// print("${provider.interactionReponseList}"); +// return GestureDetector( +// onTap: () { +// FocusScope.of(context).requestFocus(FocusNode()); +// }, +// child: Scaffold( +// appBar: AppBar( +// title: Text('Record New Interaction'), +// backgroundColor: Color(0xFF2b9af3), +// automaticallyImplyLeading: false, +// actions: [saveActions(provider)], +// leading: InkWell( +// onTap: () { +// Navigator.pop(context); +// }, +// child: const Icon( +// Icons.arrow_back_ios, +// color: Colors.white, +// ), +// ), +// ), +// body: Column( +// children: [ +// Expanded( +// child: ListView.builder( +// itemCount: provider.interactionReponseList.length, +// cacheExtent: double.parse( +// provider.interactionReponseList.length.toString()), +// itemBuilder: (context, index) { +// var item = provider.interactionReponseList[index]; +// sectionList = item.sectionList; +// return Padding( +// padding: const EdgeInsets.all(8.0), +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// item.sectionName.startsWith("/") +// ? const SizedBox.shrink() +// : Container( +// // height: double.infinity, +// width: double.infinity, +// padding: const EdgeInsets.all(8.0), +// decoration: const BoxDecoration( +// color: Color(0xFF2b9af3), +// ), +// child: Text( +// item.sectionName, +// style: const TextStyle( +// color: Colors.white, +// fontWeight: FontWeight.bold, +// fontSize: 18.0), +// )), +// const SizedBox( +// height: 20, +// ), + +// Padding( +// padding: const EdgeInsets.only(left: 8.0), +// child: GridView.count( +// crossAxisCount: +// sectionList.length == 1 || !isTablet +// ? 1 +// : 4, +// mainAxisSpacing: +// sectionList.length == 1 || !isTablet +// ? 1 +// : 3, +// shrinkWrap: true, +// padding: EdgeInsets.zero, +// childAspectRatio: +// sectionList.length == 1 || !isTablet +// ? 8 +// : 2.8, +// children: List.generate( +// sectionList.length, +// (i) { +// print(sectionList); +// SectionList sectionItem = sectionList[i]; +// dropdownvalue = sectionItem.widget == +// InteractionWidget.DROPDOWN +// ? sectionItem.value ?? "Select" +// : ' '; +// List list = sectionItem +// .widget == +// InteractionWidget.DROPDOWN || +// sectionItem.widget == +// InteractionWidget +// .AUTOCOMPLETE || +// sectionItem.widget == +// InteractionWidget.MULTISELECT +// ? provider.getData2(sectionItem) +// : []; +// provider.checkboxlist = sectionItem +// .widget == +// InteractionWidget.CHECKBOX +// ? provider.getData2(sectionItem) +// // (sectionItem.input as List) +// // .map((itemWord) => +// // InputClass.fromJson(itemWord)) +// // .toList() +// : []; +// // if (sectionItem.widget == +// // InteractionWidget.CHECKBOX && +// // provider.checkboxlist.isNotEmpty) { +// // for (InputClass obj +// // in provider.checkboxlist) { +// // // sectionItem.ischecked!.add(obj.ischecked); +// // obj.ischecked = false; +// // } +// // } +// return Column( +// crossAxisAlignment: +// CrossAxisAlignment.start, +// children: [ +// sectionItem.widget == +// InteractionWidget.BUTTON && +// sectionItem.param == 'add' +// ? const SizedBox.shrink() +// : Text( +// '${sectionItem.name}:*', +// style: TextStyle( +// color: Colors.orange.shade800, +// fontSize: 18, +// ), +// ), +// const SizedBox( +// height: 15, +// ), +// if (sectionItem.widget == +// InteractionWidget.RADIO) +// buildRadio(sectionItem, provider), +// sectionItem.widget == +// InteractionWidget.TEXT +// ? sectionItem.input == 'Date' +// ? buildDateWidget(sectionItem) +// : sectionItem.input == +// "textArea" +// ? SizedBox( +// width: double.maxFinite, +// height: 100, +// child: Column( +// crossAxisAlignment: +// CrossAxisAlignment +// .start, +// children: [ +// InteractionTextField( +// maxchars: int.parse( +// sectionItem +// .chars ?? +// "0"), +// controller: +// sectionItem +// .controller!, +// labelText: +// sectionItem +// .name, +// onChanged: (val) { +// sectionItem +// .selectedValue = []; +// setState(() {}); + +// sectionItem +// .selectedValue +// .add(val); +// }, +// ), +// Text( +// "You have ${int.parse(sectionItem.chars ?? "100") - sectionItem.controller!.text.length} characters left.Maximum characters : ${sectionItem.chars}") +// ], +// ), +// ) +// : SizedBox( +// width: 200, +// height: 50, +// child: +// InteractionTextField( +// maxchars: int.parse( +// sectionItem +// .chars ?? +// "0"), +// controller: +// sectionItem +// .controller!, +// labelText: +// sectionItem.name, +// onChanged: (val) { +// sectionItem +// .selectedValue = []; +// sectionItem +// .selectedValue +// .add(val); +// }, +// ), +// ) +// : sectionItem.widget == +// InteractionWidget.DROPDOWN +// // ? item.sectionName == 'Other' +// // ? customdropdown(sectionItem, +// // provider, list) +// // // buildLocationDropdownWidget( +// // // sectionItem, provider) +// ? customdropdown( +// sectionItem, provider, list) +// : sectionItem.widget == +// InteractionWidget.BUTTON +// ? sectionItem.param == 'add' +// ? IconButton( +// onPressed: () { +// // provider.addMultiplerows( +// // item.sectionList[ +// // i], +// // item.sectionName); +// print( +// "index is $index"); +// setState(() { +// // for (var item +// }); +// }, +// icon: const Icon( +// Icons.add, +// size: 30, +// color: Color +// .fromARGB( +// 255, +// 8, +// 39, +// 92), +// ), +// ) +// : Row( +// children: [ +// CustomButton( +// backgroundColor: +// const Color +// .fromARGB( +// 255, +// 233, +// 229, +// 229), +// onPressed: +// () async { +// FilePickerResult? +// result = +// await FilePicker +// .platform +// .pickFiles(); + +// if (result != +// null) { +// File file = File(result +// .files +// .single +// .path!); +// sectionItem +// .selectedValue = []; +// sectionItem +// .selectedValue +// .add(file +// .path); +// fileName = file +// .path +// .split( +// '/') +// .last; +// setState( +// () {}); +// } else { +// // User canceled the picker +// } +// }, +// width: 120, +// height: 40, +// fontsize: 12, +// textColor: +// Colors +// .black, +// title: +// sectionItem +// .name), +// const SizedBox( +// width: 5, +// ), +// Text( +// sectionItem +// .selectedValue +// .isNotEmpty +// ? 'File Uploaded' +// : 'No file uploaded', +// style: TextStyle( +// color: sectionItem +// .selectedValue +// .isNotEmpty +// ? Colors +// .green +// : Colors +// .red), +// ), +// ], +// ) +// : sectionItem.widget == +// InteractionWidget +// .LABEL +// ? Text( +// sectionItem.input!) +// : sectionItem.widget == +// InteractionWidget +// .CHECKBOX +// ? buildCheckbox( +// sectionItem, +// item +// .sectionName, +// provider) +// : sectionItem +// .widget == +// InteractionWidget +// .AUTOCOMPLETE +// ? customAutoCompletedropdown( +// sectionItem, +// provider, +// list) +// : sectionItem +// .widget == +// InteractionWidget +// .MULTISELECT +// ? customMultiselectDropdown( +// sectionItem, +// provider, +// list) +// : sectionItem.widget == +// InteractionWidget +// .RANGESLIDER +// ? CustomRangeSlider( +// sliderPos: sectionItem.selectedValue.isNotEmpty +// ? double.parse(sectionItem.selectedValue.last.toString()) +// : 10.0, +// onChanged: +// (val) { +// setState(() { +// sectionItem.selectedValue = []; +// sectionItem.selectedId = val.toString(); +// sectionItem.selectedValue.add(val.toInt()); +// }); +// }, +// ) +// : const SizedBox +// .shrink(), +// ], +// ); +// }, +// ), +// ), +// ), +// item.multiple +// ? gridViewWidget(provider, item.sectionName, +// item.multipleList ?? []) +// : const SizedBox.shrink(), +// provider.interactionReponseList.length == index - 1 +// ? saveActions(provider) +// : const SizedBox.shrink() +// //const Spacer(), +// ], +// ), +// ); +// }, +// ), +// ), +// // const Spacer(), +// // saveActions(provider), +// ], +// )), +// ); +// }); +// } + +// Widget buildDateWidget(SectionList sectionItem) { +// return SizedBox( +// width: sectionList.length == 1 ? MediaQuery.of(context).size.height : 200, +// height: 50, +// child: TextField( +// controller: +// sectionItem.controller, //editing controller of this TextField +// decoration: const InputDecoration( +// border: OutlineInputBorder(), +// labelStyle: TextStyle(fontSize: 16), +// suffixIcon: Icon(Icons.calendar_today), //icon of text field +// labelText: "Enter Date" //label text of field +// ), +// readOnly: true, //set it true, so that user will not able to edit text +// onTap: () async { +// DateTime? pickedDate = await showDatePicker( +// context: context, +// initialDate: DateTime.now(), +// firstDate: DateTime( +// 2000), //DateTime.now() - not to allow to choose before today. +// lastDate: DateTime(2101)); + +// if (pickedDate != null) { +// print( +// pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000 +// String formattedDate = DateFormat('yyyy-MM-dd').format(pickedDate); +// print( +// formattedDate); //formatted date output using intl package => 2021-03-16 +// //you can implement different kind of Date Format here according to your requirement + +// setState(() { +// sectionItem.controller!.text = formattedDate; +// sectionItem.selectedValue = []; +// sectionItem.selectedValue +// .add(formattedDate); //set output date to TextField value. +// }); +// } else { +// print("Date is not selected"); +// } +// }, +// ), +// ); +// } + +// Widget saveActions(InteractionProvider provider) { +// return Align( +// alignment: Alignment.centerRight, +// child: Row( +// mainAxisAlignment: MainAxisAlignment.spaceEvenly, +// children: [ +// CustomButton( +// backgroundColor: Colors.indigoAccent, +// onPressed: () async { +// if (textFieldsValidation(provider).isEmpty) { +// await provider.saveJsonObject(context); +// _displaySnackBar('Form Saved Sucessfully!'); +// } else { +// _displaySnackBar(textFieldsValidation(provider)); +// } +// }, +// textColor: Colors.white, +// title: "Save", +// height: 40, +// width: 100, +// fontsize: 16, +// ), +// const SizedBox( +// width: 20, +// ), +// CustomButton( +// backgroundColor: Colors.red.shade300, +// onPressed: () { +// //showDeleteProfileAlertDialog(context); +// for (var textcontrollers in provider.textEditingControllerList) { +// textcontrollers.text = ''; +// } +// }, +// textColor: Colors.white, +// title: "Reset", +// height: 40, +// width: 100, +// fontsize: 16, +// ), +// const SizedBox( +// width: 20, +// ), +// ], +// ), +// ); +// } + +// Widget buildRadio(SectionList sectionItem, InteractionProvider provider) { +// List list = provider.getData(sectionItem.id); +// // .map((itemWord) => InputClass.fromJson(itemWord)) +// // .toList(); +// return SizedBox( +// width: 250, +// child: Row( +// children: [ +// for (InputClass value in list) +// Row( +// children: [ +// Radio( +// value: value.name, +// activeColor: Colors.black, +// groupValue: provider.radioValue, +// onChanged: (String? value) { +// setState(() { +// print(value); +// provider.radioValue = value!; +// int index = +// list.indexWhere((element) => element.name == value); +// sectionItem.selectedValue.add(list[index].id); +// }); +// }, +// ), +// Text('${value.name}'), +// ], +// ), +// ], +// ), +// ); +// } + +// Widget buildCheckbox( +// SectionList sectionItem, +// String sectionName, +// InteractionProvider provider, +// ) { +// return SizedBox( +// width: 250, +// child: Row( +// children: [ +// for (var value in provider.checkboxlist) +// Row( +// children: [ +// Checkbox( +// value: value.ischecked ?? false, +// activeColor: Colors.black, +// checkColor: Colors.white, +// onChanged: (bool? newvalue) { +// value.ischecked = newvalue!; +// provider.setcheckBoxValue( +// sectionItem, sectionName, newvalue, value.id); +// //setState(() {}); +// }, +// ), +// Text('${value.name}'), +// ], +// ), +// ], +// ), +// ); +// } + +// Widget customdropdown(SectionList sectionItem, InteractionProvider provider, +// List list) { +// // sectionItem.value = ''; + +// if (list.isEmpty) { +// list = sectionItem.inputList; +// // if (list.isNotEmpty) { +// // InputClass obj = +// // InputClass(id: "default", name: "Select ${sectionItem.name}"); +// // list.insert(0, obj); +// // } +// } +// // InputClass selectedObj = list[0]; +// return SizedBox( +// width: 250, +// height: 60, +// child: DropdownButtonFormField2( +// isExpanded: false, +// decoration: InputDecoration( +// // Add Horizontal padding using menuItemStyleData.padding so it matches +// // the menu padding when button's width is not specified. +// contentPadding: const EdgeInsets.symmetric(vertical: 5), +// border: OutlineInputBorder( +// borderRadius: BorderRadius.circular(15), +// ), +// // Add more decoration.. +// ), +// hint: Text( +// 'Select ${sectionItem.name}', +// style: TextStyle(fontSize: 14), +// ), +// items: list +// .map((item) => DropdownMenuItem( +// value: item, +// child: Text( +// item.name, +// style: const TextStyle( +// fontSize: 14, +// ), +// ), +// )) +// .toList(), +// value: sectionItem.selectedObject ?? list[0], +// // // provider.getDropDownValue(sectionItem.value!, sectionItem, list) +// // sectionItem.value ?? list[0].name, +// validator: (value) { +// if (value == null) { +// return 'Please select ${sectionItem.name}'; +// } +// return null; +// }, +// onChanged: (value) { +// //Do something when selected item is changed. +// sectionItem.selectedObject = value!; +// sectionItem.value = value.id; +// provider.setDropDownValue(value.id, sectionItem); +// print("selected ${sectionItem.value}"); +// // setState(() {}); +// }, +// onSaved: (value) { +// sectionItem.selectedObject = value!; +// sectionItem.value = value.id; +// provider.setDropDownValue(value.id, sectionItem); +// // setState(() {}); +// }, +// buttonStyleData: const ButtonStyleData( +// padding: EdgeInsets.only(right: 8), +// ), +// iconStyleData: const IconStyleData( +// icon: Icon( +// Icons.arrow_drop_down, +// color: Colors.black45, +// ), +// iconSize: 24, +// ), +// dropdownStyleData: DropdownStyleData( +// decoration: BoxDecoration( +// borderRadius: BorderRadius.circular(15), +// ), +// ), +// menuItemStyleData: const MenuItemStyleData( +// padding: EdgeInsets.symmetric(horizontal: 16), +// ), +// ), +// ); +// } + +// Widget customAutoCompletedropdown(SectionList sectionItem, +// InteractionProvider provider, List list) { +// // sectionItem.value = list[0].name; +// if (list.isEmpty) { +// list = sectionItem.inputList; +// } +// //InputClass selectedObj = list[0]; +// return SizedBox( +// width: 250, +// height: 60, +// child: DropdownButtonHideUnderline( +// child: DropdownButtonFormField2( +// isExpanded: true, +// decoration: InputDecoration( +// // Add Horizontal padding using menuItemStyleData.padding so it matches +// // the menu padding when button's width is not specified. +// contentPadding: const EdgeInsets.symmetric(vertical: 5), +// border: OutlineInputBorder( +// borderRadius: BorderRadius.circular(15), +// ), +// // Add more decoration.. +// ), +// hint: Text( +// 'Select Item', +// style: TextStyle( +// fontSize: 14, +// color: Theme.of(context).hintColor, +// ), +// ), +// items: list +// .map((item) => DropdownMenuItem( +// value: item, +// child: Text( +// item.name, +// style: const TextStyle( +// fontSize: 14, +// ), +// ), +// )) +// .toList(), +// value: sectionItem.selectedObject, +// onSaved: (value) { +// sectionItem.selectedObject = value!; +// provider.setAutoCompleteValue(value.id, sectionItem); +// sectionItem.value = value.name; +// }, +// onChanged: (value) { +// // setState(() { +// sectionItem.selectedObject = value!; +// provider.setAutoCompleteValue(value.id, sectionItem); +// sectionItem.value = value.name; +// // setState(() {}); +// //}); +// }, + +// buttonStyleData: const ButtonStyleData( +// padding: EdgeInsets.symmetric(horizontal: 16), +// height: 40, +// width: 200, +// ), +// dropdownStyleData: const DropdownStyleData( +// maxHeight: 200, +// ), +// menuItemStyleData: const MenuItemStyleData( +// height: 40, +// ), +// dropdownSearchData: DropdownSearchData( +// searchController: textEditingController, +// searchInnerWidgetHeight: 50, +// searchInnerWidget: Container( +// height: 50, +// padding: const EdgeInsets.only( +// top: 8, +// bottom: 4, +// right: 8, +// left: 8, +// ), +// child: TextFormField( +// expands: true, +// maxLines: null, +// controller: textEditingController, +// decoration: InputDecoration( +// isDense: true, +// contentPadding: const EdgeInsets.symmetric( +// horizontal: 10, +// vertical: 8, +// ), +// hintText: 'Search for an item...', +// hintStyle: const TextStyle(fontSize: 12), +// border: OutlineInputBorder( +// borderRadius: BorderRadius.circular(8), +// ), +// ), +// ), +// ), +// searchMatchFn: (item, searchValue) { +// return item.value!.name.toString().contains(searchValue); +// }, +// ), +// //This to clear the search value when you close the menu +// onMenuStateChange: (isOpen) { +// if (!isOpen) { +// textEditingController.clear(); +// } +// }, +// ), +// ), +// ); +// } + +// Widget customMultiselectDropdown(SectionList sectionItem, +// InteractionProvider provider, List list) { +// if (list.isEmpty) { +// list = sectionItem.inputList; +// } +// InputClass selectedObj = list[0]; + +// return SizedBox( +// width: 250, +// height: 60, +// child: DropdownButtonHideUnderline( +// child: DropdownButtonFormField2( +// isExpanded: true, +// decoration: InputDecoration( +// // Add Horizontal padding using menuItemStyleData.padding so it matches +// // the menu padding when button's width is not specified. +// contentPadding: const EdgeInsets.symmetric(vertical: 5), +// border: OutlineInputBorder( +// borderRadius: BorderRadius.circular(15), +// ), +// // Add more decoration.. +// ), +// hint: Text( +// 'Select Items', +// style: TextStyle( +// fontSize: 14, +// color: Theme.of(context).hintColor, +// ), +// ), +// items: list.map((item) { +// return DropdownMenuItem( +// value: item, +// //disable default onTap to avoid closing menu when selecting an item +// enabled: false, +// child: StatefulBuilder( +// builder: (context, menuSetState) { +// final isSelected = +// sectionItem.selectedValue.contains(item.name); +// return InkWell( +// onTap: () { +// isSelected +// ? sectionItem.selectedValue.remove(item.name) +// : sectionItem.selectedValue.add(item.name); +// //This rebuilds the StatefulWidget to update the button's text +// setState(() {}); +// //This rebuilds the dropdownMenu Widget to update the check mark +// menuSetState(() {}); +// }, +// child: Container( +// height: double.infinity, +// padding: const EdgeInsets.symmetric(horizontal: 16.0), +// child: Row( +// children: [ +// if (isSelected) +// const Icon(Icons.check_box_outlined) +// else +// const Icon(Icons.check_box_outline_blank), +// const SizedBox(width: 16), +// Expanded( +// child: Text( +// item.name, +// style: const TextStyle( +// fontSize: 14, +// ), +// ), +// ), +// ], +// ), +// ), +// ); +// }, +// ), +// ); +// }).toList(), +// //Use last selected item as the current value so if we've limited menu height, it scroll to last item. +// value: selectedObj, +// // ? null +// // : provider.selectedItems.last, +// onChanged: (value) { +// selectedObj = value!; +// provider.setAutoCompleteValue(value.id, sectionItem); +// sectionItem.value = value.name; +// }, +// onSaved: (value) { +// selectedObj = value!; +// provider.setAutoCompleteValue(value.id, sectionItem); +// sectionItem.value = value.name; +// }, +// selectedItemBuilder: (context) { +// return list.map( +// (item) { +// return Container( +// alignment: AlignmentDirectional.center, +// child: Text( +// sectionItem.selectedValue.join(', '), +// style: const TextStyle( +// fontSize: 14, +// overflow: TextOverflow.ellipsis, +// ), +// maxLines: 1, +// ), +// ); +// }, +// ).toList(); +// }, +// buttonStyleData: const ButtonStyleData( +// padding: EdgeInsets.only(left: 16, right: 8), +// height: 40, +// width: 140, +// ), +// menuItemStyleData: const MenuItemStyleData( +// height: 40, +// padding: EdgeInsets.zero, +// ), +// ), +// ), +// ); +// } + +// Widget gridViewWidget(InteractionProvider provider, String sectionName, +// List sectionList) { +// return Padding( +// padding: const EdgeInsets.only(left: 8.0), +// child: GridView.count( +// crossAxisCount: 4, +// mainAxisSpacing: 3, +// shrinkWrap: true, +// padding: EdgeInsets.zero, +// childAspectRatio: 2.8, +// children: List.generate( +// sectionList.length, +// (i) { +// print(sectionList); +// SectionList sectionItem = sectionList[i]; +// dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN +// ? sectionItem.value ?? "Select" +// : ' '; +// List list = +// sectionItem.widget == InteractionWidget.DROPDOWN || +// sectionItem.widget == InteractionWidget.AUTOCOMPLETE || +// sectionItem.widget == InteractionWidget.MULTISELECT +// ? provider.getData2(sectionItem) +// : []; +// provider.checkboxlist = +// sectionItem.widget == InteractionWidget.CHECKBOX +// ? provider.getData2(sectionItem) +// // (sectionItem.input as List) +// // .map((itemWord) => +// // InputClass.fromJson(itemWord)) +// // .toList() +// : []; + +// return Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// sectionItem.widget == InteractionWidget.BUTTON && +// sectionItem.param == 'add' +// ? const SizedBox.shrink() +// : Text( +// '${sectionItem.name}:*', +// style: TextStyle( +// color: Colors.orange.shade800, +// fontSize: 18, +// ), +// ), +// const SizedBox( +// height: 15, +// ), +// if (sectionItem.widget == InteractionWidget.RADIO) +// buildRadio(sectionItem, provider), +// sectionItem.widget == InteractionWidget.TEXT +// ? sectionItem.input == 'Date' +// ? buildDateWidget(sectionItem) +// : SizedBox( +// width: sectionList.length == 1 +// ? MediaQuery.of(context).size.height +// : 200, +// height: 50, +// child: InteractionTextField( +// controller: sectionItem.controller!, +// onChanged: (val) { +// sectionItem.selectedValue = []; +// sectionItem.selectedValue.add(val); +// }, +// labelText: sectionItem.name), +// ) +// : sectionItem.widget == InteractionWidget.DROPDOWN +// // ? item.sectionName == 'Other' +// // ? customdropdown(sectionItem, +// // provider, list) +// // // buildLocationDropdownWidget( +// // // sectionItem, provider) +// ? customdropdown(sectionItem, provider, list) +// : sectionItem.widget == InteractionWidget.BUTTON +// ? sectionItem.param == 'add' +// ? IconButton( +// onPressed: () { +// provider.deleteMultipleRows( +// sectionItem.gid!, +// sectionList[i], +// sectionName); + +// setState(() {}); +// }, +// icon: const Icon( +// Icons.cancel, +// size: 30, +// color: Color.fromARGB(255, 8, 39, 92), +// ), +// ) +// : Row( +// children: [ +// CustomButton( +// backgroundColor: const Color.fromARGB( +// 255, 233, 229, 229), +// onPressed: () async { +// FilePickerResult? result = +// await FilePicker.platform +// .pickFiles(); + +// if (result != null) { +// File file = File( +// result.files.single.path!); +// sectionItem.selectedValue = []; +// sectionItem.selectedValue +// .add(file.absolute); +// setState(() {}); +// } else { +// // User canceled the picker +// } +// }, +// width: 120, +// height: 40, +// fontsize: 12, +// textColor: Colors.black, +// title: sectionItem.name), +// const SizedBox( +// width: 5, +// ), +// Text( +// sectionItem.selectedValue.isNotEmpty +// ? 'File uploaded' +// : 'No file uploaded', +// style: TextStyle( +// color: sectionItem +// .selectedValue.isNotEmpty +// ? Colors.green +// : Colors.red), +// ), +// ], +// ) +// : sectionItem.widget == InteractionWidget.LABEL +// ? Text(sectionItem.input!) +// : sectionItem.widget == +// InteractionWidget.CHECKBOX +// ? buildCheckbox( +// sectionItem, sectionName, provider) +// : sectionItem.widget == +// InteractionWidget.AUTOCOMPLETE +// ? customAutoCompletedropdown( +// sectionItem, provider, list) +// : sectionItem.widget == +// InteractionWidget.MULTISELECT +// ? customMultiselectDropdown( +// sectionItem, provider, list) +// : const SizedBox.shrink(), +// ], +// ); +// }, +// ), +// ), +// ); +// } + +// String textFieldsValidation(InteractionProvider provider) { +// if (provider.sectionList +// .any((element) => element.controller!.text.isEmpty)) { +// return 'Fields cannot be empty'; +// } + +// return ''; +// } + +// _displaySnackBar(String msg) { +// final snackBar = SnackBar( +// content: Text( +// msg, +// style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), +// )); +// ScaffoldMessenger.of(context).showSnackBar(snackBar); +// //scaffoldKeyLogin.currentState!.showSnackBar(snackBar); +// } +// } diff --git a/lib/views/interaction_module/interactionlistscreen.dart b/lib/views/interaction_module/interactionlistscreen.dart new file mode 100644 index 0000000..6a39666 --- /dev/null +++ b/lib/views/interaction_module/interactionlistscreen.dart @@ -0,0 +1,145 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:pwa_ios/model/save_interaction.dart'; +import 'package:pwa_ios/utils/util.dart'; +import 'package:pwa_ios/viewmodel/interactionprovider.dart'; +import 'package:pwa_ios/viewmodel/viewinteractionprovider.dart'; +import 'package:pwa_ios/views/interaction_module/interaction_screen.dart'; +import 'package:pwa_ios/views/interaction_module/view_forms_list.dart'; + +class InteractionListScreen extends StatefulWidget { + const InteractionListScreen({super.key}); + + @override + State createState() => _InteractionListScreenState(); +} + +class _InteractionListScreenState extends State { + List savedList = []; + @override + void initState() { + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + init(); + }); + + super.initState(); + } + + init() async { + await Provider.of(context, listen: false) + .initConfigData(); + await Provider.of(context, listen: false).getRecords(); + setState(() {}); + } + + int getCount(String form, InteractionProvider provider) { + provider.getRecords(); + return provider.savedList.where((element) => element.form == form).length; + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (BuildContext context, provider, Widget? child) { + return Scaffold( + appBar: AppBar( + title: Text( + 'Interaction Forms', + style: TextStyle(fontSize: isTablet ? 22 : 14, color: Colors.white), + ), + automaticallyImplyLeading: false, + backgroundColor: const Color(0xFF2b9af3), + ), + body: Container( + child: Center( + child: ListView.builder( + itemCount: provider.intConfigDataList.length, + cacheExtent: double.parse( + provider.intConfigDataList.length.toString()), + itemBuilder: (context, index) { + return Column( + children: [ + ListTile( + title: Row( + children: [ + Text( + 'Interaction-form${(index + 1).toString()}', + ), + const SizedBox( + width: 20, + ), + IconButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + InteractionScreen( + index: index, + form: + 'Interaction-form${(index + 1).toString()}', + ))); + }, + icon: const Icon( + Icons.arrow_circle_right_outlined, + size: 30, + color: Color.fromARGB(255, 8, 39, 92), + ), + ), + ], + ), + trailing: provider.savedList.indexWhere((element) => + element.form == + 'Interaction-form${(index + 1).toString()}') != + -1 + ? InkWell( + onTap: () { + if (getCount( + 'Interaction-form${(index + 1).toString()}', + provider) != + 0) { + List sendsavedList = provider + .savedList + .where((element) => + element.form == + 'Interaction-form${(index + 1).toString()}') + .toList(); + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + SavedFormListScreen( + formname: + 'Interaction-form${(index + 1).toString()}', + ))); + } + }, + child: Text( + "${getCount('Interaction-form${(index + 1).toString()}', provider).toString()} record(s) saved", + style: TextStyle( + fontSize: isTablet ? 18.0 : 14, + color: Colors.blue.shade900), + ), + ) + : const SizedBox.shrink(), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + InteractionScreen( + index: index, + form: + 'Interaction-form${(index + 1).toString()}', + ))); + }, + ), + const Divider(), + ], + ); + })), + ), + ); + }); + } +} diff --git a/lib/views/interaction_module/view_forms_list.dart b/lib/views/interaction_module/view_forms_list.dart new file mode 100644 index 0000000..8c7aac2 --- /dev/null +++ b/lib/views/interaction_module/view_forms_list.dart @@ -0,0 +1,201 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:pwa_ios/model/save_interaction.dart'; +import 'package:pwa_ios/utils/util.dart'; +import 'package:pwa_ios/viewmodel/interactionprovider.dart'; +import 'package:pwa_ios/viewmodel/viewinteractionprovider.dart'; +import 'package:pwa_ios/views/interaction_module/edit_interaction_screen.dart'; +import 'package:pwa_ios/views/interaction_module/interaction_screen.dart'; +import 'package:pwa_ios/views/interaction_module/view_interaction_screen.dart'; + +class SavedFormListScreen extends StatefulWidget { + // List savedList; + String formname; + SavedFormListScreen({super.key, required this.formname}); + + @override + State createState() => _SavedFormListScreenState(); +} + +class _SavedFormListScreenState extends State { + //List savedList = []; + @override + void initState() { + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + init(); + }); + + super.initState(); + } + + init() async { + // await Provider.of(context, listen: false) + // .initConfigData(); + await Provider.of(context, listen: false) + .getRecords(widget.formname); + setState(() {}); + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (BuildContext context, provider, Widget? child) { + return Scaffold( + appBar: AppBar( + title: Text( + 'Records of ${widget.formname}', + style: TextStyle(fontSize: isTablet ? 22 : 14, color: Colors.white), + ), + automaticallyImplyLeading: false, + backgroundColor: const Color(0xFF2b9af3), + leading: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: const Icon( + Icons.arrow_back_ios, + color: Colors.white, + ), + ), + ), + body: Container( + child: Center( + child: ListView.builder( + itemCount: provider.savedList.length, + cacheExtent: + double.parse(provider.savedList.length.toString()), + itemBuilder: (context, index) { + return Column( + children: [ + ListTile( + subtitle: Text( + 'Updated on ${provider.savedList[index].updatedTime}', + //style: TextStyle(fontStyle: FontStyle.italic), + ), + title: Text( + '${provider.savedList[index].id}', + ), + trailing: SizedBox( + width: 150, + child: Row(children: [ + IconButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + ViewInteractionScreen( + saveInteraction: + provider.savedList[index], + ))); + }, + icon: const Icon( + Icons.info_outline, + size: 24, + color: Color.fromARGB(255, 8, 39, 92), + ), + ), + IconButton( + onPressed: () async { + await provider.initConfigData().then({ + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + EditInteractionScreen( + saveInteraction: + provider.savedList[index], + ))) + }); + }, + icon: const Icon( + Icons.edit, + size: 24, + color: Color.fromARGB(255, 8, 39, 92), + ), + ), + IconButton( + onPressed: () { + showDeleteRecordAlertDialog( + context, + provider.savedList[index].id, + provider.savedList[index]); + }, + icon: const Icon( + Icons.delete, + size: 24, + color: Color.fromARGB(255, 8, 39, 92), + ), + ), + ]), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + ViewInteractionScreen( + saveInteraction: + provider.savedList[index], + ))); + }, + ), + const Divider(), + ], + ); + })), + ), + ); + }); + } + + showDeleteRecordAlertDialog( + BuildContext context, String record, SaveInteraction saveInteraction) { + // set up the buttons + ViewInteractionProvider provider = + Provider.of(context, listen: false); + Widget cancelButton = TextButton( + child: Text("YES"), + onPressed: () async { + await provider.deleteRecord(saveInteraction).then((value) { + _displaySnackBar("Deleted sucessfully!"); + Navigator.of(context).pop(); + }); + }, + ); + Widget continueButton = TextButton( + child: Text("NO"), + onPressed: () { + Navigator.of(context).pop(); + }, + ); + + // set up the AlertDialog + AlertDialog alert = AlertDialog( + title: const Text(""), + content: Text("Are you sure you want to delete the record $record ?"), + actions: [ + cancelButton, + continueButton, + ], + ); + + // show the dialog + showDialog( + context: context, + builder: (BuildContext context) { + return alert; + }, + ); + } + + _displaySnackBar(String msg) { + final snackBar = SnackBar( + content: Text( + msg, + style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), + )); + ScaffoldMessenger.of(context).showSnackBar(snackBar); + //scaffoldKeyLogin.currentState!.showSnackBar(snackBar); + } +} diff --git a/lib/views/interaction_module/view_interaction_screen.dart b/lib/views/interaction_module/view_interaction_screen.dart new file mode 100644 index 0000000..1c7fcaf --- /dev/null +++ b/lib/views/interaction_module/view_interaction_screen.dart @@ -0,0 +1,449 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:intl/intl.dart'; +import 'package:provider/provider.dart'; +import 'package:dropdown_button2/dropdown_button2.dart'; +import 'package:pwa_ios/model/interaction_data.dart'; +import 'package:pwa_ios/model/save_interaction.dart'; +import 'package:pwa_ios/utils/util.dart'; +import 'package:pwa_ios/viewmodel/interactionprovider.dart'; +import 'package:pwa_ios/widgets/custombutton.dart'; +import 'package:pwa_ios/widgets/customrangeslider.dart'; +import 'package:pwa_ios/widgets/interatciontextfield.dart'; +import 'package:file_picker/file_picker.dart'; +import 'package:pwa_ios/widgets/responsive_ext.dart'; + +class ViewInteractionScreen extends StatefulWidget { + SaveInteraction saveInteraction; + ViewInteractionScreen({super.key, required this.saveInteraction}); + + @override + State createState() => _ViewInteractionScreenState(); +} + +class _ViewInteractionScreenState extends State { + List interactionReponseList = []; + List sectionList = []; + List textEditingControllerList = []; + int textfieldIndex = 0; + String dropdownvalue = 'Select value'; + String? fileName; + final TextEditingController textEditingController = TextEditingController(); + @override + void initState() { + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + init(); + }); + + super.initState(); + } + + init() async { + await Provider.of(context, listen: false) + .initSavedForm(widget.saveInteraction); + setState(() {}); + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (BuildContext context, provider, Widget? child) { + print("build context"); + print("${provider.interactionReponseList}"); + return GestureDetector( + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: OrientationBuilder(builder: (context, orientation) { + return Scaffold( + //resizeToAvoidBottomInset: false, + appBar: AppBar( + title: Text( + '${widget.saveInteraction.id}', + style: TextStyle( + fontSize: isTablet ? 22 : 14, color: Colors.white), + ), + backgroundColor: const Color(0xFF2b9af3), + automaticallyImplyLeading: false, + leading: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: const Icon( + Icons.arrow_back_ios, + color: Colors.white, + ), + ), + ), + body: Column( + children: [ + Expanded( + child: ListView.builder( + itemCount: provider.interactionReponseList.length, + cacheExtent: double.parse( + provider.interactionReponseList.length.toString()), + itemBuilder: (context, index) { + var item = provider.interactionReponseList[index]; + sectionList = item.sectionList; + return ExpansionTile( + initiallyExpanded: true, + title: Stack( + alignment: AlignmentDirectional.center, + children: [ + Container( + // height: double.infinity, + width: double.infinity, + padding: const EdgeInsets.all(8.0), + decoration: const BoxDecoration( + color: Color(0xFF2b9af3), + ), + child: Text( + item.sectionName, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 18.0), + )), + ]), + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox( + height: 20, + ), + + Padding( + padding: isTablet + ? const EdgeInsets.only(left: 18.0) + : const EdgeInsets.only( + left: 12.0, right: 12.0), + child: GridView.count( + physics: + const NeverScrollableScrollPhysics(), + crossAxisCount: context.responsive( + 1, + sm: 1, // small + md: 1, // medium + lg: sectionList.length == 1 + ? 1 + : 4, // large + xl: 3, // extra large screen + ), + mainAxisSpacing: + sectionList.length == 1 || !isTablet + ? 1 + : 3.5, + shrinkWrap: true, + padding: EdgeInsets.zero, + childAspectRatio: + sectionList.length == 1 || !isTablet + ? orientation == + Orientation.landscape + ? 10 + : 3.8 + : 2.8, + children: List.generate( + sectionList.length, + (i) { + print(sectionList); + SectionList sectionItem = + sectionList[i]; + dropdownvalue = sectionItem + .widget == + InteractionWidget.DROPDOWN + ? sectionItem.value ?? "Select" + : ' '; + List list = sectionItem + .widget == + InteractionWidget + .DROPDOWN || + sectionItem.widget == + InteractionWidget + .AUTOCOMPLETE || + sectionItem.widget == + InteractionWidget + .MULTISELECT + ? provider.getData2(sectionItem) + : []; + provider.checkboxlist = sectionItem + .widget == + InteractionWidget.CHECKBOX + ? provider.getData2(sectionItem) + : []; + + return Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + sectionItem.widget == + InteractionWidget + .BUTTON && + sectionItem.param == + 'add' + ? const SizedBox.shrink() + : Text( + '${sectionItem.name}:*', + style: TextStyle( + color: Colors + .orange.shade800, + fontSize: isTablet + ? 18 + : 12, + ), + ), + SizedBox( + height: isTablet ? 15 : 5, + ), + returnWidget( + sectionItem: sectionItem, + item: item, + provider: provider, + list: list, + gridIndex: i, + listIndex: index, + widgetData: + sectionItem.widget!), + SizedBox( + height: isTablet ? 15 : 5, + ), + ], + ); + }, + ), + ), + ), + SizedBox( + height: isTablet ? 15 : 5, + ), + item.multiple + ? gridViewWidget( + provider, + item.sectionName, + item.multipleList ?? [], + orientation, + item, + index) + : const SizedBox.shrink(), + provider.interactionReponseList.length == + index - 1 + ? saveActions(provider) + : const SizedBox.shrink() + //const Spacer(), + ], + ), + ), + ]); + }, + ), + ), + // const Spacer(), + // saveActions(provider), + ], + )); + }), + ); + }); + } + + Widget returnWidget({ + required SectionList sectionItem, + required FormFieldData item, + required InteractionProvider provider, + required List list, + required int gridIndex, + required int listIndex, + required InteractionWidget widgetData, + }) { + switch (widgetData) { + case InteractionWidget.CHECKBOX: + return Text( + "${provider.getDataValue(sectionItem.id, sectionItem.selectedValue!.last)}"); + + case InteractionWidget.AUTOCOMPLETE: + return Text( + "${provider.getDataValue(sectionItem.id, sectionItem.selectedValue!.last)}"); + + case InteractionWidget.MULTISELECT: + return Text("${sectionItem.selectedValue.toString()}"); + + case InteractionWidget.RADIO: + return Text( + "${provider.getDataValue(sectionItem.id, sectionItem.selectedValue!.last)}"); + + case InteractionWidget.LABEL: + return Text(sectionItem.input!); + + case InteractionWidget.RANGESLIDER: + return Text(sectionItem.selectedValue!.isNotEmpty + ? sectionItem.selectedValue!.last.toString() + : " "); + + case InteractionWidget.TEXT: + return Text(sectionItem.selectedValue!.last); + + case InteractionWidget.BUTTON: + return sectionItem.input == "chooseFile" + ? sectionItem.selectedValue!.isNotEmpty + ? Text("File Uploaded") + : Text(" ") + : Text(" "); + default: + return Text( + "${sectionItem.selectedValue!.isNotEmpty ? provider.getDataValue(sectionItem.id, sectionItem.selectedValue!.last) : " "}"); + } + } + + Widget saveActions(InteractionProvider provider) { + return Align( + alignment: Alignment.centerRight, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + CustomButton( + backgroundColor: Colors.red.shade800, + onPressed: () { + //showDeleteProfileAlertDialog(context); + for (var textcontrollers in provider.textEditingControllerList) { + textcontrollers.text = ''; + } + }, + textColor: Colors.white, + title: "Reset", + height: 40, + width: isTablet ? 100 : 60, + fontsize: isTablet ? 15 : 10.2, + ), + SizedBox( + width: isTablet ? 20 : 4, + ), + CustomButton( + backgroundColor: Colors.green.shade900, + onPressed: () async { + if (textFieldsValidation(provider).isEmpty) { + // await provider.saveJsonObject(context, widget.form); + _displaySnackBar('Form Saved Sucessfully!'); + } else { + _displaySnackBar(textFieldsValidation(provider)); + } + }, + textColor: Colors.white, + title: "Save", + height: 40, + width: isTablet ? 100 : 60, + fontsize: isTablet ? 16 : 12, + ), + SizedBox( + width: isTablet ? 20 : 2, + ), + ], + ), + ); + } + + Widget gridViewWidget( + InteractionProvider provider, + String sectionName, + List sectionList, + Orientation orientation, + FormFieldData item, + int listIndex) { + return Padding( + padding: isTablet + ? EdgeInsets.only(left: 22.0) + : EdgeInsets.only(left: 12.0, right: 12.0), + child: GridView.count( + physics: const NeverScrollableScrollPhysics(), + crossAxisCount: context.responsive( + 1, // default + sm: 1, // small + md: 1, // medium + lg: sectionList.length == 1 ? 1 : 4, // large + xl: 5, // extra large screen + ), + mainAxisSpacing: sectionList.length == 1 || !isTablet ? 1 : 2, + shrinkWrap: true, + padding: EdgeInsets.zero, + childAspectRatio: sectionList.length == 1 || !isTablet + ? orientation == Orientation.landscape + ? 10 + : 4.2 + : 1.8, + children: List.generate( + sectionList.length, + (i) { + print(sectionList); + SectionList sectionItem = sectionList[i]; + dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN + ? sectionItem.value ?? "Select" + : ' '; + List list = + sectionItem.widget == InteractionWidget.DROPDOWN || + sectionItem.widget == InteractionWidget.AUTOCOMPLETE || + sectionItem.widget == InteractionWidget.MULTISELECT + ? provider.getData2(sectionItem) + : []; + provider.checkboxlist = + sectionItem.widget == InteractionWidget.CHECKBOX + ? provider.getData2(sectionItem) + : []; + + return Wrap(children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sectionItem.widget == InteractionWidget.BUTTON && + sectionItem.param == 'add' || + sectionItem.param == 'deletebtn' + ? const SizedBox.shrink() + : Text( + '${sectionItem.name}:*', + style: TextStyle( + color: Colors.orange.shade800, + fontSize: isTablet ? 18 : 14, + ), + ), + const SizedBox( + height: 15, + ), + returnWidget( + sectionItem: sectionItem, + item: item, + provider: provider, + list: list, + gridIndex: i, + listIndex: listIndex, + widgetData: sectionItem.widget!), + ], + ), + ]); + }, + ), + ), + ); + } + + String textFieldsValidation(InteractionProvider provider) { + if (provider.sectionList + .any((element) => element.controller!.text.isEmpty)) { + return 'Fields cannot be empty'; + } + + return ''; + } + + _displaySnackBar(String msg) { + final snackBar = SnackBar( + content: Text( + msg, + style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), + )); + ScaffoldMessenger.of(context).showSnackBar(snackBar); + //scaffoldKeyLogin.currentState!.showSnackBar(snackBar); + } +} diff --git a/lib/views/konectarpage.dart b/lib/views/konectarpage.dart new file mode 100644 index 0000000..16ac23f --- /dev/null +++ b/lib/views/konectarpage.dart @@ -0,0 +1,446 @@ +import 'package:flutter/material.dart'; +import 'dart:async'; +import 'dart:collection'; +import 'dart:io'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_inappwebview/flutter_inappwebview.dart'; +import 'package:pwa_ios/utils/apicall.dart'; +import 'package:pwa_ios/utils/constants.dart'; +import 'package:pwa_ios/views/home_screen.dart'; +import 'package:pwa_ios/views/login.dart'; +import 'package:pwa_ios/utils/util.dart'; +import 'package:pwa_ios/views/webview_example.dart'; +import 'package:pwa_ios/widgets/webview_popup.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:url_launcher/url_launcher.dart'; +import 'dart:ui' as ui; +import 'package:internet_connection_checker/internet_connection_checker.dart'; +import 'package:openid_client/openid_client.dart'; +import 'package:flutter_web_plugins/url_strategy.dart'; + +class MyApp extends StatefulWidget { + const MyApp({Key? key}) : super(key: key); + + @override + State createState() => _MyAppState(); +} + +// Use WidgetsBindingObserver to listen when the app goes in background +// to stop, on Android, JavaScript execution and any processing that can be paused safely, +// such as videos, audio, and animations. +class _MyAppState extends State with WidgetsBindingObserver { + final GlobalKey webViewKey = GlobalKey(); + ValueNotifier isLoading = ValueNotifier(true); + + InAppWebViewController? webViewController; + late Future _username; + late Future _useremail; + late Future _domain; + late Future _key; + late Future _token; + final Future _prefs = SharedPreferences.getInstance(); + late final String name, email, key; + late String token = ''; + late bool logout = false; + bool connectivity = true; + InAppWebViewSettings sharedSettings = InAppWebViewSettings( + // enable opening windows support + supportMultipleWindows: true, + javaScriptCanOpenWindowsAutomatically: true, + + // useful for identifying traffic, e.g. in Google Analytics. + applicationNameForUserAgent: 'Konectar', + // Override the User Agent, otherwise some external APIs, such as Google and Facebook logins, will not work + // because they recognize and block the default WebView User Agent. + userAgent: + 'Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.5304.105 Mobile Safari/537.36', + disableDefaultErrorPage: true, + + // enable iOS service worker feature limited to defined App Bound Domains + limitsNavigationsToAppBoundDomains: true); + + @override + void initState() { + WidgetsBinding.instance.addObserver(this); + WidgetsBinding.instance.addPostFrameCallback((timeStamp) async { + // connectivity = await InternetConnectionChecker().hasConnection; + + _username = _prefs.then((SharedPreferences prefs) { + name = prefs.getString('username') ?? ""; + return prefs.getString('username') ?? ""; + }); + _useremail = _prefs.then((SharedPreferences prefs) { + email = prefs.getString('useremail') ?? ""; + + return prefs.getString('useremail') ?? ""; + }); + _domain = _prefs.then((SharedPreferences prefs) { + return prefs.getString('domain') ?? ""; + }); + _key = _prefs.then((SharedPreferences prefs) { + key = prefs.getString('secretkey') ?? ""; + return prefs.getString('secretkey') ?? ""; + }); + _token = _prefs.then((SharedPreferences prefs) { + token = prefs.getString('token') ?? ""; + return prefs.getString('token') ?? ""; + }); + }); + super.initState(); + } + + @override + void dispose() { + webViewController = null; + WidgetsBinding.instance.removeObserver(this); + super.dispose(); + } + + @override + void didChangeAppLifecycleState(AppLifecycleState state) { + if (!kIsWeb) { + if (webViewController != null && + defaultTargetPlatform == TargetPlatform.android) { + if (state == AppLifecycleState.paused) { + pauseAll(); + } else { + resumeAll(); + } + } + } + } + + void pauseAll() { + if (defaultTargetPlatform == TargetPlatform.android) { + webViewController?.pause(); + } + webViewController?.pauseTimers(); + } + + void resumeAll() { + if (defaultTargetPlatform == TargetPlatform.android) { + webViewController?.resume(); + } + webViewController?.resumeTimers(); + } + + @override + Widget build(BuildContext context) { + return WillPopScope( + onWillPop: () async { + // detect Android back button click + final controller = webViewController; + if (controller != null) { + if (await controller.canGoBack()) { + controller.goBack(); + return false; + } + } + return true; + }, + child: SafeArea( + child: Scaffold( + body: Column( + // mainAxisAlignment: MainAxisAlignment.center, + // + children: [ + Expanded( + child: FutureBuilder( + future: isNetworkAvailable(), + builder: (context, snapshot) { + if (!snapshot.hasData) { + print("no data******"); + return Text("No internet connectivity!"); + } + + final bool networkAvailable = snapshot.data ?? false; + + // Android-only + final cacheMode = networkAvailable + ? CacheMode.LOAD_DEFAULT + : CacheMode.LOAD_CACHE_ELSE_NETWORK; + + // iOS-only + final cachePolicy = networkAvailable + ? URLRequestCachePolicy.USE_PROTOCOL_CACHE_POLICY + : URLRequestCachePolicy.RETURN_CACHE_DATA_ELSE_LOAD; + + final webViewInitialSettings = sharedSettings.copy(); + //webViewInitialSettings.cacheMode = cacheMode; + webViewInitialSettings.useShouldOverrideUrlLoading = true; + webViewInitialSettings.useShouldInterceptAjaxRequest = true; + webViewInitialSettings + .javaScriptCanOpenWindowsAutomatically = true; + webViewInitialSettings.useShouldInterceptRequest = true; + return networkAvailable + ? Stack( + alignment: AlignmentDirectional.center, + children: [ + ValueListenableBuilder( + valueListenable: isLoading, + builder: (context, value, child) { + return isLoading.value + ? CircularProgressIndicator() + : Center( + child: Container( + child: Text( + "No internet connectivity!"), + ), + ); + }, + ), + + InAppWebView( + key: webViewKey, + shouldInterceptRequest: + (controller, request) async { + print("something"); + print(request); + return null; + }, + initialUrlRequest: token.isNotEmpty + ? URLRequest( + url: WebUri( + "https://cardio-staging.konectar.io/contacts")) + : URLRequest( + url: kPwaUri, + headers: { + "key": key, + "email": email, + "name": name, + "key": + "\$2a\$08\$XeBs/kLqAESRk/jWyNVsyeCjoOvxEmDT7/TK5xkLn23FJ/.5B5beK", + // // "email": "scheepu@tikamobile.com", + // // "name": "scheepu", + }, + method: "GET", + cachePolicy: cachePolicy), + onReceivedServerTrustAuthRequest: + (controller, challenge) async { + return ServerTrustAuthResponse( + action: ServerTrustAuthResponseAction + .PROCEED); + }, + initialUserScripts: + UnmodifiableListView([ + UserScript( + source: """ + document.getElementById('notifications').addEventListener('click', function(event) { + var randomText = Math.random().toString(36).slice(2, 7); + window.flutter_inappwebview.callHandler('requestDummyNotification', randomText); + }); + """, + injectionTime: UserScriptInjectionTime + .AT_DOCUMENT_END) + ]), + initialSettings: webViewInitialSettings, + onWebViewCreated: (controller) { + webViewController = controller; + + controller.addJavaScriptHandler( + handlerName: 'readystatechange', + callback: (arguments) { + final String randomText = + arguments.isNotEmpty + ? arguments[0] + : ''; + print("responses"); + print(arguments); + ScaffoldMessenger.of(context) + .showSnackBar(const SnackBar( + content: + Text("some notification"))); + }, + ); + }, + shouldOverrideUrlLoading: + (controller, navigationAction) async { + // restrict navigation to target host, open external links in 3rd party apps + final uri = navigationAction.request.url; + if (uri != null && + navigationAction.isForMainFrame && + uri.host != kPwaHost && + await canLaunchUrl(uri)) { + // launchUrl(uri); + return NavigationActionPolicy.CANCEL; + } + return NavigationActionPolicy.ALLOW; + }, + onLoadStart: (controller, url) async { + isLoading.value = true; + print("check urls here ${url.toString()}"); + if (url.toString() == + 'https://cardio-staging.konectar.io/login/logout') { + logout = true; + } + if (url.toString() == + 'https://cardio-staging.konectar.io/login') { + controller.loadUrl( + urlRequest: URLRequest( + url: kPwaUri, + headers: { + // "key": key, + "email": email, + "name": name, + "key": + "\$2a\$08\$XeBs/kLqAESRk/jWyNVsyeCjoOvxEmDT7/TK5xkLn23FJ/.5B5beK", + }, + method: "GET")); + + if (logout) { + SharedPreferences preferences = + await SharedPreferences.getInstance(); + await preferences.clear().then((value) { + Navigator.pushReplacement( + context, + MaterialPageRoute( + builder: + (BuildContext context) => + const LoginScreen())); + }); + } + } + }, + onLoadStop: (controller, url) async { + final SharedPreferences prefs = await _prefs; + String response = + await controller.evaluateJavascript( + source: 'document.body.innerText'); + // setState(() { + // isLoading.value = false; + // isLoading.addListener(() {}); + // }); + if (response.contains('token')) { + String token = response + .split(',') + .last + .split(':')[1] + .replaceAll('}', "") + .replaceAll('"', ""); + setState(() { + _token = prefs + .setString('token', token) + .then((bool success) { + return _token; + }); + }); + + print("response"); + print(token); + print( + "https://cardio-staging.konectar.io/nested_logins/verify_url/$token/notifications/list_all_notifications"); + // await ApiCall().listnotifications( + // "https://cardio-staging.konectar.io/nested_logins/verify_url/$token/notifications/list_all_notifications"); + controller.loadUrl( + urlRequest: URLRequest( + url: WebUri( + "https://cardio-staging.konectar.io/nested_logins/verify_url/$token/contacts/", + ), + )); + } + + if (await isNetworkAvailable() && + !(await isPWAInstalled())) { + // if network is available and this is the first timeß + setPWAInstalled(); + } + }, + onReceivedError: + (controller, request, error) async { + final isForMainFrame = + request.isForMainFrame ?? true; + if (isForMainFrame && + !(await isNetworkAvailable())) { + if (!(await isPWAInstalled())) { + await controller.loadData( + data: kHTMLErrorPageNotInstalled); + } + } + }, + // shouldInterceptAjaxRequest: + // (InAppWebViewController controller, + // AjaxRequest ajaxRequest) async { + // print("ajax urls"); + // print(ajaxRequest.url); + // // ajaxRequest.headers!.setRequestHeader( + // // "Cookie", "list_all_notifications"); + // return ajaxRequest; + // }, + // onAjaxReadyStateChange: + // (InAppWebViewController controller, + // AjaxRequest ajaxRequest) async { + // print("ajax request"); + // print(ajaxRequest.url); + // print(ajaxRequest.status); + // return AjaxRequestAction.PROCEED; + // }, + // onAjaxProgress: (InAppWebViewController controller, + // AjaxRequest ajaxRequest) async { + // print("ajax response"); + // print(ajaxRequest.url); + // print(ajaxRequest.status); + // return AjaxRequestAction.PROCEED; + // }, + onCreateWindow: + (controller, createWindowAction) async { + print("CREATES WINDOW"); + showDialog( + context: context, + builder: (context) { + final popupWebViewSettings = + sharedSettings.copy(); + popupWebViewSettings + .supportMultipleWindows = false; + popupWebViewSettings + .javaScriptCanOpenWindowsAutomatically = + false; + + return WebViewPopup( + createWindowAction: + createWindowAction, + popupWebViewSettings: + popupWebViewSettings); + }, + ); + return true; + }, + ), + // backdropFilterExample(context), + ], + ) + : Container( + child: Text("No internet"), + ); + }, + ), + ), + ])), + ), + ); + } + + // Widget backdropFilterExample(BuildContext context) { + // return Positioned.fill( + // child: BackdropFilter( + // filter: ui.ImageFilter.blur( + // sigmaX: 0.0, + // sigmaY: 0.0, + // ), + // child: Container( + // // width: MediaQuery.of(context).size.height, + // // height: 100, + // color: Colors.transparent, + // child: isLoading.value + // ? Transform.scale( + // scale: 0.5, + // child: const CircularProgressIndicator( + // color: Colors.blue, + // ), + // ) + // : SizedBox.shrink(), + // )), + // ); + // } +} diff --git a/lib/views/login.dart b/lib/views/login.dart new file mode 100644 index 0000000..ff94cb3 --- /dev/null +++ b/lib/views/login.dart @@ -0,0 +1,258 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:pwa_ios/model/userdata_model.dart'; +import 'package:pwa_ios/utils/apicall.dart'; +import 'package:pwa_ios/utils/sessionmanager.dart'; +import 'package:pwa_ios/utils/util.dart'; +import 'package:pwa_ios/viewmodel/loginprovider.dart'; +import 'package:pwa_ios/views/home_screen.dart'; +import 'package:pwa_ios/utils/validations.dart'; +import 'package:pwa_ios/widgets/custombutton.dart'; +import 'package:pwa_ios/widgets/customtextfield.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class LoginScreen extends StatefulWidget { + const LoginScreen({super.key}); + + @override + State createState() => _LoginScreenState(); +} + +class _LoginScreenState extends State { + final scaffoldKeyLogin = GlobalKey(); + final nameTextController = TextEditingController(); + final emailTextController = TextEditingController(); + final domainTextConrtroller = TextEditingController(); + final secretKeyTextConrtroller = TextEditingController(); + final Future _prefs = SharedPreferences.getInstance(); + late Future _username; + late Future _useremail; + late Future _domain; + late Future _key; + late Future _login; + var provider; + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + init(); + provider = Provider.of(context, listen: false); + }); + _username = _prefs.then((SharedPreferences prefs) { + return prefs.getString('username') ?? ""; + }); + _useremail = _prefs.then((SharedPreferences prefs) { + return prefs.getString('useremail') ?? ""; + }); + _domain = _prefs.then((SharedPreferences prefs) { + return prefs.getString('domain') ?? ""; + }); + _key = _prefs.then((SharedPreferences prefs) { + return prefs.getString('secretkey') ?? ""; + }); + _login = _prefs.then((SharedPreferences prefs) { + return prefs.getBool('isloggedin') ?? false; + }); + } + + init() async { + await ApiCall().parseInfo(); + } + + @override + Widget build(BuildContext context) { + return OrientationBuilder( + builder: (BuildContext context, Orientation orientation) { + return Scaffold( + // resizeToAvoidBottomInset: true, + body: orientation == Orientation.portrait + ? Column( + children: _buildBody(orientation), + ) + : Row( + children: _buildBody(orientation), + ), + ); + }); + } + + List _buildBody(Orientation orientation) { + return [ + Expanded( + flex: 1, + child: Container( + width: orientation == Orientation.portrait + ? double.infinity + : MediaQuery.of(context).size.height * 0.45, + decoration: const BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + Color.fromARGB(255, 8, 39, 92), + Color.fromARGB(255, 11, 60, 144), + Color.fromARGB(255, 26, 64, 129), + ], + )), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + width: isTablet ? 160 : 80, + height: isTablet ? 160 : 80, + child: CircleAvatar( + backgroundColor: Color.fromARGB(255, 126, 134, 147), + child: Icon( + Icons.person, + size: isTablet ? 120 : 60, + ), + ), + ), + const SizedBox( + height: 20, + ), + Text( + 'Welcome, you are almost there!', + style: TextStyle( + fontSize: isTablet ? 22 : 18, color: Colors.white), + ) + ], + ), + ), + ), + Expanded( + flex: 2, + child: Container( + // decoration: const BoxDecoration( + // gradient: LinearGradient( + // begin: Alignment.topRight, + // end: Alignment.bottomLeft, + // colors: [ + // Color.fromARGB(255, 126, 134, 147), + // Color.fromARGB(255, 193, 198, 209), + // Color.fromARGB(255, 214, 217, 223), + // ], + // )), + child: _buildform(), + padding: EdgeInsets.symmetric( + horizontal: 30, + vertical: orientation == Orientation.portrait ? 20 : 0), + ), + ) + ]; + } + + Widget _buildform() { + return SingleChildScrollView( + child: Column(mainAxisAlignment: MainAxisAlignment.start, children: [ + Text( + 'Please fill the details', + style: TextStyle( + fontSize: isTablet ? 22.0 : 16, + fontWeight: FontWeight.bold, + color: Colors.blue[900]), + ), + const SizedBox( + height: 20, + ), + CustomTextField(labelText: "Name", controller: nameTextController), + const SizedBox( + height: 20, + ), + CustomTextField(labelText: "Email", controller: emailTextController), + const SizedBox( + height: 20, + ), + CustomTextField( + labelText: "Application url", controller: domainTextConrtroller), + const SizedBox( + height: 20, + ), + CustomTextField( + labelText: "Secret key", controller: secretKeyTextConrtroller), + SizedBox( + height: isTablet ? 40 : 20, + ), + CustomButton( + backgroundColor: Colors.indigoAccent, + onPressed: () { + if (textFieldsValidation().isEmpty) { + //_joinMeeting(roomText.text, "demo meet2"); + _saveprefs( + nameTextController.text, + emailTextController.text, + domainTextConrtroller.text, + secretKeyTextConrtroller.text, + true) + .then((value) { + Navigator.of(context).pushReplacement( + MaterialPageRoute(builder: (context) => const HomeScreen()), + ); + }); + } else { + _displaySnackBar(textFieldsValidation()); + } + }, + textColor: Colors.white, + fontsize: isTablet ? 22 : 18, + title: "Submit"), + ]), + ); + } + + Future _saveprefs( + String name, String email, String domain, String key, bool login) async { + final SharedPreferences prefs = await _prefs; + final String useremail = (prefs.getString('useremail') ?? ''); + final String username = (prefs.getString('username') ?? ''); + final String userdomain = (prefs.getString('domain') ?? ''); + final String secretkey = (prefs.getString('secretkey') ?? ''); + final bool isloggedin = (prefs.getBool('isloggedin') ?? false); + setState(() { + _useremail = prefs.setString('useremail', email).then((bool success) { + return useremail; + }); + _username = prefs.setString('username', name).then((bool success) { + return username; + }); + _domain = prefs.setString('domain', domain).then((bool success) { + return userdomain; + }); + _key = prefs.setString('secretkey', key).then((bool success) { + return secretkey; + }); + _login = prefs.setBool('isloggedin', login).then((bool success) { + return isloggedin; + }); + SessionManager().setLoggedIn(isloggedin); + }); + UserData userData = + UserData(email: email, name: name, domainUrl: domain, secretkey: key); + await provider.saveUserData(userData); + } + + _displaySnackBar(String msg) { + final snackBar = SnackBar(content: Text(msg)); + ScaffoldMessenger.of(context).showSnackBar(snackBar); + //scaffoldKeyLogin.currentState!.showSnackBar(snackBar); + } + + String textFieldsValidation() { + if (FieldValidation.validateName(nameTextController.text).isNotEmpty) { + return FieldValidation.validateName(nameTextController.text); + } + if (FieldValidation.validateEmail(emailTextController.text).isNotEmpty) { + return FieldValidation.validateEmail(emailTextController.text); + } + if (FieldValidation.validateUrl(domainTextConrtroller.text).isNotEmpty) { + return FieldValidation.validateUrl(domainTextConrtroller.text); + } + if (FieldValidation.validateSecretKey(secretKeyTextConrtroller.text) + .isNotEmpty) { + return FieldValidation.validateSecretKey(secretKeyTextConrtroller.text); + } else { + return ''; + } + } +} diff --git a/lib/views/notification_screen.dart b/lib/views/notification_screen.dart new file mode 100644 index 0000000..3c0fb08 --- /dev/null +++ b/lib/views/notification_screen.dart @@ -0,0 +1,237 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; + +class NotificationCustomScreen extends StatefulWidget { + const NotificationCustomScreen({super.key}); + + @override + State createState() => + _NotificationCustomScreenState(); +} + +class _NotificationCustomScreenState extends State { + List tableDataRows = [ + const TableRow( + children: [ + TableCell( + child: Text('Row 1, Column 1'), + ), + TableCell( + child: Text('Row 1, Column 2'), + ), + ], + ), + const TableRow( + children: [ + TableCell( + child: Text('Row 2, Column 1'), + ), + TableCell( + child: Text('Row 2, Column 2'), + ), + ], + ), + const TableRow( + children: [ + TableCell( + child: Text('Row 3, Column 1'), + ), + TableCell( + child: Text('Row 3, Column 2'), + ), + + ], + ), + + const TableRow( + children: [ + TableCell( + child: Text('Row 4, Column 1'), + ), + TableCell( + child: Text('Row 4, Column 2'), + ), + + ], + ), + const TableRow( + children: [ + TableCell( + child: Text('Row 5, Column 1'), + ), + TableCell( + child: Text('Row 5, Column 2'), + ), + + ], + ), + ]; + + @override + Widget build(BuildContext context) { + var headers = ["Start date", "End date", "Note", "Created by"]; + + var list = [ + { + 'Start date': "06/09/2023", + "End date": "11/10/2023", + "notification": "Test notifications", + "createdby": "Sneha" + }, + { + 'Start date': "06/09/2023", + "End date": "11/09/2023", + "notification": "Test notifications", + "createdby": "Sneha" + }, + ]; + return MaterialApp( + home: Scaffold( + appBar: AppBar( + title: Text('Notifications'), + backgroundColor: Color.fromARGB(255, 11, 60, 144), + ), + body: Padding( + padding: const EdgeInsets.all(20.0), + child: Center( + child: Column( + children: [ + Table( + border: TableBorder.all(color: Colors.black), + columnWidths: { + 0: FixedColumnWidth( + MediaQuery.of(context).size.height * 0.30), + 1: FixedColumnWidth( + MediaQuery.of(context).size.height * 0.30), + 2: FixedColumnWidth( + MediaQuery.of(context).size.height * 0.30), + 3: FixedColumnWidth( + MediaQuery.of(context).size.height * 0.30) + }, + children: [ + // for (var item in headers) + TableRow(children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Text( + headers[0], + style: const TextStyle(fontSize: 18.0), + ), + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Text( + headers[1], + style: const TextStyle(fontSize: 18.0), + ), + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Text( + headers[2], + style: const TextStyle(fontSize: 18.0), + ), + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Text( + headers[3], + style: const TextStyle(fontSize: 18.0), + ), + ), + ), + // Text(item[1]), + // Text(item[2]), + ]) + ]), + Table( + border: TableBorder.all(color: Colors.black), + columnWidths: { + 0: FixedColumnWidth( + MediaQuery.of(context).size.height * 0.30), + 1: FixedColumnWidth( + MediaQuery.of(context).size.height * 0.30), + 2: FixedColumnWidth( + MediaQuery.of(context).size.height * 0.30), + 3: FixedColumnWidth( + MediaQuery.of(context).size.height * 0.30) + }, + children: [ + for (var item in list) + TableRow(children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + item['Start date']!, + style: TextStyle(fontSize: 18.0), + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + item['End date']!, + style: TextStyle(fontSize: 18.0), + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + item['notification']!, + style: TextStyle(fontSize: 18.0), + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + item['createdby']!, + style: TextStyle(fontSize: 18.0), + ), + ), + ]) + ]), + ], + ), + ), + ), + floatingActionButton: FloatingActionButton( + backgroundColor: Color.fromARGB(255, 11, 60, 144), + onPressed: () { + setState(() { + // Update the list of table data rows + tableDataRows = [ + const TableRow( + children: [ + TableCell( + child: Text('Row 1, Column 1 (updated)'), + ), + TableCell( + child: Text('Row 1, Column 2 (updated)'), + ), + ], + ), + const TableRow( + children: [ + TableCell( + child: Text('Row 2, Column 1 (updated)'), + ), + TableCell( + child: Text('Row 2, Column 2 (updated)'), + ), + ], + ), + ]; + }); + }, + child: Icon(Icons.refresh), + ), + ), + ); + } +} diff --git a/lib/views/notifications.dart b/lib/views/notifications.dart new file mode 100644 index 0000000..3c8488e --- /dev/null +++ b/lib/views/notifications.dart @@ -0,0 +1,602 @@ +import 'dart:collection'; +import 'dart:convert'; + +import 'package:pwa_ios/utils/apicall.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:theta/theta.dart'; +import 'package:url_launcher/url_launcher.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_inappwebview/flutter_inappwebview.dart'; +import 'package:pwa_ios/utils/constants.dart'; +import 'package:pwa_ios/utils/util.dart'; +import 'package:pwa_ios/widgets/webview_popup.dart'; + +class NotificationsScreen extends StatefulWidget { + const NotificationsScreen({super.key}); + + @override + State createState() => _NotificationsScreenState(); +} + +class _NotificationsScreenState extends State + with WidgetsBindingObserver { + final GlobalKey webViewKey = GlobalKey(); + ValueNotifier isLoading = ValueNotifier(true); + + InAppWebViewController? webViewController; + late Future _username; + late Future _useremail; + late Future _domain; + late Future _key; + late Future _token; + final Future _prefs = SharedPreferences.getInstance(); + late final String name, email, key; + late String token = ''; + late bool logout = false; + + InAppWebViewSettings sharedSettings = InAppWebViewSettings( + // enable opening windows support + supportMultipleWindows: true, + javaScriptCanOpenWindowsAutomatically: true, + + // useful for identifying traffic, e.g. in Google Analytics. + applicationNameForUserAgent: 'My PWA App Name', + // Override the User Agent, otherwise some external APIs, such as Google and Facebook logins, will not work + // because they recognize and block the default WebView User Agent. + userAgent: + 'Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.5304.105 Mobile Safari/537.36', + disableDefaultErrorPage: true, + + // enable iOS service worker feature limited to defined App Bound Domains + limitsNavigationsToAppBoundDomains: true); + + @override + void initState() { + WidgetsBinding.instance.addObserver(this); + super.initState(); + + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + // init(); + // showDialog( + // context: context, + // builder: (context) { + // return Align( + // alignment: Alignment.center, + // child: UIBox( + // 'Notifications', + // overrides: [ + // Override( + // 'd32e1776-1467-571c-8a86-99f564425733', + // builder: (context, node, child, children) { + // return GestureDetector( + // onTap: () { + // debugPrint('Tapped!'); + // Navigator.pop(context); + // }, + // child: Container( + // color: Colors.blue, + // height: 40, + // child: child, + // ) // You can even use the original child + // ); + // }, + // ), + // Override( + // '37326013-d2b7-5f86-96da-8764757eefdd', + // builder: (context, node, child, children) { + // return Text('\n\nTest Notifications\n\n\n\n'); + // }, + // ) + // ], + // )); + // }, + // ); + _username = _prefs.then((SharedPreferences prefs) { + name = prefs.getString('username') ?? ""; + return prefs.getString('username') ?? ""; + }); + _useremail = _prefs.then((SharedPreferences prefs) { + email = prefs.getString('useremail') ?? ""; + + return prefs.getString('useremail') ?? ""; + }); + _domain = _prefs.then((SharedPreferences prefs) { + return prefs.getString('domain') ?? ""; + }); + _key = _prefs.then((SharedPreferences prefs) { + key = prefs.getString('secretkey') ?? ""; + return prefs.getString('secretkey') ?? ""; + }); + _token = _prefs.then((SharedPreferences prefs) { + token = prefs.getString('token') ?? ""; + return prefs.getString('token') ?? ""; + }); + }); + } + + init() async { + // await ApiCall().listnotifications("ja"); + } + + @override + void dispose() { + webViewController = null; + WidgetsBinding.instance.removeObserver(this); + super.dispose(); + } + + @override + void didChangeAppLifecycleState(AppLifecycleState state) { + if (!kIsWeb) { + if (webViewController != null && + defaultTargetPlatform == TargetPlatform.android) { + if (state == AppLifecycleState.paused) { + pauseAll(); + } else { + resumeAll(); + } + } + } + } + + void pauseAll() { + if (defaultTargetPlatform == TargetPlatform.android) { + webViewController?.pause(); + } + webViewController?.pauseTimers(); + } + + void resumeAll() { + if (defaultTargetPlatform == TargetPlatform.android) { + webViewController?.resume(); + } + webViewController?.resumeTimers(); + } + + @override + Widget build(BuildContext context) { + return WillPopScope( + onWillPop: () async { + // detect Android back button click + final controller = webViewController; + if (controller != null) { + if (await controller.canGoBack()) { + controller.goBack(); + return false; + } + } + return true; + }, + child: SafeArea( + child: Scaffold( + body: Column(children: [ + Expanded( + child: Stack( + children: [ + FutureBuilder( + future: isNetworkAvailable(), + builder: (context, snapshot) { + if (!snapshot.hasData) { + return Container(); + } + + final bool networkAvailable = snapshot.data ?? false; + + // Android-only + final cacheMode = networkAvailable + ? CacheMode.LOAD_DEFAULT + : CacheMode.LOAD_CACHE_ELSE_NETWORK; + + // iOS-only + final cachePolicy = networkAvailable + ? URLRequestCachePolicy.USE_PROTOCOL_CACHE_POLICY + : URLRequestCachePolicy.RETURN_CACHE_DATA_ELSE_LOAD; + + final webViewInitialSettings = sharedSettings.copy(); + //webViewInitialSettings.cacheMode = cacheMode; + webViewInitialSettings.useShouldOverrideUrlLoading = true; + webViewInitialSettings + .javaScriptCanOpenWindowsAutomatically = true; + webViewInitialSettings.useShouldInterceptRequest = true; + webViewInitialSettings.useShouldInterceptAjaxRequest = true; + return InAppWebView( + key: webViewKey, + // initialData: + + shouldInterceptRequest: (controller, request) async { + print("REQUEST URL "); + print(request.url); + return null; + }, + + initialUrlRequest: token.isNotEmpty + ? URLRequest( + url: WebUri( + "https://cardio-staging.konectar.io/notifications/"), + headers: { + "rows": "10", + "page": "1", + "sidx": "name", + "sord": "desc" + }, + method: "POST") + : URLRequest( + url: kPwaUri, + headers: { + "key": key, + "email": email, + "name": name, + "key": + "\$2a\$08\$XeBs/kLqAESRk/jWyNVsyeCjoOvxEmDT7/TK5xkLn23FJ/.5B5beK", + // // "email": "scheepu@tikamobile.com", + // // "name": "scheepu", + }, + method: "GET"), + + //cachePolicy: cachePolicy), + onReceivedServerTrustAuthRequest: + (controller, challenge) async { + return ServerTrustAuthResponse( + action: ServerTrustAuthResponseAction.PROCEED); + }, + + initialUserScripts: UnmodifiableListView([ + UserScript( + source: """ + document.getElementById('notifications').addEventListener('click', function(event) { + var randomText = Math.random().toString(36).slice(2, 7); + window.flutter_inappwebview.callHandler('requestDummyNotification', randomText); + }); + """, + injectionTime: + UserScriptInjectionTime.AT_DOCUMENT_END) + ]), + + initialSettings: webViewInitialSettings, + + onWebViewCreated: (controller) { + webViewController = controller; + controller.callAsyncJavaScript( + functionBody: "list_notifications_grid"); + // message event listener + + controller.addJavaScriptHandler( + handlerName: 'list_notifications_grid', + callback: (arguments) { + final String randomText = + arguments.isNotEmpty ? arguments[0] : ''; + print("responses notifications"); + print(arguments); + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text("some notification"))); + }, + ); + }, + + shouldOverrideUrlLoading: + (controller, navigationAction) async { + // restrict navigation to target host, open external links in 3rd party apps + final uri = navigationAction.request.url; + if (uri != null && + navigationAction.isForMainFrame && + uri.host != kPwaHost && + await canLaunchUrl(uri)) { + launchUrl(uri); + return NavigationActionPolicy.CANCEL; + } + return NavigationActionPolicy.ALLOW; + }, + onLoadStop: (controller, url) async { + await controller.evaluateJavascript(source: """ + window.addEventListener("list_notifications_grid", (event) => { + console.log(JSON.stringify(event.detail)); + }, false); + """); + final SharedPreferences prefs = await _prefs; + var html = await controller.evaluateJavascript( + source: + "document.getElementById('notificationsList').innerText"); + print("html"); + print(html); + dynamic response = await controller.evaluateJavascript( + source: 'document.body.innerText'); + print(jsonEncode(response)); + // String response2 = await controller.evaluateJavascript( + // source: 'notificationsList'); + // setState(() { + // isLoading.value = false; + // isLoading.addListener(() {}); + // }); + if (response.contains('token')) { + String token = response + .split(',') + .last + .split(':')[1] + .replaceAll('}', "") + .replaceAll('"', ""); + setState(() { + _token = prefs + .setString('token', token) + .then((bool success) { + return _token; + }); + }); + + print("response"); + print(token); + print( + "https://cardio-staging.konectar.io/nested_logins/verify_url/$token/notifications/list_all_notifications"); + // await ApiCall().listnotifications( + // "https://cardio-staging.konectar.io/nested_logins/verify_url/$token/notifications/list_all_notifications"); + controller.loadUrl( + urlRequest: URLRequest( + url: WebUri( + "https://cardio-staging.konectar.io/nested_logins/verify_url/$token/user_settings/", + ), + )); + } + await ApiCall() + .listnotifications() + .then((value) => print("see value $value")); + // controller.loadUrl( + // urlRequest: URLRequest( + // url: WebUri( + // "https://cardio-staging.konectar.io/notifications/list_all_notifications", + // ), + // headers: { + // "rows": "10", + // "page": "1", + // "sidx": "name", + // "sord": "desc" + // }, + // method: "POST")); + if (await isNetworkAvailable() && + !(await isPWAInstalled())) { + // if network is available and this is the first timeß + setPWAInstalled(); + } + }, + onProgressChanged: (controller, progress) { + setState(() { + // loadingProgress = progress / 100; + }); + }, + shouldInterceptAjaxRequest: + (InAppWebViewController controller, + AjaxRequest ajaxRequest) async { + print("ajax urls"); + print(ajaxRequest.url); + // ajaxRequest.headers!.setRequestHeader( + // "Cookie", "list_all_notifications"); + return ajaxRequest; + }, + onAjaxReadyStateChange: + (InAppWebViewController controller, + AjaxRequest ajaxRequest) async { + print("ajax request"); + print(ajaxRequest.url); + print(ajaxRequest.status); + return AjaxRequestAction.PROCEED; + }, + onAjaxProgress: (InAppWebViewController controller, + AjaxRequest ajaxRequest) async { + print("ajax response"); + print(ajaxRequest.url); + print(ajaxRequest.status); + return AjaxRequestAction.PROCEED; + }, + onReceivedError: (controller, request, error) async { + final isForMainFrame = request.isForMainFrame ?? true; + if (isForMainFrame && !(await isNetworkAvailable())) { + if (!(await isPWAInstalled())) { + await controller.loadData( + data: kHTMLErrorPageNotInstalled); + } + } + }, + onCreateWindow: (controller, createWindowAction) async { + print("CREATES WINDOW"); + showDialog( + context: context, + builder: (context) { + final popupWebViewSettings = sharedSettings.copy(); + popupWebViewSettings.supportMultipleWindows = false; + popupWebViewSettings + .javaScriptCanOpenWindowsAutomatically = false; + + return WebViewPopup( + createWindowAction: createWindowAction, + popupWebViewSettings: popupWebViewSettings); + }, + ); + return true; + }, + ); + }, + ) + ], + ), + ), + ])), + ), + ); + } +} +/* + Widget buildLocationDropdownWidget( + SectionList sectionItem, InteractionProvider provider) { + if (sectionItem.name == 'Country' && provider.countryList.isNotEmpty) { + print("country list ${provider.countryList}"); + + List list = + provider.countryList.map((e) => e.countryName).toList(); + provider.selectedCountry = list[0]; + // dropdownvalue = provider.selectedCountry; + print("country list $list"); + return returnCountryDropDown(sectionItem, provider, list); + } + if (sectionItem.name == 'State') { + List list = provider.stateList.map((e) => e.stateName).toList(); + provider.selectedState = provider.getStateId(list[0]); + // dropdownvalue = list[0]; + return returnStateDropDown(sectionItem, provider, list); + } + if (sectionItem.name == 'City') { + List list = provider.selectedState.isNotEmpty + ? provider + .getCity(provider.selectedState) + .map((e) => e.cityName) + .toList() + : provider.cityList.map((e) => e.cityName).toList(); + provider.selectedCity = list[0]; + + // dropdownvalue = provider.selectedCity; + return returnCityDropDown(sectionItem, provider, list); + } + return SizedBox.shrink(); + } + + Widget returnCountryDropDown( + var sectionItem, InteractionProvider provider, List list) { + return Container( + width: 160, + decoration: BoxDecoration( + border: Border.all(width: 1.0, color: Colors.grey.shade800)), + child: Center( + child: DropdownButton( + // Initial Value + value: dropdownvalue, + underline: const SizedBox.shrink(), + hint: Text('Select'), + + // Down Arrow Icon + icon: const Icon(Icons.keyboard_arrow_down), + + // Array list of items + items: provider.countryList.map((Country items) { + return DropdownMenuItem( + value: items.countryName, + child: Text(items.countryName), + ); + }).toList(), + // After selecting the desired option,it will + // change button value to selected value + onChanged: (String? newValue) { + setState(() { + sectionItem['value'] = newValue!; + if (sectionItem['name'] == 'Country') { + provider.selectedCountry = provider.getCountryId(newValue); + print("see country id : ${provider.selectedCountry}"); + } + // if (sectionItem['name'] == 'State') { + // provider.selectedState = newValue; + // } + // if (sectionItem['name'] == 'City') { + // provider.selectedCity = newValue; + // } + }); + }, + ), + ), + ); + } + + Widget returnStateDropDown( + var sectionItem, InteractionProvider provider, List list) { + return Container( + width: 160, + decoration: BoxDecoration( + border: Border.all(width: 1.0, color: Colors.grey.shade800)), + child: Center( + child: DropdownButton( + // Initial Value + value: dropdownvalue, + underline: const SizedBox.shrink(), + hint: Text('Select'), + + // Down Arrow Icon + icon: const Icon(Icons.keyboard_arrow_down), + + // Array list of items + items: provider.selectedCountry.isNotEmpty + ? provider.stateList.map((States items) { + return DropdownMenuItem( + value: items.stateId, + child: Text(items.stateName), + ); + }).toList() + : list.map((String items) { + return DropdownMenuItem( + value: items, + child: Text(items), + ); + }).toList(), + // After selecting the desired option,it will + // change button value to selected value + onChanged: (String? newValue) { + setState(() { + sectionItem['value'] = newValue!; + if (provider.selectedCountry.isNotEmpty) { + provider.selectedState = provider.getStateId(newValue); + print("see state id : ${provider.selectedState}"); + } + // if (sectionItem['name'] == 'State') { + // provider.selectedState = newValue; + // } + // if (sectionItem['name'] == 'City') { + // provider.selectedCity = newValue; + // } + }); + }, + ), + ), + ); + } + + Widget returnCityDropDown( + var sectionItem, InteractionProvider provider, List list) { + return Container( + width: 160, + decoration: BoxDecoration( + border: Border.all(width: 1.0, color: Colors.grey.shade800)), + child: Center( + child: DropdownButton( + // Initial Value + value: dropdownvalue, + underline: const SizedBox.shrink(), + hint: Text('Select'), + + // Down Arrow Icon + icon: const Icon(Icons.keyboard_arrow_down), + + // Array list of items + items: provider.cityList.map((City items) { + return DropdownMenuItem( + value: items.cityName, + child: Text(items.cityName), + ); + }).toList(), + // After selecting the desired option,it will + // change button value to selected value + onChanged: (String? newValue) { + setState(() { + sectionItem['value'] = newValue!; + + provider.selectedCity = provider.getCityId(newValue); + print("see city id : ${provider.selectedCity}"); + + // if (sectionItem['name'] == 'State') { + // provider.selectedState = newValue; + // } + // if (sectionItem['name'] == 'City') { + // provider.selectedCity = newValue; + // } + }); + }, + ), + ), + ); + } +*/ \ No newline at end of file diff --git a/lib/views/profile.dart b/lib/views/profile.dart new file mode 100644 index 0000000..a633c5f --- /dev/null +++ b/lib/views/profile.dart @@ -0,0 +1,569 @@ +import 'dart:convert'; +import 'dart:developer'; +import 'dart:io'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:provider/provider.dart'; +import 'package:pwa_ios/main.dart'; +import 'package:pwa_ios/model/interaction_data.dart'; +import 'package:pwa_ios/model/json_form_data.dart'; +import 'package:pwa_ios/model/save_interaction.dart'; +import 'package:pwa_ios/model/userdata_model.dart'; +import 'package:pwa_ios/utils/apicall.dart'; +import 'package:pwa_ios/utils/mockapi.dart'; +import 'package:pwa_ios/utils/sessionmanager.dart'; +import 'package:pwa_ios/utils/util.dart'; +import 'package:pwa_ios/viewmodel/configprovider.dart'; +import 'package:pwa_ios/viewmodel/interactionprovider.dart'; +import 'package:pwa_ios/viewmodel/loginprovider.dart'; +import 'package:pwa_ios/viewmodel/viewinteractionprovider.dart'; +import 'package:pwa_ios/views/login.dart'; +import 'package:pwa_ios/utils/validations.dart'; +import 'package:pwa_ios/widgets/custombutton.dart'; +import 'package:pwa_ios/widgets/customtextfield.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:internet_connection_checker/internet_connection_checker.dart'; + +class ProfileScreen extends StatefulWidget { + const ProfileScreen({super.key}); + + @override + State createState() => _ProfileScreenState(); +} + +class _ProfileScreenState extends State { + final nameTextController = TextEditingController(); + final emailTextController = TextEditingController(); + final domainTextConrtroller = TextEditingController(); + final secretKeyTextConrtroller = TextEditingController(); + final Future _prefs = SharedPreferences.getInstance(); + late String _username; + late String _useremail; + late String _domain; + late String _key; + late Future _login; + late String bytes; + Uint8List? imagebytes; + late String base64Image; + late LoginProvider provider; + ValueNotifier username = ValueNotifier(' '); + File? imageFile; + + bool toggleLockDomain = false; + bool toggleLockKey = false; + @override + void initState() { + super.initState(); + provider = Provider.of(context, listen: false); + WidgetsBinding.instance.addPostFrameCallback((timeStamp) async { + UserData userData = await provider.getUserData(); + print("results"); + print(userData.name); + print(userData.email); + print(userData.secretkey); + + _username = userData.name!; + nameTextController.text = _username; + username.value = _username; + _useremail = userData.email!; + emailTextController.text = _useremail; + _domain = userData.domainUrl!; + domainTextConrtroller.text = _domain; + _key = userData.secretkey!; + secretKeyTextConrtroller.text = _key; + + setState(() { + bytes = userData.imageBytes ?? ""; + imagebytes = base64Decode(userData.imageBytes ?? ""); + base64Image = userData.imageBytes ?? ""; + print("images"); + print(imagebytes); + // bytes = _prefs.then((SharedPreferences prefs) { + // imagebytes = base64Decode(prefs.getString('image') ?? ""); + // print("images"); + // print(imagebytes); + // return prefs.getString('image') ?? ""; + // }); + }); + }); + } + + @override + void didChangeDependencies() { + // TODO: implement didChangeDependencies + WidgetsBinding.instance.addPostFrameCallback((timeStamp) async { + provider = Provider.of(context, listen: false); + + UserData userData = await provider.getUserData(); + print(userData.imageBytes); + bytes = userData.imageBytes ?? ""; + imagebytes = base64Decode(userData.imageBytes ?? ""); + print("images1"); + print(imagebytes); + }); + super.didChangeDependencies(); + } + + @override + Widget build(BuildContext context) { + return OrientationBuilder( + builder: (BuildContext context, Orientation orientation) { + return Scaffold( + resizeToAvoidBottomInset: false, + body: orientation == Orientation.portrait + ? Column( + children: _buildBody(orientation), + ) + : Row( + children: _buildBody(orientation), + ), + ); + }); + } + + List _buildBody(Orientation orientation) { + return [ + Expanded( + flex: 1, + child: Container( + width: orientation == Orientation.portrait + ? double.infinity + : MediaQuery.of(context).size.height * 0.35, + decoration: const BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + Color.fromARGB(255, 8, 39, 92), + Color.fromARGB(255, 11, 60, 144), + Color.fromARGB(255, 26, 64, 129), + ], + )), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + padding: orientation == Orientation.portrait + ? const EdgeInsets.only(top: 40) + : EdgeInsets.zero, + width: MediaQuery.of(context).size.height * 0.45, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Stack( + alignment: AlignmentDirectional.bottomEnd, + children: [ + SizedBox( + width: isTablet ? 160 : 100, + height: isTablet ? 160 : 100, + child: CircleAvatar( + backgroundColor: + const Color.fromARGB(255, 126, 134, 147), + radius: isTablet ? 140 - 5 : 100 - 5, + backgroundImage: imageFile != null + ? Image.file( + imageFile!, + fit: BoxFit.cover, + ).image + : imagebytes != null + ? Image.memory(imagebytes!).image + : const NetworkImage( + 'https://via.placeholder.com/150'), + ), + ), + InkWell( + onTap: () { + showAlertDialog(context); + }, + child: const CircleAvatar( + backgroundColor: Colors.white, + child: Icon( + Icons.camera_alt_sharp, + size: 30, + color: Color.fromARGB(255, 8, 39, 92), + ), + ), + ), + ], + ), + const SizedBox( + height: 20, + ), + Text( + 'Hello,${username.value}', + style: const TextStyle(fontSize: 22, color: Colors.white), + ), + SizedBox( + height: isTablet ? 20 : 5, + ), + CustomButton( + backgroundColor: Colors.grey.shade300, + onPressed: () async { + //cancelTimer(); + bool result = + await InternetConnectionChecker().hasConnection; + if (result == true) { + showLoaderDialog(context); + + // ignore: use_build_context_synchronously + final provider = Provider.of( + context, + listen: false); + final prov = Provider.of(context, + listen: false); + List senSavedList = []; + List savedList = + await provider.getAllRecords(); + for (var obj in savedList) { + senSavedList.add(prov.formJson(obj)); + } + + SendSaveJson jsonData = + SendSaveJson(savedList: senSavedList); + DataJson dataJson = DataJson(sendSaveJson: jsonData); + String jsonstr = saveFormJsonToJson(jsonData); + print(jsonstr); + String jsonDataEncoded = + saveInteractionFormJsonToJson(dataJson); + print(jsonDataEncoded); + + var result = await MockApiCall().postSavedData( + jsonstr, + "/Users/aissel/Library/Developer/CoreSimulator/Devices/1E435121-7E65-45C6-9E0B-411C8B9915F5/data/Containers/Data/Application/4B7EDC75-F376-4A21-A1E4-2A621BCCBD13/Documents/konectar/files/Flutter Questionaire.pdf"); + if (result != null) { + Navigator.pop(context); + _displaySnackBar('Data synced sucessfully!'); + } else { + Navigator.pop(context); + _displaySnackBar('Something went wrong!'); + } + } + }, + textColor: Colors.black, + title: "Sync now", + height: isTablet ? 40 : 35, + width: 120, + fontsize: 14, + ), + ], + ), + ), + ], + ), + ), + ), + Expanded( + flex: 2, + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 20.0, + vertical: orientation == Orientation.portrait ? 10 : 0), + child: _buildform(), + )) + ]; + } + + showLoaderDialog(BuildContext context) { + AlertDialog alert = AlertDialog( + content: Row( + children: [ + const CircularProgressIndicator(), + Container( + margin: const EdgeInsets.only(left: 7), + child: Text("Syncing...")), + ], + ), + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return alert; + }, + ); + } + + Widget _buildform() { + return SingleChildScrollView( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + // const Expanded(child: SizedBox.shrink()), + const Text( + 'Profile Settings', + style: TextStyle(fontSize: 22), + ), + const SizedBox( + height: 30, + ), + CustomTextField(labelText: "Name", controller: nameTextController), + const SizedBox( + height: 30, + ), + CustomTextField( + labelText: "Email", + controller: emailTextController, + enabled: false, + ), + const SizedBox( + height: 30, + ), + Row( + children: [ + Flexible( + child: CustomTextField( + labelText: "Application url", + controller: domainTextConrtroller, + enabled: toggleLockDomain, + obscure: !toggleLockDomain, + ), + ), + IconButton( + onPressed: () { + setState(() { + toggleLockDomain = !toggleLockDomain; + }); + }, + icon: toggleLockDomain + ? const Icon(Icons.lock_open) + : const Icon(Icons.lock), + ), + ], + ), + const SizedBox( + height: 30, + ), + Row( + children: [ + Flexible( + child: CustomTextField( + labelText: "Secret key", + controller: secretKeyTextConrtroller, + enabled: toggleLockKey, + obscure: !toggleLockKey, + ), + ), + IconButton( + onPressed: () { + setState(() { + toggleLockKey = !toggleLockKey; + }); + }, + icon: toggleLockKey + ? const Icon(Icons.lock_open) + : const Icon(Icons.lock), + ), + ], + ), + const SizedBox( + height: 30, + ), + Align( + alignment: Alignment.bottomRight, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + CustomButton( + backgroundColor: Colors.green.shade800, + onPressed: () { + if (textFieldsValidation().isEmpty) { + //_joinMeeting(roomText.text, "demo meet2"); + _saveprefs( + nameTextController.text, + emailTextController.text, + domainTextConrtroller.text, + secretKeyTextConrtroller.text, + base64Image) + .then((value) { + setState(() { + username.value = nameTextController.text; + // final bytes = imageFile!.readAsBytesSync(); + // saveImage(bytes); + }); + _displaySnackBar('Updated Sucessfully!'); + }); + } else { + _displaySnackBar(textFieldsValidation()); + } + }, + textColor: Colors.white, + title: "Save Profile", + height: 50, + fontsize: 16, + ), + CustomButton( + backgroundColor: Colors.red.shade800, + onPressed: () { + showDeleteProfileAlertDialog(context); + }, + textColor: Colors.white, + title: "Delete Profile", + height: 50, + fontsize: 16, + ), + ], + ), + ), + const SizedBox( + height: 30, + ), + ]), + ); + } + + Future _saveprefs(String name, String email, String domain, String key, + String imageBytes) async { + UserData userData = UserData( + email: email, + name: name, + domainUrl: domain, + secretkey: key, + imageBytes: imageBytes); + await provider.saveUserData(userData); + } + + _displaySnackBar(String msg) { + final snackBar = SnackBar(content: Text(msg)); + ScaffoldMessenger.of(context).showSnackBar(snackBar); + //scaffoldKeyLogin.currentState!.showSnackBar(snackBar); + } + + String textFieldsValidation() { + if (FieldValidation.validateName(nameTextController.text).isNotEmpty) { + return FieldValidation.validateName(nameTextController.text); + } + if (FieldValidation.validateEmail(emailTextController.text).isNotEmpty) { + return FieldValidation.validateEmail(emailTextController.text); + } + if (FieldValidation.validateUrl(domainTextConrtroller.text).isNotEmpty) { + return FieldValidation.validateUrl(domainTextConrtroller.text); + } + if (FieldValidation.validateSecretKey(secretKeyTextConrtroller.text) + .isNotEmpty) { + return FieldValidation.validateSecretKey(secretKeyTextConrtroller.text); + } else { + return ''; + } + } + + _getFromGallery() async { + try { + final image = await ImagePicker().pickImage(source: ImageSource.gallery); + if (image == null) return; + final imageTemp = File(image.path); + setState(() => imageFile = imageTemp); + final bytes = imageFile!.readAsBytesSync(); + await saveImage(bytes); + } on PlatformException catch (e) { + print('Failed to pick image: $e'); + } + } + + _getFromCamera() async { + try { + final image = await ImagePicker().pickImage(source: ImageSource.camera); + if (image == null) return; + final imageTemp = File(image.path); + setState(() => imageFile = imageTemp); + final bytes = imageFile!.readAsBytesSync(); + await saveImage(bytes); + } on PlatformException catch (e) { + print('Failed to pick image: $e'); + } + } + + showAlertDialog(BuildContext context) { + // set up the buttons + Widget cancelButton = TextButton( + child: Text("Gallery"), + onPressed: () async { + await _getFromGallery(); + setState(() {}); + Navigator.pop(context); + }, + ); + Widget continueButton = TextButton( + child: Text("Camera"), + onPressed: () async { + await _getFromCamera(); + setState(() {}); + Navigator.pop(context); + }, + ); + + // set up the AlertDialog + AlertDialog alert = AlertDialog( + title: Text(""), + content: Text("Profile photo"), + actions: [ + cancelButton, + continueButton, + ], + ); + + // show the dialog + showDialog( + context: context, + builder: (BuildContext context) { + return alert; + }, + ); + } + + showDeleteProfileAlertDialog(BuildContext context) { + // set up the buttons + Widget cancelButton = TextButton( + child: Text("YES"), + onPressed: () async { + await provider.deleteUserData().then((value) async { + await SessionManager().clearSession().then((value) { + Navigator.of(context).popUntil((route) => route.isFirst); + Navigator.of(context, rootNavigator: true) + .pushReplacementNamed("/"); + }); + }); + }, + ); + Widget continueButton = TextButton( + child: Text("NO"), + onPressed: () { + Navigator.of(context).pop(); + }, + ); + + // set up the AlertDialog + AlertDialog alert = AlertDialog( + title: const Text(""), + content: const Text( + "Are you sure you want to delete the profile as it is not synced and all the data will be unsaved ?"), + actions: [ + cancelButton, + continueButton, + ], + ); + + // show the dialog + showDialog( + context: context, + builder: (BuildContext context) { + return alert; + }, + ); + } + + Future saveImage(List imageBytes) async { + final SharedPreferences prefs = await SharedPreferences.getInstance(); + base64Image = base64Encode(imageBytes); + UserData userData = await provider.getUserData(); + userData.imageBytes = base64Image; + await provider.saveUserData(userData); + return prefs.setString("image", base64Image); + } + + Future getImage() async { + final SharedPreferences prefs = await SharedPreferences.getInstance(); + Uint8List bytes = base64Decode(prefs.getString("image")!); + return Image.memory(bytes); + } +} diff --git a/lib/views/webview_example.dart b/lib/views/webview_example.dart new file mode 100644 index 0000000..899ac1b --- /dev/null +++ b/lib/views/webview_example.dart @@ -0,0 +1,252 @@ +import 'dart:collection'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_inappwebview/flutter_inappwebview.dart'; +import 'package:pwa_ios/utils/constants.dart'; +import 'package:pwa_ios/views/htmlpage.dart'; +import 'package:pwa_ios/utils/util.dart'; +import 'package:pwa_ios/widgets/webview_popup.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class WebviewExample extends StatefulWidget { + const WebviewExample({Key? key}) : super(key: key); + + @override + State createState() => _WebviewExampleState(); +} + +// Use WidgetsBindingObserver to listen when the app goes in background +// to stop, on Android, JavaScript execution and any processing that can be paused safely, +// such as videos, audio, and animations. +class _WebviewExampleState extends State + with WidgetsBindingObserver { + final GlobalKey webViewKey = GlobalKey(); + + InAppWebViewController? webViewController; + InAppWebViewSettings sharedSettings = InAppWebViewSettings( + // enable opening windows support + supportMultipleWindows: true, + javaScriptCanOpenWindowsAutomatically: true, + + // useful for identifying traffic, e.g. in Google Analytics. + applicationNameForUserAgent: 'My PWA App Name', + // Override the User Agent, otherwise some external APIs, such as Google and Facebook logins, will not work + // because they recognize and block the default WebView User Agent. + userAgent: + 'Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.5304.105 Mobile Safari/537.36', + disableDefaultErrorPage: true, + + // enable iOS service worker feature limited to defined App Bound Domains + limitsNavigationsToAppBoundDomains: true); + + @override + void initState() { + WidgetsBinding.instance.addObserver(this); + super.initState(); + } + + @override + void dispose() { + webViewController = null; + WidgetsBinding.instance.removeObserver(this); + super.dispose(); + } + + @override + void didChangeAppLifecycleState(AppLifecycleState state) { + if (!kIsWeb) { + if (webViewController != null && + defaultTargetPlatform == TargetPlatform.android) { + if (state == AppLifecycleState.paused) { + pauseAll(); + } else { + resumeAll(); + } + } + } + } + + void pauseAll() { + if (defaultTargetPlatform == TargetPlatform.android) { + webViewController?.pause(); + } + webViewController?.pauseTimers(); + } + + void resumeAll() { + if (defaultTargetPlatform == TargetPlatform.android) { + webViewController?.resume(); + } + webViewController?.resumeTimers(); + } + + @override + Widget build(BuildContext context) { + return WillPopScope( + onWillPop: () async { + // detect Android back button click + final controller = webViewController; + if (controller != null) { + if (await controller.canGoBack()) { + controller.goBack(); + return false; + } + } + return true; + }, + child: SafeArea( + child: Scaffold( + body: Column(children: [ + Expanded( + child: Stack( + children: [ + FutureBuilder( + future: isNetworkAvailable(), + builder: (context, snapshot) { + if (!snapshot.hasData) { + return Container(); + } + + final bool networkAvailable = snapshot.data ?? false; + + // Android-only + final cacheMode = networkAvailable + ? CacheMode.LOAD_DEFAULT + : CacheMode.LOAD_CACHE_ELSE_NETWORK; + + // iOS-only + final cachePolicy = networkAvailable + ? URLRequestCachePolicy.USE_PROTOCOL_CACHE_POLICY + : URLRequestCachePolicy.RETURN_CACHE_DATA_ELSE_LOAD; + + final webViewInitialSettings = sharedSettings.copy(); + //webViewInitialSettings.cacheMode = cacheMode; + webViewInitialSettings.useShouldOverrideUrlLoading = true; + webViewInitialSettings + .javaScriptCanOpenWindowsAutomatically = true; + webViewInitialSettings.useShouldInterceptRequest = true; + return InAppWebView( + key: webViewKey, + initialData: + InAppWebViewInitialData(data: HtmlPage.htmlCode), + + shouldInterceptRequest: (controller, request) async { + print("something"); + print(request); + return null; + }, + + // initialUrlRequest: + // URLRequest(url: kPwaUri, headers: { + // "key" :"\$2a\$08\$u5DKCL4ir88CPKUhGFqbnuoXcibLZnxs/qi/48miKAuNJM/5.WGWy", + // // "email": "mia_mimedx@tika.com", + // // "name" : "Mia MiMedx", + // // "url": "https://cardio.konectar.io/npiprofile/1841382421" + // "email": "scheepu@tikamobile.com", + // "name" : "Scheepu", + // // "url": "https://192.168.2.127/konectar-sandbox/interactions", + // // "YourHeaderKey" : "YourExpectedHeaderValue" + + // },method: "GET"), + + //cachePolicy: cachePolicy), + onReceivedServerTrustAuthRequest: + (controller, challenge) async { + return ServerTrustAuthResponse( + action: ServerTrustAuthResponseAction.PROCEED); + }, + + initialUserScripts: UnmodifiableListView([ + UserScript( + source: """ + document.getElementById('notifications').addEventListener('click', function(event) { + var randomText = Math.random().toString(36).slice(2, 7); + window.flutter_inappwebview.callHandler('requestDummyNotification', randomText); + }); + """, + injectionTime: + UserScriptInjectionTime.AT_DOCUMENT_END) + ]), + + initialSettings: webViewInitialSettings, + + onWebViewCreated: (controller) { + webViewController = controller; + + controller.addJavaScriptHandler( + handlerName: 'readystatechange', + callback: (arguments) { + final String randomText = + arguments.isNotEmpty ? arguments[0] : ''; + print("responses"); + print(arguments); + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text("some notification"))); + }, + ); + }, + shouldOverrideUrlLoading: + (controller, navigationAction) async { + // restrict navigation to target host, open external links in 3rd party apps + final uri = navigationAction.request.url; + if (uri != null && + navigationAction.isForMainFrame && + uri.host != kPwaHost && + await canLaunchUrl(uri)) { + launchUrl(uri); + return NavigationActionPolicy.CANCEL; + } + return NavigationActionPolicy.ALLOW; + }, + onLoadStop: (controller, url) async { + String response = await controller.evaluateJavascript( + source: 'document.body.innerText'); + print("response"); + print(response); + + if (await isNetworkAvailable() && + !(await isPWAInstalled())) { + // if network is available and this is the first time + setPWAInstalled(); + } + }, + + onReceivedError: (controller, request, error) async { + final isForMainFrame = request.isForMainFrame ?? true; + if (isForMainFrame && !(await isNetworkAvailable())) { + if (!(await isPWAInstalled())) { + await controller.loadData( + data: kHTMLErrorPageNotInstalled); + } + } + }, + onCreateWindow: (controller, createWindowAction) async { + showDialog( + context: context, + builder: (context) { + final popupWebViewSettings = sharedSettings.copy(); + popupWebViewSettings.supportMultipleWindows = false; + popupWebViewSettings + .javaScriptCanOpenWindowsAutomatically = false; + + return WebViewPopup( + createWindowAction: createWindowAction, + popupWebViewSettings: popupWebViewSettings); + }, + ); + return true; + }, + ); + }, + ) + ], + ), + ), + ])), + ), + ); + } +} diff --git a/lib/widgets/custombutton.dart b/lib/widgets/custombutton.dart new file mode 100644 index 0000000..2ecd2ea --- /dev/null +++ b/lib/widgets/custombutton.dart @@ -0,0 +1,40 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; + +class CustomButton extends StatelessWidget { + String title; + Color textColor; + Color backgroundColor; + VoidCallback onPressed; + double? width = 200; + double? height = 45.0; + double? fontsize = 45.0; + CustomButton( + {super.key, + required this.backgroundColor, + required this.onPressed, + required this.textColor, + required this.title, + this.fontsize, + this.height, + this.width}); + + @override + Widget build(BuildContext context) { + return SizedBox( + height: height, + width: width, + child: ElevatedButton( + onPressed: onPressed, + style: ButtonStyle( + backgroundColor: + MaterialStateColor.resolveWith((states) => backgroundColor), + ), + child: Text( + title, + style: TextStyle(color: textColor, fontSize: fontsize ?? 24.0), + ), + ), + ); + } +} diff --git a/lib/widgets/customdropdown.dart b/lib/widgets/customdropdown.dart new file mode 100644 index 0000000..31bb723 --- /dev/null +++ b/lib/widgets/customdropdown.dart @@ -0,0 +1,30 @@ +import 'package:flutter/material.dart'; + +class CustomDropdown extends StatelessWidget { + List items = []; + late VoidCallback onChanged; + String? hint; + CustomDropdown({ + super.key, + required items, + required hint, + }); + + @override + Widget build(BuildContext context) { + return SizedBox( + width: 200, + child: DropdownButton( + items: ["Face to face", "phone"].map((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + onChanged: (value) { + onChanged(); + }, + ), + ); + } +} diff --git a/lib/widgets/customrangeslider.dart b/lib/widgets/customrangeslider.dart new file mode 100644 index 0000000..8f80c44 --- /dev/null +++ b/lib/widgets/customrangeslider.dart @@ -0,0 +1,43 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:pwa_ios/utils/util.dart'; + +class CustomRangeSlider extends StatelessWidget { + final double sliderPos; + final void Function(double) onChanged; + double? min; + double? max; + + CustomRangeSlider( + {super.key, + required this.sliderPos, + required this.onChanged, + this.max, + this.min}); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Slider( + activeColor: const Color(0xFF2b9af3), + onChanged: onChanged, + min: min ?? 10.0, + max: max ?? 80.0, + label: sliderPos.toInt().toString(), + divisions: 48, + value: sliderPos, + ), + SizedBox( + height: isTablet ? 2 : 1, + ), + Text( + "Range: ${sliderPos.toInt()}", + style: TextStyle( + fontSize: isTablet ? 14.0 : 12, + ), + ), + ], + ); + } +} diff --git a/lib/widgets/customtextfield.dart b/lib/widgets/customtextfield.dart new file mode 100644 index 0000000..ac8d9fd --- /dev/null +++ b/lib/widgets/customtextfield.dart @@ -0,0 +1,36 @@ +import 'package:flutter/material.dart'; +import 'package:pwa_ios/utils/util.dart'; + +class CustomTextField extends StatelessWidget { + String labelText; + TextEditingController controller; + String? hintText; + IconButton? suffixIcon; + bool? enabled = true; + bool? obscure = false; + CustomTextField( + {super.key, + required this.controller, + this.hintText, + required this.labelText, + this.suffixIcon, + this.enabled, + this.obscure}); + + @override + Widget build(BuildContext context) { + return TextField( + controller: controller, + style: TextStyle(fontSize: isTablet ? 18.0 : 16), + enabled: enabled, + obscureText: obscure ?? false, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelStyle: TextStyle(fontSize: isTablet ? 18.0 : 16), + labelText: labelText, + hintStyle: TextStyle(fontSize: isTablet ? 18.0 : 16), + suffixIcon: suffixIcon, + hintText: hintText), + ); + } +} diff --git a/lib/widgets/interatciontextfield.dart b/lib/widgets/interatciontextfield.dart new file mode 100644 index 0000000..5d0689a --- /dev/null +++ b/lib/widgets/interatciontextfield.dart @@ -0,0 +1,62 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +class InteractionTextField extends StatelessWidget { + String labelText; + TextEditingController controller; + String? hintText; + IconButton? suffixIcon; + bool? enabled = true; + bool? obscure = false; + Function onChanged; + TextInputType? inputType; + int? maxchars = 0; + int? maxlines = 1; + int? minlines = 0; + InteractionTextField( + {super.key, + required this.controller, + this.hintText, + required this.labelText, + this.suffixIcon, + this.enabled, + this.maxchars, + this.maxlines, + this.inputType, + this.minlines, + required this.onChanged, + this.obscure}); + + @override + Widget build(BuildContext context) { + return TextField( + controller: controller, + style: const TextStyle(fontSize: 16), + enabled: enabled, + obscureText: obscure ?? false, + onTap: () {}, + maxLines: maxlines ?? 1, + minLines: minlines, + keyboardType: inputType ?? TextInputType.none, + onChanged: (value) { + onChanged(value); + }, + inputFormatters: [ + inputType == TextInputType.number + ? FilteringTextInputFormatter.digitsOnly + : maxchars == 0 + ? LengthLimitingTextInputFormatter(100) + : LengthLimitingTextInputFormatter(maxchars), + ], + decoration: InputDecoration( + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10.0), + ), + // labelStyle: const TextStyle(fontSize: 16), + // labelText: labelText, + // hintStyle: const TextStyle(fontSize: 16), + suffixIcon: suffixIcon, + hintText: hintText), + ); + } +} diff --git a/lib/widgets/responsive_ext.dart b/lib/widgets/responsive_ext.dart new file mode 100644 index 0000000..52536ff --- /dev/null +++ b/lib/widgets/responsive_ext.dart @@ -0,0 +1,22 @@ +import 'package:flutter/material.dart'; + +extension Responsive on BuildContext { + T responsive( + T defaultVal, { + T? sm, + T? md, + T? lg, + T? xl, + }) { + final wd = MediaQuery.of(this).size.width; + return wd >= 1280 + ? (xl ?? lg ?? md ?? sm ?? defaultVal) + : wd >= 1024 + ? (lg ?? md ?? sm ?? defaultVal) + : wd >= 768 + ? (md ?? sm ?? defaultVal) + : wd >= 640 + ? (sm ?? defaultVal) + : defaultVal; + } +} diff --git a/lib/widgets/webview_popup.dart b/lib/widgets/webview_popup.dart new file mode 100644 index 0000000..945532c --- /dev/null +++ b/lib/widgets/webview_popup.dart @@ -0,0 +1,77 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_inappwebview/flutter_inappwebview.dart'; + +import '../utils/constants.dart'; +import '../utils/util.dart'; + +class WebViewPopup extends StatelessWidget { + final CreateWindowAction createWindowAction; + final InAppWebViewSettings popupWebViewSettings; + + const WebViewPopup( + {Key? key, + required this.createWindowAction, + required this.popupWebViewSettings}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return FutureBuilder( + future: isNetworkAvailable(), + builder: (context, snapshot) { + if (!snapshot.hasData) { + return Container(); + } + + final bool networkAvailable = snapshot.data ?? false; + + // Android-only + final cacheMode = networkAvailable + ? CacheMode.LOAD_DEFAULT + : CacheMode.LOAD_CACHE_ELSE_NETWORK; + + final webViewInitialSettings = popupWebViewSettings.copy(); + webViewInitialSettings.cacheMode = cacheMode; + + return AlertDialog( + content: SizedBox( + width: double.maxFinite, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + height: 250, + child: InAppWebView( + gestureRecognizers: >{ + Factory( + () => EagerGestureRecognizer(), + ), + }, + initialSettings: webViewInitialSettings, + windowId: createWindowAction.windowId, + onCloseWindow: (controller) { + Navigator.pop(context); + }, + onReceivedError: (controller, request, error) async { + final isForMainFrame = request.isForMainFrame ?? true; + if (isForMainFrame && !(await isNetworkAvailable())) { + if (!(await isPWAInstalled())) { + await controller.loadData( + data: kHTMLErrorPageNotInstalled); + } else if (request.url.host != kPwaHost) { + await controller.loadData(data: kHTMLErrorPage); + } + } + }, + ), + ), + ], + ), + ), + ); + }); + } +} diff --git a/linux/.gitignore b/linux/.gitignore new file mode 100644 index 0000000..d3896c9 --- /dev/null +++ b/linux/.gitignore @@ -0,0 +1 @@ +flutter/ephemeral diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt new file mode 100644 index 0000000..b2d576c --- /dev/null +++ b/linux/CMakeLists.txt @@ -0,0 +1,139 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.10) +project(runner LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "pwa_ios") +# The unique GTK application identifier for this application. See: +# https://wiki.gnome.org/HowDoI/ChooseApplicationID +set(APPLICATION_ID "com.example.pwa_ios") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(SET CMP0063 NEW) + +# Load bundled libraries from the lib/ directory relative to the binary. +set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") + +# Root filesystem for cross-building. +if(FLUTTER_TARGET_PLATFORM_SYSROOT) + set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +endif() + +# Define build configuration options. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") +endif() + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_14) + target_compile_options(${TARGET} PRIVATE -Wall -Werror) + target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") + target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) + +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") + +# Define the application target. To change its name, change BINARY_NAME above, +# not the value here, or `flutter run` will no longer work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} + "main.cc" + "my_application.cc" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add dependency libraries. Add any application-specific dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) + +# Only the install-generated bundle's copy of the executable will launch +# correctly, since the resources must in the right relative locations. To avoid +# people trying to run the unbundled copy, put it in a subdirectory instead of +# the default top-level location. +set_target_properties(${BINARY_NAME} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" +) + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# By default, "installing" just makes a relocatable bundle in the build +# directory. +set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +# Start with a clean build bundle directory every time. +install(CODE " + file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") + " COMPONENT Runtime) + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) + install(FILES "${bundled_library}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endforeach(bundled_library) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") + install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() diff --git a/linux/flutter/CMakeLists.txt b/linux/flutter/CMakeLists.txt new file mode 100644 index 0000000..d5bd016 --- /dev/null +++ b/linux/flutter/CMakeLists.txt @@ -0,0 +1,88 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.10) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. + +# Serves the same purpose as list(TRANSFORM ... PREPEND ...), +# which isn't available in 3.10. +function(list_prepend LIST_NAME PREFIX) + set(NEW_LIST "") + foreach(element ${${LIST_NAME}}) + list(APPEND NEW_LIST "${PREFIX}${element}") + endforeach(element) + set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) +endfunction() + +# === Flutter Library === +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) +pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) +pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) + +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "fl_basic_message_channel.h" + "fl_binary_codec.h" + "fl_binary_messenger.h" + "fl_dart_project.h" + "fl_engine.h" + "fl_json_message_codec.h" + "fl_json_method_codec.h" + "fl_message_codec.h" + "fl_method_call.h" + "fl_method_channel.h" + "fl_method_codec.h" + "fl_method_response.h" + "fl_plugin_registrar.h" + "fl_plugin_registry.h" + "fl_standard_message_codec.h" + "fl_standard_method_codec.h" + "fl_string_codec.h" + "fl_value.h" + "fl_view.h" + "flutter_linux.h" +) +list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") +target_link_libraries(flutter INTERFACE + PkgConfig::GTK + PkgConfig::GLIB + PkgConfig::GIO +) +add_dependencies(flutter flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CMAKE_CURRENT_BINARY_DIR}/_phony_ + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" + ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} +) diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..7299b5c --- /dev/null +++ b/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,19 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + +#include +#include + +void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); + file_selector_plugin_register_with_registrar(file_selector_linux_registrar); + g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); + url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); +} diff --git a/linux/flutter/generated_plugin_registrant.h b/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..e0f0a47 --- /dev/null +++ b/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake new file mode 100644 index 0000000..786ff5c --- /dev/null +++ b/linux/flutter/generated_plugins.cmake @@ -0,0 +1,25 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST + file_selector_linux + url_launcher_linux +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/linux/main.cc b/linux/main.cc new file mode 100644 index 0000000..e7c5c54 --- /dev/null +++ b/linux/main.cc @@ -0,0 +1,6 @@ +#include "my_application.h" + +int main(int argc, char** argv) { + g_autoptr(MyApplication) app = my_application_new(); + return g_application_run(G_APPLICATION(app), argc, argv); +} diff --git a/linux/my_application.cc b/linux/my_application.cc new file mode 100644 index 0000000..0861dd4 --- /dev/null +++ b/linux/my_application.cc @@ -0,0 +1,104 @@ +#include "my_application.h" + +#include +#ifdef GDK_WINDOWING_X11 +#include +#endif + +#include "flutter/generated_plugin_registrant.h" + +struct _MyApplication { + GtkApplication parent_instance; + char** dart_entrypoint_arguments; +}; + +G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) + +// Implements GApplication::activate. +static void my_application_activate(GApplication* application) { + MyApplication* self = MY_APPLICATION(application); + GtkWindow* window = + GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); + + // Use a header bar when running in GNOME as this is the common style used + // by applications and is the setup most users will be using (e.g. Ubuntu + // desktop). + // If running on X and not using GNOME then just use a traditional title bar + // in case the window manager does more exotic layout, e.g. tiling. + // If running on Wayland assume the header bar will work (may need changing + // if future cases occur). + gboolean use_header_bar = TRUE; +#ifdef GDK_WINDOWING_X11 + GdkScreen* screen = gtk_window_get_screen(window); + if (GDK_IS_X11_SCREEN(screen)) { + const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); + if (g_strcmp0(wm_name, "GNOME Shell") != 0) { + use_header_bar = FALSE; + } + } +#endif + if (use_header_bar) { + GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); + gtk_widget_show(GTK_WIDGET(header_bar)); + gtk_header_bar_set_title(header_bar, "pwa_ios"); + gtk_header_bar_set_show_close_button(header_bar, TRUE); + gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); + } else { + gtk_window_set_title(window, "pwa_ios"); + } + + gtk_window_set_default_size(window, 1280, 720); + gtk_widget_show(GTK_WIDGET(window)); + + g_autoptr(FlDartProject) project = fl_dart_project_new(); + fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); + + FlView* view = fl_view_new(project); + gtk_widget_show(GTK_WIDGET(view)); + gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); + + fl_register_plugins(FL_PLUGIN_REGISTRY(view)); + + gtk_widget_grab_focus(GTK_WIDGET(view)); +} + +// Implements GApplication::local_command_line. +static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { + MyApplication* self = MY_APPLICATION(application); + // Strip out the first argument as it is the binary name. + self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); + + g_autoptr(GError) error = nullptr; + if (!g_application_register(application, nullptr, &error)) { + g_warning("Failed to register: %s", error->message); + *exit_status = 1; + return TRUE; + } + + g_application_activate(application); + *exit_status = 0; + + return TRUE; +} + +// Implements GObject::dispose. +static void my_application_dispose(GObject* object) { + MyApplication* self = MY_APPLICATION(object); + g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); + G_OBJECT_CLASS(my_application_parent_class)->dispose(object); +} + +static void my_application_class_init(MyApplicationClass* klass) { + G_APPLICATION_CLASS(klass)->activate = my_application_activate; + G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; + G_OBJECT_CLASS(klass)->dispose = my_application_dispose; +} + +static void my_application_init(MyApplication* self) {} + +MyApplication* my_application_new() { + return MY_APPLICATION(g_object_new(my_application_get_type(), + "application-id", APPLICATION_ID, + "flags", G_APPLICATION_NON_UNIQUE, + nullptr)); +} diff --git a/linux/my_application.h b/linux/my_application.h new file mode 100644 index 0000000..72271d5 --- /dev/null +++ b/linux/my_application.h @@ -0,0 +1,18 @@ +#ifndef FLUTTER_MY_APPLICATION_H_ +#define FLUTTER_MY_APPLICATION_H_ + +#include + +G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, + GtkApplication) + +/** + * my_application_new: + * + * Creates a new Flutter-based application. + * + * Returns: a new #MyApplication. + */ +MyApplication* my_application_new(); + +#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/macos/.gitignore b/macos/.gitignore new file mode 100644 index 0000000..746adbb --- /dev/null +++ b/macos/.gitignore @@ -0,0 +1,7 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/dgph +**/xcuserdata/ diff --git a/macos/Flutter/Flutter-Debug.xcconfig b/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 0000000..4b81f9b --- /dev/null +++ b/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/Flutter-Release.xcconfig b/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 0000000..5caa9d1 --- /dev/null +++ b/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 0000000..3c46cee --- /dev/null +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,26 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + +import connectivity_plus +import device_info_plus +import file_selector_macos +import flutter_inappwebview +import package_info_plus +import path_provider_foundation +import shared_preferences_foundation +import url_launcher_macos + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin")) + DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) + FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) + InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin")) + FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) +} diff --git a/macos/Podfile b/macos/Podfile new file mode 100644 index 0000000..c795730 --- /dev/null +++ b/macos/Podfile @@ -0,0 +1,43 @@ +platform :osx, '10.14' + +# 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', 'ephemeral', '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 Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_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_macos_build_settings(target) + end +end diff --git a/macos/Podfile.lock b/macos/Podfile.lock new file mode 100644 index 0000000..470dce7 --- /dev/null +++ b/macos/Podfile.lock @@ -0,0 +1,77 @@ +PODS: + - connectivity_plus (0.0.1): + - FlutterMacOS + - ReachabilitySwift + - device_info_plus (0.0.1): + - FlutterMacOS + - file_selector_macos (0.0.1): + - FlutterMacOS + - flutter_inappwebview (0.0.1): + - FlutterMacOS + - OrderedSet (~> 5.0) + - FlutterMacOS (1.0.0) + - OrderedSet (5.0.0) + - package_info_plus (0.0.1): + - FlutterMacOS + - path_provider_foundation (0.0.1): + - Flutter + - FlutterMacOS + - ReachabilitySwift (5.0.0) + - shared_preferences_foundation (0.0.1): + - Flutter + - FlutterMacOS + - url_launcher_macos (0.0.1): + - FlutterMacOS + +DEPENDENCIES: + - connectivity_plus (from `Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos`) + - device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`) + - file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`) + - flutter_inappwebview (from `Flutter/ephemeral/.symlinks/plugins/flutter_inappwebview/macos`) + - FlutterMacOS (from `Flutter/ephemeral`) + - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) + - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) + - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) + - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) + +SPEC REPOS: + trunk: + - OrderedSet + - ReachabilitySwift + +EXTERNAL SOURCES: + connectivity_plus: + :path: Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos + device_info_plus: + :path: Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos + file_selector_macos: + :path: Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos + flutter_inappwebview: + :path: Flutter/ephemeral/.symlinks/plugins/flutter_inappwebview/macos + FlutterMacOS: + :path: Flutter/ephemeral + package_info_plus: + :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos + path_provider_foundation: + :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin + shared_preferences_foundation: + :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin + url_launcher_macos: + :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos + +SPEC CHECKSUMS: + connectivity_plus: 18d3c32514c886e046de60e9c13895109866c747 + device_info_plus: 5401765fde0b8d062a2f8eb65510fb17e77cf07f + file_selector_macos: 468fb6b81fac7c0e88d71317f3eec34c3b008ff9 + flutter_inappwebview: 62e949df616a9f6e1b0366326381f208c7fcad37 + FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 + OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c + package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce + path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 + ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 + shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 + url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95 + +PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 + +COCOAPODS: 1.12.1 diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..0c6a299 --- /dev/null +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,791 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + 54572DA2C86BA61D9E74DDF4 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B132AADB72DEF82BE9CA18B /* Pods_Runner.framework */; }; + 79EB4E6D77177145C016D2B6 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B05FB94DF0970E82545D7538 /* Pods_RunnerTests.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC10EC2044A3C60003C045; + remoteInfo = Runner; + }; + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* pwa_ios.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = pwa_ios.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 39FA1D58CAE99C36AAD9B72C /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + 3A40D73CB19E86EDA7CCD663 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 41FA2DC319C260DB85747051 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 4B132AADB72DEF82BE9CA18B /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 698A552F3A124393BD968A82 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + ABE3956069AAD7AEC26EDE93 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + B05FB94DF0970E82545D7538 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FBDD2EC5C33C2819DC35AA85 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 331C80D2294CF70F00263BE5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 79EB4E6D77177145C016D2B6 /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 54572DA2C86BA61D9E74DDF4 /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C80D6294CF71000263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C80D7294CF71000263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 331C80D6294CF71000263BE5 /* RunnerTests */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + 5716179E15C00CD0E709D646 /* Pods */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* pwa_ios.app */, + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + 5716179E15C00CD0E709D646 /* Pods */ = { + isa = PBXGroup; + children = ( + 41FA2DC319C260DB85747051 /* Pods-Runner.debug.xcconfig */, + ABE3956069AAD7AEC26EDE93 /* Pods-Runner.release.xcconfig */, + 3A40D73CB19E86EDA7CCD663 /* Pods-Runner.profile.xcconfig */, + 39FA1D58CAE99C36AAD9B72C /* Pods-RunnerTests.debug.xcconfig */, + 698A552F3A124393BD968A82 /* Pods-RunnerTests.release.xcconfig */, + FBDD2EC5C33C2819DC35AA85 /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 4B132AADB72DEF82BE9CA18B /* Pods_Runner.framework */, + B05FB94DF0970E82545D7538 /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C80D4294CF70F00263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 9006D226F67785506984FB01 /* [CP] Check Pods Manifest.lock */, + 331C80D1294CF70F00263BE5 /* Sources */, + 331C80D2294CF70F00263BE5 /* Frameworks */, + 331C80D3294CF70F00263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C80DA294CF71000263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + DC4AAC067CDFA7CB993B3192 /* [CP] Check Pods Manifest.lock */, + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + 0BFA1DB535D670C37C5829B8 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* pwa_ios.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 1300; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C80D4294CF70F00263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 33CC10EC2044A3C60003C045; + }; + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 331C80D4294CF70F00263BE5 /* RunnerTests */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C80D3294CF70F00263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 0BFA1DB535D670C37C5829B8 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; + 9006D226F67785506984FB01 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + DC4AAC067CDFA7CB993B3192 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C80D1294CF70F00263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC10EC2044A3C60003C045 /* Runner */; + targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; + }; + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 331C80DB294CF71000263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 39FA1D58CAE99C36AAD9B72C /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.pwaIos.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/pwa_ios.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/pwa_ios"; + }; + name = Debug; + }; + 331C80DC294CF71000263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 698A552F3A124393BD968A82 /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.pwaIos.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/pwa_ios.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/pwa_ios"; + }; + name = Release; + }; + 331C80DD294CF71000263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FBDD2EC5C33C2819DC35AA85 /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.pwaIos.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/pwa_ios.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/pwa_ios"; + }; + name = Profile; + }; + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C80DB294CF71000263BE5 /* Debug */, + 331C80DC294CF71000263BE5 /* Release */, + 331C80DD294CF71000263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..7e098bb --- /dev/null +++ b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/macos/Runner.xcworkspace/contents.xcworkspacedata b/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..21a3cc1 --- /dev/null +++ b/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/macos/Runner/AppDelegate.swift b/macos/Runner/AppDelegate.swift new file mode 100644 index 0000000..d53ef64 --- /dev/null +++ b/macos/Runner/AppDelegate.swift @@ -0,0 +1,9 @@ +import Cocoa +import FlutterMacOS + +@NSApplicationMain +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } +} diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..a2ec33f --- /dev/null +++ b/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 0000000..82b6f9d Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 0000000..13b35eb Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 0000000..0a3f5fa Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 0000000..bdb5722 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 0000000..f083318 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 0000000..326c0e7 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 0000000..2f1632c Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/macos/Runner/Base.lproj/MainMenu.xib b/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 0000000..80e867a --- /dev/null +++ b/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/macos/Runner/Configs/AppInfo.xcconfig b/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 0000000..d294607 --- /dev/null +++ b/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = pwa_ios + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.example.pwaIos + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2023 com.example. All rights reserved. diff --git a/macos/Runner/Configs/Debug.xcconfig b/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 0000000..36b0fd9 --- /dev/null +++ b/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/macos/Runner/Configs/Release.xcconfig b/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 0000000..dff4f49 --- /dev/null +++ b/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/macos/Runner/Configs/Warnings.xcconfig b/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 0000000..42bcbf4 --- /dev/null +++ b/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/macos/Runner/DebugProfile.entitlements b/macos/Runner/DebugProfile.entitlements new file mode 100644 index 0000000..dddb8a3 --- /dev/null +++ b/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.cs.allow-jit + + com.apple.security.network.server + + + diff --git a/macos/Runner/Info.plist b/macos/Runner/Info.plist new file mode 100644 index 0000000..4789daa --- /dev/null +++ b/macos/Runner/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/macos/Runner/MainFlutterWindow.swift b/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 0000000..3cc05eb --- /dev/null +++ b/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,15 @@ +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController() + let windowFrame = self.frame + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/macos/Runner/Release.entitlements b/macos/Runner/Release.entitlements new file mode 100644 index 0000000..852fa1a --- /dev/null +++ b/macos/Runner/Release.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/macos/RunnerTests/RunnerTests.swift b/macos/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..5418c9f --- /dev/null +++ b/macos/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import FlutterMacOS +import Cocoa +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..adf4751 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,1474 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 + url: "https://pub.dev" + source: hosted + version: "64.0.0" + after_layout: + dependency: transitive + description: + name: after_layout + sha256: "95a1cb2ca1464f44f14769329fbf15987d20ab6c88f8fc5d359bd362be625f29" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" + url: "https://pub.dev" + source: hosted + version: "6.2.0" + archive: + dependency: transitive + description: + name: archive + sha256: d4dc11707abb32ef756ab95678c0d6df54003d98277f7c9aeda14c48e7a38c2f + url: "https://pub.dev" + source: hosted + version: "3.4.3" + args: + dependency: transitive + description: + name: args + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + asn1lib: + dependency: transitive + description: + name: asn1lib + sha256: "21afe4333076c02877d14f4a89df111e658a6d466cbfc802eb705eb91bd5adfd" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + asset_webview: + dependency: "direct main" + description: + name: asset_webview + sha256: "3edea08458cff517962aeca67e603963c035adaf550fd368302c05b9f62502f0" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + box_transform: + dependency: transitive + description: + name: box_transform + sha256: ca3f90f4924d63ce69ef02b8fd251512b44bbac5ad4f454087cbde04754344dc + url: "https://pub.dev" + source: hosted + version: "0.2.1" + build: + dependency: transitive + description: + name: build + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" + source: hosted + version: "1.1.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" + url: "https://pub.dev" + source: hosted + version: "4.0.0" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "64e12b0521812d1684b1917bc80945625391cb9bdd4312536b1d69dcb6133ed8" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + build_runner: + dependency: "direct main" + description: + name: build_runner + sha256: "10c6bcdbf9d049a0b666702cf1cee4ddfdc38f02a19d35ae392863b47519848b" + url: "https://pub.dev" + source: hosted + version: "2.4.6" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: c9e32d21dd6626b5c163d48b037ce906bbe428bc23ab77bcd77bb21e593b6185 + url: "https://pub.dev" + source: hosted + version: "7.2.11" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: a8de5955205b4d1dbbbc267daddf2178bd737e4bab8987c04a500478c9651e74 + url: "https://pub.dev" + source: hosted + version: "8.6.3" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "1be9be30396d7e4c0db42c35ea6ccd7cc6a1e19916b5dc64d6ac216b5544d677" + url: "https://pub.dev" + source: hosted + version: "4.7.0" + collection: + dependency: transitive + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + connectivity_plus: + dependency: "direct dev" + description: + name: connectivity_plus + sha256: b74247fad72c171381dbe700ca17da24deac637ab6d43c343b42867acb95c991 + url: "https://pub.dev" + source: hosted + version: "3.0.6" + connectivity_plus_platform_interface: + dependency: transitive + description: + name: connectivity_plus_platform_interface + sha256: cf1d1c28f4416f8c654d7dc3cd638ec586076255d407cef3ddbdaf178272a71a + url: "https://pub.dev" + source: hosted + version: "1.2.4" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: fd832b5384d0d6da4f6df60b854d33accaaeb63aa9e10e736a87381f08dee2cb + url: "https://pub.dev" + source: hosted + version: "0.3.3+5" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + crypto_keys: + dependency: transitive + description: + name: crypto_keys + sha256: acc19abf34623d990a0e8aec69463d74a824c31f137128f42e2810befc509ad0 + url: "https://pub.dev" + source: hosted + version: "0.3.0+1" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be + url: "https://pub.dev" + source: hosted + version: "1.0.5" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: abd7625e16f51f554ea244d090292945ec4d4be7bfbaf2ec8cccea568919d334 + url: "https://pub.dev" + source: hosted + version: "2.3.3" + dbus: + dependency: transitive + description: + name: dbus + sha256: "6f07cba3f7b3448d42d015bfd3d53fe12e5b36da2423f23838efc1d5fb31a263" + url: "https://pub.dev" + source: hosted + version: "0.7.8" + defer_pointer: + dependency: transitive + description: + name: defer_pointer + sha256: d69e6f8c1d0f052d2616cc1db3782e0ea73f42e4c6f6122fd1a548dfe79faf02 + url: "https://pub.dev" + source: hosted + version: "0.0.2" + device_frame: + dependency: transitive + description: + name: device_frame + sha256: afe76182aec178d171953d9b4a50a43c57c7cf3c77d8b09a48bf30c8fa04dd9d + url: "https://pub.dev" + source: hosted + version: "1.1.0" + device_info_plus: + dependency: transitive + description: + name: device_info_plus + sha256: "86add5ef97215562d2e090535b0a16f197902b10c369c558a100e74ea06e8659" + url: "https://pub.dev" + source: hosted + version: "9.0.3" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64 + url: "https://pub.dev" + source: hosted + version: "7.0.0" + dio: + dependency: "direct main" + description: + name: dio + sha256: ce75a1b40947fea0a0e16ce73337122a86762e38b982e1ccb909daa3b9bc4197 + url: "https://pub.dev" + source: hosted + version: "5.3.2" + dropdown_button2: + dependency: "direct dev" + description: + name: dropdown_button2 + sha256: b0fe8d49a030315e9eef6c7ac84ca964250155a6224d491c1365061bc974a9e1 + url: "https://pub.dev" + source: hosted + version: "2.3.9" + either_dart: + dependency: transitive + description: + name: either_dart + sha256: "0b57f6a9410ce0ba2cc340220109f545bf4bad1b06b242219f0af11ab9e84f0e" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + encrypt: + dependency: transitive + description: + name: encrypt + sha256: "62d9aa4670cc2a8798bab89b39fc71b6dfbacf615de6cf5001fb39f7e4a996a2" + url: "https://pub.dev" + source: hosted + version: "5.0.3" + enum_to_string: + dependency: transitive + description: + name: enum_to_string + sha256: bd9e83a33b754cb43a75b36a9af2a0b92a757bfd9847d2621ca0b1bed45f8e7a + url: "https://pub.dev" + source: hosted + version: "2.0.1" + equatable: + dependency: transitive + description: + name: equatable + sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 + url: "https://pub.dev" + source: hosted + version: "2.0.5" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + feather_icons: + dependency: transitive + description: + name: feather_icons + sha256: "9fe1e52305fc363c3ee08cabaef32526e2e8ce53091c7b70f9c774460a1f03ae" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + ffi: + dependency: transitive + description: + name: ffi + sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99 + url: "https://pub.dev" + source: hosted + version: "2.0.2" + file: + dependency: transitive + description: + name: file + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" + source: hosted + version: "6.1.4" + file_picker: + dependency: "direct dev" + description: + name: file_picker + sha256: "4e42aacde3b993c5947467ab640882c56947d9d27342a5b6f2895b23956954a6" + url: "https://pub.dev" + source: hosted + version: "6.1.1" + file_selector_linux: + dependency: transitive + description: + name: file_selector_linux + sha256: "045d372bf19b02aeb69cacf8b4009555fb5f6f0b7ad8016e5f46dd1387ddd492" + url: "https://pub.dev" + source: hosted + version: "0.9.2+1" + file_selector_macos: + dependency: transitive + description: + name: file_selector_macos + sha256: "182c3f8350cee659f7b115e956047ee3dc672a96665883a545e81581b9a82c72" + url: "https://pub.dev" + source: hosted + version: "0.9.3+2" + file_selector_platform_interface: + dependency: transitive + description: + name: file_selector_platform_interface + sha256: "0aa47a725c346825a2bd396343ce63ac00bda6eff2fbc43eabe99737dede8262" + url: "https://pub.dev" + source: hosted + version: "2.6.1" + file_selector_windows: + dependency: transitive + description: + name: file_selector_windows + sha256: d3547240c20cabf205c7c7f01a50ecdbc413755814d6677f3cb366f04abcead0 + url: "https://pub.dev" + source: hosted + version: "0.9.3+1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_box_transform: + dependency: transitive + description: + name: flutter_box_transform + sha256: "1e25647db0246bac10e330b5bcddc836f5eb9573e0b8846676a518f0a90527a4" + url: "https://pub.dev" + source: hosted + version: "0.2.1" + flutter_inappwebview: + dependency: "direct dev" + description: + name: flutter_inappwebview + sha256: fad1f2740ff4b5b7da378a639f54beeb9d787b6339c89a9de00494d92372c0bb + url: "https://pub.dev" + source: hosted + version: "6.0.0-beta.24+1" + flutter_inappwebview_internal_annotations: + dependency: transitive + description: + name: flutter_inappwebview_internal_annotations + sha256: "064a8ccbc76217dcd3b0fd6c6ea6f549e69b2849a0233b5bb46af9632c3ce2ff" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: f185ac890306b5779ecbd611f52502d8d4d63d27703ef73161ca0407e815f02c + url: "https://pub.dev" + source: hosted + version: "2.0.16" + flutter_staggered_animations: + dependency: transitive + description: + name: flutter_staggered_animations + sha256: "81d3c816c9bb0dca9e8a5d5454610e21ffb068aedb2bde49d2f8d04f75538351" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter_svg: + dependency: "direct main" + description: + name: flutter_svg + sha256: "8c5d68a82add3ca76d792f058b186a0599414f279f00ece4830b9b231b570338" + url: "https://pub.dev" + source: hosted + version: "2.0.7" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + font_awesome_flutter: + dependency: transitive + description: + name: font_awesome_flutter + sha256: "5fb789145cae1f4c3245c58b3f8fb287d055c26323879eab57a7bf0cfd1e45f3" + url: "https://pub.dev" + source: hosted + version: "10.5.0" + font_awesome_flutter_named: + dependency: transitive + description: + name: font_awesome_flutter_named + sha256: ed0a376065c70d0ea538b6e19aa1a602f1ae033c6ac8e5961433f9e8b119fcff + url: "https://pub.dev" + source: hosted + version: "1.1.2+1" + freezed_annotation: + dependency: transitive + description: + name: freezed_annotation + sha256: c3fd9336eb55a38cc1bbd79ab17573113a8deccd0ecbbf926cca3c62803b5c2d + url: "https://pub.dev" + source: hosted + version: "2.4.1" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + gap: + dependency: transitive + description: + name: gap + sha256: f19387d4e32f849394758b91377f9153a1b41d79513ef7668c088c77dbc6955d + url: "https://pub.dev" + source: hosted + version: "3.0.1" + get_it: + dependency: transitive + description: + name: get_it + sha256: f79870884de16d689cf9a7d15eedf31ed61d750e813c538a6efb92660fea83c3 + url: "https://pub.dev" + source: hosted + version: "7.6.4" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + go_router: + dependency: "direct dev" + description: + name: go_router + sha256: b3cadd2cd59a4103fd5f6bc572ca75111264698784e927aa471921c3477d5475 + url: "https://pub.dev" + source: hosted + version: "10.0.0" + google_fonts: + dependency: transitive + description: + name: google_fonts + sha256: "6b6f10f0ce3c42f6552d1c70d2c28d764cf22bb487f50f66cca31dcd5194f4d6" + url: "https://pub.dev" + source: hosted + version: "4.0.4" + graphs: + dependency: transitive + description: + name: graphs + sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 + url: "https://pub.dev" + source: hosted + version: "2.3.1" + hive: + dependency: "direct dev" + description: + name: hive + sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941" + url: "https://pub.dev" + source: hosted + version: "2.2.3" + hive_flutter: + dependency: "direct main" + description: + name: hive_flutter + sha256: dca1da446b1d808a51689fb5d0c6c9510c0a2ba01e22805d492c73b68e33eecc + url: "https://pub.dev" + source: hosted + version: "1.1.0" + hive_generator: + dependency: "direct main" + description: + name: hive_generator + sha256: "06cb8f58ace74de61f63500564931f9505368f45f98958bd7a6c35ba24159db4" + url: "https://pub.dev" + source: hosted + version: "2.0.1" + http: + dependency: transitive + description: + name: http + sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + url: "https://pub.dev" + source: hosted + version: "0.13.6" + http_mock_adapter: + dependency: "direct main" + description: + name: http_mock_adapter + sha256: "07e78a5b64410ff8404aee2f8889ebff08def0c752b85a3945dec2029a6e1110" + url: "https://pub.dev" + source: hosted + version: "0.6.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + image_picker: + dependency: "direct main" + description: + name: image_picker + sha256: "7d7f2768df2a8b0a3cefa5ef4f84636121987d403130e70b17ef7e2cf650ba84" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + image_picker_android: + dependency: transitive + description: + name: image_picker_android + sha256: d32a997bcc4ee135aebca8e272b7c517927aa65a74b9c60a81a2764ef1a0462d + url: "https://pub.dev" + source: hosted + version: "0.8.7+5" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + sha256: "50bc9ae6a77eea3a8b11af5eb6c661eeb858fdd2f734c2a4fd17086922347ef7" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + image_picker_ios: + dependency: transitive + description: + name: image_picker_ios + sha256: c5538cacefacac733c724be7484377923b476216ad1ead35a0d2eadcdc0fc497 + url: "https://pub.dev" + source: hosted + version: "0.8.8+2" + image_picker_linux: + dependency: transitive + description: + name: image_picker_linux + sha256: "4ed1d9bb36f7cd60aa6e6cd479779cc56a4cb4e4de8f49d487b1aaad831300fa" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_macos: + dependency: transitive + description: + name: image_picker_macos + sha256: "3f5ad1e8112a9a6111c46d0b57a7be2286a9a07fc6e1976fdf5be2bd31d4ff62" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + sha256: ed9b00e63977c93b0d2d2b343685bed9c324534ba5abafbb3dfbd6a780b1b514 + url: "https://pub.dev" + source: hosted + version: "2.9.1" + image_picker_windows: + dependency: transitive + description: + name: image_picker_windows + sha256: "6ad07afc4eb1bc25f3a01084d28520496c4a3bb0cb13685435838167c9dcedeb" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + internet_connection_checker: + dependency: "direct dev" + description: + name: internet_connection_checker + sha256: "1c683e63e89c9ac66a40748b1b20889fd9804980da732bf2b58d6d5456c8e876" + url: "https://pub.dev" + source: hosted + version: "1.0.0+1" + intl: + dependency: "direct main" + description: + name: intl + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + url: "https://pub.dev" + source: hosted + version: "0.18.1" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + jose: + dependency: transitive + description: + name: jose + sha256: "7955ec5d131960104e81fbf151abacb9d835c16c9e793ed394b2809f28b2198d" + url: "https://pub.dev" + source: hosted + version: "0.3.4" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + url: "https://pub.dev" + source: hosted + version: "4.8.1" + light_logger: + dependency: transitive + description: + name: light_logger + sha256: e4d1ed16750a41e20d87b6feb367d6fd96d0dffac6dc4b6a76f685b3d79de56f + url: "https://pub.dev" + source: hosted + version: "0.0.3" + line_icons: + dependency: transitive + description: + name: line_icons + sha256: "249d781d922f5437ac763d9c8f5a02cf5b499a6dc3f85e4b92e074cff0a932ab" + url: "https://pub.dev" + source: hosted + version: "2.0.3" + lints: + dependency: transitive + description: + name: lints + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + logger: + dependency: transitive + description: + name: logger + sha256: "6bbb9d6f7056729537a4309bda2e74e18e5d9f14302489cc1e93f33b3fe32cac" + url: "https://pub.dev" + source: hosted + version: "2.0.2+1" + logging: + dependency: transitive + description: + name: logging + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + lottie: + dependency: transitive + description: + name: lottie + sha256: b8bdd54b488c54068c57d41ae85d02808da09e2bee8b8dd1f59f441e7efa60cd + url: "https://pub.dev" + source: hosted + version: "2.6.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" + source: hosted + version: "0.12.16" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" + source: hosted + version: "0.5.0" + material_design_icons_flutter: + dependency: transitive + description: + name: material_design_icons_flutter + sha256: "4c81ebf55b9661d1eb94652884a7b098af63153ea75b9070caedaddfae308e02" + url: "https://pub.dev" + source: hosted + version: "6.0.7296" + meta: + dependency: transitive + description: + name: meta + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + url: "https://pub.dev" + source: hosted + version: "1.10.0" + mime: + dependency: transitive + description: + name: mime + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + url: "https://pub.dev" + source: hosted + version: "1.0.4" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + nm: + dependency: transitive + description: + name: nm + sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254" + url: "https://pub.dev" + source: hosted + version: "0.5.0" + openid_client: + dependency: "direct dev" + description: + name: openid_client + sha256: "514c0ba645b81029c28999831a70cb055dda1a3bc60be759a04d2556f60ec960" + url: "https://pub.dev" + source: hosted + version: "0.4.7" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + sha256: "6ff267fcd9d48cb61c8df74a82680e8b82e940231bb5f68356672fde0397334a" + url: "https://pub.dev" + source: hosted + version: "4.1.0" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6" + url: "https://pub.dev" + source: hosted + version: "2.0.1" + path: + dependency: transitive + description: + name: path + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" + source: hosted + version: "1.8.3" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf + url: "https://pub.dev" + source: hosted + version: "1.0.1" + path_provider: + dependency: "direct main" + description: + name: path_provider + sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa + url: "https://pub.dev" + source: hosted + version: "2.1.1" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "6b8b19bd80da4f11ce91b2d1fb931f3006911477cec227cce23d3253d80df3f1" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: ba2b77f0c52a33db09fc8caf85b12df691bf28d983e84cf87ff6d693cfa007b3 + url: "https://pub.dev" + source: hosted + version: "2.2.0" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: bced5679c7df11190e1ddc35f3222c858f328fff85c3942e46e7f5589bf9eb84 + url: "https://pub.dev" + source: hosted + version: "2.1.0" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: ee0e0d164516b90ae1f970bdf29f726f1aa730d7cfc449ecc74c495378b705da + url: "https://pub.dev" + source: hosted + version: "2.2.0" + permission_handler: + dependency: "direct dev" + description: + name: permission_handler + sha256: "860c6b871c94c78e202dc69546d4d8fd84bd59faeb36f8fb9888668a53ff4f78" + url: "https://pub.dev" + source: hosted + version: "11.1.0" + permission_handler_android: + dependency: transitive + description: + name: permission_handler_android + sha256: "2f1bec180ee2f5665c22faada971a8f024761f632e93ddc23310487df52dcfa6" + url: "https://pub.dev" + source: hosted + version: "12.0.1" + permission_handler_apple: + dependency: transitive + description: + name: permission_handler_apple + sha256: "1a816084338ada8d574b1cb48390e6e8b19305d5120fe3a37c98825bacc78306" + url: "https://pub.dev" + source: hosted + version: "9.2.0" + permission_handler_html: + dependency: transitive + description: + name: permission_handler_html + sha256: "11b762a8c123dced6461933a88ea1edbbe036078c3f9f41b08886e678e7864df" + url: "https://pub.dev" + source: hosted + version: "0.1.0+2" + permission_handler_platform_interface: + dependency: transitive + description: + name: permission_handler_platform_interface + sha256: d87349312f7eaf6ce0adaf668daf700ac5b06af84338bd8b8574dfbd93ffe1a1 + url: "https://pub.dev" + source: hosted + version: "4.0.2" + permission_handler_windows: + dependency: transitive + description: + name: permission_handler_windows + sha256: "1e8640c1e39121128da6b816d236e714d2cf17fac5a105dd6acdd3403a628004" + url: "https://pub.dev" + source: hosted + version: "0.2.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 + url: "https://pub.dev" + source: hosted + version: "5.4.0" + platform: + dependency: transitive + description: + name: platform + sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "43798d895c929056255600343db8f049921cbec94d31ec87f1dc5c16c01935dd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + pointycastle: + dependency: transitive + description: + name: pointycastle + sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c" + url: "https://pub.dev" + source: hosted + version: "3.7.3" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + provider: + dependency: "direct main" + description: + name: provider + sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f + url: "https://pub.dev" + source: hosted + version: "6.0.5" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 + url: "https://pub.dev" + source: hosted + version: "1.2.3" + quiver: + dependency: transitive + description: + name: quiver + sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47 + url: "https://pub.dev" + source: hosted + version: "3.2.1" + recase: + dependency: transitive + description: + name: recase + sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 + url: "https://pub.dev" + source: hosted + version: "4.1.0" + riverpod: + dependency: "direct main" + description: + name: riverpod + sha256: a600120d6f213a9922860eea1abc32597436edd5b2c4e73b91410f8c2af67d22 + url: "https://pub.dev" + source: hosted + version: "2.4.0" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: "0344316c947ffeb3a529eac929e1978fcd37c26be4e8468628bac399365a3ca1" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: fe8401ec5b6dcd739a0fe9588802069e608c3fdbfd3c3c93e546cf2f90438076 + url: "https://pub.dev" + source: hosted + version: "2.2.0" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: f39696b83e844923b642ce9dd4bd31736c17e697f6731a5adf445b1274cf3cd4 + url: "https://pub.dev" + source: hosted + version: "2.3.2" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "71d6806d1449b0a9d4e85e0c7a917771e672a3d5dc61149cc9fac871115018e1" + url: "https://pub.dev" + source: hosted + version: "2.3.0" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "23b052f17a25b90ff2b61aad4cc962154da76fb62848a9ce088efe30d7c50ab1" + url: "https://pub.dev" + source: hosted + version: "2.3.0" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: "7347b194fb0bbeb4058e6a4e87ee70350b6b2b90f8ac5f8bd5b3a01548f6d33a" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: f95e6a43162bce43c9c3405f3eb6f39e5b5d11f65fab19196cf8225e2777624d + url: "https://pub.dev" + source: hosted + version: "2.3.0" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: fc0da689e5302edb6177fdd964efcb7f58912f43c28c2047a808f5bfff643d16 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + source_helper: + dependency: transitive + description: + name: source_helper + sha256: "6adebc0006c37dd63fe05bca0a929b99f06402fc95aa35bf36d67f5c06de01fd" + url: "https://pub.dev" + source: hosted + version: "1.3.4" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + state_notifier: + dependency: transitive + description: + name: state_notifier + sha256: b8677376aa54f2d7c58280d5a007f9e8774f1968d1fb1c096adcb4792fba29bb + url: "https://pub.dev" + source: hosted + version: "1.0.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" + source: hosted + version: "0.6.1" + theta: + dependency: "direct main" + description: + name: theta + sha256: "4774f8b21ed42cffdf512837eecd09379c3f9b1c9734949d3df5236b60967eeb" + url: "https://pub.dev" + source: hosted + version: "0.8.7" + theta_analytics: + dependency: transitive + description: + name: theta_analytics + sha256: "983a84cdb590368610de14ade218cc55df655ec4ff503f14e6ea99d72d6c1a8b" + url: "https://pub.dev" + source: hosted + version: "0.1.4" + theta_design_system: + dependency: transitive + description: + name: theta_design_system + sha256: "1a9999582fabe15eb0fef5dcdea881b365801b2bc11069d3f3e4867e81c8024a" + url: "https://pub.dev" + source: hosted + version: "0.3.6" + theta_models: + dependency: transitive + description: + name: theta_models + sha256: "2271892f23cb49fa929e1ef3c5e40c139df1c10c36000d15f6acd9ad6eb0d33b" + url: "https://pub.dev" + source: hosted + version: "0.7.8" + theta_open_widgets: + dependency: transitive + description: + name: theta_open_widgets + sha256: "06b4b7e098272c2b1f1e88f9e2bf16f90ed5637f236a282aaae15ad42eed4a95" + url: "https://pub.dev" + source: hosted + version: "0.7.12" + theta_rendering: + dependency: transitive + description: + name: theta_rendering + sha256: bccf2d8c0e31678259611994d5076d66ef214aa1d589122018c17dc9a2b2cea3 + url: "https://pub.dev" + source: hosted + version: "0.2.3" + timing: + dependency: transitive + description: + name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + url_launcher: + dependency: "direct dev" + description: + name: url_launcher + sha256: "781bd58a1eb16069412365c98597726cd8810ae27435f04b3b4d3a470bacd61e" + url: "https://pub.dev" + source: hosted + version: "6.1.12" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "78cb6dea3e93148615109e58e42c35d1ffbf5ef66c44add673d0ab75f12ff3af" + url: "https://pub.dev" + source: hosted + version: "6.0.37" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: "9af7ea73259886b92199f9e42c116072f05ff9bea2dcb339ab935dfc957392c2" + url: "https://pub.dev" + source: hosted + version: "6.1.4" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: "207f4ddda99b95b4d4868320a352d374b0b7e05eefad95a4a26f57da413443f5" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "1c4fdc0bfea61a70792ce97157e5cc17260f61abbe4f39354513f39ec6fd73b1" + url: "https://pub.dev" + source: hosted + version: "3.0.6" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: bfdfa402f1f3298637d71ca8ecfe840b4696698213d5346e9d12d4ab647ee2ea + url: "https://pub.dev" + source: hosted + version: "2.1.3" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: cc26720eefe98c1b71d85f9dc7ef0cada5132617046369d9dc296b3ecaa5cbb4 + url: "https://pub.dev" + source: hosted + version: "2.0.18" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "7967065dd2b5fccc18c653b97958fdf839c5478c28e767c61ee879f4e7882422" + url: "https://pub.dev" + source: hosted + version: "3.0.7" + uuid: + dependency: transitive + description: + name: uuid + sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + url: "https://pub.dev" + source: hosted + version: "3.0.7" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: "670f6e07aca990b4a2bcdc08a784193c4ccdd1932620244c3a86bb72a0eac67f" + url: "https://pub.dev" + source: hosted + version: "1.1.7" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: "7451721781d967db9933b63f5733b1c4533022c0ba373a01bdd79d1a5457f69f" + url: "https://pub.dev" + source: hosted + version: "1.1.7" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: "80a13c613c8bde758b1464a1755a7b3a8f2b6cec61fbf0f5a53c94c30f03ba2e" + url: "https://pub.dev" + source: hosted + version: "1.1.7" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + url: "https://pub.dev" + source: hosted + version: "0.3.0" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + url: "https://pub.dev" + source: hosted + version: "2.4.0" + win32: + dependency: transitive + description: + name: win32 + sha256: f2add6fa510d3ae152903412227bda57d0d5a8da61d2c39c1fb022c9429a41c0 + url: "https://pub.dev" + source: hosted + version: "5.0.6" + win32_registry: + dependency: transitive + description: + name: win32_registry + sha256: e4506d60b7244251bc59df15656a3093501c37fb5af02105a944d73eb95be4c9 + url: "https://pub.dev" + source: hosted + version: "1.1.1" + x509: + dependency: transitive + description: + name: x509 + sha256: "6db77b0baecf54584f886607247e9dedd9fd63f1e2d0ee0a00b5bb353fd7885f" + url: "https://pub.dev" + source: hosted + version: "0.2.3" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: e0b1147eec179d3911f1f19b59206448f78195ca1d20514134e10641b7d7fbff + url: "https://pub.dev" + source: hosted + version: "1.0.1" + xml: + dependency: transitive + description: + name: xml + sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84" + url: "https://pub.dev" + source: hosted + version: "6.3.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" +sdks: + dart: ">=3.2.0-194.0.dev <4.0.0" + flutter: ">=3.16.0" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..c2ce60d --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,112 @@ +name: pwa_ios +description: A new Flutter project. +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: "none" # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: ">=3.0.5 <4.0.0" + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 + dio: ^5.3.2 + asset_webview: ^1.0.0 + shared_preferences: ^2.2.0 + provider: ^6.0.5 + image_picker: ^1.0.4 + flutter_svg: ^2.0.7 + riverpod: ^2.4.0 + theta: ^0.8.5 + intl: ^0.18.1 + hive_generator: ^2.0.1 + hive_flutter: ^1.1.0 + build_runner: ^2.4.6 + path_provider: ^2.1.1 + http_mock_adapter: ^0.6.0 +dev_dependencies: + flutter_inappwebview: ^6.0.0-beta.21 + connectivity_plus: ^3.0.2 + url_launcher: ^6.1.6 + openid_client: ^0.4.7 + go_router: ^10.0.0 + hive: ^2.2.3 + dropdown_button2: ^2.3.9 + file_picker: ^6.1.1 + permission_handler: ^11.1.0 + internet_connection_checker: ^1.0.0+1 + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^2.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + assets: + - assets/images/ + - assets/images/interactionform.json + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/test/widget_test.dart b/test/widget_test.dart new file mode 100644 index 0000000..3381861 --- /dev/null +++ b/test/widget_test.dart @@ -0,0 +1,31 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility in the flutter_test package. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:pwa_ios/main.dart'; +import 'package:pwa_ios/views/konectarpage.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(const MyApp()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +} diff --git a/web/favicon.png b/web/favicon.png new file mode 100644 index 0000000..8aaa46a Binary files /dev/null and b/web/favicon.png differ diff --git a/web/icons/Icon-192.png b/web/icons/Icon-192.png new file mode 100644 index 0000000..b749bfe Binary files /dev/null and b/web/icons/Icon-192.png differ diff --git a/web/icons/Icon-512.png b/web/icons/Icon-512.png new file mode 100644 index 0000000..88cfd48 Binary files /dev/null and b/web/icons/Icon-512.png differ diff --git a/web/icons/Icon-maskable-192.png b/web/icons/Icon-maskable-192.png new file mode 100644 index 0000000..eb9b4d7 Binary files /dev/null and b/web/icons/Icon-maskable-192.png differ diff --git a/web/icons/Icon-maskable-512.png b/web/icons/Icon-maskable-512.png new file mode 100644 index 0000000..d69c566 Binary files /dev/null and b/web/icons/Icon-maskable-512.png differ diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..cdbd950 --- /dev/null +++ b/web/index.html @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + pwa_ios + + + + + + + + + + diff --git a/web/manifest.json b/web/manifest.json new file mode 100644 index 0000000..5db7477 --- /dev/null +++ b/web/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "pwa_ios", + "short_name": "pwa_ios", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "icons/Icon-maskable-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/Icon-maskable-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/windows/.gitignore b/windows/.gitignore new file mode 100644 index 0000000..d492d0d --- /dev/null +++ b/windows/.gitignore @@ -0,0 +1,17 @@ +flutter/ephemeral/ + +# Visual Studio user-specific files. +*.suo +*.user +*.userosscache +*.sln.docstates + +# Visual Studio build-related files. +x64/ +x86/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt new file mode 100644 index 0000000..71fd10f --- /dev/null +++ b/windows/CMakeLists.txt @@ -0,0 +1,102 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.14) +project(pwa_ios LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "pwa_ios") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(SET CMP0063 NEW) + +# Define build configuration option. +get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(IS_MULTICONFIG) + set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" + CACHE STRING "" FORCE) +else() + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") + endif() +endif() +# Define settings for the Profile build mode. +set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") +set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") +set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") +set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") + +# Use Unicode for all projects. +add_definitions(-DUNICODE -D_UNICODE) + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_17) + target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") + target_compile_options(${TARGET} PRIVATE /EHsc) + target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") + target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# Application build; see runner/CMakeLists.txt. +add_subdirectory("runner") + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# Support files are copied into place next to the executable, so that it can +# run in place. This is done instead of making a separate bundle (as on Linux) +# so that building and running from within Visual Studio will work. +set(BUILD_BUNDLE_DIR "$") +# Make the "install" step default, as it's required to run. +set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +if(PLUGIN_BUNDLED_LIBRARIES) + install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + CONFIGURATIONS Profile;Release + COMPONENT Runtime) diff --git a/windows/flutter/CMakeLists.txt b/windows/flutter/CMakeLists.txt new file mode 100644 index 0000000..930d207 --- /dev/null +++ b/windows/flutter/CMakeLists.txt @@ -0,0 +1,104 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.14) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. +set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") + +# === Flutter Library === +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "flutter_export.h" + "flutter_windows.h" + "flutter_messenger.h" + "flutter_plugin_registrar.h" + "flutter_texture_registrar.h" +) +list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") +add_dependencies(flutter flutter_assemble) + +# === Wrapper === +list(APPEND CPP_WRAPPER_SOURCES_CORE + "core_implementations.cc" + "standard_codec.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_PLUGIN + "plugin_registrar.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_APP + "flutter_engine.cc" + "flutter_view_controller.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") + +# Wrapper sources needed for a plugin. +add_library(flutter_wrapper_plugin STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} +) +apply_standard_settings(flutter_wrapper_plugin) +set_target_properties(flutter_wrapper_plugin PROPERTIES + POSITION_INDEPENDENT_CODE ON) +set_target_properties(flutter_wrapper_plugin PROPERTIES + CXX_VISIBILITY_PRESET hidden) +target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) +target_include_directories(flutter_wrapper_plugin PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_plugin flutter_assemble) + +# Wrapper sources needed for the runner. +add_library(flutter_wrapper_app STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_APP} +) +apply_standard_settings(flutter_wrapper_app) +target_link_libraries(flutter_wrapper_app PUBLIC flutter) +target_include_directories(flutter_wrapper_app PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_app flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") +set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} + ${PHONY_OUTPUT} + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" + windows-x64 $ + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} +) diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..dbf8289 --- /dev/null +++ b/windows/flutter/generated_plugin_registrant.cc @@ -0,0 +1,23 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + +#include +#include +#include +#include + +void RegisterPlugins(flutter::PluginRegistry* registry) { + ConnectivityPlusWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin")); + FileSelectorWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FileSelectorWindows")); + PermissionHandlerWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); + UrlLauncherWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("UrlLauncherWindows")); +} diff --git a/windows/flutter/generated_plugin_registrant.h b/windows/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..dc139d8 --- /dev/null +++ b/windows/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void RegisterPlugins(flutter::PluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake new file mode 100644 index 0000000..c22844a --- /dev/null +++ b/windows/flutter/generated_plugins.cmake @@ -0,0 +1,27 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST + connectivity_plus + file_selector_windows + permission_handler_windows + url_launcher_windows +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/windows/runner/CMakeLists.txt b/windows/runner/CMakeLists.txt new file mode 100644 index 0000000..394917c --- /dev/null +++ b/windows/runner/CMakeLists.txt @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 3.14) +project(runner LANGUAGES CXX) + +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} WIN32 + "flutter_window.cpp" + "main.cpp" + "utils.cpp" + "win32_window.cpp" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" + "Runner.rc" + "runner.exe.manifest" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the build version. +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") + +# Disable Windows macros that collide with C++ standard library functions. +target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") + +# Add dependency libraries and include directories. Add any application-specific +# dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) +target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc new file mode 100644 index 0000000..3078ad9 --- /dev/null +++ b/windows/runner/Runner.rc @@ -0,0 +1,121 @@ +// Microsoft Visual C++ generated resource script. +// +#pragma code_page(65001) +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_APP_ICON ICON "resources\\app_icon.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) +#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD +#else +#define VERSION_AS_NUMBER 1,0,0,0 +#endif + +#if defined(FLUTTER_VERSION) +#define VERSION_AS_STRING FLUTTER_VERSION +#else +#define VERSION_AS_STRING "1.0.0" +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_AS_NUMBER + PRODUCTVERSION VERSION_AS_NUMBER + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "com.example" "\0" + VALUE "FileDescription", "pwa_ios" "\0" + VALUE "FileVersion", VERSION_AS_STRING "\0" + VALUE "InternalName", "pwa_ios" "\0" + VALUE "LegalCopyright", "Copyright (C) 2023 com.example. All rights reserved." "\0" + VALUE "OriginalFilename", "pwa_ios.exe" "\0" + VALUE "ProductName", "pwa_ios" "\0" + VALUE "ProductVersion", VERSION_AS_STRING "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/windows/runner/flutter_window.cpp b/windows/runner/flutter_window.cpp new file mode 100644 index 0000000..b25e363 --- /dev/null +++ b/windows/runner/flutter_window.cpp @@ -0,0 +1,66 @@ +#include "flutter_window.h" + +#include + +#include "flutter/generated_plugin_registrant.h" + +FlutterWindow::FlutterWindow(const flutter::DartProject& project) + : project_(project) {} + +FlutterWindow::~FlutterWindow() {} + +bool FlutterWindow::OnCreate() { + if (!Win32Window::OnCreate()) { + return false; + } + + RECT frame = GetClientArea(); + + // The size here must match the window dimensions to avoid unnecessary surface + // creation / destruction in the startup path. + flutter_controller_ = std::make_unique( + frame.right - frame.left, frame.bottom - frame.top, project_); + // Ensure that basic setup of the controller was successful. + if (!flutter_controller_->engine() || !flutter_controller_->view()) { + return false; + } + RegisterPlugins(flutter_controller_->engine()); + SetChildContent(flutter_controller_->view()->GetNativeWindow()); + + flutter_controller_->engine()->SetNextFrameCallback([&]() { + this->Show(); + }); + + return true; +} + +void FlutterWindow::OnDestroy() { + if (flutter_controller_) { + flutter_controller_ = nullptr; + } + + Win32Window::OnDestroy(); +} + +LRESULT +FlutterWindow::MessageHandler(HWND hwnd, UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + // Give Flutter, including plugins, an opportunity to handle window messages. + if (flutter_controller_) { + std::optional result = + flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, + lparam); + if (result) { + return *result; + } + } + + switch (message) { + case WM_FONTCHANGE: + flutter_controller_->engine()->ReloadSystemFonts(); + break; + } + + return Win32Window::MessageHandler(hwnd, message, wparam, lparam); +} diff --git a/windows/runner/flutter_window.h b/windows/runner/flutter_window.h new file mode 100644 index 0000000..6da0652 --- /dev/null +++ b/windows/runner/flutter_window.h @@ -0,0 +1,33 @@ +#ifndef RUNNER_FLUTTER_WINDOW_H_ +#define RUNNER_FLUTTER_WINDOW_H_ + +#include +#include + +#include + +#include "win32_window.h" + +// A window that does nothing but host a Flutter view. +class FlutterWindow : public Win32Window { + public: + // Creates a new FlutterWindow hosting a Flutter view running |project|. + explicit FlutterWindow(const flutter::DartProject& project); + virtual ~FlutterWindow(); + + protected: + // Win32Window: + bool OnCreate() override; + void OnDestroy() override; + LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, + LPARAM const lparam) noexcept override; + + private: + // The project to run. + flutter::DartProject project_; + + // The Flutter instance hosted by this window. + std::unique_ptr flutter_controller_; +}; + +#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/windows/runner/main.cpp b/windows/runner/main.cpp new file mode 100644 index 0000000..61d4729 --- /dev/null +++ b/windows/runner/main.cpp @@ -0,0 +1,43 @@ +#include +#include +#include + +#include "flutter_window.h" +#include "utils.h" + +int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, + _In_ wchar_t *command_line, _In_ int show_command) { + // Attach to console when present (e.g., 'flutter run') or create a + // new console when running with a debugger. + if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { + CreateAndAttachConsole(); + } + + // Initialize COM, so that it is available for use in the library and/or + // plugins. + ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + + flutter::DartProject project(L"data"); + + std::vector command_line_arguments = + GetCommandLineArguments(); + + project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); + + FlutterWindow window(project); + Win32Window::Point origin(10, 10); + Win32Window::Size size(1280, 720); + if (!window.Create(L"pwa_ios", origin, size)) { + return EXIT_FAILURE; + } + window.SetQuitOnClose(true); + + ::MSG msg; + while (::GetMessage(&msg, nullptr, 0, 0)) { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + + ::CoUninitialize(); + return EXIT_SUCCESS; +} diff --git a/windows/runner/resource.h b/windows/runner/resource.h new file mode 100644 index 0000000..66a65d1 --- /dev/null +++ b/windows/runner/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Runner.rc +// +#define IDI_APP_ICON 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/windows/runner/resources/app_icon.ico b/windows/runner/resources/app_icon.ico new file mode 100644 index 0000000..c04e20c Binary files /dev/null and b/windows/runner/resources/app_icon.ico differ diff --git a/windows/runner/runner.exe.manifest b/windows/runner/runner.exe.manifest new file mode 100644 index 0000000..a42ea76 --- /dev/null +++ b/windows/runner/runner.exe.manifest @@ -0,0 +1,20 @@ + + + + + PerMonitorV2 + + + + + + + + + + + + + + + diff --git a/windows/runner/utils.cpp b/windows/runner/utils.cpp new file mode 100644 index 0000000..b2b0873 --- /dev/null +++ b/windows/runner/utils.cpp @@ -0,0 +1,65 @@ +#include "utils.h" + +#include +#include +#include +#include + +#include + +void CreateAndAttachConsole() { + if (::AllocConsole()) { + FILE *unused; + if (freopen_s(&unused, "CONOUT$", "w", stdout)) { + _dup2(_fileno(stdout), 1); + } + if (freopen_s(&unused, "CONOUT$", "w", stderr)) { + _dup2(_fileno(stdout), 2); + } + std::ios::sync_with_stdio(); + FlutterDesktopResyncOutputStreams(); + } +} + +std::vector GetCommandLineArguments() { + // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. + int argc; + wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); + if (argv == nullptr) { + return std::vector(); + } + + std::vector command_line_arguments; + + // Skip the first argument as it's the binary name. + for (int i = 1; i < argc; i++) { + command_line_arguments.push_back(Utf8FromUtf16(argv[i])); + } + + ::LocalFree(argv); + + return command_line_arguments; +} + +std::string Utf8FromUtf16(const wchar_t* utf16_string) { + if (utf16_string == nullptr) { + return std::string(); + } + int target_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + -1, nullptr, 0, nullptr, nullptr) + -1; // remove the trailing null character + int input_length = (int)wcslen(utf16_string); + std::string utf8_string; + if (target_length <= 0 || target_length > utf8_string.max_size()) { + return utf8_string; + } + utf8_string.resize(target_length); + int converted_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + input_length, utf8_string.data(), target_length, nullptr, nullptr); + if (converted_length == 0) { + return std::string(); + } + return utf8_string; +} diff --git a/windows/runner/utils.h b/windows/runner/utils.h new file mode 100644 index 0000000..3879d54 --- /dev/null +++ b/windows/runner/utils.h @@ -0,0 +1,19 @@ +#ifndef RUNNER_UTILS_H_ +#define RUNNER_UTILS_H_ + +#include +#include + +// Creates a console for the process, and redirects stdout and stderr to +// it for both the runner and the Flutter library. +void CreateAndAttachConsole(); + +// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string +// encoded in UTF-8. Returns an empty std::string on failure. +std::string Utf8FromUtf16(const wchar_t* utf16_string); + +// Gets the command line arguments passed in as a std::vector, +// encoded in UTF-8. Returns an empty std::vector on failure. +std::vector GetCommandLineArguments(); + +#endif // RUNNER_UTILS_H_ diff --git a/windows/runner/win32_window.cpp b/windows/runner/win32_window.cpp new file mode 100644 index 0000000..60608d0 --- /dev/null +++ b/windows/runner/win32_window.cpp @@ -0,0 +1,288 @@ +#include "win32_window.h" + +#include +#include + +#include "resource.h" + +namespace { + +/// Window attribute that enables dark mode window decorations. +/// +/// Redefined in case the developer's machine has a Windows SDK older than +/// version 10.0.22000.0. +/// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute +#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE +#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 +#endif + +constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; + +/// Registry key for app theme preference. +/// +/// A value of 0 indicates apps should use dark mode. A non-zero or missing +/// value indicates apps should use light mode. +constexpr const wchar_t kGetPreferredBrightnessRegKey[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; +constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; + +// The number of Win32Window objects that currently exist. +static int g_active_window_count = 0; + +using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); + +// Scale helper to convert logical scaler values to physical using passed in +// scale factor +int Scale(int source, double scale_factor) { + return static_cast(source * scale_factor); +} + +// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. +// This API is only needed for PerMonitor V1 awareness mode. +void EnableFullDpiSupportIfAvailable(HWND hwnd) { + HMODULE user32_module = LoadLibraryA("User32.dll"); + if (!user32_module) { + return; + } + auto enable_non_client_dpi_scaling = + reinterpret_cast( + GetProcAddress(user32_module, "EnableNonClientDpiScaling")); + if (enable_non_client_dpi_scaling != nullptr) { + enable_non_client_dpi_scaling(hwnd); + } + FreeLibrary(user32_module); +} + +} // namespace + +// Manages the Win32Window's window class registration. +class WindowClassRegistrar { + public: + ~WindowClassRegistrar() = default; + + // Returns the singleton registrar instance. + static WindowClassRegistrar* GetInstance() { + if (!instance_) { + instance_ = new WindowClassRegistrar(); + } + return instance_; + } + + // Returns the name of the window class, registering the class if it hasn't + // previously been registered. + const wchar_t* GetWindowClass(); + + // Unregisters the window class. Should only be called if there are no + // instances of the window. + void UnregisterWindowClass(); + + private: + WindowClassRegistrar() = default; + + static WindowClassRegistrar* instance_; + + bool class_registered_ = false; +}; + +WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; + +const wchar_t* WindowClassRegistrar::GetWindowClass() { + if (!class_registered_) { + WNDCLASS window_class{}; + window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); + window_class.lpszClassName = kWindowClassName; + window_class.style = CS_HREDRAW | CS_VREDRAW; + window_class.cbClsExtra = 0; + window_class.cbWndExtra = 0; + window_class.hInstance = GetModuleHandle(nullptr); + window_class.hIcon = + LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); + window_class.hbrBackground = 0; + window_class.lpszMenuName = nullptr; + window_class.lpfnWndProc = Win32Window::WndProc; + RegisterClass(&window_class); + class_registered_ = true; + } + return kWindowClassName; +} + +void WindowClassRegistrar::UnregisterWindowClass() { + UnregisterClass(kWindowClassName, nullptr); + class_registered_ = false; +} + +Win32Window::Win32Window() { + ++g_active_window_count; +} + +Win32Window::~Win32Window() { + --g_active_window_count; + Destroy(); +} + +bool Win32Window::Create(const std::wstring& title, + const Point& origin, + const Size& size) { + Destroy(); + + const wchar_t* window_class = + WindowClassRegistrar::GetInstance()->GetWindowClass(); + + const POINT target_point = {static_cast(origin.x), + static_cast(origin.y)}; + HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); + UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); + double scale_factor = dpi / 96.0; + + HWND window = CreateWindow( + window_class, title.c_str(), WS_OVERLAPPEDWINDOW, + Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), + Scale(size.width, scale_factor), Scale(size.height, scale_factor), + nullptr, nullptr, GetModuleHandle(nullptr), this); + + if (!window) { + return false; + } + + UpdateTheme(window); + + return OnCreate(); +} + +bool Win32Window::Show() { + return ShowWindow(window_handle_, SW_SHOWNORMAL); +} + +// static +LRESULT CALLBACK Win32Window::WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + if (message == WM_NCCREATE) { + auto window_struct = reinterpret_cast(lparam); + SetWindowLongPtr(window, GWLP_USERDATA, + reinterpret_cast(window_struct->lpCreateParams)); + + auto that = static_cast(window_struct->lpCreateParams); + EnableFullDpiSupportIfAvailable(window); + that->window_handle_ = window; + } else if (Win32Window* that = GetThisFromHandle(window)) { + return that->MessageHandler(window, message, wparam, lparam); + } + + return DefWindowProc(window, message, wparam, lparam); +} + +LRESULT +Win32Window::MessageHandler(HWND hwnd, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + switch (message) { + case WM_DESTROY: + window_handle_ = nullptr; + Destroy(); + if (quit_on_close_) { + PostQuitMessage(0); + } + return 0; + + case WM_DPICHANGED: { + auto newRectSize = reinterpret_cast(lparam); + LONG newWidth = newRectSize->right - newRectSize->left; + LONG newHeight = newRectSize->bottom - newRectSize->top; + + SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, + newHeight, SWP_NOZORDER | SWP_NOACTIVATE); + + return 0; + } + case WM_SIZE: { + RECT rect = GetClientArea(); + if (child_content_ != nullptr) { + // Size and position the child window. + MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, TRUE); + } + return 0; + } + + case WM_ACTIVATE: + if (child_content_ != nullptr) { + SetFocus(child_content_); + } + return 0; + + case WM_DWMCOLORIZATIONCOLORCHANGED: + UpdateTheme(hwnd); + return 0; + } + + return DefWindowProc(window_handle_, message, wparam, lparam); +} + +void Win32Window::Destroy() { + OnDestroy(); + + if (window_handle_) { + DestroyWindow(window_handle_); + window_handle_ = nullptr; + } + if (g_active_window_count == 0) { + WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); + } +} + +Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { + return reinterpret_cast( + GetWindowLongPtr(window, GWLP_USERDATA)); +} + +void Win32Window::SetChildContent(HWND content) { + child_content_ = content; + SetParent(content, window_handle_); + RECT frame = GetClientArea(); + + MoveWindow(content, frame.left, frame.top, frame.right - frame.left, + frame.bottom - frame.top, true); + + SetFocus(child_content_); +} + +RECT Win32Window::GetClientArea() { + RECT frame; + GetClientRect(window_handle_, &frame); + return frame; +} + +HWND Win32Window::GetHandle() { + return window_handle_; +} + +void Win32Window::SetQuitOnClose(bool quit_on_close) { + quit_on_close_ = quit_on_close; +} + +bool Win32Window::OnCreate() { + // No-op; provided for subclasses. + return true; +} + +void Win32Window::OnDestroy() { + // No-op; provided for subclasses. +} + +void Win32Window::UpdateTheme(HWND const window) { + DWORD light_mode; + DWORD light_mode_size = sizeof(light_mode); + LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, + kGetPreferredBrightnessRegValue, + RRF_RT_REG_DWORD, nullptr, &light_mode, + &light_mode_size); + + if (result == ERROR_SUCCESS) { + BOOL enable_dark_mode = light_mode == 0; + DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, + &enable_dark_mode, sizeof(enable_dark_mode)); + } +} diff --git a/windows/runner/win32_window.h b/windows/runner/win32_window.h new file mode 100644 index 0000000..e901dde --- /dev/null +++ b/windows/runner/win32_window.h @@ -0,0 +1,102 @@ +#ifndef RUNNER_WIN32_WINDOW_H_ +#define RUNNER_WIN32_WINDOW_H_ + +#include + +#include +#include +#include + +// A class abstraction for a high DPI-aware Win32 Window. Intended to be +// inherited from by classes that wish to specialize with custom +// rendering and input handling +class Win32Window { + public: + struct Point { + unsigned int x; + unsigned int y; + Point(unsigned int x, unsigned int y) : x(x), y(y) {} + }; + + struct Size { + unsigned int width; + unsigned int height; + Size(unsigned int width, unsigned int height) + : width(width), height(height) {} + }; + + Win32Window(); + virtual ~Win32Window(); + + // Creates a win32 window with |title| that is positioned and sized using + // |origin| and |size|. New windows are created on the default monitor. Window + // sizes are specified to the OS in physical pixels, hence to ensure a + // consistent size this function will scale the inputted width and height as + // as appropriate for the default monitor. The window is invisible until + // |Show| is called. Returns true if the window was created successfully. + bool Create(const std::wstring& title, const Point& origin, const Size& size); + + // Show the current window. Returns true if the window was successfully shown. + bool Show(); + + // Release OS resources associated with window. + void Destroy(); + + // Inserts |content| into the window tree. + void SetChildContent(HWND content); + + // Returns the backing Window handle to enable clients to set icon and other + // window properties. Returns nullptr if the window has been destroyed. + HWND GetHandle(); + + // If true, closing this window will quit the application. + void SetQuitOnClose(bool quit_on_close); + + // Return a RECT representing the bounds of the current client area. + RECT GetClientArea(); + + protected: + // Processes and route salient window messages for mouse handling, + // size change and DPI. Delegates handling of these to member overloads that + // inheriting classes can handle. + virtual LRESULT MessageHandler(HWND window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Called when CreateAndShow is called, allowing subclass window-related + // setup. Subclasses should return false if setup fails. + virtual bool OnCreate(); + + // Called when Destroy is called. + virtual void OnDestroy(); + + private: + friend class WindowClassRegistrar; + + // OS callback called by message pump. Handles the WM_NCCREATE message which + // is passed when the non-client area is being created and enables automatic + // non-client DPI scaling so that the non-client area automatically + // responds to changes in DPI. All other messages are handled by + // MessageHandler. + static LRESULT CALLBACK WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Retrieves a class instance pointer for |window| + static Win32Window* GetThisFromHandle(HWND const window) noexcept; + + // Update the window frame's theme to match the system theme. + static void UpdateTheme(HWND const window); + + bool quit_on_close_ = false; + + // window handle for top level window. + HWND window_handle_ = nullptr; + + // window handle for hosted content. + HWND child_content_ = nullptr; +}; + +#endif // RUNNER_WIN32_WINDOW_H_