commit b58b6802dd4c03a4589449d2cc2e5b1a8682d78b Author: Ankit Sharma Date: Thu Jan 30 22:24:14 2025 +0530 First Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..79c113f --- /dev/null +++ b/.gitignore @@ -0,0 +1,45 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/.metadata b/.metadata new file mode 100644 index 0000000..fac5aec --- /dev/null +++ b/.metadata @@ -0,0 +1,45 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3 + base_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3 + - platform: android + create_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3 + base_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3 + - platform: ios + create_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3 + base_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3 + - platform: linux + create_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3 + base_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3 + - platform: macos + create_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3 + base_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3 + - platform: web + create_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3 + base_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3 + - platform: windows + create_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3 + base_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3 + + # 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/README.md b/README.md new file mode 100644 index 0000000..0bd5edd --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# shayog + +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..0d29021 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..55afd91 --- /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/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/android/app/build.gradle b/android/app/build.gradle new file mode 100644 index 0000000..bd077af --- /dev/null +++ b/android/app/build.gradle @@ -0,0 +1,44 @@ +plugins { + id "com.android.application" + id "kotlin-android" + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id "dev.flutter.flutter-gradle-plugin" +} + +android { + namespace = "com.example.shayog" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8 + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.example.shayog" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.debug + } + } +} + +flutter { + source = "../.." +} 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..53e966d --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/example/shayog/MainActivity.kt b/android/app/src/main/kotlin/com/example/shayog/MainActivity.kt new file mode 100644 index 0000000..b0e8283 --- /dev/null +++ b/android/app/src/main/kotlin/com/example/shayog/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.shayog + +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..d2ffbff --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,18 @@ +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..2597170 --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError +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..7bb2df6 --- /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-8.3-all.zip diff --git a/android/settings.gradle b/android/settings.gradle new file mode 100644 index 0000000..b9e43bd --- /dev/null +++ b/android/settings.gradle @@ -0,0 +1,25 @@ +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "8.1.0" apply false + id "org.jetbrains.kotlin.android" version "1.8.22" apply false +} + +include ":app" diff --git a/assets/fonts/AnekLatin-Bold.ttf b/assets/fonts/AnekLatin-Bold.ttf new file mode 100644 index 0000000..a3a80e5 Binary files /dev/null and b/assets/fonts/AnekLatin-Bold.ttf differ diff --git a/assets/fonts/AnekLatin-ExtraBold.ttf b/assets/fonts/AnekLatin-ExtraBold.ttf new file mode 100644 index 0000000..a2ad2f7 Binary files /dev/null and b/assets/fonts/AnekLatin-ExtraBold.ttf differ diff --git a/assets/fonts/AnekLatin-Light.ttf b/assets/fonts/AnekLatin-Light.ttf new file mode 100644 index 0000000..4f58726 Binary files /dev/null and b/assets/fonts/AnekLatin-Light.ttf differ diff --git a/assets/fonts/AnekLatin-Medium.ttf b/assets/fonts/AnekLatin-Medium.ttf new file mode 100644 index 0000000..04f6197 Binary files /dev/null and b/assets/fonts/AnekLatin-Medium.ttf differ diff --git a/assets/fonts/AnekLatin-Regular.ttf b/assets/fonts/AnekLatin-Regular.ttf new file mode 100644 index 0000000..2cb7324 Binary files /dev/null and b/assets/fonts/AnekLatin-Regular.ttf differ diff --git a/assets/fonts/AnekLatin-SemiBold.ttf b/assets/fonts/AnekLatin-SemiBold.ttf new file mode 100644 index 0000000..fb99e3b Binary files /dev/null and b/assets/fonts/AnekLatin-SemiBold.ttf differ diff --git a/assets/fonts/AnekLatin-Thin.ttf b/assets/fonts/AnekLatin-Thin.ttf new file mode 100644 index 0000000..755f4a4 Binary files /dev/null and b/assets/fonts/AnekLatin-Thin.ttf differ diff --git a/assets/images/configuration_blue.png b/assets/images/configuration_blue.png new file mode 100644 index 0000000..29f6b06 Binary files /dev/null and b/assets/images/configuration_blue.png differ diff --git a/assets/images/download.png b/assets/images/download.png new file mode 100644 index 0000000..abc853c Binary files /dev/null and b/assets/images/download.png differ diff --git a/assets/images/drop_down_arrow.png b/assets/images/drop_down_arrow.png new file mode 100644 index 0000000..2fc7c2e Binary files /dev/null and b/assets/images/drop_down_arrow.png differ diff --git a/assets/images/filter.png b/assets/images/filter.png new file mode 100644 index 0000000..c62c472 Binary files /dev/null and b/assets/images/filter.png differ diff --git a/assets/images/freight_bill_blue.png b/assets/images/freight_bill_blue.png new file mode 100644 index 0000000..feb70b9 Binary files /dev/null and b/assets/images/freight_bill_blue.png differ diff --git a/assets/images/freight_bill_manage.png b/assets/images/freight_bill_manage.png new file mode 100644 index 0000000..ffe843e Binary files /dev/null and b/assets/images/freight_bill_manage.png differ diff --git a/assets/images/img_configuration.png b/assets/images/img_configuration.png new file mode 100644 index 0000000..4ce30f6 Binary files /dev/null and b/assets/images/img_configuration.png differ diff --git a/assets/images/img_multiple-files.png b/assets/images/img_multiple-files.png new file mode 100644 index 0000000..892d8f8 Binary files /dev/null and b/assets/images/img_multiple-files.png differ diff --git a/assets/images/img_prices.png b/assets/images/img_prices.png new file mode 100644 index 0000000..e6f554c Binary files /dev/null and b/assets/images/img_prices.png differ diff --git a/assets/images/invoice_blue.png b/assets/images/invoice_blue.png new file mode 100644 index 0000000..e75f8d2 Binary files /dev/null and b/assets/images/invoice_blue.png differ diff --git a/assets/images/invoice_manage.png b/assets/images/invoice_manage.png new file mode 100644 index 0000000..4f0e04f Binary files /dev/null and b/assets/images/invoice_manage.png differ diff --git a/assets/images/multifiles_blue.png b/assets/images/multifiles_blue.png new file mode 100644 index 0000000..df036f7 Binary files /dev/null and b/assets/images/multifiles_blue.png differ diff --git a/assets/images/prices_blue.png b/assets/images/prices_blue.png new file mode 100644 index 0000000..84eba0b Binary files /dev/null and b/assets/images/prices_blue.png differ diff --git a/assets/images/refresh.png b/assets/images/refresh.png new file mode 100644 index 0000000..d5c124a Binary files /dev/null and b/assets/images/refresh.png differ diff --git a/assets/images/report.png b/assets/images/report.png new file mode 100644 index 0000000..9fbd5b5 Binary files /dev/null and b/assets/images/report.png differ diff --git a/assets/images/report_blue.png b/assets/images/report_blue.png new file mode 100644 index 0000000..bfa5ed9 Binary files /dev/null and b/assets/images/report_blue.png differ diff --git a/assets/images/user_mgmt.png b/assets/images/user_mgmt.png new file mode 100644 index 0000000..324fe4e Binary files /dev/null and b/assets/images/user_mgmt.png differ diff --git a/assets/images/user_mgmt_blue.png b/assets/images/user_mgmt_blue.png new file mode 100644 index 0000000..22e040c Binary files /dev/null and b/assets/images/user_mgmt_blue.png differ 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..7c56964 --- /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 + 12.0 + + diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..592ceee --- /dev/null +++ b/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..592ceee --- /dev/null +++ b/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..5500f19 --- /dev/null +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,616 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 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 = ""; }; + 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 = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 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 */, + ); + 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 = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 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; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.shayog; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.shayog.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.shayog.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.shayog.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.shayog; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.shayog; + 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..8e3ca5d --- /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..1d526a1 --- /dev/null +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + 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..6266644 --- /dev/null +++ b/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import Flutter +import UIKit + +@main +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} 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..879b501 --- /dev/null +++ b/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Shayog + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + shayog + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + + + 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/components/common/common_btn.dart b/lib/components/common/common_btn.dart new file mode 100644 index 0000000..5612131 --- /dev/null +++ b/lib/components/common/common_btn.dart @@ -0,0 +1,45 @@ +import 'package:flutter/cupertino.dart'; +import 'package:shayog/components/styles/app_colors.dart'; + +class CommonBtn extends StatelessWidget { + CommonBtn({super.key, this.text, + this.width, this.bkClr, + this.borderClr,this.textClr, + this.margin, + required this.clickAction, + this.style + }); + + String? text; + Color? bkClr; + Color? textClr; + Color? borderClr; + double? width; + EdgeInsets? margin; + VoidCallback clickAction; + +TextStyle? style; + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: clickAction, + child: Container( + margin: margin, + height: 30, + width: width ?? 100, + decoration: BoxDecoration( + color: bkClr ?? AppColors.primaryClr, + borderRadius: BorderRadius.circular(4), + border: Border.all(color: borderClr ?? AppColors.primaryClr)), + child: Center( + child: Text( + text ?? '', + style: style ?? TextStyle( + fontSize: 12, + color: textClr ?? AppColors.primaryClr, + fontWeight: FontWeight.w900), + )), + ), + ); + } +} diff --git a/lib/components/common/common_button.dart b/lib/components/common/common_button.dart new file mode 100644 index 0000000..76e8f4e --- /dev/null +++ b/lib/components/common/common_button.dart @@ -0,0 +1,138 @@ + +import 'package:flutter/material.dart'; + +import 'package:get/get.dart'; +import 'package:shayog/components/styles/textStyles.dart'; + +import '../../../components/styles/app_colors.dart'; + + + + + + +class CommonButton extends StatelessWidget { + String text; + Color? backgroundColor; + Color? textColor; + VoidCallback clickAction; + RxBool? isEnable = false.obs; + double? borderRadius; + double? elevation; + EdgeInsets? margin; + double? marginHorizontal; + double? height; + double? width; + TextStyle? textStyle; + double? borderWidth; + RxBool? isLoading; + Color? borderColor; + + CommonButton( + {Key? key, + required this.text, + this.textColor, + this.backgroundColor, + required this.clickAction, + this.isEnable, + this.borderRadius, + this.elevation, + this.margin, + this.marginHorizontal, + this.height, + this.width, + this.textStyle, + this.borderWidth, + this.isLoading, + this.borderColor}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return + + Container( + height: height ?? 45, + margin: margin ?? + EdgeInsets.symmetric( + horizontal: marginHorizontal ?? 16, + ), + width: width ?? double.infinity, + child: + Obx( + () => (isLoading?.value??false) ? + Column( + children: [ + SizedBox( + height: 20,width: 20, + child: CircularProgressIndicator(color: AppColors.primaryClr), + + ), + ], + ) + : + ElevatedButton( + onPressed: + isEnable?.value ?? RxBool(true).value ? clickAction : null, + style: ButtonStyle( + elevation: MaterialStateProperty.all(elevation), + backgroundColor: MaterialStateProperty.all( + isEnable?.value ?? RxBool(true).value + ? backgroundColor ?? AppColors.primaryClr + : backgroundColor ?? + AppColors.primaryClr.withOpacity(0.29)), + shape: MaterialStateProperty.all(RoundedRectangleBorder( + borderRadius: BorderRadius.circular(borderRadius ?? 30), + side: BorderSide( + color: borderColor ?? Colors.transparent, + width: borderWidth ?? 1.5)))), + child: Center( + child: Text(text.tr, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: textStyle ?? 16.txtMediumWhite.copyWith(color: textColor)), + ), + ), + // ), + ), + ); + } +} +// loader(BuildContext context, {Key? key}){ +// var child = Column( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// const CircularProgressIndicator( +// backgroundColor: AppColors.greyHint, +// strokeAlign: 2.5, +// strokeCap: StrokeCap.round, +// strokeWidth: 6.5, +// valueColor: AlwaysStoppedAnimation(AppColors.primaryBlue), +// ), +// TextView(text: 'Loading...', style: 20.txtBoldWhite, +// margin: const EdgeInsets.only(top: 20), +// ) +// ], +// ); +// +// final alertDialog = AlertDialog( +// key: key, +// shape: const RoundedRectangleBorder( +// borderRadius: BorderRadius.all(Radius.circular( +// 6))), +// backgroundColor: Colors.transparent, +// shadowColor: Colors.transparent, +// insetPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 40 +// // horizontal: AppFonts.s16, vertical: AppFonts.s40 +// ), +// content: SizedBox(width: double.maxFinite, child: child), +// ); +// +// showDialog( +// context: context, +// useSafeArea: true, +// barrierDismissible: false, +// builder: (_) => AnimateDialog( +// childView: alertDialog, +// )); +// } \ No newline at end of file diff --git a/lib/components/common/common_model.dart b/lib/components/common/common_model.dart new file mode 100644 index 0000000..5821c23 --- /dev/null +++ b/lib/components/common/common_model.dart @@ -0,0 +1,6 @@ +class CommonModel { + String? title; + String? image; + String? selectionImg; + CommonModel({this.title,this.image,this.selectionImg}); +} \ No newline at end of file diff --git a/lib/components/common/custom_drop_down.dart b/lib/components/common/custom_drop_down.dart new file mode 100644 index 0000000..4434e6f --- /dev/null +++ b/lib/components/common/custom_drop_down.dart @@ -0,0 +1,290 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:shayog/components/styles/app_colors.dart'; +class CustomDropdown extends StatefulWidget { + final List items; + final String Function(T) itemLabel; + final Function(T?) onSelected; + final String hintText; + final bool enableSearch; + // final double width; + final EdgeInsetsGeometry padding; + final T? initialValue; // Add initialValue parameter + final bool showError; + final bool isHeight; + final Color? borderClr; + final Color? backClr; + + CustomDropdown({ + required this.items, + required this.itemLabel, + required this.onSelected, + required this.hintText, + this.enableSearch = true, + // this.width = 100.0, + this.padding = const EdgeInsets.all(8.0), + this.initialValue, // Initialize with a value for edit mode + this.showError = false, + this.isHeight = false, + this.borderClr, + this.backClr + }); + + @override + _CustomDropdownState createState() => _CustomDropdownState(); +} + +class _CustomDropdownState extends State> { + T? selectedItem; + List filteredItems = []; + List fullItems = []; + late TextEditingController searchController; + OverlayEntry? overlayEntry; + final LayerLink layerLink = LayerLink(); + bool isDropdownOpen = false; + bool isSearching = false; + + @override + void initState() { + super.initState(); + searchController = TextEditingController(); + filteredItems = List.from(widget.items); + + // Set initial value if provided + if (widget.initialValue != null) { + selectedItem = widget.initialValue; + } + + searchController.addListener(() { + final text = searchController.text; + if (text.isEmpty) { + setState(() { + isSearching = false; + fullItems = List.from(widget.items); + }); + } else { + setState(() { + isSearching = true; + _filterList(text); + }); + } + }); + } + + @override + void didUpdateWidget(CustomDropdown oldWidget) { + super.didUpdateWidget(oldWidget); + if (widget.initialValue != oldWidget.initialValue) { + setState(() { + selectedItem = widget.initialValue; + }); + } + } + + @override + void dispose() { + searchController.dispose(); + + overlayEntry?.remove(); + super.dispose(); + } + + + + void _toggleDropdown() { + if (isDropdownOpen) { + _closeDropdown(); + } else { + _openDropdown(); + } + } + + void _openDropdown() { + setState(() { + isSearching = false; + filteredItems = List.from(widget.items); + searchController.clear(); + }); + + overlayEntry = _createOverlayEntry(); + Overlay.of(context).insert(overlayEntry!); + + setState(() { + isDropdownOpen = true; + }); + } + + void _closeDropdown() { + overlayEntry?.remove(); + overlayEntry = null; + setState(() { + isDropdownOpen = false; + }); + } + + void _selectItem(T item) { + setState(() { + selectedItem = item; + isDropdownOpen = false; + }); + searchController.clear(); + widget.onSelected(item); // Notify parent with selected value + _closeDropdown(); + filteredItems = List.from(widget.items); + } + + void _filterList(String query) { + filteredItems = widget.items + .where((item) => + widget.itemLabel(item).toLowerCase().contains(query.toLowerCase())) + .toList(); + + if (overlayEntry != null) { + overlayEntry!.markNeedsBuild(); + } + } + + OverlayEntry _createOverlayEntry() { + final RenderBox renderBox = context.findRenderObject() as RenderBox; + + return OverlayEntry( + builder: (context) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: _closeDropdown, + child: Stack( + children: [ + Positioned( + width: 150, + child: CompositedTransformFollower( + link: layerLink, + showWhenUnlinked: false, + offset: Offset(0, renderBox.size.height + 5), + child: Material( + elevation: 4, + borderRadius: BorderRadius.circular(8), + child: Container( + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + border: Border.all( + color: Colors.grey, + width: 1, + ), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + if (widget.enableSearch && widget.items.length > 1) + Padding( + padding: const EdgeInsets.only(bottom: 8.0), + child: SizedBox( + height: 32, + child: TextField( + + enabled: widget.enableSearch, + controller: searchController, + style: const TextStyle( + fontSize: 12, + overflow: TextOverflow.ellipsis), + decoration: InputDecoration( + hintText: 'Search...', + contentPadding: const EdgeInsets.symmetric( + vertical: 8.0, + horizontal: 12.0, + ), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(8), + ), + ), + ), + ), + ), + Container( + constraints: BoxConstraints(maxHeight: 200), + child: ListView.builder( + shrinkWrap: true, + itemCount: filteredItems.length, + itemBuilder: (context, index) { + final item = filteredItems[index]; + return ListTile( + contentPadding: EdgeInsets.all(0), + minVerticalPadding: 0, + dense: true, + visualDensity: VisualDensity.compact, + title: Tooltip( + message: widget.itemLabel(item), + child: Text( + widget.itemLabel(item), + style: const TextStyle( + fontSize: 12, + overflow: TextOverflow.ellipsis, + ), + ), + ), + onTap: () => _selectItem(item), + ); + }, + ), + ), + ], + ), + ), + ), + ), + ), + ], + ), + ); + }, + ); + } + + @override + Widget build(BuildContext context) { + return CompositedTransformTarget( + link: layerLink, + child: GestureDetector( + onTap: _toggleDropdown, + child: Container( + padding: EdgeInsets.symmetric(vertical: widget.isHeight ? 12 : 6.4, horizontal: 16), + // width: widget.width, + decoration: BoxDecoration( + color: widget.backClr ?? AppColors.white, + border: Border.all( + // color: widget.showError ? Colors.red : AppColors.clrGrey, width: 1), + color: widget.showError ? Colors.red : widget.borderClr ?? Colors.transparent, width: 1), + borderRadius: BorderRadius.circular(2), + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + selectedItem != null + ? widget.itemLabel(selectedItem!) + : widget.hintText, + style: TextStyle(fontSize: 12, color: Colors.black), + overflow: TextOverflow.ellipsis, + ), + ), + const Icon( + Icons.keyboard_arrow_down_outlined, + size: 20, + color: Colors.black, + ), + ], + ), + ), + ), + ); + } +} + + + + + + diff --git a/lib/components/common/data_cell.dart b/lib/components/common/data_cell.dart new file mode 100644 index 0000000..9fe5977 --- /dev/null +++ b/lib/components/common/data_cell.dart @@ -0,0 +1,39 @@ +import 'package:flutter/material.dart'; + +import '../../../components/styles/app_colors.dart'; + +DataCell editableCell(int index, String? value, + {bool isLink = false, VoidCallback? onTap}) { + return DataCell( + GestureDetector( + onTap: isLink && onTap != null ? onTap : null, + child: MouseRegion( + cursor: isLink ? SystemMouseCursors.click : SystemMouseCursors.basic, + child: Text( + value ?? "", + textAlign: TextAlign.center, + maxLines: 2, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: isLink ? Colors.blue : AppColors.darkGrey, + ), + ), + ), + ), + ); +} + +DataColumn dataColumn(String text, {Function(int, bool)? onSort}) { + return DataColumn( + onSort: onSort, + headingRowAlignment: MainAxisAlignment.center, + label: Text( + text, + textAlign: TextAlign.center, + maxLines: 2, + style: TextStyle( + fontSize: 12, fontWeight: FontWeight.bold, color: Colors.black), + ), + ); +} diff --git a/lib/components/common/input_field.dart b/lib/components/common/input_field.dart new file mode 100644 index 0000000..858e505 --- /dev/null +++ b/lib/components/common/input_field.dart @@ -0,0 +1,68 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +import '../../../components/styles/app_colors.dart'; + +class InputField extends StatelessWidget { + InputField( + {super.key, + this.title, + this.controller, + this.inputFormatter, + this.onChanged, + this.onFieldSubmitted, + this.validator, + this.edgesInsects, + this.underLineBorder}); + + String? title; + OutlineInputBorder? underLineBorder; + TextEditingController? controller; + Function(String)? onChanged; + Function(String)? onFieldSubmitted; + String? Function(String?)? validator; + List? inputFormatter; + EdgeInsets? edgesInsects; + var inputBorder = OutlineInputBorder( + borderRadius: BorderRadius.circular(2.0), + borderSide: BorderSide(color: AppColors.clrGrey)); + var errorInputBorder = OutlineInputBorder( + borderRadius: BorderRadius.circular(2.0), + borderSide: const BorderSide(color: Colors.red)); + + @override + Widget build(BuildContext context) { + return TextFormField( + controller: controller, + contextMenuBuilder: (context, editableTextState) { + return Container(height: 0, color: Colors.transparent); + }, + style: TextStyle(fontSize: 12, color: AppColors.black), + decoration: InputDecoration( + isDense: true, + hintStyle: TextStyle(fontSize: 12, color: AppColors.darkGrey), + maintainHintHeight: true, + contentPadding: edgesInsects ?? + EdgeInsets.symmetric(vertical: 12.0, horizontal: 12.0), + border: underLineBorder ?? inputBorder, + errorBorder: underLineBorder ?? inputBorder, + enabledBorder: underLineBorder ?? inputBorder, + disabledBorder: underLineBorder ?? inputBorder, + focusedBorder: underLineBorder ?? inputBorder, + focusedErrorBorder: underLineBorder ?? inputBorder, + filled: true, + labelText: title ?? "", + labelStyle: TextStyle(fontSize: 12, color: AppColors.darkGrey), + fillColor: AppColors.clrD9, + errorStyle: TextStyle( + fontSize: 10.0, + // height: 0.2, + ), + ), + inputFormatters: inputFormatter, + validator: validator, + onChanged: onChanged, + onFieldSubmitted: onFieldSubmitted, + ); + } +} diff --git a/lib/components/styles/app_colors.dart b/lib/components/styles/app_colors.dart new file mode 100644 index 0000000..8810d5f --- /dev/null +++ b/lib/components/styles/app_colors.dart @@ -0,0 +1,13 @@ +import 'package:flutter/material.dart'; + +class AppColors { +static Color primaryClr = Color(0xff294291); +static Color secondaryClr = Color(0xffE5E5E5); +static Color clrGrey = Color(0xffB4B4B4); +static Color darkGrey = Color(0xff5C5C5C); +static Color clrD9 = Color(0xffD9D9D9); +static Color clrF2 = Color(0xffF2F2F2); +static Color black = Color(0xff000000); +static Color white = Color(0xffFFFFFF); +static Color green = Color(0xff10A711); +} \ No newline at end of file diff --git a/lib/components/styles/app_images.dart b/lib/components/styles/app_images.dart new file mode 100644 index 0000000..7a495c2 --- /dev/null +++ b/lib/components/styles/app_images.dart @@ -0,0 +1,24 @@ +class AppImages { + static String path = "assets/images/"; + static String userMgmtBlue = "${path}user_mgmt_blue.png"; + static String userMgmt = "${path}user_mgmt.png"; + static String configuration = "${path}img_configuration.png"; + static String configurationBlue = "${path}configuration_blue.png"; + static String masters = "${path}img_multiple-files.png"; + static String mastersBlue = "${path}multifiles_blue.png"; + static String bills = "${path}img_prices.png"; + static String billsBlue = "${path}prices_blue.png"; + static String refresh = "${path}refresh.png"; + static String download = "${path}download.png"; + static String filter = "${path}filter.png"; + + + static String inVoiceManage = '${path}invoice_manage.png'; + static String report = '${path}report.png'; + static String dropdownArrow = '${path}drop_down_arrow.png'; + static String freightBillManage = '${path}freight_bill_manage.png'; + static String freightBillBlue = '${path}freight_bill_blue.png'; + static String invoiceManageBlue = '${path}invoice_blue.png'; + static String invoice = '${path}invoice_manage.png'; + static String reportBlue = '${path}report_blue.png'; +} diff --git a/lib/components/styles/app_strings.dart b/lib/components/styles/app_strings.dart new file mode 100644 index 0000000..d7316c3 --- /dev/null +++ b/lib/components/styles/app_strings.dart @@ -0,0 +1,84 @@ +class AppStrings { + static const String appName = "BANGUR"; + static const String internalUser = "Add Internal User"; + static const String userPlant = "User Plant Mapping"; + static const String manageUser = "Manage User"; + static const String userType = "User Type"; + static const String roleMapping = "Internal User Role Mapping"; + static const String cancel = "Cancel"; + static const String add = "Add"; + static const String submit = "Submit"; + static const String userTypes = "User Types"; + static const String cement = "CEMENT"; + static const String adminUser = "Admin User"; + static const String transportVendor = "Transport/Vendor 1"; + static const String refresh = "Refresh"; + static const String filter = "Filter"; + static const String download = "Download"; + static const String export = "Export"; + static const String transporterMaster = "Transporter Master"; + static const String plantMaster = "Plant Master"; + static const String activeBill = "Active Freight Bill Information"; + static const String cancelBill = "Cancelled Freight Bill Information"; + static const String viewBill = "View Freight Bill & Invoice"; + static const String generateFreightBill = "Generate Freight Bill"; + static const String viewFreightBill = "View Freight Bill"; + static const String pendingGeneration = "Pending for Generation"; + static const String viewGrnDetails = "View MRN/GRN Details"; + static const String save = "Save"; + static const String srNo = "Sr.No."; + static const String mrnNo = "MRN/GRN No."; + static const String plantNo = "Plant No"; + static const String product = "Product"; + static const String date = "Date"; + static const String fromLocation = "From Location Desc"; + static const String vehicleNo = "Vehicle No."; + static const String transporterLrNo = "Transporter LR No."; + static const String transporterLrNoDate = "Transporter LR No.Date"; + static const String dispQty = "Disp Qty"; + static const String netQty = "Net Qty"; + static const String billingQty = "Billing Qty"; + static const String vom = "Vom"; + static const String freightRate = "Freight Rate"; + static const String freightAmount = "Freight Amount"; + static const String plant = "Plant"; + static const String productName = "Product Name"; + static const String freightBillNo = "Freight Bill No."; + static const String freightBillDate = "Freight Bill Date"; + static const String freightInvoice = "Freight Invoice No."; + static const String freightInvoiceDate = "Freight Invoice Date"; + static const String uom = "UOM"; + static const String freightAmt = "Freight Amount"; + static const String cGST = "CGST"; + static const String sGST = "SGST"; + static const String iGST = "IGST"; + static const String totalGst = "Total GST"; + static const String cCN = "CCN No."; + static const String cCNDate = "CCN Date"; + static const String miroStatus = "Micro Status"; + static const String gstHold = "GST Hold"; + static const String gstRelease = "If GST release this invoice" + " than required GST Payment Due & UTN Number"; + static const String utrNo = "UTR No."; + static const String utrDate = "UTR Date"; + static const String amount = "Amount"; + static const String totalInvoiceAmt = "Total Invoice Amount"; + static const String firstName = "First Name"; + static const String lastName = "Last Name"; + static const String status = "Status"; + static const String enterLastName = "Enter Last Name"; + static const String enterFirstName = "Enter First Name"; + static const String employeeCode = "Employee Code"; + static const String enterEmployeeCode = "Enter Employee Code"; + static const String emailAddress = "Email Address"; + static const String enterEmailAddress = "Enter Email Address"; + static const String mobileNo = "Mobile No."; + static const String enterMobileNo = "Enter Mobile Number"; + static const String edit = "Edit"; + static const String back = "Back"; + static const String freightBill = "Freight Bill No.:"; + static const String freightDate = "Freight Bill Date:"; + static const String plantName = "Plant Name"; + static const String fromLocDesc = "From Location Desc."; + static const String remark = "Remark"; +} diff --git a/lib/components/styles/textStyles.dart b/lib/components/styles/textStyles.dart new file mode 100644 index 0000000..76684cf --- /dev/null +++ b/lib/components/styles/textStyles.dart @@ -0,0 +1,62 @@ + + +import 'package:flutter/material.dart'; +import 'package:shayog/utils/extensions.dart'; + + +import 'app_colors.dart'; + +extension TextStyles on num{ + + + + + TextStyle get txtRegularBlack => _textStyle(this,AppColors.black,Family.regular); + TextStyle get txtRegularWhite => _textStyle(this,AppColors.white,Family.regular); + + + + + + //medium + TextStyle get txtMediumWhite => _textStyle(this,AppColors.white,Family.medium); + + + //Semi bold + TextStyle get txtSBoldBlackText => _textStyle(this,AppColors.black,Family.semiBold); + + + + + //bold + TextStyle get txtBoldWhite => _textStyle(this,AppColors.white,Family.bold); + TextStyle get txtBoldBlack => _textStyle(this,AppColors.black,Family.bold); + + +} + + + + + + + + + + + + + +TextStyle _textStyle(num size, color, family) => TextStyle( + fontSize: size.numToDouble, + color: color, + fontFamily: family + ); +class Family{ + static const String light = ' AnekLatin-Light'; + static const String regular = 'AnekLatin-Regular'; + static const String medium = 'AnekLatin-Medium'; + static const String semiBold = ' AnekLatin-SemiBold'; + static const String bold = 'AnekLatin-Bold'; + static const String extraBold = 'AnekLatin-ExtraBold'; +} \ No newline at end of file diff --git a/lib/feature/presentation/screens/admin/configuration_management/configuration_screen.dart b/lib/feature/presentation/screens/admin/configuration_management/configuration_screen.dart new file mode 100644 index 0000000..92ddd02 --- /dev/null +++ b/lib/feature/presentation/screens/admin/configuration_management/configuration_screen.dart @@ -0,0 +1,42 @@ +import 'package:flutter/material.dart'; + +import '../../../widgets/custom_table.dart'; + +class ConfigurationScreen extends StatelessWidget { + const ConfigurationScreen({super.key}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + // Row 1 (Header Row) + Row( + children: [ + CustomTable(text:"Header 1", isHeader: true), + CustomTable(text:"Header 2", isHeader: true), + CustomTable(text:"Header 3", isHeader: true), + ], + ), + Row( + children: [ + CustomTable(text:"Row 1, Col 1"), + CustomTable(text:"Row 1, Col 2"), + CustomTable(text:"Row 1, Col 3"), + ], + ), + Row( + children: [ + CustomTable(text:"Row 2, Col 1"), + CustomTable(text:"Row 2, Col 2"), + CustomTable(text:"Row 2, Col 3"), + ], + ), + ], + ), + + ); + } + +} diff --git a/lib/feature/presentation/screens/admin/freight_bills/controller/freightbill_ctrl.dart b/lib/feature/presentation/screens/admin/freight_bills/controller/freightbill_ctrl.dart new file mode 100644 index 0000000..b4f6bb3 --- /dev/null +++ b/lib/feature/presentation/screens/admin/freight_bills/controller/freightbill_ctrl.dart @@ -0,0 +1,45 @@ +import 'package:get/get.dart'; +import '../../../../../../components/common/common_model.dart'; +import '../../../../../../components/styles/app_images.dart'; +import '../../../../../../components/styles/app_strings.dart'; + + +class FreightBillCtrl extends GetxController{ + var selectedUser = 0.obs; + RxBool isSelected = false.obs; + RxList userTabs = [ + CommonModel(title: AppStrings.activeBill), + CommonModel(title: AppStrings.cancelBill), + CommonModel(title: AppStrings.viewBill), + + + ].obs; + var selectedValue = 'Admin'.obs; // Default value + var selectedStatus = 'STO'.obs; // Default value + void toggleContainer() { + isSelected.value = true; + print("isSelected.value..${isSelected.value}"); + } + var items = ['Admin', 'Sub Admin', + 'Internal Audit', 'Raw material','MIS User'].obs; + var status = ['STO','In-Bound']; + RxList tabs = [ + CommonModel( + title: "User\nManagement", + image: AppImages.userMgmt, + selectionImg: AppImages.userMgmtBlue), + CommonModel( + title: "Configuration\nManagement", + image: AppImages.configuration, + selectionImg: AppImages.configurationBlue), + CommonModel( + title: "Masters", + image: AppImages.masters, + selectionImg: AppImages.mastersBlue), + CommonModel( + title: "Freight Bill & \n Invoice", + image: AppImages.bills, + selectionImg: AppImages.billsBlue), + ].obs; + +} \ No newline at end of file diff --git a/lib/feature/presentation/screens/admin/freight_bills/freightbill_screen.dart b/lib/feature/presentation/screens/admin/freight_bills/freightbill_screen.dart new file mode 100644 index 0000000..a272610 --- /dev/null +++ b/lib/feature/presentation/screens/admin/freight_bills/freightbill_screen.dart @@ -0,0 +1,460 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +import '../../../../../components/common/common_btn.dart'; +import '../../../../../components/common/input_field.dart'; +import '../../../../../components/styles/app_colors.dart'; +import '../../../../../components/styles/app_images.dart'; +import '../../../../../components/styles/app_strings.dart'; + + +import 'controller/freightbill_ctrl.dart'; + +class FreightBillScreen extends StatelessWidget { + FreightBillScreen({super.key}); + + final freightBillCtrl = Get.put(FreightBillCtrl()); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + padding: EdgeInsets.only(bottom: 16), + margin: EdgeInsets.all(16), + child: Column( + children: [ + Container( + margin: EdgeInsets.only(bottom: 12), + height: 45, + color: AppColors.primaryClr, + child: Row( + children: [ + ListView.separated( + padding: EdgeInsets.symmetric(horizontal: 16), + scrollDirection: Axis.horizontal, + shrinkWrap: true, + itemBuilder: (context, index) { + return Obx( + () => InkWell( + onTap: () { + freightBillCtrl.selectedUser.value = index; + }, + child: Container( + margin: EdgeInsets.only(bottom: 10, top: 10), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: freightBillCtrl + .selectedUser.value == + index + ? Colors.white + : AppColors.primaryClr, + width: 3))), + child: Center( + child: Text( + freightBillCtrl.userTabs[index].title ?? "", + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w900, + color: Colors.white), + ), + ), + ), + ), + ); + }, + separatorBuilder: (context, index) { + return SizedBox(width: 16); + }, + itemCount: freightBillCtrl.userTabs.length), + Spacer(), + InkWell( + child: Image.asset(AppImages.refresh, + height: 10, width: 10)), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + AppStrings.refresh, + style: TextStyle( + color: AppColors.white, + fontSize: 10, + fontWeight: FontWeight.normal), + ), + ), + InkWell( + onTap: freightBillCtrl.toggleContainer, + child: Image.asset(AppImages.filter, + height: 12, width: 12)), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + AppStrings.filter, + style: TextStyle( + color: AppColors.white, + fontSize: 10, + fontWeight: FontWeight.normal), + ), + ), + ], + ), + ), + Obx( + () => freightBillCtrl.isSelected.value + ? Container( + padding: EdgeInsets.all(16), + color: AppColors.clrF2, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _commonText( + "Transporter Name", + ), + SizedBox(height: 8), + InputField( + title: "Enter Transporter Name", + ), + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _commonText( + "Freight Bill No.", + ), + SizedBox(height: 8), + InputField( + title: "Enter Freight Bill No.", + ), + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _commonText( + "Product Name", + ), + SizedBox(height: 8), + InputField( + title: "Enter Product Name", + ), + ], + )), + ], + ), + Padding( + padding: const EdgeInsets.only( + top: 16.0, left: 8, right: 8), + child: Row( + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + _commonText( + "Plant", + ), + SizedBox(height: 8), + Obx( + () => Container( + padding: EdgeInsets.only(left: 8), + height: 35, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(4.0), + color: AppColors.clrD9, + border: Border.all( + color: AppColors.clrGrey)), + child: DropdownButton( + icon: Icon( + Icons + .keyboard_arrow_down_outlined, + size: 20, + color: AppColors.darkGrey), + + isExpanded: true, + underline: SizedBox(), + + value: freightBillCtrl + .selectedValue.value, + // Use the selected value + onChanged: (String? newValue) { + if (newValue != null) { + freightBillCtrl + .selectedValue.value = + newValue; // Update the selected value + } + }, + items: freightBillCtrl.items + .map((String value) { + return DropdownMenuItem( + value: value.toString(), + child: Text( + value, + style: TextStyle( + fontSize: 12, + color: + AppColors.darkGrey), + ), + ); + }).toList(), + ), + ), + ), + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + _commonText( + "Trancastion Type", + ), + Obx( + () => Container( + margin: EdgeInsets.only(top: 8), + padding: EdgeInsets.only(left: 8), + height: 35, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(4.0), + color: AppColors.clrD9, + border: Border.all( + color: AppColors.clrGrey)), + child: DropdownButton( + icon: Icon( + Icons + .keyboard_arrow_down_outlined, + size: 20, + color: AppColors.darkGrey), + + isExpanded: true, + underline: SizedBox(), + + value: freightBillCtrl + .selectedStatus.value, + // Use the selected value + onChanged: (String? newValue) { + if (newValue != null) { + freightBillCtrl + .selectedStatus.value = + newValue; // Update the selected value + } + }, + items: freightBillCtrl.status + .map((String value) { + return DropdownMenuItem( + value: value.toString(), + child: Text( + value, + style: TextStyle( + fontSize: 12, + color: + AppColors.darkGrey), + ), + ); + }).toList(), + ), + ), + ), + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + _commonText( + "Freight Bill Date", + ), + SizedBox(height: 8), + InputField( + title: "Enter Bill Date", + ), + ], + )), + ], + ), + ), + + Padding( + padding: const EdgeInsets.all(16.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + CommonBtn( + bkClr: Colors.white, + text: AppStrings.cancel, clickAction: () { },), + SizedBox(width: 16), + CommonBtn( + text: AppStrings.submit, + textClr: Colors.white, clickAction: () { }, + ), + ], + ), + ), + ], + ), + ) + : SizedBox(), + ), + Obx(() { + switch (freightBillCtrl.selectedUser.value) { + case 0: + return _tableView(); + + default: + return _tableView(); + } + }), + ], + ), + ), + ], + ); + } + + _tableView() { + return Table(border: TableBorder.all(color: AppColors.clrGrey), children: [ + TableRow( + decoration: BoxDecoration(color: AppColors.secondaryClr), + children: [ + _cellText( + text: "SR. No.", + clr: Colors.black, + fontWeight: FontWeight.bold), + _cellText( + text: "Transporter Name", + clr: Colors.black, + fontWeight: FontWeight.bold), + _cellText( + text: "Freight Bill No.", + clr: Colors.black, + fontWeight: FontWeight.bold), + _cellText( + text: "Freight Bill Date", + clr: Colors.black, + fontWeight: FontWeight.bold), + _cellText( + text: "Paint", clr: Colors.black, fontWeight: FontWeight.bold), + _cellText( + text: "Product Name", + clr: Colors.black, + fontWeight: FontWeight.bold), + _cellText( + text: "Transaction Type", + clr: Colors.black, + fontWeight: FontWeight.bold), + _cellText( + text: "CCN Amount", + clr: Colors.black, + fontWeight: FontWeight.bold), + _cellText( + text: "Legal Entity", + clr: Colors.black, + fontWeight: FontWeight.bold), + ]), + TableRow(children: [ + _cellText(text: "01"), + _cellText(text: "User 1"), + _cellText(text: "9841651635426", clr: AppColors.primaryClr), + _cellText(text: "1 August 2024"), + _cellText(text: "78549-Plant 1"), + _cellText(text: "Product 1"), + _cellText(text: "ST0"), + _cellText(text: "XXXXXXXX"), + _cellText(text: "78646646"), + ]), + TableRow(children: [ + _cellText(text: "02"), + _cellText(text: "User 2"), + _cellText(text: "9841651635426", clr: AppColors.primaryClr), + _cellText(text: "1 August 2024"), + _cellText(text: "78549-Plant 1"), + _cellText(text: "Product 2"), + _cellText(text: "ST0"), + _cellText(text: "XXXXXXXX"), + _cellText(text: "78646646"), + ]), + TableRow(children: [ + _cellText(text: "03"), + _cellText(text: "User 3"), + _cellText(text: "9841651635426", clr: AppColors.primaryClr), + _cellText(text: "1 August 2024"), + _cellText(text: "78549-Plant 1"), + _cellText(text: "Product 3"), + _cellText(text: "Inbound"), + _cellText(text: "-"), + _cellText(text: "-"), + ]), + TableRow(children: [ + _cellText(text: "04"), + _cellText(text: "User 4"), + _cellText(text: "9841651635426", clr: AppColors.primaryClr), + _cellText(text: "1 August 2024"), + _cellText(text: "78549-Plant 1"), + _cellText(text: "Product 4"), + _cellText(text: "Inbound"), + _cellText(text: "XXXXXXXX"), + _cellText(text: "78646646"), + ]), + TableRow(children: [ + _cellText(text: "05"), + _cellText(text: "User 5"), + _cellText(text: "9841651635426", clr: AppColors.primaryClr), + _cellText(text: "1 August 2024"), + _cellText(text: "78549-Plant 1"), + _cellText(text: "Product 5"), + _cellText(text: "Inbound"), + _cellText(text: "-"), + _cellText(text: "-"), + ]), + ]); + } + + _cellText({String? text, Color? clr, FontWeight? fontWeight}) { + return Center( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 4), + child: Text( + text ?? '', + textAlign: TextAlign.center, + style: TextStyle( + color: clr ?? AppColors.darkGrey, + fontSize: 12, + fontWeight: fontWeight ?? FontWeight.normal), + ), + ), + ); + } + + _commonText(String title) { + return Text( + title, + style: TextStyle( + fontSize: 13, color: Colors.black, fontWeight: FontWeight.w900), + ); + } +} diff --git a/lib/feature/presentation/screens/admin/masters/controller/master_ctrl.dart b/lib/feature/presentation/screens/admin/masters/controller/master_ctrl.dart new file mode 100644 index 0000000..fe63227 --- /dev/null +++ b/lib/feature/presentation/screens/admin/masters/controller/master_ctrl.dart @@ -0,0 +1,27 @@ +import 'package:get/get.dart'; + +import '../../../../../../components/common/common_model.dart'; +import '../../../../../../components/styles/app_strings.dart'; + + +class MasterCtrl extends GetxController{ + var selectedUser = 0.obs; + var supplierCode = 'Supplier Code'.obs; + var bpGrouping = 'BP Grouping'.obs; + var accountGrp = 'Supplier Account Group'.obs; + var name = 'Name'.obs; + var supplier = ['110590034', '110590035', + '110590036', '110590037','110590038'].obs; + var grouping = ['BP Grouping','110590034', '110590035', + '110590036', '110590037','110590038'].obs; + var account = ['Supplier Account Group','110590034', '110590035', + '110590036', '110590037','110590038'].obs; + var nameList = ['Name','110590034', '110590035', + '110590036', '110590037','110590038'].obs; + + RxList userTabs = [ + CommonModel(title: AppStrings.transporterMaster), + CommonModel(title: AppStrings.plantMaster), + + ].obs; +} \ No newline at end of file diff --git a/lib/feature/presentation/screens/admin/masters/master_screen.dart b/lib/feature/presentation/screens/admin/masters/master_screen.dart new file mode 100644 index 0000000..9418492 --- /dev/null +++ b/lib/feature/presentation/screens/admin/masters/master_screen.dart @@ -0,0 +1,222 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import '../../../../../components/common/custom_drop_down.dart'; +import '../../../../../components/styles/app_colors.dart'; +import '../../../../../components/styles/app_images.dart'; +import '../../../../../components/styles/app_strings.dart'; + +import 'controller/master_ctrl.dart'; + +class MasterScreen extends StatelessWidget { + MasterScreen({super.key}); + + final masterCtrl = Get.put(MasterCtrl()); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + padding: EdgeInsets.only(bottom: 16), + margin: EdgeInsets.all(16), + + child: Column( + children: [ + Container( + height: 45, + color: AppColors.primaryClr, + child: Row( + children: [ + ListView.separated( + padding: EdgeInsets.symmetric(horizontal: 16), + scrollDirection: Axis.horizontal, + shrinkWrap: true, + itemBuilder: (context, index) { + return Obx( + () => InkWell( + onTap: () { + masterCtrl.selectedUser.value = index; + }, + child: Container( + margin: EdgeInsets.only(bottom: 10, top: 10), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: + masterCtrl.selectedUser.value == index + ? Colors.white + : AppColors.primaryClr, + width: 3))), + child: Center( + child: Text( + masterCtrl.userTabs[index].title ?? "", + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w900, + color: Colors.white), + ), + ), + ), + ), + ); + }, + separatorBuilder: (context, index) { + return SizedBox(width: 16); + }, + itemCount: masterCtrl.userTabs.length), + Spacer(), + InkWell( + child: Image.asset(AppImages.refresh, + height: 10, width: 10)), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + AppStrings.refresh, + style: TextStyle( + color: AppColors.white, + fontSize: 10, + fontWeight: FontWeight.normal), + ), + ), + InkWell( + child: Image.asset(AppImages.filter, + height: 12, width: 12)), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + AppStrings.filter, + style: TextStyle( + color: AppColors.white, + fontSize: 10, + fontWeight: FontWeight.normal), + ), + ), + InkWell( + child: Image.asset(AppImages.download, + height: 15, width: 15)), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + AppStrings.export, + style: TextStyle( + color: AppColors.white, + fontSize: 10, + fontWeight: FontWeight.normal), + ), + ), + ], + ), + ), + Obx(() { + switch (masterCtrl.selectedUser.value) { + case 0: + return _tableView(); + + + default: + return Text(""); + } + }), + + ], + ), + ), + ], + ); + } +_tableView(){ + return Table(border: TableBorder.all(color: AppColors.clrGrey), children: [ + TableRow( + decoration: BoxDecoration(color: AppColors.secondaryClr), + children: [ + _cellText(text: "SR. No."), + //CustomTable(text: "SR. NO."), + CustomDropdown( + items: masterCtrl.supplier, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + masterCtrl.supplierCode.value = selected; + } + }, + hintText: 'Supplier Code'), + CustomDropdown( + items: masterCtrl.supplier, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + masterCtrl.supplierCode.value = selected; + } + }, + hintText: 'BP Grouping'), + CustomDropdown( + items: masterCtrl.supplier, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + masterCtrl.supplierCode.value = selected; + } + }, + hintText: 'Supplier Account Group'), + CustomDropdown( + items: masterCtrl.supplier, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + masterCtrl.supplierCode.value = selected; + } + }, + hintText: 'Name'), + _cellText(text: "Legal Entity"), + ]), + TableRow(children: [ + _cellText(text: "01"), + _cellText(text: "11059440"), + _cellText(text: "ZIPT"), + _cellText(text: "ZIPT"), + _cellText(text: "ASAP Logistics Private Limited "), + _cellText(text: "0"), + ]), + TableRow(children: [ + _cellText(text: "02"), + _cellText(text: "11059440"), + _cellText(text: "ZIPT"), + _cellText(text: "ZIPT"), + _cellText(text: "ASAP Logistics Private Limited "), + _cellText(text: "0"), + + ]), + TableRow(children: [ + _cellText(text: "03"), + _cellText(text: "11059440"), + _cellText(text: "ZIPT"), + _cellText(text: "ZIPT"), + _cellText(text: "ASAP Logistics Private Limited "), + _cellText(text: "0"), + ]), + TableRow(children: [ + _cellText(text: "04"), + _cellText(text: "11059440"), + _cellText(text: "ZIPT"), + _cellText(text: "ZIPT"), + _cellText(text: "ASAP Logistics Private Limited "), + _cellText(text: "0"), + + ]), + ]); +} + _cellText({String? text, Color? clr}) { + return Center( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0,horizontal: 4), + child: Text( + text ?? '',textAlign: TextAlign.center, + style: TextStyle( + color: clr ?? AppColors.darkGrey, + fontSize: 12, + fontWeight: FontWeight.normal), + ), + ), + ); + } +} diff --git a/lib/feature/presentation/screens/admin/user_management/add_internal_user.dart b/lib/feature/presentation/screens/admin/user_management/add_internal_user.dart new file mode 100644 index 0000000..1ca79b8 --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/add_internal_user.dart @@ -0,0 +1,233 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:shayog/components/common/common_button.dart'; +import 'package:shayog/feature/presentation/widgets/text_view.dart'; +import '../../../../../components/common/common_btn.dart'; +import '../../../../../components/common/custom_drop_down.dart'; +import '../../../../../components/common/input_field.dart'; +import '../../../../../components/styles/app_colors.dart'; +import '../../../../../components/styles/app_strings.dart'; +import '../../../../../utils/validations.dart'; +import '../../dashboard/controller/dashboard_ctrl.dart'; + +class AddInternalUser extends StatelessWidget { + AddInternalUser({super.key}); + + final ctrl = Get.put(DashboardCtrl()); + + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.all(16), + color: AppColors.clrF2, + child: Stack( + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextView( + text: AppStrings.firstName, + style: TextStyle( + fontSize: 12, fontWeight: FontWeight.bold)), + SizedBox(height: 8), + InputField( + controller: ctrl.nameCtrl, + title: AppStrings.enterFirstName, + ), + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextView( + text: AppStrings.lastName, + style: TextStyle( + fontSize: 12, fontWeight: FontWeight.bold)), + SizedBox(height: 8), + InputField( + validator: Validations.checkLastName, + controller: ctrl.lastNCtrl, + title: AppStrings.enterLastName, + ), + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextView( + text: AppStrings.employeeCode, + style: TextStyle( + fontSize: 12, fontWeight: FontWeight.bold)), + SizedBox(height: 8), + InputField( + controller: ctrl.employeeCodeCtrl, + title: AppStrings.enterEmployeeCode, + ), + ], + )), + ], + ), + Padding( + padding: const EdgeInsets.only(top: 16.0), + child: Row( + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextView( + text: AppStrings.userType, + style: TextStyle( + fontSize: 12, fontWeight: FontWeight.bold)), + SizedBox(height: 8), + CustomDropdown( + initialValue: ctrl.selectUserVal.value, + backClr: AppColors.clrD9, + borderClr: AppColors.clrGrey, + items: ctrl.items, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + ctrl.selectedValue.value = selected; + } + }, + hintText: 'Select User Type'), + Obx(() { + return ctrl.errorText.value.isNotEmpty + ? Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Text( + ctrl.errorText.value, + style: TextStyle( + color: Colors.red, fontSize: 12), + ), + ) + : SizedBox.shrink(); + }), + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextView( + text: AppStrings.status, + style: TextStyle( + fontSize: 12, fontWeight: FontWeight.bold)), + SizedBox(height: 8), + CustomDropdown( + initialValue: ctrl.selectedStatus.value, + backClr: AppColors.clrD9, + borderClr: AppColors.clrGrey, + items: ctrl.status, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + ctrl.selectedStatus.value = selected; + } + }, + hintText: 'Select Status'), + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextView( + text: AppStrings.emailAddress, + style: TextStyle( + fontSize: 12, fontWeight: FontWeight.bold)), + SizedBox(height: 8), + InputField( + controller: ctrl.emailCtrl, + title: AppStrings.enterEmailAddress, + ), + ], + )), + ], + ), + ), + Padding( + padding: const EdgeInsets.only(top: 16.0, bottom: 8), + child: TextView( + text: AppStrings.mobileNo, + style: + TextStyle(fontSize: 12, fontWeight: FontWeight.bold)), + ), + Row( + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.only(right: 8.0), + child: InputField( + validator: Validations.checkPhoneValidations, + controller: ctrl.mobileCtrl, + title: AppStrings.enterMobileNo, + ), + )), + Expanded( + flex: 2, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + CommonBtn( + bkClr: Colors.white, + text: AppStrings.cancel, + clickAction: () { + Get.back(); + }, + ), + SizedBox(width: 16), + CommonButton( + height: 30, + width: 100, + borderRadius: 4, + isLoading: ctrl.employeeCodeCtrl.text.isEmpty ? ctrl.isLoading : ctrl.editLoading, + text: ctrl.employeeCodeCtrl.text.isEmpty + ? AppStrings.add + : AppStrings.edit, + textStyle: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: Colors.white), + // textClr: Colors.white, + clickAction: () { + ctrl.employeeCodeCtrl.text.isEmpty + ? ctrl.createUser() + : ctrl.editAllUser( + ctrl.employeeCodeCtrl.text); + }, + ), + ], + ), + )) + ], + ), + ], + ), + ], + ), + ); + } +} diff --git a/lib/feature/presentation/screens/admin/user_management/internal_user_role_mapping.dart b/lib/feature/presentation/screens/admin/user_management/internal_user_role_mapping.dart new file mode 100644 index 0000000..5e6e320 --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/internal_user_role_mapping.dart @@ -0,0 +1,279 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:shayog/components/common/custom_drop_down.dart'; +import 'package:shayog/feature/presentation/screens/dashboard/controller/dashboard_ctrl.dart'; +import 'package:shayog/feature/presentation/screens/transporter/widgets/common_card.dart'; +import 'package:sizer/sizer.dart'; +import '../../../../../components/common/common_btn.dart'; +import '../../../../../components/styles/app_colors.dart'; +import '../../../../../components/styles/app_strings.dart'; + +class InternalUserRoleMapping extends StatelessWidget { + InternalUserRoleMapping({super.key}); + + final ctrl = Get.put(DashboardCtrl()); + + @override + Widget build(BuildContext context) { + return Obx(() { + if (ctrl.isDropDownLoading.value) { + return Center( + child: CircularProgressIndicator( + color: AppColors.primaryClr, + ), + ); + } else { + return Container( + color: Colors.white, + child: Column( + children: [ + Container( + color: AppColors.clrF2, + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 8.0, vertical: 16), + child: Row( + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _commonText( + "Employee Code", + ), + SizedBox(height: 8), + CustomDropdown( + backClr: AppColors.clrD9, + borderClr: AppColors.clrGrey, + items: ctrl.employeeCodes, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + ctrl.selectedEmpCode.value = selected; + } + }, + hintText: "Enter Employee Code", + ), + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _commonText( + "Email Address", + ), + SizedBox(height: 8), + CustomDropdown( + backClr: AppColors.clrD9, + borderClr: AppColors.clrGrey, + items: ctrl.emails, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + ctrl.selectedEmail.value = selected; + } + }, + hintText: "Enter Email Address", + ), + ], + )), + SizedBox(width: 16), + Expanded( + //flex: 2, + child: Column( + children: [ + _commonText( + "", + ), + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + CommonBtn( + bkClr: Colors.white, + text: AppStrings.cancel, + clickAction: () {}, + ), + SizedBox(width: 16), + CommonBtn( + text: AppStrings.submit, + textClr: Colors.white, + clickAction: () { + ctrl.getRoleMappingData(); + }, + ), + ], + ), + ), + ], + ), + ), + ], + ), + ), + ), + SizedBox( + height: 8, + ), + Visibility( + visible: ctrl.showRolesSection.value, + child: Padding( + padding: const EdgeInsets.only(left: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + 'User Type: Admin', + style: TextStyle( + color: Colors.black, + fontSize: 12.sp, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox( + height: 10, + ), + GetBuilder( + builder: (controller) { + return SizedBox( + height: MediaQuery.sizeOf(context).height * 0.42, + width: MediaQuery.sizeOf(context).width, + child: ListView.separated( + padding: EdgeInsets.zero, + shrinkWrap: true, + itemCount: ctrl.roleMappingData.length, + itemBuilder: (context, index) { + final fetchRole = + ctrl.roleMappingData[index]; + final roleId = fetchRole.roleId ?? 0; + + return Row( + children: [ + Transform.scale( + scale: 0.80, + child: Checkbox( + value: controller.selectedRoleIds + .contains(roleId), + onChanged: (value) { + controller.updateSelectedRoleIds( + roleId, value ?? false); + }, + activeColor: AppColors.primaryClr, + checkColor: Colors.white, + materialTapTargetSize: + MaterialTapTargetSize.shrinkWrap, + ), + ), + Text( + fetchRole.roleName ?? "", + style: TextStyle( + fontSize: 12, color: Colors.black), + ), + ], + ); + }, + separatorBuilder: (context, index) { + return SizedBox(); // Customize separator if needed + }, + ), + ); + }, + ), + const SizedBox( + height: 8, + ), + Text( + '*Note- If user type is transporter, by default all the plants would be selected for the first time.', + style: TextStyle( + color: Colors.red, + fontSize: 13.sp, + ), + ), + const SizedBox( + height: 12, + ), + Padding( + padding: const EdgeInsets.all(16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + CommonBtn( + bkClr: Colors.white, + text: AppStrings.cancel, + clickAction: () {}, + ), + SizedBox(width: 16), + CommonBtn( + text: AppStrings.submit, + textClr: Colors.white, + clickAction: () { + CommonAlertDialog.showDialog( + message: + 'Are you sure you want to do this action?', + positiveText: "Submit", + negativeBtCallback: () { + Get.back(); + }, + negativeText: 'Cancel', + positiveBtCallback: () { + ctrl.selectRoles(); + Get.back(); + }, + ); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ); + } + }); + } + + Widget rowCheck({ + required bool isCheckValue, + required String descRole, + required ValueChanged onChanged, + }) { + return Row( + children: [ + Checkbox( + activeColor: AppColors.primaryClr, + checkColor: Colors.white, + value: isCheckValue, + onChanged: onChanged, + ), + const SizedBox( + width: 6, + ), + Text( + descRole, + style: TextStyle( + color: Colors.black, + fontSize: 12.sp, + ), + ), + ], + ); + } + + _commonText(String title) { + return Text( + title, + style: TextStyle( + fontSize: 13, color: Colors.black, fontWeight: FontWeight.w900), + ); + } +} diff --git a/lib/feature/presentation/screens/admin/user_management/manage_user.dart b/lib/feature/presentation/screens/admin/user_management/manage_user.dart new file mode 100644 index 0000000..0afe44f --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/manage_user.dart @@ -0,0 +1,127 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import '../../../../../components/common/common_btn.dart'; +import '../../../../../components/common/data_cell.dart'; +import '../../../../../components/styles/app_colors.dart'; +import '../../dashboard/controller/dashboard_ctrl.dart'; + +class ManageUser extends StatelessWidget { + ManageUser({super.key}); + + final controller = Get.put(DashboardCtrl()); + + @override + Widget build(BuildContext context) { + return Obx(() { + if (controller.userLoading.value) { + return Center(child: CircularProgressIndicator()); + } + + return Scrollbar( + thumbVisibility: true, + controller: controller.verticalScrollController, + child: SingleChildScrollView( + controller: controller.verticalScrollController, + child: Scrollbar( + thumbVisibility: true, + controller: controller.horizontalScrollController, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + controller: controller.horizontalScrollController, + child: Container( + margin: EdgeInsets.only(top: 16), + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey.shade400, + width: 1.0, + ), + ), + child: DataTable( + dataRowHeight: 28, + headingRowHeight: 40, + headingRowColor: WidgetStateProperty.all(AppColors.clrF2), + border: TableBorder( + horizontalInside: BorderSide(color: AppColors.clrGrey), + verticalInside: BorderSide(color: AppColors.clrGrey), + bottom: BorderSide(color: AppColors.clrGrey), + left: BorderSide(color: AppColors.clrGrey), + right: BorderSide(color: AppColors.clrGrey), + top: BorderSide(color: AppColors.clrGrey), + ), + columns: [ + dataColumn("Sr.No."), + dataColumn("User Name"), + dataColumn("Email ID"), + dataColumn("Employee/\nTransporter Code"), + dataColumn("Mobile No."), + dataColumn("User Type"), + dataColumn("Created By"), + dataColumn("Created Date"), + dataColumn("Last Updated By"), + dataColumn("Last Update Date"), + dataColumn("Status"), + dataColumn("Action"), + ], + rows: List.generate(controller.getAllUser.length, + (index) { + final stoppage = controller.getAllUser[index]; + + return DataRow( + selected: stoppage.isSelected, + // onSelectChanged: (value) { + // controller.toggleSelection(index, value ?? false); + // }, + cells: [ + editableCell(index, "0${index + 1}"), + editableCell(index, stoppage.userName ?? ""), + editableCell(index, stoppage.userEmail ?? ""), + editableCell(index, stoppage.userEmpTransCode ?? ""), + editableCell(index, stoppage.userMobile ?? ""), + editableCell(index, stoppage.usertypeName ?? ""), + editableCell(index, stoppage.createdBy.toString()), + editableCell(index, stoppage.createdOn.toString()), + editableCell(index, stoppage.lastUpdatedBy.toString()), + editableCell(index, stoppage.lastUpdatedOn.toString()), + editableCell(index, stoppage.status.toString()), + DataCell(CommonBtn( + style: TextStyle( + fontSize: 8, + color: Colors.white, + fontWeight: FontWeight.bold), + margin: EdgeInsets.symmetric(vertical: 6), + width: 35, + text: "Edit", + textClr: Colors.white, + clickAction: () { + controller.nameCtrl.text = stoppage.userFname ?? ''; + controller.lastNCtrl.text = + stoppage.userLname ?? ''; + controller.mobileCtrl.text = + stoppage.userMobile ?? ''; + controller.emailCtrl.text = + stoppage.userEmail ?? ''; + controller.userTypeId.value = + stoppage.usertypeId.toString(); + controller.selectedValue.value = + stoppage.userAddedChannel ?? ''; + controller.selectedStatus.value = + stoppage.status ?? ''; + controller.employeeCodeCtrl.text = + stoppage.userEmpTransCode ?? ''; + controller.selectUserVal.value = + stoppage.usertypeName ?? ''; + controller.selectedUser.value = 1; + }, + )), + ], + ); + }), + ), + ), + ), + ), + ), + ); + }); + } +} diff --git a/lib/feature/presentation/screens/admin/user_management/model/assign_plants_res_model.dart b/lib/feature/presentation/screens/admin/user_management/model/assign_plants_res_model.dart new file mode 100644 index 0000000..f117ca1 --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/model/assign_plants_res_model.dart @@ -0,0 +1,37 @@ +// To parse this JSON data, do +// +// final assignPlantResModel = assignPlantResModelFromJson(jsonString); + +import 'dart:convert'; + +AssignPlantResModel assignPlantResModelFromJson(String str) => AssignPlantResModel.fromJson(json.decode(str)); + +String assignPlantResModelToJson(AssignPlantResModel data) => json.encode(data.toJson()); + +class AssignPlantResModel { + final int? status; + final String? message; + final String? data; + final DateTime? timestamp; + + AssignPlantResModel({ + this.status, + this.message, + this.data, + this.timestamp, + }); + + factory AssignPlantResModel.fromJson(Map json) => AssignPlantResModel( + status: json["status"], + message: json["message"], + data: json["data"], + timestamp: json["timestamp"] == null ? null : DateTime.parse(json["timestamp"]), + ); + + Map toJson() => { + "status": status, + "message": message, + "data": data, + "timestamp": timestamp?.toIso8601String(), + }; +} diff --git a/lib/feature/presentation/screens/admin/user_management/model/check_status_res_model.dart b/lib/feature/presentation/screens/admin/user_management/model/check_status_res_model.dart new file mode 100644 index 0000000..9beef87 --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/model/check_status_res_model.dart @@ -0,0 +1,53 @@ +// To parse this JSON data, do +// +// final checkStatusResModel = checkStatusResModelFromJson(jsonString); + +import 'dart:convert'; + +CheckStatusResModel checkStatusResModelFromJson(String str) => CheckStatusResModel.fromJson(json.decode(str)); + +String checkStatusResModelToJson(CheckStatusResModel data) => json.encode(data.toJson()); + +class CheckStatusResModel { + final int? status; + final String? message; + final Data? data; + final DateTime? timestamp; + + CheckStatusResModel({ + this.status, + this.message, + this.data, + this.timestamp, + }); + + factory CheckStatusResModel.fromJson(Map json) => CheckStatusResModel( + status: json["status"], + message: json["message"], + data: json["data"] == null ? null : Data.fromJson(json["data"]), + timestamp: json["timestamp"] == null ? null : DateTime.parse(json["timestamp"]), + ); + + Map toJson() => { + "status": status, + "message": message, + "data": data?.toJson(), + "timestamp": timestamp?.toIso8601String(), + }; +} + +class Data { + final String? message; + + Data({ + this.message, + }); + + factory Data.fromJson(Map json) => Data( + message: json["message"], + ); + + Map toJson() => { + "message": message, + }; +} diff --git a/lib/feature/presentation/screens/admin/user_management/model/create_user_model.dart b/lib/feature/presentation/screens/admin/user_management/model/create_user_model.dart new file mode 100644 index 0000000..aaca599 --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/model/create_user_model.dart @@ -0,0 +1,65 @@ +// To parse this JSON data, do +// +// final createUserResModel = createUserResModelFromJson(jsonString); + +import 'dart:convert'; + +CreateUserResModel createUserResModelFromJson(String str) => CreateUserResModel.fromJson(json.decode(str)); + +String createUserResModelToJson(CreateUserResModel data) => json.encode(data.toJson()); + +class CreateUserResModel { + final int? status; + final String? message; + final List? data; + final DateTime? timestamp; + + CreateUserResModel({ + this.status, + this.message, + this.data, + this.timestamp, + }); + + factory CreateUserResModel.fromJson(Map json) => CreateUserResModel( + status: json["status"], + message: json["message"], + data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => Datum.fromJson(x))), + timestamp: json["timestamp"] == null ? null : DateTime.parse(json["timestamp"]), + ); + + Map toJson() => { + "status": status, + "message": message, + "data": data == null ? [] : List.from(data!.map((x) => x.toJson())), + "timestamp": timestamp?.toIso8601String(), + }; +} + +class Datum { + final String? action; + final String? employeeTransCode; + final int? userId; + final String? email; + + Datum({ + this.action, + this.employeeTransCode, + this.userId, + this.email, + }); + + factory Datum.fromJson(Map json) => Datum( + action: json["action"], + employeeTransCode: json["employeeTransCode"], + userId: json["userId"], + email: json["email"], + ); + + Map toJson() => { + "action": action, + "employeeTransCode": employeeTransCode, + "userId": userId, + "email": email, + }; +} diff --git a/lib/feature/presentation/screens/admin/user_management/model/dropdown_res_model.dart b/lib/feature/presentation/screens/admin/user_management/model/dropdown_res_model.dart new file mode 100644 index 0000000..4cc30ac --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/model/dropdown_res_model.dart @@ -0,0 +1,57 @@ +// To parse this JSON data, do +// +// final dropDownResModel = dropDownResModelFromJson(jsonString); + +import 'dart:convert'; + +DropDownResModel dropDownResModelFromJson(String str) => DropDownResModel.fromJson(json.decode(str)); + +String dropDownResModelToJson(DropDownResModel data) => json.encode(data.toJson()); + +class DropDownResModel { + final int? status; + final String? message; + final Data? data; + final DateTime? timestamp; + + DropDownResModel({ + this.status, + this.message, + this.data, + this.timestamp, + }); + + factory DropDownResModel.fromJson(Map json) => DropDownResModel( + status: json["status"], + message: json["message"], + data: json["data"] == null ? null : Data.fromJson(json["data"]), + timestamp: json["timestamp"] == null ? null : DateTime.parse(json["timestamp"]), + ); + + Map toJson() => { + "status": status, + "message": message, + "data": data?.toJson(), + "timestamp": timestamp?.toIso8601String(), + }; +} + +class Data { + final List? employeeCodes; + final List? userEmails; + + Data({ + this.employeeCodes, + this.userEmails, + }); + + factory Data.fromJson(Map json) => Data( + employeeCodes: json["employeeCodes"] == null ? [] : List.from(json["employeeCodes"]!.map((x) => x)), + userEmails: json["userEmails"] == null ? [] : List.from(json["userEmails"]!.map((x) => x)), + ); + + Map toJson() => { + "employeeCodes": employeeCodes == null ? [] : List.from(employeeCodes!.map((x) => x)), + "userEmails": userEmails == null ? [] : List.from(userEmails!.map((x) => x)), + }; +} diff --git a/lib/feature/presentation/screens/admin/user_management/model/edit_user_res_model.dart b/lib/feature/presentation/screens/admin/user_management/model/edit_user_res_model.dart new file mode 100644 index 0000000..cbd152f --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/model/edit_user_res_model.dart @@ -0,0 +1,66 @@ +import 'dart:convert'; + +EditUserResModel editUserResModelFromJson(String str) => + EditUserResModel.fromJson(json.decode(str)); + +String editUserResModelToJson(EditUserResModel data) => + json.encode(data.toJson()); + +class EditUserResModel { + final int? status; + final String? message; + final Data? data; + final DateTime? timestamp; + + EditUserResModel({ + this.status, + this.message, + this.data, + this.timestamp, + }); + + factory EditUserResModel.fromJson(Map json) => + EditUserResModel( + status: json["status"], + message: json["message"], + data: json["data"] == null ? null : Data.fromJson(json["data"]), + timestamp: json["timestamp"] == null + ? null + : DateTime.parse(json["timestamp"]), + ); + + Map toJson() => { + "status": status, + "message": message, + "data": data?.toJson(), + "timestamp": timestamp?.toIso8601String(), + }; +} + +class Data { + final String? action; + final String? employeeTransCode; + final int? userId; + final String? email; + + Data({ + this.action, + this.employeeTransCode, + this.userId, + this.email, + }); + + factory Data.fromJson(Map json) => Data( + action: json["action"], + employeeTransCode: json["employeeTransCode"], + userId: json["userId"], + email: json["email"], + ); + + Map toJson() => { + "action": action, + "employeeTransCode": employeeTransCode, + "userId": userId, + "email": email, + }; +} diff --git a/lib/feature/presentation/screens/admin/user_management/model/fetch_internal _user_model.dart b/lib/feature/presentation/screens/admin/user_management/model/fetch_internal _user_model.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/feature/presentation/screens/admin/user_management/model/fetch_internal_user_model/fetch_internal_user_model.dart b/lib/feature/presentation/screens/admin/user_management/model/fetch_internal_user_model/fetch_internal_user_model.dart new file mode 100644 index 0000000..a423d49 --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/model/fetch_internal_user_model/fetch_internal_user_model.dart @@ -0,0 +1,127 @@ +// To parse this JSON data, do +// +// final fetchInternalUserModel = fetchInternalUserModelFromJson(jsonString); + +import 'dart:convert'; + +FetchInternalUserModel fetchInternalUserModelFromJson(String str) => + FetchInternalUserModel.fromJson(json.decode(str)); + +String fetchInternalUserModelToJson(FetchInternalUserModel data) => + json.encode(data.toJson()); + +class FetchInternalUserModel { + int? status; + String? message; + List? data; + DateTime? timestamp; + + FetchInternalUserModel({ + this.status, + this.message, + this.data, + this.timestamp, + }); + + FetchInternalUserModel copyWith({ + int? status, + String? message, + List? data, + DateTime? timestamp, + }) => + FetchInternalUserModel( + status: status ?? this.status, + message: message ?? this.message, + data: data ?? this.data, + timestamp: timestamp ?? this.timestamp, + ); + + factory FetchInternalUserModel.fromJson(Map json) => + FetchInternalUserModel( + status: json["status"], + message: json["message"], + data: json["data"] == null + ? [] + : List.from(json["data"]!.map((x) => InternalRoleMappingData.fromJson(x))), + timestamp: json["timestamp"] == null + ? null + : DateTime.parse(json["timestamp"]), + ); + + Map toJson() => { + "status": status, + "message": message, + "data": data == null + ? [] + : List.from(data!.map((x) => x.toJson())), + "timestamp": timestamp?.toIso8601String(), + }; +} + +class InternalRoleMappingData { + int? roleId; + String? roleName; + String? roleDescription; + int? userTypeId; + String? status; + int? createdBy; + int? lastUpdatedBy; + bool? assigned; + bool? isSelected; + + InternalRoleMappingData({ + this.roleId, + this.roleName, + this.roleDescription, + this.userTypeId, + this.status, + this.createdBy, + this.lastUpdatedBy, + this.assigned, + this.isSelected = false, + }); + + InternalRoleMappingData copyWith({ + int? roleId, + String? roleName, + String? roleDescription, + int? userTypeId, + String? status, + int? createdBy, + int? lastUpdatedBy, + bool? assigned, + }) => + InternalRoleMappingData( + roleId: roleId ?? this.roleId, + roleName: roleName ?? this.roleName, + roleDescription: roleDescription ?? this.roleDescription, + userTypeId: userTypeId ?? this.userTypeId, + status: status ?? this.status, + createdBy: createdBy ?? this.createdBy, + lastUpdatedBy: lastUpdatedBy ?? this.lastUpdatedBy, + assigned: assigned ?? this.assigned, + ); + + factory InternalRoleMappingData.fromJson(Map json) => InternalRoleMappingData( + roleId: json["roleId"], + roleName: json["roleName"], + roleDescription: json["roleDescription"], + userTypeId: json["userTypeId"], + status: json["status"], + createdBy: json["createdBy"], + lastUpdatedBy: json["lastUpdatedBy"], + assigned: json["assigned"], + ); + + Map toJson() => { + "roleId": roleId, + "roleName": roleName, + "roleDescription": roleDescription, + "userTypeId": userTypeId, + "status": status, + "createdBy": createdBy, + "lastUpdatedBy": lastUpdatedBy, + "assigned": assigned, + }; +} + diff --git a/lib/feature/presentation/screens/admin/user_management/model/fetch_plant_res_model.dart b/lib/feature/presentation/screens/admin/user_management/model/fetch_plant_res_model.dart new file mode 100644 index 0000000..95e1377 --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/model/fetch_plant_res_model.dart @@ -0,0 +1,93 @@ +// To parse this JSON data, do +// +// final fetchPlantResModel = fetchPlantResModelFromJson(jsonString); + +import 'dart:convert'; + +FetchPlantResModel fetchPlantResModelFromJson(String str) => FetchPlantResModel.fromJson(json.decode(str)); + +String fetchPlantResModelToJson(FetchPlantResModel data) => json.encode(data.toJson()); + +class FetchPlantResModel { + final int? status; + final String? message; + final List? data; + final DateTime? timestamp; + + FetchPlantResModel({ + this.status, + this.message, + this.data, + this.timestamp, + }); + + factory FetchPlantResModel.fromJson(Map json) => FetchPlantResModel( + status: json["status"], + message: json["message"], + data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => Datum.fromJson(x))), + timestamp: json["timestamp"] == null ? null : DateTime.parse(json["timestamp"]), + ); + + Map toJson() => { + "status": status, + "message": message, + "data": data == null ? [] : List.from(data!.map((x) => x.toJson())), + "timestamp": timestamp?.toIso8601String(), + }; +} + +class Datum { + final int? plantId; + final String? plantCode; + final String? plantDesc; + final String? plantPan; + final String? plantGst; + final int? plantGstRate; + final String? addedChannel; + final String? status; + final int? createdBy; + final int? lastUpdatedBy; + final bool? assigned; + + Datum({ + this.plantId, + this.plantCode, + this.plantDesc, + this.plantPan, + this.plantGst, + this.plantGstRate, + this.addedChannel, + this.status, + this.createdBy, + this.lastUpdatedBy, + this.assigned, + }); + + factory Datum.fromJson(Map json) => Datum( + plantId: json["plantId"], + plantCode: json["plantCode"], + plantDesc: json["plantDesc"], + plantPan: json["plantPan"], + plantGst: json["plantGst"], + plantGstRate: json["plantGstRate"], + addedChannel: json["addedChannel"], + status: json["status"], + createdBy: json["createdBy"], + lastUpdatedBy: json["lastUpdatedBy"], + assigned: json["assigned"], + ); + + Map toJson() => { + "plantId": plantId, + "plantCode": plantCode, + "plantDesc": plantDesc, + "plantPan": plantPan, + "plantGst": plantGst, + "plantGstRate": plantGstRate, + "addedChannel": addedChannel, + "status": status, + "createdBy": createdBy, + "lastUpdatedBy": lastUpdatedBy, + "assigned": assigned, + }; +} diff --git a/lib/feature/presentation/screens/admin/user_management/model/getAllUserResModel.dart b/lib/feature/presentation/screens/admin/user_management/model/getAllUserResModel.dart new file mode 100644 index 0000000..d566e01 --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/model/getAllUserResModel.dart @@ -0,0 +1,227 @@ +// To parse this JSON data, do +// +// final getAllUserResModel = getAllUserResModelFromJson(jsonString); + +import 'dart:convert'; + +GetAllUserResModel getAllUserResModelFromJson(String str) => GetAllUserResModel.fromJson(json.decode(str)); + +String getAllUserResModelToJson(GetAllUserResModel data) => json.encode(data.toJson()); + +class GetAllUserResModel { + final int? status; + final String? message; + final UserData? data; + final DateTime? timestamp; + + GetAllUserResModel({ + this.status, + this.message, + this.data, + this.timestamp, + }); + + factory GetAllUserResModel.fromJson(Map json) => GetAllUserResModel( + status: json["status"], + message: json["message"], + data: json["data"] == null ? null : UserData.fromJson(json["data"]), + timestamp: json["timestamp"] == null ? null : DateTime.parse(json["timestamp"]), + ); + + Map toJson() => { + "status": status, + "message": message, + "data": data?.toJson(), + "timestamp": timestamp?.toIso8601String(), + }; +} + +class UserData { + final List? content; + final Pageable? pageable; + final bool? last; + final int? totalElements; + final int? totalPages; + final bool? first; + final int? size; + final int? number; + final Sort? sort; + final int? numberOfElements; + final bool? empty; + + UserData({ + this.content, + this.pageable, + this.last, + this.totalElements, + this.totalPages, + this.first, + this.size, + this.number, + this.sort, + this.numberOfElements, + this.empty, + }); + + factory UserData.fromJson(Map json) => UserData( + content: json["content"] == null ? [] : List.from(json["content"]!.map((x) => AllUser.fromJson(x))), + pageable: json["pageable"] == null ? null : Pageable.fromJson(json["pageable"]), + last: json["last"], + totalElements: json["totalElements"], + totalPages: json["totalPages"], + first: json["first"], + size: json["size"], + number: json["number"], + sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]), + numberOfElements: json["numberOfElements"], + empty: json["empty"], + ); + + Map toJson() => { + "content": content == null ? [] : List.from(content!.map((x) => x.toJson())), + "pageable": pageable?.toJson(), + "last": last, + "totalElements": totalElements, + "totalPages": totalPages, + "first": first, + "size": size, + "number": number, + "sort": sort?.toJson(), + "numberOfElements": numberOfElements, + "empty": empty, + }; +} + +class AllUser { + final int? userId; + final int? usertypeId; + final String? usertypeName; + final String? userName; + final String? userFname; + final String? userLname; + final String? userEmail; + final String? userMobile; + final String? userEmpTransCode; + final String? userAddedChannel; + final String? status; + final DateTime? createdOn; + final int? createdBy; + final DateTime? lastUpdatedOn; + final int? lastUpdatedBy; + final bool isSelected; + + AllUser({ + this.userId, + this.usertypeId, + this.usertypeName, + this.userName, + this.userFname, + this.userLname, + this.userEmail, + this.userMobile, + this.userEmpTransCode, + this.userAddedChannel, + this.status, + this.createdOn, + this.createdBy, + this.lastUpdatedOn, + this.lastUpdatedBy, + this.isSelected = false + }); + + factory AllUser.fromJson(Map json) => AllUser( + userId: json["user_id"], + usertypeId: json["usertype_id"], + usertypeName: json["usertype_name"], + userName: json["user_name"], + userFname: json["user_fname"], + userLname: json["user_lname"], + userEmail: json["user_email"], + userMobile: json["user_mobile"], + userEmpTransCode: json["user_emp_trans_code"], + userAddedChannel: json["user_added_channel"], + status: json["status"], + createdOn: json["created_on"] == null ? null : DateTime.parse(json["created_on"]), + createdBy: json["created_by"], + lastUpdatedOn: json["last_updated_on"] == null ? null : DateTime.parse(json["last_updated_on"]), + lastUpdatedBy: json["last_updated_by"], + ); + + Map toJson() => { + "user_id": userId, + "usertype_id": usertypeId, + "usertype_name": usertypeName, + "user_name": userName, + "user_fname": userFname, + "user_lname": userLname, + "user_email": userEmail, + "user_mobile": userMobile, + "user_emp_trans_code": userEmpTransCode, + "user_added_channel": userAddedChannel, + "status": status, + "created_on": createdOn?.toIso8601String(), + "created_by": createdBy, + "last_updated_on": lastUpdatedOn?.toIso8601String(), + "last_updated_by": lastUpdatedBy, + }; +} + +class Pageable { + final int? pageNumber; + final int? pageSize; + final Sort? sort; + final int? offset; + final bool? paged; + final bool? unpaged; + + Pageable({ + this.pageNumber, + this.pageSize, + this.sort, + this.offset, + this.paged, + this.unpaged, + }); + + factory Pageable.fromJson(Map json) => Pageable( + pageNumber: json["pageNumber"], + pageSize: json["pageSize"], + sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]), + offset: json["offset"], + paged: json["paged"], + unpaged: json["unpaged"], + ); + + Map toJson() => { + "pageNumber": pageNumber, + "pageSize": pageSize, + "sort": sort?.toJson(), + "offset": offset, + "paged": paged, + "unpaged": unpaged, + }; +} + +class Sort { + final bool? empty; + final bool? sorted; + final bool? unsorted; + + Sort({ + this.empty, + this.sorted, + this.unsorted, + }); + + factory Sort.fromJson(Map json) => Sort( + empty: json["empty"], + sorted: json["sorted"], + unsorted: json["unsorted"], + ); + + Map toJson() => { + "empty": empty, + "sorted": sorted, + "unsorted": unsorted, + }; +} diff --git a/lib/feature/presentation/screens/admin/user_management/model/get_internal_user_model.dart b/lib/feature/presentation/screens/admin/user_management/model/get_internal_user_model.dart new file mode 100644 index 0000000..5e4b915 --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/model/get_internal_user_model.dart @@ -0,0 +1,88 @@ +import 'dart:convert'; + +InternalUserDropModel internalUserDropModelFromJson(String str) => + InternalUserDropModel.fromJson(json.decode(str)); + +String internalUserDropModelToJson(InternalUserDropModel data) => + json.encode(data.toJson()); + +class InternalUserDropModel { + int? status; + String? message; + Data? data; + DateTime? timestamp; + + InternalUserDropModel({ + this.status, + this.message, + this.data, + this.timestamp, + }); + + InternalUserDropModel copyWith({ + int? status, + String? message, + Data? data, + DateTime? timestamp, + }) => + InternalUserDropModel( + status: status ?? this.status, + message: message ?? this.message, + data: data ?? this.data, + timestamp: timestamp ?? this.timestamp, + ); + + factory InternalUserDropModel.fromJson(Map json) => + InternalUserDropModel( + status: json["status"], + message: json["message"], + data: json["data"] == null ? null : Data.fromJson(json["data"]), + timestamp: json["timestamp"] == null + ? null + : DateTime.parse(json["timestamp"]), + ); + + Map toJson() => { + "status": status, + "message": message, + "data": data?.toJson(), + "timestamp": timestamp?.toIso8601String(), + }; +} + +class Data { + List? employeeCodes; + List? userEmails; + + Data({ + this.employeeCodes, + this.userEmails, + }); + + Data copyWith({ + List? employeeCodes, + List? userEmails, + }) => + Data( + employeeCodes: employeeCodes ?? this.employeeCodes, + userEmails: userEmails ?? this.userEmails, + ); + + factory Data.fromJson(Map json) => Data( + employeeCodes: json["employeeCodes"] == null + ? [] + : List.from(json["employeeCodes"]!.map((x) => x)), + userEmails: json["userEmails"] == null + ? [] + : List.from(json["userEmails"]!.map((x) => x)), + ); + + Map toJson() => { + "employeeCodes": employeeCodes == null + ? [] + : List.from(employeeCodes!.map((x) => x)), + "userEmails": userEmails == null + ? [] + : List.from(userEmails!.map((x) => x)), + }; +} diff --git a/lib/feature/presentation/screens/admin/user_management/model/internal_user_role_mapping_res_model.dart b/lib/feature/presentation/screens/admin/user_management/model/internal_user_role_mapping_res_model.dart new file mode 100644 index 0000000..ddb3e2d --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/model/internal_user_role_mapping_res_model.dart @@ -0,0 +1,73 @@ +// To parse this JSON data, do +// +// final internalUserRoleMappingResModel = internalUserRoleMappingResModelFromJson(jsonString); + +import 'dart:convert'; + +List internalUserRoleMappingResModelFromJson(String str) => List.from(json.decode(str).map((x) => InternalUserRoleMappingResModel.fromJson(x))); + +String internalUserRoleMappingResModelToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class InternalUserRoleMappingResModel { + final int? roleId; + final String? roleName; + final String? roleDescription; + final int? userTypeId; + final Status? status; + final int? createdBy; + final int? lastUpdatedBy; + final bool? assigned; + + InternalUserRoleMappingResModel({ + this.roleId, + this.roleName, + this.roleDescription, + this.userTypeId, + this.status, + this.createdBy, + this.lastUpdatedBy, + this.assigned, + }); + + factory InternalUserRoleMappingResModel.fromJson(Map json) => InternalUserRoleMappingResModel( + roleId: json["roleId"], + roleName: json["roleName"], + roleDescription: json["roleDescription"], + userTypeId: json["userTypeId"], + status: statusValues.map[json["status"]]!, + createdBy: json["createdBy"], + lastUpdatedBy: json["lastUpdatedBy"], + assigned: json["assigned"], + ); + + Map toJson() => { + "roleId": roleId, + "roleName": roleName, + "roleDescription": roleDescription, + "userTypeId": userTypeId, + "status": statusValues.reverse[status], + "createdBy": createdBy, + "lastUpdatedBy": lastUpdatedBy, + "assigned": assigned, + }; +} + +enum Status { + A +} + +final statusValues = EnumValues({ + "A": Status.A +}); + +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/feature/presentation/screens/admin/user_management/model/plant_mapping_res_model.dart b/lib/feature/presentation/screens/admin/user_management/model/plant_mapping_res_model.dart new file mode 100644 index 0000000..32f6c9d --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/model/plant_mapping_res_model.dart @@ -0,0 +1,95 @@ +// To parse this JSON data, do +// +// final fetchPlantResModel = fetchPlantResModelFromJson(jsonString); + +import 'dart:convert'; + +FetchPlantResModel fetchPlantResModelFromJson(String str) => FetchPlantResModel.fromJson(json.decode(str)); + +String fetchPlantResModelToJson(FetchPlantResModel data) => json.encode(data.toJson()); + +class FetchPlantResModel { + final int? status; + final String? message; + final List? data; + final DateTime? timestamp; + + FetchPlantResModel({ + this.status, + this.message, + this.data, + this.timestamp, + }); + + factory FetchPlantResModel.fromJson(Map json) => FetchPlantResModel( + status: json["status"], + message: json["message"], + data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => PlantsData.fromJson(x))), + timestamp: json["timestamp"] == null ? null : DateTime.parse(json["timestamp"]), + ); + + Map toJson() => { + "status": status, + "message": message, + "data": data == null ? [] : List.from(data!.map((x) => x.toJson())), + "timestamp": timestamp?.toIso8601String(), + }; +} + +class PlantsData { + final int? plantId; + final String? plantCode; + final String? plantDesc; + final String? plantPan; + final String? plantGst; + final int? plantGstRate; + final String? addedChannel; + final String? status; + final int? createdBy; + final int? lastUpdatedBy; + final bool? assigned; + bool isSelected; + + PlantsData({ + this.plantId, + this.plantCode, + this.plantDesc, + this.plantPan, + this.plantGst, + this.plantGstRate, + this.addedChannel, + this.status, + this.createdBy, + this.lastUpdatedBy, + this.assigned, + this.isSelected = false, + }); + + factory PlantsData.fromJson(Map json) => PlantsData( + plantId: json["plantId"], + plantCode: json["plantCode"], + plantDesc: json["plantDesc"], + plantPan: json["plantPan"], + plantGst: json["plantGst"], + plantGstRate: json["plantGstRate"], + addedChannel: json["addedChannel"], + status: json["status"], + createdBy: json["createdBy"], + lastUpdatedBy: json["lastUpdatedBy"], + assigned: json["assigned"], + ); + + Map toJson() => { + "plantId": plantId, + "plantCode": plantCode, + "plantDesc": plantDesc, + "plantPan": plantPan, + "plantGst": plantGst, + "plantGstRate": plantGstRate, + "addedChannel": addedChannel, + "status": status, + "createdBy": createdBy, + "lastUpdatedBy": lastUpdatedBy, + "assigned": assigned, + }; +} diff --git a/lib/feature/presentation/screens/admin/user_management/model/select_assign_role_model/select_assign_role_model.dart b/lib/feature/presentation/screens/admin/user_management/model/select_assign_role_model/select_assign_role_model.dart new file mode 100644 index 0000000..97af347 --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/model/select_assign_role_model/select_assign_role_model.dart @@ -0,0 +1,50 @@ +// To parse this JSON data, do +// +// final selectAssignRoleModel = selectAssignRoleModelFromJson(jsonString); + +import 'dart:convert'; + +SelectAssignRoleModel selectAssignRoleModelFromJson(String str) => SelectAssignRoleModel.fromJson(json.decode(str)); + +String selectAssignRoleModelToJson(SelectAssignRoleModel data) => json.encode(data.toJson()); + +class SelectAssignRoleModel { + int? status; + String? message; + String? data; + DateTime? timestamp; + + SelectAssignRoleModel({ + this.status, + this.message, + this.data, + this.timestamp, + }); + + SelectAssignRoleModel copyWith({ + int? status, + String? message, + String? data, + DateTime? timestamp, + }) => + SelectAssignRoleModel( + status: status ?? this.status, + message: message ?? this.message, + data: data ?? this.data, + timestamp: timestamp ?? this.timestamp, + ); + + factory SelectAssignRoleModel.fromJson(Map json) => SelectAssignRoleModel( + status: json["status"], + message: json["message"], + data: json["data"], + timestamp: json["timestamp"] == null ? null : DateTime.parse(json["timestamp"]), + ); + + Map toJson() => { + "status": status, + "message": message, + "data": data, + "timestamp": timestamp?.toIso8601String(), + }; +} diff --git a/lib/feature/presentation/screens/admin/user_management/model/user_plant_res_model.dart b/lib/feature/presentation/screens/admin/user_management/model/user_plant_res_model.dart new file mode 100644 index 0000000..1669a6d --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/model/user_plant_res_model.dart @@ -0,0 +1,93 @@ +// To parse this JSON data, do +// +// final userPlantResModel = userPlantResModelFromJson(jsonString); + +import 'dart:convert'; + +UserPlantResModel userPlantResModelFromJson(String str) => UserPlantResModel.fromJson(json.decode(str)); + +String userPlantResModelToJson(UserPlantResModel data) => json.encode(data.toJson()); + +class UserPlantResModel { + final int? status; + final String? message; + final List? data; + final DateTime? timestamp; + + UserPlantResModel({ + this.status, + this.message, + this.data, + this.timestamp, + }); + + factory UserPlantResModel.fromJson(Map json) => UserPlantResModel( + status: json["status"], + message: json["message"], + data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => Datum.fromJson(x))), + timestamp: json["timestamp"] == null ? null : DateTime.parse(json["timestamp"]), + ); + + Map toJson() => { + "status": status, + "message": message, + "data": data == null ? [] : List.from(data!.map((x) => x.toJson())), + "timestamp": timestamp?.toIso8601String(), + }; +} + +class Datum { + final int? plantId; + final String? plantCode; + final String? plantDesc; + final String? plantPan; + final String? plantGst; + final int? plantGstRate; + final String? addedChannel; + final String? status; + final int? createdBy; + final int? lastUpdatedBy; + final bool? assigned; + + Datum({ + this.plantId, + this.plantCode, + this.plantDesc, + this.plantPan, + this.plantGst, + this.plantGstRate, + this.addedChannel, + this.status, + this.createdBy, + this.lastUpdatedBy, + this.assigned, + }); + + factory Datum.fromJson(Map json) => Datum( + plantId: json["plantId"], + plantCode: json["plantCode"], + plantDesc: json["plantDesc"], + plantPan: json["plantPan"], + plantGst: json["plantGst"], + plantGstRate: json["plantGstRate"], + addedChannel: json["addedChannel"], + status: json["status"], + createdBy: json["createdBy"], + lastUpdatedBy: json["lastUpdatedBy"], + assigned: json["assigned"], + ); + + Map toJson() => { + "plantId": plantId, + "plantCode": plantCode, + "plantDesc": plantDesc, + "plantPan": plantPan, + "plantGst": plantGst, + "plantGstRate": plantGstRate, + "addedChannel": addedChannel, + "status": status, + "createdBy": createdBy, + "lastUpdatedBy": lastUpdatedBy, + "assigned": assigned, + }; +} diff --git a/lib/feature/presentation/screens/admin/user_management/model/user_type_details_res_model.dart b/lib/feature/presentation/screens/admin/user_management/model/user_type_details_res_model.dart new file mode 100644 index 0000000..e7cc508 --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/model/user_type_details_res_model.dart @@ -0,0 +1,197 @@ +// To parse this JSON data, do +// +// final userTypeDetailsResModel = userTypeDetailsResModelFromJson(jsonString); + +import 'dart:convert'; + +UserTypeDetailsResModel userTypeDetailsResModelFromJson(String str) => UserTypeDetailsResModel.fromJson(json.decode(str)); + +String userTypeDetailsResModelToJson(UserTypeDetailsResModel data) => json.encode(data.toJson()); + +class UserTypeDetailsResModel { + final int? status; + final String? message; + final UserTypeDetails? data; + final DateTime? timestamp; + + UserTypeDetailsResModel({ + this.status, + this.message, + this.data, + this.timestamp, + }); + + factory UserTypeDetailsResModel.fromJson(Map json) => UserTypeDetailsResModel( + status: json["status"], + message: json["message"], + data: json["data"] == null ? null : UserTypeDetails.fromJson(json["data"]), + timestamp: json["timestamp"] == null ? null : DateTime.parse(json["timestamp"]), + ); + + Map toJson() => { + "status": status, + "message": message, + "data": data?.toJson(), + "timestamp": timestamp?.toIso8601String(), + }; +} + +class UserTypeDetails { + final List? content; + final Pageable? pageable; + final bool? last; + final int? totalElements; + final int? totalPages; + final int? size; + final int? number; + final Sort? sort; + final bool? first; + final int? numberOfElements; + final bool? empty; + + UserTypeDetails({ + this.content, + this.pageable, + this.last, + this.totalElements, + this.totalPages, + this.size, + this.number, + this.sort, + this.first, + this.numberOfElements, + this.empty, + }); + + factory UserTypeDetails.fromJson(Map json) => UserTypeDetails( + content: json["content"] == null ? [] : List.from(json["content"]!.map((x) => UserType.fromJson(x))), + pageable: json["pageable"] == null ? null : Pageable.fromJson(json["pageable"]), + last: json["last"], + totalElements: json["totalElements"], + totalPages: json["totalPages"], + size: json["size"], + number: json["number"], + sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]), + first: json["first"], + numberOfElements: json["numberOfElements"], + empty: json["empty"], + ); + + Map toJson() => { + "content": content == null ? [] : List.from(content!.map((x) => x.toJson())), + "pageable": pageable?.toJson(), + "last": last, + "totalElements": totalElements, + "totalPages": totalPages, + "size": size, + "number": number, + "sort": sort?.toJson(), + "first": first, + "numberOfElements": numberOfElements, + "empty": empty, + }; +} + +class UserType { + final int? usertypeId; + final String? usertypeName; + final String? usertypeDescription; + final String? status; + final DateTime? createdOn; + final int? createdBy; + final DateTime? lastUpdatedOn; + final int? lastUpdatedBy; + + UserType({ + this.usertypeId, + this.usertypeName, + this.usertypeDescription, + this.status, + this.createdOn, + this.createdBy, + this.lastUpdatedOn, + this.lastUpdatedBy, + }); + + factory UserType.fromJson(Map json) => UserType( + usertypeId: json["usertype_id"], + usertypeName: json["usertype_name"], + usertypeDescription: json["usertype_description"], + status: json["status"], + createdOn: json["created_on"] == null ? null : DateTime.parse(json["created_on"]), + createdBy: json["created_by"], + lastUpdatedOn: json["last_updated_on"] == null ? null : DateTime.parse(json["last_updated_on"]), + lastUpdatedBy: json["last_updated_by"], + ); + + Map toJson() => { + "usertype_id": usertypeId, + "usertype_name": usertypeName, + "usertype_description": usertypeDescription, + "status": status, + "created_on": createdOn?.toIso8601String(), + "created_by": createdBy, + "last_updated_on": lastUpdatedOn?.toIso8601String(), + "last_updated_by": lastUpdatedBy, + }; +} + +class Pageable { + final int? pageNumber; + final int? pageSize; + final Sort? sort; + final int? offset; + final bool? paged; + final bool? unpaged; + + Pageable({ + this.pageNumber, + this.pageSize, + this.sort, + this.offset, + this.paged, + this.unpaged, + }); + + factory Pageable.fromJson(Map json) => Pageable( + pageNumber: json["pageNumber"], + pageSize: json["pageSize"], + sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]), + offset: json["offset"], + paged: json["paged"], + unpaged: json["unpaged"], + ); + + Map toJson() => { + "pageNumber": pageNumber, + "pageSize": pageSize, + "sort": sort?.toJson(), + "offset": offset, + "paged": paged, + "unpaged": unpaged, + }; +} + +class Sort { + final bool? empty; + final bool? sorted; + final bool? unsorted; + + Sort({ + this.empty, + this.sorted, + this.unsorted, + }); + + factory Sort.fromJson(Map json) => Sort( + empty: json["empty"], + sorted: json["sorted"], + unsorted: json["unsorted"], + ); + + Map toJson() => { + "empty": empty, + "sorted": sorted, + "unsorted": unsorted, + }; +} diff --git a/lib/feature/presentation/screens/admin/user_management/model/user_type_res_model.dart b/lib/feature/presentation/screens/admin/user_management/model/user_type_res_model.dart new file mode 100644 index 0000000..8fd5eda --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/model/user_type_res_model.dart @@ -0,0 +1,65 @@ +// To parse this JSON data, do +// +// final userTypeResModel = userTypeResModelFromJson(jsonString); + +import 'dart:convert'; + +UserTypeResModel userTypeResModelFromJson(String str) => UserTypeResModel.fromJson(json.decode(str)); + +String userTypeResModelToJson(UserTypeResModel data) => json.encode(data.toJson()); + +class UserTypeResModel { + final int? status; + final String? message; + final List? data; + final DateTime? timestamp; + + UserTypeResModel({ + this.status, + this.message, + this.data, + this.timestamp, + }); + + factory UserTypeResModel.fromJson(Map json) => UserTypeResModel( + status: json["status"], + message: json["message"], + data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => UserTypeData.fromJson(x))), + timestamp: json["timestamp"] == null ? null : DateTime.parse(json["timestamp"]), + ); + + Map toJson() => { + "status": status, + "message": message, + "data": data == null ? [] : List.from(data!.map((x) => x.toJson())), + "timestamp": timestamp?.toIso8601String(), + }; +} + +class UserTypeData { + final int? userTypeId; + final String? userTypeName; + final String? action; + final String? status; + + UserTypeData({ + this.userTypeId, + this.userTypeName, + this.action, + this.status, + }); + + factory UserTypeData.fromJson(Map json) => UserTypeData( + userTypeId: json["userTypeId"], + userTypeName: json["userTypeName"], + action: json["action"], + status: json["status"], + ); + + Map toJson() => { + "userTypeId": userTypeId, + "userTypeName": userTypeName, + "action": action, + "status": status, + }; +} diff --git a/lib/feature/presentation/screens/admin/user_management/user_plant_mapping.dart b/lib/feature/presentation/screens/admin/user_management/user_plant_mapping.dart new file mode 100644 index 0000000..7f228a1 --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/user_plant_mapping.dart @@ -0,0 +1,226 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:shayog/feature/presentation/screens/dashboard/controller/dashboard_ctrl.dart'; +import 'package:shayog/feature/presentation/screens/transporter/widgets/common_card.dart'; + +import '../../../../../components/common/common_btn.dart'; +import '../../../../../components/common/custom_drop_down.dart'; +import '../../../../../components/styles/app_colors.dart'; +import '../../../../../components/styles/app_strings.dart'; + +class UserPlantMapping extends StatelessWidget { + UserPlantMapping({super.key}); + + final ctrl = Get.put(DashboardCtrl()); + + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 16), + color: AppColors.clrF2, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _commonText( + "Employee/Transporter Code", + ), + SizedBox(height: 8), + CustomDropdown( + initialValue: ctrl.selectedCode.value, + backClr: AppColors.clrD9, + borderClr: AppColors.clrGrey, + items: ctrl.employeeCode, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + ctrl.selectedCode.value = selected; + } + }, + hintText: 'Select Status'), + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _commonText( + "Email Address", + ), + SizedBox(height: 8), + CustomDropdown( + initialValue: ctrl.selectPlantEmail.value, + backClr: AppColors.clrD9, + borderClr: AppColors.clrGrey, + items: ctrl.userEmails, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + ctrl.selectPlantEmail.value = 'Select Email'; + } + }, + hintText: 'Select Email'), + ], + )), + SizedBox(width: 16), + Expanded( + //flex: 2, + child: Column( + children: [ + _commonText( + "", + ), + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + CommonBtn( + bkClr: Colors.white, + text: AppStrings.cancel, + clickAction: () {}, + ), + SizedBox(width: 16), + CommonBtn( + text: AppStrings.submit, + textClr: Colors.white, + clickAction: () { + ctrl.getPlantMapping(); + }, + ), + ], + ), + ), + ], + )), + ], + ), + ), + Obx( + () => + ctrl.plantMapping.isNotEmpty + ? Padding( + padding: const EdgeInsets.only(top: 16.0), + child: Text( + "User Type: Admin", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 14, + color: Colors.black), + ), + ) + : SizedBox(), + ), + Obx( + () => + ListView.separated( + padding: EdgeInsets.zero, + shrinkWrap: true, + itemBuilder: (context, index) { + return Row( + children: [ + Transform.scale( + scale: 0.80, + child: Checkbox( + value: ctrl.plantRoleIds + .contains( + ctrl.plantMapping[index].plantId), + onChanged: (value) { + ctrl.updatePlantRole( + ctrl.plantMapping[index].plantId ?? 0, + value ?? false); + }, + activeColor: AppColors.primaryClr, + // Custom color when selected + checkColor: Colors.white, + // Custom color for check mark + materialTapTargetSize: MaterialTapTargetSize + .shrinkWrap, + ), + ), + Text( + ctrl.plantMapping[index].plantPan ?? "", + style: TextStyle(fontSize: 12, color: Colors.black), + ), + ], + ); + }, + separatorBuilder: (context, index) { + return SizedBox(); + }, + itemCount: ctrl.plantMapping.length), + ), + Obx( + () => + ctrl.plantMapping.isNotEmpty + ? Text( + "*Note-If user type is a transporter,by default all the plants would be selected for the frist time", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 12, + color: Colors.red), + ) + : SizedBox(), + ), + const SizedBox( + height: 12, + ), + Obx( + () => + ctrl.plantMapping.isNotEmpty + ? Padding( + padding: const EdgeInsets.all(16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + CommonBtn( + bkClr: Colors.white, + text: AppStrings.cancel, + clickAction: () {}, + ), + SizedBox(width: 16), + CommonBtn( + text: AppStrings.submit, + textClr: Colors.white, + clickAction: () { + CommonAlertDialog.showDialog( + message: 'Are you sure you want to do this action?', + positiveText: "Submit", + negativeBtCallback: () { + Get.back(); + }, + negativeText: 'Cancel', + positiveBtCallback: () { + ctrl.selectPlantRoles(); + Get.back(); + }, + ); + }, + ), + ], + ), + ) + : SizedBox.shrink(), + ), + + ], + ); + } + + _commonText(String title) { + return Text( + title, + style: TextStyle( + fontSize: 13, color: Colors.black, fontWeight: FontWeight.w900), + ); + } +} diff --git a/lib/feature/presentation/screens/admin/user_management/user_screen.dart b/lib/feature/presentation/screens/admin/user_management/user_screen.dart new file mode 100644 index 0000000..2aad0ba --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/user_screen.dart @@ -0,0 +1,338 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:shayog/feature/presentation/screens/admin/user_management/user_plant_mapping.dart'; +import 'package:shayog/feature/presentation/widgets/text_view.dart'; +import '../../../../../components/common/common_btn.dart'; +import '../../../../../components/common/custom_drop_down.dart'; +import '../../../../../components/styles/app_colors.dart'; +import '../../../../../components/styles/app_images.dart'; +import '../../../../../components/styles/app_strings.dart'; +import '../../dashboard/controller/dashboard_ctrl.dart'; +import 'add_internal_user.dart'; +import 'user_type.dart'; +import 'internal_user_role_mapping.dart'; +import 'manage_user.dart'; + +class UserScreen extends StatelessWidget { + UserScreen({super.key}); + + final ctrl = Get.put(DashboardCtrl()); + + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + child: Column( + children: [ + Container( + padding: EdgeInsets.only(bottom: 16), + margin: EdgeInsets.all(16), + child: Column( + children: [ + Container( + height: 50, + color: AppColors.primaryClr, + child: Row( + children: [ + ListView.separated( + padding: EdgeInsets.symmetric(horizontal: 16), + scrollDirection: Axis.horizontal, + shrinkWrap: true, + itemBuilder: (context, index) { + return Obx( + () => InkWell( + onTap: () { + ctrl.selectedUser.value = index; + if (ctrl.selectedUser.value == 0) { + print("fhudsfh"); + ctrl.getManageUser(); + } + if (ctrl.selectedUser.value == 2) { + ctrl.clearPrefillData(); + ctrl.showRolesSection.value = false; + } + if (ctrl.selectedUser.value != 3) { + ctrl.selectPlantEmail.value = + "Select Email"; + ctrl.selectedCode.value = + 'Select Employee Code'; + ctrl.plantMapping.clear(); + } + }, + child: Container( + margin: EdgeInsets.only(bottom: 10, top: 10), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: ctrl.selectedUser.value == + index + ? Colors.white + : AppColors.primaryClr, + width: 3))), + child: Center( + child: Text( + ctrl.userTabs[index].title ?? "", + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w900, + color: Colors.white), + ), + ), + ), + ), + ); + }, + separatorBuilder: (context, index) { + return SizedBox(width: 16); + }, + itemCount: 5), + Spacer(), + InkWell( + child: Image.asset(AppImages.refresh, + height: 12, width: 12)), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + AppStrings.refresh, + style: TextStyle( + color: AppColors.white, + fontSize: 12, + fontWeight: FontWeight.bold), + ), + ), + Obx( + () => Visibility( + visible: ctrl.selectedUser.value == 0, + child: InkWell( + onTap:(){ + ctrl.toggleContainer(); + }, + + child: Image.asset(AppImages.filter, + height: 16, width: 16)), + ), + ), + Obx( + () => Visibility( + visible: ctrl.selectedUser.value == 0, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + AppStrings.filter, + style: TextStyle( + color: AppColors.white, + fontSize: 12, + fontWeight: FontWeight.bold), + ), + ), + ), + ), + ], + ), + ), + Obx( + () => ctrl.isSelected.value + ? Container( + margin: EdgeInsets.symmetric(vertical: 16), + padding: EdgeInsets.all(16), + color: AppColors.clrF2, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + TextView( + text: "User Name", + ), + SizedBox(height: 8), + // CustomDropdown( + // backClr: AppColors.clrD9, + // borderClr: AppColors.clrGrey, + // items: ctrl.plantList, + // itemLabel: (item) => item, + // onSelected: (selected) { + // if (selected != null) { + // ctrl.selectedPlant.value = + // selected; + // } + // }, + // hintText: 'Select Plant'), + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + TextView( + text: "User Type", + ), + SizedBox(height: 8), + // CustomDropdown( + // backClr: AppColors.clrD9, + // borderClr: AppColors.clrGrey, + // items: ctrl.freightBillList, + // itemLabel: (item) => item, + // onSelected: (selected) { + // if (selected != null) { + // ctrl.selectedFreight.value = + // selected; + // } + // }, + // hintText: 'Select Freight Number'), + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + TextView( + text: "Email Address", + ), + SizedBox(height: 8), + // CustomDropdown( + // backClr: AppColors.clrD9, + // borderClr: AppColors.clrGrey, + // items: ctrl.plantList, + // itemLabel: (item) => item, + // onSelected: (selected) { + // if (selected != null) { + // ctrl.selectedPlant.value = + // selected; + // } + // }, + // hintText: 'Select Product'), + ], + )), + ], + ), + Padding( + padding: const EdgeInsets.only( + top: 16.0, left: 8, right: 8), + child: Row( + children: [ + Expanded( + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + TextView( + text: "Employee/Transporter Code", + ), + SizedBox(height: 8), + // CustomDropdown( + // backClr: AppColors.clrD9, + // borderClr: AppColors.clrGrey, + // items: ctrl.plantList, + // itemLabel: (item) => item, + // onSelected: (selected) { + // if (selected != null) { + // ctrl.selectedPlant.value = + // selected; + // } + // }, + // hintText: 'Select Product'), + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + TextView( + text: + "Status", + ), + SizedBox(height: 8), + // CustomDropdown( + // backClr: AppColors.clrD9, + // borderClr: AppColors.clrGrey, + // items: ctrl.plantList, + // itemLabel: (item) => item, + // onSelected: (selected) { + // if (selected != null) { + // ctrl.selectedPlant.value = + // selected; + // } + // }, + // hintText: 'Select Product'), + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + children: [ + TextView( + text: "", + ), + SizedBox(height: 8), + Row( + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + CommonBtn( + bkClr: Colors.white, + text: AppStrings.cancel, + clickAction: () { + ctrl.isSelected.value = false; + }, + ), + SizedBox(width: 16), + CommonBtn( + text: AppStrings.submit, + textClr: Colors.white, + clickAction: () { + ctrl.isSelected.value = false; + }, + ), + ], + ), + ], + ), + ), + ], + ), + ), + ], + ), + ) + : SizedBox(), + ), + Obx(() { + switch (ctrl.selectedUser.value) { + case 0: + return ManageUser(); + case 1: + return AddInternalUser(); + case 2: + return InternalUserRoleMapping(); + case 3: + return UserPlantMapping(); + default: + return UserType(); + } + }), + ], + ), + ) + ], + ), + ); + } +} diff --git a/lib/feature/presentation/screens/admin/user_management/user_type.dart b/lib/feature/presentation/screens/admin/user_management/user_type.dart new file mode 100644 index 0000000..f12203c --- /dev/null +++ b/lib/feature/presentation/screens/admin/user_management/user_type.dart @@ -0,0 +1,239 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:shayog/components/common/common_button.dart'; +import 'package:shayog/feature/presentation/screens/transporter/widgets/common_card.dart'; +import '../../../../../components/common/common_btn.dart'; +import '../../../../../components/common/custom_drop_down.dart'; +import '../../../../../components/common/data_cell.dart'; +import '../../../../../components/common/input_field.dart'; +import '../../../../../components/styles/app_colors.dart'; +import '../../../../../components/styles/app_strings.dart'; +import '../../dashboard/controller/dashboard_ctrl.dart'; + +class UserType extends StatelessWidget { + UserType({super.key}); + + final controller = Get.put(DashboardCtrl()); + + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.all(16.0), + color: AppColors.clrF2, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _commonText( + "Add User Type", + ), + SizedBox(height: 8), + InputField( + controller: controller.userTypeCtrl, + title: "Enter User Type", + ), + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _commonText( + "Status Type", + ), + SizedBox(height: 8), + CustomDropdown( + initialValue: controller.selectedStatus.value, + backClr: AppColors.clrD9, + borderClr: AppColors.clrGrey, + items: controller.status, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + controller.selectedStatus.value = selected; + } + }, + hintText: 'Select Status'), + ], + )), + SizedBox(width: 16), + Expanded( + //flex: 2, + child: Column( + children: [ + _commonText( + "", + ), + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + CommonBtn( + bkClr: Colors.white, + text: AppStrings.cancel, + clickAction: () {}, + ), + SizedBox(width: 16), + CommonButton( + isLoading: controller.userTypeLoading, + height: 28, + borderRadius: 4, + width: 100, + text: AppStrings.submit, + textStyle: TextStyle( + fontSize: 12, + color: Colors.white, + fontWeight: FontWeight.bold), + //textClr: Colors.white, + clickAction: () { + controller.createUserType(); + }, + ), + ], + ), + ), + ], + )) + ], + ), + ), + Container( + padding: const EdgeInsets.only(top: 8.0, bottom: 8, left: 8), + margin: const EdgeInsets.only(top: 24.0, bottom: 8), + width: MediaQuery.of(context).size.width, + color: AppColors.primaryClr, + child: Text( + AppStrings.userTypes, + style: TextStyle(fontSize: 14, color: Colors.white), + ), + ), + Obx(() { + if (controller.userType.isEmpty) { + return Center(child: Text("No User Found")); + } + + return Scrollbar( + thumbVisibility: true, + controller: controller.verticalScrollController, + child: SingleChildScrollView( + controller: controller.verticalScrollController, + child: Scrollbar( + thumbVisibility: true, + controller: controller.horizontalScrollController, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + controller: controller.horizontalScrollController, + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey.shade400, + width: 1.0, + ), + ), + child: Column( + children: [ + DataTable( + columnSpacing: 280, + dataRowHeight: 28, + headingRowHeight: 40, + headingRowColor: + WidgetStateProperty.all(AppColors.clrF2), + border: TableBorder( + horizontalInside: + BorderSide(color: AppColors.clrGrey), + verticalInside: + BorderSide(color: AppColors.clrGrey), + bottom: BorderSide(color: AppColors.clrGrey), + left: BorderSide(color: AppColors.clrGrey), + right: BorderSide(color: AppColors.clrGrey), + top: BorderSide(color: AppColors.clrGrey), + ), + columns: [ + dataColumn("SR.No."), + dataColumn("User Type"), + dataColumn("Status"), + dataColumn("Action"), + ], + rows: List.generate( + controller.userType.length, (index) { + final stoppage = controller.userType[index]; + + return DataRow( + + cells: [ + editableCell(index, "0$index"), + editableCell( + index, stoppage.usertypeName ?? ""), + editableCell( + index, + stoppage.status == "I" + ? "In-Active" + : "Active"), + + DataCell( + Center( + child: CommonButton( + margin: EdgeInsets.symmetric(vertical: 4), + borderRadius: 4, + height: 25, + textStyle: TextStyle( + fontSize: 8, + fontWeight: FontWeight.bold, + color: Colors.white), + text: stoppage.status == "A" + ? "In-Active" + : "Active", + clickAction: () { + CommonAlertDialog.showDialog( + message: + "Are you sure want to do this action?", + negativeText: AppStrings.cancel, + positiveText: AppStrings.submit, + negativeBtCallback: () { + Get.back(); + }, + positiveBtCallback: () { + Get.back(); + controller.checkStatus( + stoppage.usertypeId ?? 0, + stoppage.status); + }); + }, + isLoading: controller.statusLoading, + ), + ), + ), + // editableCell(index, stoppage.action ?? ""), + ], + ); + }), + ), + ], + ), + ), + ), + ), + ), + ); + }), + ], + ); + } + + _commonText(String title) { + return Text( + title, + style: TextStyle( + fontSize: 13, color: Colors.black, fontWeight: FontWeight.w900), + ); + } +} diff --git a/lib/feature/presentation/screens/dashboard/controller/dashboard_ctrl.dart b/lib/feature/presentation/screens/dashboard/controller/dashboard_ctrl.dart new file mode 100644 index 0000000..79f3d02 --- /dev/null +++ b/lib/feature/presentation/screens/dashboard/controller/dashboard_ctrl.dart @@ -0,0 +1,486 @@ +import 'package:flutter/cupertino.dart'; +import 'package:get/get.dart'; +import 'package:shayog/components/styles/app_images.dart'; +import 'package:shayog/feature/presentation/screens/admin/user_management/model/select_assign_role_model/select_assign_role_model.dart'; +import 'package:shayog/services/network/get_requests.dart'; +import 'package:shayog/utils/alert_service.dart'; +import '../../../../../components/common/common_model.dart'; +import '../../../../../components/styles/app_strings.dart'; +import '../../../../../services/network/post_request.dart'; +import '../../admin/user_management/model/assign_plants_res_model.dart'; +import '../../admin/user_management/model/edit_user_res_model.dart'; +import '../../admin/user_management/model/fetch_internal_user_model/fetch_internal_user_model.dart'; +import '../../admin/user_management/model/getAllUserResModel.dart'; +import '../../admin/user_management/model/plant_mapping_res_model.dart'; +import '../../admin/user_management/model/user_type_details_res_model.dart'; +import '../../admin/user_management/model/user_type_res_model.dart'; + +import '../../transporter/widgets/freightbill_dialog.dart'; + +class DashboardCtrl extends GetxController { + final ScrollController horizontalScrollController = ScrollController(); + final ScrollController verticalScrollController = ScrollController(); + var errorMessage = ''.obs; + final nameCtrl = TextEditingController(); + final lastNCtrl = TextEditingController(); + final employeeCodeCtrl = TextEditingController(); + final emailCtrl = TextEditingController(); + final mobileCtrl = TextEditingController(); + final userTypeCtrl = TextEditingController(); + var selectedIndex = 0.obs; + var selectUserType = 0.obs; + var selectedUser = 0.obs; + var selectedValue = ''.obs; + + var errorText = ''.obs; + RxBool showRolesSection = false.obs; + RxBool showPlantRolesSection = false.obs; + RxBool isSelected = false.obs; + + void toggleContainer() { + isSelected.value = true; + print("isSelected.value..${isSelected.value}"); + } + + var items = + ['Admin', 'Sub Admin', 'Internal Audit', 'Raw material', 'MIS User'].obs; + + RxList tabs = [ + CommonModel( + title: "User\nManagement", + image: AppImages.userMgmt, + selectionImg: AppImages.userMgmtBlue), + CommonModel( + title: "Configuration\nManagement", + image: AppImages.configuration, + selectionImg: AppImages.configurationBlue), + CommonModel( + title: "Masters", + image: AppImages.masters, + selectionImg: AppImages.mastersBlue), + CommonModel( + title: "Freight Bill & \n Invoice", + image: AppImages.bills, + selectionImg: AppImages.billsBlue), + ].obs; + RxList userTabs = [ + CommonModel(title: AppStrings.manageUser), + CommonModel(title: AppStrings.internalUser), + CommonModel(title: AppStrings.roleMapping), + CommonModel(title: AppStrings.userPlant), + CommonModel(title: AppStrings.userType), + ].obs; + + void onInit() { + getManageUser(); + getDropDownData(); + getEmailCodeOfRoleMapping(); + userTypeDetails(); + super.onInit(); + } + + //***************************************************************** + final formKey = GlobalKey(); + + var userData = [].obs; + + + + + +//**************************Manage-User************************************ + + var getAllUser = [].obs; + var userLoading = false.obs; + + getManageUser() async { + try { + userLoading.value = true; + + Map requestBody = { + "userName": "", + "userTypeName": "", + "email": "", + "employeeTransCode": "", + "status": "" + }; + + var response = await PostRequests.getAllUser(requestBody); + if (response != null) { + getAllUser.assignAll(response.data?.content ?? []); + } + } finally { + userLoading.value = false; + } + } + +//********************************edit User****************************// + var editLoading = false.obs; + Rx editUserResModel = Data().obs; + + editAllUser(String id) async { + try { + editLoading.value = true; + Map requestBody = { + "firstName": nameCtrl.text, + "lastName": lastNCtrl.text, + "addedChannel": selectedValue.value, + "userTypeId": userTypeId.value, + "phoneNumber": mobileCtrl.text, + "emailId": emailCtrl.text, + "status": selectedStatus.value, + }; + print('request body ${requestBody.toString()}'); + var response = await PostRequests.editUser(requestBody, id); + if (response != null) { + editUserResModel.value = response.data!; + getManageUser(); + getAllUser.refresh(); + } + selectedUser.value = 0; + clearPrefillData(); + } finally { + editLoading.value = false; + } + } + + +//**************************Add Internal-User****************************** + + var isLoading = false.obs; + var status = ['A', 'I']; + var selectedStatus = 'Select Status'.obs; + void createUser() { + if (selectedValue.value.isEmpty || + selectedStatus.value.isEmpty || + nameCtrl.text.isEmpty || + lastNCtrl.text.isEmpty || + mobileCtrl.text.isEmpty || + emailCtrl.text.isEmpty || + employeeCodeCtrl.text.isEmpty) { + + CommonDialog.showDialog( + message: "All Fields are Required", + onclick: () { + Get.back(); + }); + } else { + print("???????????????"); + addInternalUser(); + } + } + addInternalUser() async { + try { + isLoading.value = true; + + final List> requestBody = [ + { + //"userName": "", + "userName": nameCtrl.text, + "firstName": nameCtrl.text, + "lastName": lastNCtrl.text, + "userTypeId": 3, + "mobile": mobileCtrl.text, + "employeeTransCode": employeeCodeCtrl.text, + "email": emailCtrl.text, + "status": selectedStatus.value, + "addedChannel": "F" + } + ]; + + var response = await PostRequests.createUser(requestBody); + print("requestBody>>>$requestBody"); + if (response != null) { + CommonDialog.showDialog( + message: "User Created Successfully", + onclick: () { + Get.back(); + getManageUser(); + selectedUser.value = 0; + }); + + } + } finally { + isLoading.value = false; + } + } +//**************************Internal User Role Mapping********************* +//**************************User Plant Mapping***************************** +//**************************Create User Type******************************* + + void updateSelectedRoleIds(int roleId, bool isSelected) { + if (isSelected) { + selectedRoleIds.add(roleId); + } else { + selectedRoleIds.remove(roleId); // Remove the roleId if it's unselected + } + update(); + } + + void updatePlantRole(int roleId, bool isSelected) { + if (isSelected) { + plantRoleIds.add(roleId); + } else { + plantRoleIds.remove(roleId); // Remove the roleId if it's unselected + } + plantRoleIds.refresh(); + plantMapping.refresh(); + update(); + } + + + + clearPrefillData() { + nameCtrl.clear(); + lastNCtrl.clear(); + mobileCtrl.clear(); + emailCtrl.clear(); + employeeCodeCtrl.clear(); + selectedStatus.value = ''; + selectUserVal.value = ''; + selectUserType.value = 0; + errorText.value = ''; + } + + var selectUserVal = 'Select User Type'.obs; + var userTypeId = ''.obs; + + var selectedCode = 'Select Employee Code'.obs; + var selectedEmail = 'Select Email'.obs; + var selectPlantEmail = 'Select Email'.obs; + + var isDropDownLoading = true.obs; + + var selectedEmpCode = ''.obs; + + RxList selectedRoleIds = [].obs; + RxList plantRoleIds = [].obs; + + clearRoles() { + selectedEmail.value = ''; + selectedEmpCode.value = ''; + selectedRoleIds.clear(); + plantRoleIds.clear(); + showRolesSection.value = false; + showPlantRolesSection.value = false; + } + + //************************getAllUser***************************** + + + //************************editAllUser***************************** + + + //************************-createUserType-***************************** + var userTypeLoading = false.obs; + var userTypeData = [].obs; + + createUserType() async { + try { + userTypeLoading.value = true; + Map requestBody = { + "userTypeName": userTypeCtrl.text, + "status": selectedStatus.value, + "createdBy": "0", + "lastUpdatedBy": "0" + }; + print('request body ${requestBody.toString()}'); + var response = await PostRequests.addUserType(requestBody); + if (response != null) { + userTypeDetails(); + //userTypeData.assignAll(response.data ?? []); + // editUserResModel.value = response.data!; + } + // + } finally { + userTypeLoading.value = false; + } + } + + //************************get DropDown Data***************************** + var dropDownLoader = true.obs; + var employeeCode = [].obs; + var userEmails = [].obs; + + getDropDownData() async { + try { + dropDownLoader.value = true; + + var response = await GetRequests.dropDownList(); + if (response != null) { + employeeCode.assignAll(response.data?.employeeCodes ?? []); + userEmails.assignAll(response.data?.userEmails ?? []); + } + } finally { + dropDownLoader.value = false; + } + } + + //************************plant mapping data***************************** + var plantMappingLoader = false.obs; + + RxList plantMapping = [].obs; + + getPlantMapping() async { + try { + plantMappingLoader.value = true; + Map requestBody = { + "email": selectPlantEmail.value, + "employeeTransCode": selectedCode.value + }; + print('request body ${requestBody.toString()}'); + var response = await PostRequests.plantMapping(requestBody); + if (response != null) { + plantMapping.value = response.data!; + + showPlantRolesSection.value = true; + } + + // + } finally { + plantMappingLoader.value = false; + } + } + + //************************Internal Role mapping drop down***************************** + RxList roleMappingData = [].obs; + var fetchEmailsNCodesLoading = false.obs; + + + getRoleMappingData() async { + try { + fetchEmailsNCodesLoading.value = true; + Map requestBody = { + "email": selectedEmail.value, + "employeeTransCode": selectedEmpCode.value, + }; + var response = await PostRequests.fetchEmailsAndEmpCodes(requestBody); + if (response != null) { + print('fetch role desc ${response.data?.length}'); + roleMappingData.value = response.data!; + showRolesSection.value = true; + } + } finally { + fetchEmailsNCodesLoading.value = false; + } + } + + //************************plant mapping drop down***************************** + var emails = [].obs; + var employeeCodes = [].obs; + + getEmailCodeOfRoleMapping() async { + try { + isDropDownLoading.value = true; + var response = await GetRequests.getInternalUserDropDown(); + if (response != null) { + emails.assignAll(response.data?.userEmails ?? []); + employeeCodes.assignAll(response.data?.employeeCodes ?? []); + print( + 'drop value ${response.data?.employeeCodes?.length} AND ${response.data?.userEmails?.length}'); + } + } finally { + isDropDownLoading.value = false; + } + } + + + var selectRolesLoading = true.obs; + Rx? selectAssignModel = SelectAssignRoleModel().obs; + + selectRoles() async { + try { + selectRolesLoading.value = true; + Map requestBody = { + "email": selectedEmail.value, + "employeeTransCode": selectedEmpCode.value, + "selectedRoleIds": selectedRoleIds, + "createdBy": 1, + "lastUpdatedBy": 1, + }; + print('req body...select ${requestBody.toString()}'); + var response = await PostRequests.selectAssignRole(requestBody); + if (response != null) { + selectAssignModel?.value = response; + AppAlerts.success('${response.message}'); + } + } finally { + selectRolesLoading.value = false; + } + } + + //*******************************selectPlantRoles************************************************* + + var selectPlantLoader = false.obs; + Rx? selectPlantRole = AssignPlantResModel().obs; + + selectPlantRoles() async { + try { + selectPlantLoader.value = true; + Map requestBody = { + "email": selectPlantEmail.value, + "employeeTransCode": selectedCode.value, + "selectedPlantIds": plantRoleIds, + "createdBy": 1, + "lastUpdatedBy": 1, + }; + print('req body...select ${requestBody.toString()}'); + var response = await PostRequests.selectPlantRole(requestBody); + if (response != null) { + selectPlantRole?.value = response; + AppAlerts.success('${response.message}'); + } + } finally { + selectPlantLoader.value = false; + } + } + + //***********************************CHECK STATUS*********************************// + + var statusLoading = false.obs; + RxString checkUserStatus = "".obs; + + checkStatus(int id, String? status) async { + try { + statusLoading.value = true; + Map requestBody = {"status": status == "I" ? "A" : "I"}; + print('request body ${requestBody.toString()}'); + var response = await PostRequests.checkStatus(requestBody, id); + if (response != null) { + checkUserStatus.value = response.data?.message ?? ""; + userTypeDetails(); + CommonDialog.showDialog( + message: "Status Updated Successfully", + onclick: () { + Get.back(); + }); + } + } finally { + statusLoading.value = false; + } + } + +//**************************************User-Type-Details************************************** + + var userTypeLoader = false.obs; + + var userType = [].obs; + + userTypeDetails() async { + try { + userTypeLoader.value = true; + Map requestBody = { + "userTypeId": "", + "usertypeName": "", + "status": "" + }; + print('request body ${requestBody.toString()}'); + var response = await PostRequests.userTypeDetails(requestBody); + if (response != null) { + userType.assignAll(response.data?.content ?? []); + } + } finally { + userTypeLoader.value = false; + } + } +} diff --git a/lib/feature/presentation/screens/dashboard/dashboard_screen.dart b/lib/feature/presentation/screens/dashboard/dashboard_screen.dart new file mode 100644 index 0000000..280c856 --- /dev/null +++ b/lib/feature/presentation/screens/dashboard/dashboard_screen.dart @@ -0,0 +1,184 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:shayog/components/styles/app_strings.dart'; +import 'package:shayog/feature/presentation/screens/transporter/view/transport_view.dart'; + +import '../../../../components/styles/app_colors.dart'; +import '../admin/configuration_management/configuration_screen.dart'; +import '../admin/freight_bills/freightbill_screen.dart'; +import '../admin/masters/master_screen.dart'; +import '../admin/user_management/user_screen.dart'; +import 'controller/dashboard_ctrl.dart'; + +class DashboardScreen extends StatefulWidget { + const DashboardScreen({super.key}); + + @override + State createState() => _DashboardScreenState(); +} + +class _DashboardScreenState extends State { + final ctrl = Get.put(DashboardCtrl()); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: AppColors.secondaryClr, + title: RichText( + textAlign: TextAlign.center, + text: TextSpan( + text: AppStrings.appName, + style: TextStyle( + fontSize: 20, + color: AppColors.primaryClr, + fontWeight: FontWeight.w900), + children: [ + TextSpan( + text: '\n${AppStrings.cement}', + style: TextStyle( + fontSize: 15, + color: AppColors.primaryClr, + fontWeight: FontWeight.w900)) + ])), + actions: [ + Padding( + padding: const EdgeInsets.only(top: 8, bottom: 8), + child: CircleAvatar( + backgroundColor: AppColors.primaryClr, + radius: 30, + child: CircleAvatar( + backgroundColor: Colors.white, + radius: 18, + child: Center( + child: Text( + "A", + style: TextStyle(fontSize: 18, color: AppColors.primaryClr), + )), + )), + ), + Obx( + () => Text( + ctrl.selectUserType.value == 0 + ? AppStrings.adminUser + : AppStrings.transportVendor, + style: TextStyle( + fontSize: 12, + color: Colors.black, + fontWeight: FontWeight.w900), + ), + ), + PopupMenuButton( + color: Colors.white, + onSelected: (val) {}, + child: Icon( + Icons.keyboard_arrow_down_outlined, + color: Colors.black, + size: 20, + ), + itemBuilder: (context) { + return List.generate( + 2, + (index) { + return PopupMenuItem( + onTap: () { + ctrl.selectUserType.value = index; + }, + child: Text(index == 0 + ? AppStrings.adminUser + : AppStrings.transportVendor), + ); + }, + ); + }, + ), + SizedBox(width: 8), + ], + ), + body: Obx( + () => ctrl.selectUserType.value == 0 + ? ListView( + physics: NeverScrollableScrollPhysics(), + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: MediaQuery.of(context).size.height, + width: 80, + color: AppColors.primaryClr, + child: ListView.separated( + shrinkWrap: true, + padding: EdgeInsets.zero, + scrollDirection: Axis.vertical, + itemBuilder: (context, index) { + return Obx( + () => InkWell( + onTap: () { + ctrl.selectedIndex.value = index; + + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.symmetric( + horizontal: 16), + height: 80, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: + ctrl.selectedIndex.value == index + ? Colors.white + : AppColors.primaryClr, + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + ctrl.selectedIndex.value == index + ? ctrl + .tabs[index].selectionImg + : ctrl.tabs[index].image), + ), + ), + Text( + ctrl.tabs[index].title ?? "", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 10, + color: Colors.white, + fontWeight: FontWeight.w900), + ) + ], + ), + ), + ); + }, + separatorBuilder: (context, index) { + return SizedBox(height: 0); + }, + itemCount: 4), + ), + Expanded( + child: Obx(() { + switch (ctrl.selectedIndex.value) { + case 0: + return UserScreen(); + case 1: + return ConfigurationScreen(); + case 2: + return MasterScreen(); + default: + return FreightBillScreen(); + } + }), + ) + ], + ), + ], + ) + : TransportView(), + ), + ); + } +} diff --git a/lib/feature/presentation/screens/transporter/model/freightbill_res_model.dart b/lib/feature/presentation/screens/transporter/model/freightbill_res_model.dart new file mode 100644 index 0000000..515b025 --- /dev/null +++ b/lib/feature/presentation/screens/transporter/model/freightbill_res_model.dart @@ -0,0 +1,37 @@ +// To parse this JSON data, do +// +// final freightBillsResModel = freightBillsResModelFromJson(jsonString); + +import 'dart:convert'; + +FreightBillsResModel freightBillsResModelFromJson(String str) => FreightBillsResModel.fromJson(json.decode(str)); + +String freightBillsResModelToJson(FreightBillsResModel data) => json.encode(data.toJson()); + +class FreightBillsResModel { + final List? plant; + final List? prodect; + final List? fromLocation; + final List? freightBill; + + FreightBillsResModel({ + this.plant, + this.prodect, + this.fromLocation, + this.freightBill, + }); + + factory FreightBillsResModel.fromJson(Map json) => FreightBillsResModel( + plant: json["Plant"] == null ? [] : List.from(json["Plant"]!.map((x) => x)), + prodect: json["prodect"] == null ? [] : List.from(json["prodect"]!.map((x) => x)), + fromLocation: json["fromLocation"] == null ? [] : List.from(json["fromLocation"]!.map((x) => x)), + freightBill: json["FreightBill"] == null ? [] : List.from(json["FreightBill"]!.map((x) => x)), + ); + + Map toJson() => { + "Plant": plant == null ? [] : List.from(plant!.map((x) => x)), + "prodect": prodect == null ? [] : List.from(prodect!.map((x) => x)), + "fromLocation": fromLocation == null ? [] : List.from(fromLocation!.map((x) => x)), + "FreightBill": freightBill == null ? [] : List.from(freightBill!.map((x) => x)), + }; +} diff --git a/lib/feature/presentation/screens/transporter/model/transporter_model.dart b/lib/feature/presentation/screens/transporter/model/transporter_model.dart new file mode 100644 index 0000000..fceca2f --- /dev/null +++ b/lib/feature/presentation/screens/transporter/model/transporter_model.dart @@ -0,0 +1,41 @@ +class PostRequest { + final String plant; + final String productName; + final String transactionType; + final String fromLocation; + final String grnFromDate; + final String grnToDate; + + PostRequest({ + required this.plant, + required this.productName, + required this.transactionType, + required this.fromLocation, + required this.grnFromDate, + required this.grnToDate, + }); + + // Factory constructor to create PostRequest from a JSON object + factory PostRequest.fromJson(Map json) { + return PostRequest( + plant: json["plant"], + productName: json["productName"], + transactionType: json["transactionType"], + fromLocation: json["fromLocation"], + grnFromDate: json["grnFromDate"], + grnToDate: json["grnToDate"], + ); + } + + // Convert PostRequest to JSON + Map toJson() { + return { + "plant": plant, + "productName": productName, + "transactionType": transactionType, + "fromLocation": fromLocation, + "grnFromDate": grnFromDate, + "grnToDate": grnToDate, + }; + } +} diff --git a/lib/feature/presentation/screens/transporter/model/view_freight_bill_res_model.dart b/lib/feature/presentation/screens/transporter/model/view_freight_bill_res_model.dart new file mode 100644 index 0000000..2b96c6c --- /dev/null +++ b/lib/feature/presentation/screens/transporter/model/view_freight_bill_res_model.dart @@ -0,0 +1,269 @@ +// To parse this JSON data, do +// +// final viewFreightBillResModel = viewFreightBillResModelFromJson(jsonString); + +import 'dart:convert'; + +ViewFreightBillResModel viewFreightBillResModelFromJson(String str) => ViewFreightBillResModel.fromJson(json.decode(str)); + +String viewFreightBillResModelToJson(ViewFreightBillResModel data) => json.encode(data.toJson()); + +class ViewFreightBillResModel { + final List>? content; + final Pageable? pageable; + final bool? last; + final int? totalElements; + final int? totalPages; + final int? size; + final int? number; + final Sort? sort; + final bool? first; + final int? numberOfElements; + final bool? empty; + + ViewFreightBillResModel({ + this.content, + this.pageable, + this.last, + this.totalElements, + this.totalPages, + this.size, + this.number, + this.sort, + this.first, + this.numberOfElements, + this.empty, + }); + + factory ViewFreightBillResModel.fromJson(Map json) => ViewFreightBillResModel( + content: json["content"] == null ? [] : List>.from(json["content"]!.map((x) => List.from(x.map((x) => FreightBill.fromJson(x))))), + pageable: json["pageable"] == null ? null : Pageable.fromJson(json["pageable"]), + last: json["last"], + totalElements: json["totalElements"], + totalPages: json["totalPages"], + size: json["size"], + number: json["number"], + sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]), + first: json["first"], + numberOfElements: json["numberOfElements"], + empty: json["empty"], + ); + + Map toJson() => { + "content": content == null ? [] : List.from(content!.map((x) => List.from(x.map((x) => x.toJson())))), + "pageable": pageable?.toJson(), + "last": last, + "totalElements": totalElements, + "totalPages": totalPages, + "size": size, + "number": number, + "sort": sort?.toJson(), + "first": first, + "numberOfElements": numberOfElements, + "empty": empty, + }; +} + +class FreightBill { + final int? freightbillId; + final String? freightbillCode; + final String? status; + final DateTime? statusDate; + final String? plantCode; + final String? materialCode; + final String? fromLocation; + final int? billingQty; + final dynamic uom; + final double? freightAmount; + final double? cgst; + final double? sgst; + final int? igst; + final double? totalGst; + final double? shipmentNetAmount; + final DateTime? createdOn; + final dynamic trasnporterInvoiceNo; + final dynamic trasnporterInvoiceNoDate; + final dynamic utr1No; + final dynamic utr2No; + final dynamic utr3No; + final dynamic utr4No; + final dynamic utr5No; + final dynamic utr1PaymentAmount; + final dynamic utr2PaymentAmount; + final dynamic utr3PaymentAmount; + final dynamic utr4PaymentAmount; + final dynamic utr5PaymentAmount; + final dynamic utr1Date; + final dynamic utr2Date; + final dynamic utr3Date; + final dynamic utr4Date; + final dynamic utr5Date; + + FreightBill({ + this.freightbillId, + this.freightbillCode, + this.status, + this.statusDate, + this.plantCode, + this.materialCode, + this.fromLocation, + this.billingQty, + this.uom, + this.freightAmount, + this.cgst, + this.sgst, + this.igst, + this.totalGst, + this.shipmentNetAmount, + this.createdOn, + this.trasnporterInvoiceNo, + this.trasnporterInvoiceNoDate, + this.utr1No, + this.utr2No, + this.utr3No, + this.utr4No, + this.utr5No, + this.utr1PaymentAmount, + this.utr2PaymentAmount, + this.utr3PaymentAmount, + this.utr4PaymentAmount, + this.utr5PaymentAmount, + this.utr1Date, + this.utr2Date, + this.utr3Date, + this.utr4Date, + this.utr5Date, + }); + + factory FreightBill.fromJson(Map json) => FreightBill( + freightbillId: json["freightbill_id"], + freightbillCode: json["freightbill_code"], + status: json["status"], + statusDate: json["status_date"] == null ? null : DateTime.parse(json["status_date"]), + plantCode: json["plant_code"], + materialCode: json["material_code"], + fromLocation: json["from_location"], + billingQty: json["billing_qty"], + uom: json["uom"], + freightAmount: json["freight_amount"]?.toDouble(), + cgst: json["cgst"]?.toDouble(), + sgst: json["sgst"]?.toDouble(), + igst: json["igst"], + totalGst: json["total_gst"]?.toDouble(), + shipmentNetAmount: json["shipment_net_amount"]?.toDouble(), + createdOn: json["created_on"] == null ? null : DateTime.parse(json["created_on"]), + trasnporterInvoiceNo: json["trasnporter_invoice_no"], + trasnporterInvoiceNoDate: json["trasnporter_invoice_no_date"], + utr1No: json["utr1_no"], + utr2No: json["utr2_no"], + utr3No: json["utr3_no"], + utr4No: json["utr4_no"], + utr5No: json["utr5_no"], + utr1PaymentAmount: json["utr1_payment_amount"], + utr2PaymentAmount: json["utr2_payment_amount"], + utr3PaymentAmount: json["utr3_payment_amount"], + utr4PaymentAmount: json["utr4_payment_amount"], + utr5PaymentAmount: json["utr5_payment_amount"], + utr1Date: json["utr1_date"], + utr2Date: json["utr2_date"], + utr3Date: json["utr3_date"], + utr4Date: json["utr4_date"], + utr5Date: json["utr5_date"], + ); + + Map toJson() => { + "freightbill_id": freightbillId, + "freightbill_code": freightbillCode, + "status": status, + "status_date": "${statusDate!.year.toString().padLeft(4, '0')}-${statusDate!.month.toString().padLeft(2, '0')}-${statusDate!.day.toString().padLeft(2, '0')}", + "plant_code": plantCode, + "material_code": materialCode, + "from_location": fromLocation, + "billing_qty": billingQty, + "uom": uom, + "freight_amount": freightAmount, + "cgst": cgst, + "sgst": sgst, + "igst": igst, + "total_gst": totalGst, + "shipment_net_amount": shipmentNetAmount, + "created_on": createdOn?.toIso8601String(), + "trasnporter_invoice_no": trasnporterInvoiceNo, + "trasnporter_invoice_no_date": trasnporterInvoiceNoDate, + "utr1_no": utr1No, + "utr2_no": utr2No, + "utr3_no": utr3No, + "utr4_no": utr4No, + "utr5_no": utr5No, + "utr1_payment_amount": utr1PaymentAmount, + "utr2_payment_amount": utr2PaymentAmount, + "utr3_payment_amount": utr3PaymentAmount, + "utr4_payment_amount": utr4PaymentAmount, + "utr5_payment_amount": utr5PaymentAmount, + "utr1_date": utr1Date, + "utr2_date": utr2Date, + "utr3_date": utr3Date, + "utr4_date": utr4Date, + "utr5_date": utr5Date, + }; +} + +class Pageable { + final Sort? sort; + final int? offset; + final int? pageSize; + final int? pageNumber; + final bool? unpaged; + final bool? paged; + + Pageable({ + this.sort, + this.offset, + this.pageSize, + this.pageNumber, + this.unpaged, + this.paged, + }); + + factory Pageable.fromJson(Map json) => Pageable( + sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]), + offset: json["offset"], + pageSize: json["pageSize"], + pageNumber: json["pageNumber"], + unpaged: json["unpaged"], + paged: json["paged"], + ); + + Map toJson() => { + "sort": sort?.toJson(), + "offset": offset, + "pageSize": pageSize, + "pageNumber": pageNumber, + "unpaged": unpaged, + "paged": paged, + }; +} + +class Sort { + final bool? empty; + final bool? sorted; + final bool? unsorted; + + Sort({ + this.empty, + this.sorted, + this.unsorted, + }); + + factory Sort.fromJson(Map json) => Sort( + empty: json["empty"], + sorted: json["sorted"], + unsorted: json["unsorted"], + ); + + Map toJson() => { + "empty": empty, + "sorted": sorted, + "unsorted": unsorted, + }; +} diff --git a/lib/feature/presentation/screens/transporter/view/sub_views/generate_fright_bill.dart b/lib/feature/presentation/screens/transporter/view/sub_views/generate_fright_bill.dart new file mode 100644 index 0000000..07527b0 --- /dev/null +++ b/lib/feature/presentation/screens/transporter/view/sub_views/generate_fright_bill.dart @@ -0,0 +1,452 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:intl/intl.dart'; +import 'package:shayog/components/styles/app_colors.dart'; +import 'package:shayog/components/styles/textStyles.dart'; +import 'package:shayog/feature/presentation/widgets/text_view.dart'; +import 'package:sizer/sizer.dart'; +import 'package:vph_web_date_picker/vph_web_date_picker.dart'; +import '../../../../../../../components/common/common_btn.dart'; +import '../../../../../../../components/common/custom_drop_down.dart'; +import '../../../../../../../components/common/data_cell.dart'; +import '../../../../../../../components/styles/app_strings.dart'; + +import '../../view_model/transport_controller.dart'; +import '../../widgets/common_card.dart'; +import '../../widgets/freightbill_dialog.dart'; + +class GenerateFrightBill extends StatelessWidget { + GenerateFrightBill({super.key}); + + final controller = Get.put(TransportController()); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + padding: EdgeInsets.all(16), + color: AppColors.clrF2, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _commonText("Plant"), + SizedBox(height: 8), + CustomDropdown( + backClr: AppColors.clrD9, + borderClr: AppColors.clrGrey, + items: controller.plant, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + controller.selectPlant.value = selected; + print( + "selectPlant${controller.selectPlant.value}"); + } + }, + hintText: "Select Plant", + ), + ], + ), + ), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _commonText("Product Name"), + SizedBox(height: 8), + CustomDropdown( + backClr: AppColors.clrD9, + borderClr: AppColors.clrGrey, + items: controller.product, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + controller.selectProduct.value = selected; + print( + "selectPlant${controller.selectProduct.value}"); + } + }, + hintText: "Select Product Name", + ), + ], + ), + ), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _commonText("Transaction Type"), + SizedBox(height: 8), + CustomDropdown( + backClr: AppColors.clrD9, + borderClr: AppColors.clrGrey, + items: controller.transactionType, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + controller.selectTransactionType.value = selected; + print( + "selectTransactionType${controller.selectTransactionType.value}"); + } + }, + hintText: "Select Transaction Type", + ), + ], + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(top: 16.0, left: 0, right: 8), + child: Row( + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _commonText("MRN Date Range"), + // SizedBox(height: 8), + // CustomDropdown( + // borderClr: AppColors.clrGrey, + // items: controller.date, + // itemLabel: (item) => item, + // onSelected: (selected) { + // if (selected != null) { + // controller.selectPlant.value = selected; + // } + // }, + // hintText: "Select MRN Date Range", + // ), + Container( + margin: EdgeInsets.only(top: 8), + height: 35, + child: TextFormField( + key: controller.fromTextFieldKey, + controller: controller.fromController, + onTap: () async { + final pickedDate = await showWebDatePicker( + width: 20.w, + context: controller + .fromTextFieldKey.currentContext!, + initialDate: controller.fromSelectedDate, + firstDate: DateTime(2000), + lastDate: DateTime.now(), + ); + + if (pickedDate != null) { + controller.fromSelectedDate = pickedDate; + String formattedDate = + controller.getFormattedDate(pickedDate); + controller.fromController.text = + formattedDate; + controller.dateCheck.value = true; + } + }, + decoration: InputDecoration( + hintText: 'Select MRN Date Range', + hintStyle: TextStyle( + fontSize: 12, + overflow: TextOverflow.ellipsis), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(2.0), + borderSide: + BorderSide(color: AppColors.black), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(2.0), + borderSide: + BorderSide(color: AppColors.clrGrey), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(2.0), + borderSide: + BorderSide(color: AppColors.clrGrey), + ), + disabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(2.0), + borderSide: + BorderSide(color: AppColors.clrGrey), + ), + suffixIcon: controller.dateCheck.value + ? InkWell( + onTap: () { + controller.dateCheck.value = false; + controller.fromController.clear(); + controller.fromSelectedDate = + DateTime.now(); + }, + child: Icon(Icons.close, size: 1.2.w), + ) + : null, + contentPadding: const EdgeInsets.symmetric( + horizontal: 12.0, vertical: 0.0), + ), + ), + ), + ], + ), + ), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _commonText("From Location"), + SizedBox(height: 8), + CustomDropdown( + backClr: AppColors.clrD9, + borderClr: AppColors.clrGrey, + items: controller.fromLocation, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + controller.selectLocation.value = selected; + } + }, + hintText: "Select From Location", + ), + ], + ), + ), + SizedBox( + width: 16, + ), + Expanded( + //flex: 2, + child: Column( + children: [ + _commonText( + "", + ), + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + CommonBtn( + bkClr: Colors.white, + text: AppStrings.cancel, + clickAction: () {}, + ), + SizedBox(width: 16), + CommonBtn( + text: AppStrings.submit, + textClr: Colors.white, + clickAction: () { + controller.postData(); + }, + ), + ], + ), + ), + ], + )) + ], + ), + ), + ], + ), + ), + Container( + padding: EdgeInsets.symmetric(horizontal: 10), + margin: EdgeInsets.only(top: 16), + height: 45, + color: AppColors.primaryClr, + child: Row( + children: [ + TextView(text: AppStrings.viewGrnDetails, style: 15.txtBoldWhite), + Spacer(), + CommonBtn( + bkClr: AppColors.white, + borderClr: AppColors.primaryClr, + textClr: AppColors.primaryClr, + text: AppStrings.save, + clickAction: () { + bool hasSelectedRows = controller.grnDetails + .any((element) => element.isSelected); + if (!hasSelectedRows) { + showPopup(context: context, onClick: () { + Get.back(); + }); + } else { + CommonAlertDialog.showDialog( + message: "Are you sure want to\nsave this?", + positiveText: "Save", + negativeText: "Cancel", + positiveBtCallback: () { + Get.back(); + controller.addFreightBill(); + + showFreightBill(context); + }, + negativeBtCallback: () {}); + } + }), + ], + ), + ), + Obx(() { + if (controller.isLoading.value) { + return Center(child: CircularProgressIndicator()); + } + + if (controller.errorMessage.isNotEmpty) { + return Center(child: Text(controller.errorMessage.value)); + } + + if (controller.grnDetails.isEmpty) { + return Center(child: Text('No data available.')); + } + return Scrollbar( + thumbVisibility: true, + controller: controller.verticalScrollController, + child: SingleChildScrollView( + controller: controller.verticalScrollController, + child: Scrollbar( + thumbVisibility: true, + controller: controller.horizontalScrollController, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + controller: controller.horizontalScrollController, + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey.shade400, + width: 1.0, + ), + ), + child: DataTable( + dataRowHeight: 28, + headingRowHeight: 40, + headingRowColor: WidgetStateProperty.all(AppColors.clrF2), + border: TableBorder( + horizontalInside: BorderSide(color: AppColors.clrGrey), + verticalInside: BorderSide(color: AppColors.clrGrey), + bottom: BorderSide(color: AppColors.clrGrey), + left: BorderSide(color: AppColors.clrGrey), + right: BorderSide(color: AppColors.clrGrey), + top: BorderSide(color: AppColors.clrGrey), + ), + columns: [ + DataColumn( + label: Transform.scale( + scale: 0.80, + // Adjust this scale to make the checkbox bigger or smaller + child: Checkbox( + value: controller.selectAllField.value, + + onChanged: (value) { + controller.selectAll(value ?? false); + }, + activeColor: AppColors.primaryClr, + checkColor: Colors.white, + materialTapTargetSize: MaterialTapTargetSize + .shrinkWrap, // Avoids large tap area + ), + ), + ), + dataColumn(AppStrings.srNo), + dataColumn(AppStrings.mrnNo), + dataColumn(AppStrings.plantNo), + dataColumn(AppStrings.product), + dataColumn(AppStrings.date), + dataColumn(AppStrings.fromLocation), + dataColumn(AppStrings.vehicleNo), + dataColumn(AppStrings.transporterLrNo), + dataColumn(AppStrings.transporterLrNoDate), + dataColumn(AppStrings.dispQty), + dataColumn(AppStrings.netQty), + dataColumn(AppStrings.billingQty), + dataColumn(AppStrings.vom), + dataColumn(AppStrings.freightRate), + dataColumn(AppStrings.freightAmount), + ], + rows: List.generate(controller.grnDetails.length, + (index) { + final stoppage = controller.grnDetails[index]; + + return DataRow( + selected: stoppage.isSelected, + cells: [ + DataCell( + Transform.scale( + scale: 0.80, + child: Checkbox( + value: stoppage.isSelected, + onChanged: (value) { + controller.toggleSelection( + index, value ?? false); + }, + activeColor: AppColors.primaryClr, + // Custom color when selected + checkColor: Colors.white, + // Custom color for check mark + materialTapTargetSize: MaterialTapTargetSize + .shrinkWrap, // Avoids large tap area + ), + ), + ), + editableCell(index, "0${index + 1}"), + editableCell(index, stoppage.grnNo ?? ""), + editableCell(index, stoppage.plantCode ?? ""), + editableCell(index, stoppage.materialCode ?? ""), + editableCell( + index, + DateFormat('yyyy-MM-dd').format( + stoppage.grnDate ?? DateTime.now())), + editableCell(index, stoppage.fromLocation ?? ""), + editableCell(index, stoppage.vehicleNo ?? ""), + editableCell(index, stoppage.lrNo ?? ""), + editableCell( + index, + DateFormat('yyyy-MM-dd') + .format(stoppage.lrDate ?? DateTime.now())), + editableCell( + index, stoppage.dispQty?.toString() ?? ""), + editableCell( + index, stoppage.netQty?.toString() ?? ""), + editableCell( + index, stoppage.billingQty?.toString() ?? ""), + editableCell( + index, stoppage.freightRate?.toString() ?? ""), + editableCell( + index, stoppage.shipmentCost?.toString() ?? ""), + editableCell( + index, stoppage.statusId?.toString() ?? ""), + ], + ); + }), + ), + ), + ), + ), + ), + ); + }), + ], + ); + } + + _commonText(String title) { + return Text( + title, + style: TextStyle( + fontSize: 13, color: Colors.black, fontWeight: FontWeight.w900), + ); + } +} diff --git a/lib/feature/presentation/screens/transporter/view/sub_views/pending_generation.dart b/lib/feature/presentation/screens/transporter/view/sub_views/pending_generation.dart new file mode 100644 index 0000000..5d1a585 --- /dev/null +++ b/lib/feature/presentation/screens/transporter/view/sub_views/pending_generation.dart @@ -0,0 +1,175 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:intl/intl.dart'; +import 'package:shayog/feature/presentation/screens/transporter/view_model/transport_controller.dart'; +import '../../../../../../../components/common/data_cell.dart'; +import '../../../../../../../components/styles/app_colors.dart'; +import '../../../../../../../components/styles/app_strings.dart'; + +class PendingGeneration extends StatelessWidget { + PendingGeneration({super.key}); + + final ScrollController horizontalScrollController = ScrollController(); + final ScrollController verticalScrollController = ScrollController(); + final controller = Get.put(TransportController()); + + @override + Widget build(BuildContext context) { + return Obx(() { + if (controller.freightViewLoader.value) { + return Center( + child: CircularProgressIndicator( + color: AppColors.primaryClr, + ), + ); + } else { + return Column( + children: [ + Obx(() { + if (controller.isLoading.value) { + return Center(child: CircularProgressIndicator()); + } + + if (controller.errorMessage.isNotEmpty) { + return Center(child: Text(controller.errorMessage.value)); + } + + if (controller.grnDetails.isEmpty) { + return Center(child: Text('No data available.')); + } + return Scrollbar( + thumbVisibility: true, + controller: controller.verticalScrollController, + child: SingleChildScrollView( + controller: controller.verticalScrollController, + child: Scrollbar( + thumbVisibility: true, + controller: controller.horizontalScrollController, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + controller: controller.horizontalScrollController, + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey.shade400, + width: 1.0, + ), + ), + child: DataTable( + dataRowHeight: 28, + headingRowHeight: 40, + headingRowColor: + WidgetStateProperty.all(AppColors.clrF2), + border: TableBorder( + horizontalInside: + BorderSide(color: AppColors.clrGrey), + verticalInside: + BorderSide(color: AppColors.clrGrey), + bottom: BorderSide(color: AppColors.clrGrey), + left: BorderSide(color: AppColors.clrGrey), + right: BorderSide(color: AppColors.clrGrey), + top: BorderSide(color: AppColors.clrGrey), + ), + columns: [ + DataColumn( + label: Transform.scale( + scale: 0.80, + child: Checkbox( + value: controller.selectAllField.value, + onChanged: (value) { + controller.selectAll(value ?? false); + }, + activeColor: AppColors.primaryClr, + checkColor: Colors.white, + materialTapTargetSize: + MaterialTapTargetSize.shrinkWrap, + ), + ), + ), + dataColumn(AppStrings.srNo), + dataColumn(AppStrings.plantName), + dataColumn(AppStrings.productName), + dataColumn(AppStrings.date), + dataColumn(AppStrings.fromLocation), + dataColumn(AppStrings.vehicleNo), + dataColumn(AppStrings.transporterLrNo), + dataColumn(AppStrings.transporterLrNoDate), + dataColumn(AppStrings.dispQty), + dataColumn(AppStrings.netQty), + dataColumn(AppStrings.billingQty), + dataColumn(AppStrings.uom), + dataColumn(AppStrings.freightRate), + dataColumn(AppStrings.freightAmount), + dataColumn(AppStrings.remark), + ], + rows: List.generate( + controller.grnDetails.length, (index) { + final stoppage = controller.grnDetails[index]; + + return DataRow( + selected: stoppage.isSelected, + cells: [ + DataCell( + Transform.scale( + scale: 0.80, + child: Checkbox( + value: stoppage.isSelected, + onChanged: (value) { + controller.toggleSelection( + index, value ?? false); + }, + activeColor: AppColors.primaryClr, + + checkColor: Colors.white, + + materialTapTargetSize: MaterialTapTargetSize + .shrinkWrap, + ), + ), + ), + editableCell(index, "0${index + 1}"), + editableCell(index, stoppage.plantCode ?? ""), + editableCell(index, stoppage.plantCode ?? ""), + + editableCell( + index, + DateFormat('yyyy-MM-dd').format( + stoppage.grnDate ?? DateTime.now())), + editableCell( + index, stoppage.fromLocation ?? ""), + editableCell(index, stoppage.vehicleNo ?? ""), + editableCell(index, stoppage.lrNo ?? ""), + editableCell( + index, + DateFormat('yyyy-MM-dd').format( + stoppage.lrDate ?? DateTime.now())), + editableCell( + index, stoppage.dispQty?.toString() ?? ""), + editableCell( + index, stoppage.netQty?.toString() ?? ""), + editableCell(index, + stoppage.billingQty?.toString() ?? ""), + editableCell(index, + stoppage.codeValue?.toString() ?? ""), + editableCell(index, + stoppage.freightRate?.toString() ?? ""), + editableCell( + index, stoppage.freightRate?.toString() ?? ""), + editableCell( + index, stoppage.freightRate?.toString() ?? ""), + ], + ); + }), + ), + ), + ), + ), + ), + ); + }), + ], + ); + } + }); + } +} diff --git a/lib/feature/presentation/screens/transporter/view/sub_views/view_freight_bill.dart b/lib/feature/presentation/screens/transporter/view/sub_views/view_freight_bill.dart new file mode 100644 index 0000000..8d18a2a --- /dev/null +++ b/lib/feature/presentation/screens/transporter/view/sub_views/view_freight_bill.dart @@ -0,0 +1,353 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:shayog/components/common/common_btn.dart'; +import 'package:shayog/components/common/common_button.dart'; +import 'package:shayog/feature/presentation/screens/transporter/model/view_freight_bill_res_model.dart'; +import 'package:shayog/feature/presentation/screens/transporter/widgets/freightbill_dialog.dart'; + +import '../../../../../../../components/common/data_cell.dart'; + +import '../../../../../../../components/styles/app_colors.dart'; +import '../../../../../../../components/styles/app_strings.dart'; +import '../../view_model/transport_controller.dart'; + +class ViewFreightBill extends StatelessWidget { + ViewFreightBill({super.key}); + + final ScrollController horizontalScrollController = ScrollController(); + final ScrollController verticalScrollController = ScrollController(); + final ctrl = Get.put(TransportController()); + + @override + Widget build(BuildContext context) { + return Obx(() { + if (ctrl.freightViewLoader.value) { + return Center( + child: CircularProgressIndicator( + color: AppColors.primaryClr, + ), + ); + } else { + return Column( + children: [ + Scrollbar( + thumbVisibility: true, + controller: verticalScrollController, + child: SingleChildScrollView( + controller: verticalScrollController, + child: Scrollbar( + thumbVisibility: true, + controller: horizontalScrollController, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + controller: horizontalScrollController, + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey.shade400, + width: 1.0, + ), + ), + child: DataTable( + dataRowHeight: 28, + headingRowHeight: 38, + headingRowColor: + WidgetStateProperty.all(AppColors.clrF2), + + border: TableBorder( + horizontalInside: + BorderSide(color: AppColors.clrGrey), + verticalInside: BorderSide(color: AppColors.clrGrey), + bottom: BorderSide(color: AppColors.clrGrey), + left: BorderSide(color: AppColors.clrGrey), + right: BorderSide(color: AppColors.clrGrey), + top: BorderSide(color: AppColors.clrGrey), + ), + columns: [ + + dataColumn(AppStrings.srNo), + dataColumn(AppStrings.plant), + dataColumn( + AppStrings.productName, + onSort: (_, __) => ctrl.changeSort( + AppStrings.productName.toLowerCase()), + ), + dataColumn(AppStrings.freightBillNo), + dataColumn(AppStrings.freightBillDate), + dataColumn(AppStrings.freightInvoice), + dataColumn(AppStrings.freightInvoiceDate), + dataColumn(AppStrings.billingQty), + dataColumn(AppStrings.uom), + dataColumn(AppStrings.freightAmount), + dataColumn(AppStrings.cGST), + dataColumn(AppStrings.sGST), + dataColumn(AppStrings.iGST), + dataColumn(AppStrings.totalGst), + dataColumn(AppStrings.totalInvoiceAmt), + dataColumn(AppStrings.cCN), + dataColumn(AppStrings.cCNDate), + dataColumn(AppStrings.miroStatus), + dataColumn(AppStrings.gstHold), + dataColumn(AppStrings.gstRelease), + dataColumn(AppStrings.utrNo), + dataColumn(AppStrings.utrDate), + dataColumn(AppStrings.amount), + dataColumn("${AppStrings.utrNo} 1"), + dataColumn(AppStrings.utrDate), + dataColumn("${AppStrings.amount} 1"), + dataColumn("${AppStrings.utrNo} 2"), + dataColumn(AppStrings.utrDate), + dataColumn("${AppStrings.amount} 2"), + dataColumn("${AppStrings.utrNo} 3"), + dataColumn(AppStrings.utrDate), + dataColumn("${AppStrings.amount} 3"), + dataColumn("${AppStrings.utrNo} 4"), + dataColumn(AppStrings.utrDate), + dataColumn("${AppStrings.amount} 4"), + dataColumn("${AppStrings.utrNo} 5"), + dataColumn(AppStrings.utrDate), + dataColumn("${AppStrings.amount} 5"), + ], + rows: List.generate( + ctrl.freightBillData.length, (index) { + final freightBill = ctrl.freightBillData[index]; + + return DataRow( + cells: [ + editableCell(index, "0${index + 1}"), + editableCell(index, "${freightBill.plantCode}"), + editableCell(index, "${freightBill.status}"), + editableCell( + index, + "${freightBill.freightbillId}", + isLink: true, + onTap: () { + showFreightBillDetailsDialog( + context, freightBill); + }, + ), + editableCell(index, "${freightBill.utr1Date}"), + editableCell( + index, "${freightBill.trasnporterInvoiceNo}"), + editableCell(index, + "${freightBill.trasnporterInvoiceNoDate}"), + editableCell(index, "${freightBill.billingQty}"), + editableCell(index, "${freightBill.uom}"), + editableCell( + index, "${freightBill.freightAmount}"), + editableCell(index, "${freightBill.cgst}"), + editableCell(index, "${freightBill.sgst}"), + editableCell(index, "${freightBill.igst}"), + editableCell(index, "${freightBill.totalGst}"), + editableCell(index, "${freightBill.totalGst}"), + editableCell( + index, "${freightBill.freightAmount}"), + editableCell(index, + "${freightBill.trasnporterInvoiceNoDate}"), + editableCell(index, "${freightBill.status}"), + editableCell(index, "${freightBill.totalGst}"), + editableCell(index, + "${freightBill.trasnporterInvoiceNoDate}"), + editableCell(index, "${freightBill.utr5No}"), + editableCell(index, "${freightBill.utr1Date}"), + editableCell( + index, "${freightBill.freightAmount}"), + editableCell(index, "${freightBill.utr1No}"), + editableCell(index, "${freightBill.utr1Date}"), + editableCell( + index, "${freightBill.utr1PaymentAmount}"), + editableCell(index, "${freightBill.utr2No}"), + editableCell(index, "${freightBill.utr2Date}"), + editableCell( + index, "${freightBill.utr2PaymentAmount}"), + editableCell(index, "${freightBill.utr3No}"), + editableCell(index, "${freightBill.utr3Date}"), + editableCell( + index, "${freightBill.utr3PaymentAmount}"), + editableCell(index, "${freightBill.utr4No}"), + editableCell(index, "${freightBill.utr4Date}"), + editableCell( + index, "${freightBill.utr4PaymentAmount}"), + editableCell(index, "${freightBill.utr5No}"), + editableCell(index, "${freightBill.utr5Date}"), + editableCell( + index, "${freightBill.utr5PaymentAmount}"), + ], + ); + }), + ), + ), + ), + ), + ), + ), + Align( + alignment: Alignment.bottomRight, + child: Container( + padding: const EdgeInsets.only(bottom: 16), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + IconButton( + icon: Icon(Icons.chevron_left), + onPressed: ctrl.currentPage > 0 + ? () => ctrl.previousPage() + : null, + ), + SizedBox(width: 16), + Text( + 'Page ${ctrl.currentPage.value + 1} of ${ctrl.totalPages.value}', + style: TextStyle(fontSize: 16), + ), + SizedBox(width: 16), + IconButton( + icon: Icon(Icons.chevron_right), + onPressed: ctrl.currentPage < ctrl.totalPages.value - 1 + ? () => ctrl.nextPage() + : null, + ), + ], + ), + ), + ), + ], + ); + } + }); + } + + void showFreightBillDetailsDialog( + BuildContext context, FreightBill freightBill) { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + backgroundColor: Colors.white, + title: Text( + "TRANSPORTER NAME", + style: TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 24, + ), + ), + content: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("${AppStrings.freightBill} ${freightBill.freightbillId}"), + Text("${AppStrings.freightDate} ${freightBill.statusDate}"), + const SizedBox( + height: 8, + ), + Scrollbar( + thumbVisibility: true, + controller: verticalScrollController, + child: SingleChildScrollView( + controller: verticalScrollController, + child: Scrollbar( + thumbVisibility: true, + controller: horizontalScrollController, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + controller: horizontalScrollController, + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey.shade400, + width: 1.0, + ), + ), + child: DataTable( + dataRowHeight: 28, + headingRowHeight: 38, + headingRowColor: + WidgetStateProperty.all(AppColors.clrF2), + border: TableBorder( + horizontalInside: + BorderSide(color: AppColors.clrGrey), + verticalInside: + BorderSide(color: AppColors.clrGrey), + bottom: BorderSide(color: AppColors.clrGrey), + left: BorderSide(color: AppColors.clrGrey), + right: BorderSide(color: AppColors.clrGrey), + top: BorderSide(color: AppColors.clrGrey), + ), + columns: [ + dataColumn(AppStrings.srNo), + dataColumn(AppStrings.mrnNo), + dataColumn( + AppStrings.plantName, + onSort: (_, __) => ctrl.changeSort( + AppStrings.productName.toLowerCase()), + ), + dataColumn(AppStrings.product), + dataColumn(AppStrings.date), + dataColumn(AppStrings.fromLocDesc), + dataColumn(AppStrings.vehicleNo), + dataColumn(AppStrings.transporterLrNo), + dataColumn(AppStrings.transporterLrNoDate), + dataColumn(AppStrings.dispQty), + dataColumn(AppStrings.netQty), + dataColumn(AppStrings.billingQty), + dataColumn(AppStrings.uom), + dataColumn(AppStrings.freightBill), + dataColumn(AppStrings.freightAmount), + ], + rows: List.generate( + ctrl.freightBillData.length, (index) { + final freightBill = ctrl.freightBillData[index]; + return DataRow( + cells: [ + editableCell(index, "0${index + 1}"), + editableCell(index, "${freightBill.plantCode}"), + editableCell(index, "${freightBill.status}"), + editableCell( + index, + "${freightBill.freightbillId}", + isLink: true, + onTap: () { + showFreightBillDetailsDialog( + context, freightBill); + }, + ), + editableCell(index, "${freightBill.utr1Date}"), + editableCell(index, + "${freightBill.trasnporterInvoiceNo}"), + editableCell(index, + "${freightBill.trasnporterInvoiceNoDate}"), + editableCell( + index, "${freightBill.billingQty}"), + editableCell(index, "${freightBill.uom}"), + editableCell( + index, "${freightBill.freightAmount}"), + editableCell(index, "${freightBill.cgst}"), + editableCell(index, "${freightBill.sgst}"), + editableCell(index, "${freightBill.igst}"), + editableCell(index, "${freightBill.totalGst}"), + editableCell(index, "${freightBill.totalGst}"), + ], + ); + }), + ), + ), + ), + ), + ), + ), + ], + ), + actions: [ + CommonBtn( + bkClr: Colors.white, + text: AppStrings.back, + clickAction: () { + Get.back(); + }, + ), + ], + ); + }, + ); + } +} diff --git a/lib/feature/presentation/screens/transporter/view/transport_view.dart b/lib/feature/presentation/screens/transporter/view/transport_view.dart new file mode 100644 index 0000000..d0fd5aa --- /dev/null +++ b/lib/feature/presentation/screens/transporter/view/transport_view.dart @@ -0,0 +1,397 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:shayog/components/common/custom_drop_down.dart'; + +import '../../../../../../components/common/common_btn.dart'; + +import '../../../../../../components/styles/app_colors.dart'; +import '../../../../../../components/styles/app_images.dart'; +import '../../../../../../components/styles/app_strings.dart'; +import '../view_model/transport_controller.dart'; +import 'sub_views/generate_fright_bill.dart'; +import 'sub_views/pending_generation.dart'; +import 'sub_views/view_freight_bill.dart'; + +class TransportView extends StatefulWidget { + const TransportView({super.key}); + + @override + State createState() => _TransportViewState(); +} + +class _TransportViewState extends State { + final ctrl = Get.put(TransportController()); + + @override + Widget build(BuildContext context) { + return ListView( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: MediaQuery.of(context).size.height, + width: 80, + color: AppColors.primaryClr, + child: ListView.separated( + shrinkWrap: true, + padding: EdgeInsets.zero, + scrollDirection: Axis.vertical, + itemBuilder: (context, index) { + return Obx( + () => InkWell( + onTap: () { + ctrl.selectedIndex.value = index; + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.symmetric(horizontal: 16), + height: 80, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: ctrl.selectedIndex.value == index + ? Colors.white + : AppColors.primaryClr, + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + ctrl.selectedIndex.value == index + ? ctrl.tabs[index].selectionImg + : ctrl.tabs[index].image), + ), + ), + Text( + ctrl.tabs[index].title ?? "", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 10, + color: Colors.white, + fontWeight: FontWeight.w900), + ) + ], + ), + ), + ); + }, + separatorBuilder: (context, index) { + return SizedBox(height: 0); + }, + itemCount: 3, + ), + ), + Expanded( + child: Obx(() { + switch (ctrl.selectedIndex.value) { + case 0: + return _dashboardView(); + + case 1: + return Center(child: Text('')); + + default: + return Center(child: Text('')); + } + }), + ) + ], + ), + ], + ); + } + + _dashboardView() { + return Column( + children: [ + Container( + color: Colors.white, + padding: EdgeInsets.only(bottom: 16), + margin: EdgeInsets.all(16), + child: Column( + children: [ + Container( + height: 60, + color: AppColors.primaryClr, + child: Row( + children: [ + ListView.separated( + shrinkWrap: true, + padding: EdgeInsets.symmetric(horizontal: 16), + scrollDirection: Axis.horizontal, + itemBuilder: (context, index) { + return Obx( + () => InkWell( + onTap: () { + ctrl.selectedUser.value = index; + }, + child: Container( + margin: EdgeInsets.only(bottom: 10, top: 10), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: ctrl.selectedUser.value == index + ? Colors.white + : AppColors.primaryClr, + width: 3))), + child: Center( + child: Text( + ctrl.userTabs[index].title ?? "", + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w900, + color: Colors.white), + ), + ), + ), + ), + ); + }, + separatorBuilder: (context, index) { + return SizedBox(width: 16); + }, + itemCount: 3, + ), + Spacer(), + InkWell( + + child: Image.asset(AppImages.refresh, + height: 16, width: 16)), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + AppStrings.refresh, + style: TextStyle( + color: AppColors.white, + fontSize: 12, + fontWeight: FontWeight.bold), + ), + ), + Obx(() => + Visibility( + visible: ctrl.selectedUser.value >= 1, + child: InkWell( + onTap: ctrl.toggleContainer, + child: Image.asset(AppImages.filter, + height: 16, width: 16)), + ), + ), + Visibility( + visible: ctrl.selectedUser.value >= 1, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + AppStrings.filter, + style: TextStyle( + color: AppColors.white, + fontSize: 12, + fontWeight: FontWeight.bold), + ), + ), + ), + ], + ), + ), + Obx( + () => ctrl.isSelected.value + ? Container( + margin: EdgeInsets.symmetric(vertical: 16), + padding: EdgeInsets.all(16), + color: AppColors.clrF2, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _commonText( + "Plant", + ), + SizedBox(height: 8), + CustomDropdown( + backClr: AppColors.clrD9, + borderClr: AppColors.clrGrey, + items: ctrl.plantList, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + ctrl.selectedPlant.value = selected; + } + }, + hintText: 'Select Plant'), + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _commonText( + "Freight Bill No.", + ), + SizedBox(height: 8), + CustomDropdown( + backClr: AppColors.clrD9, + borderClr: AppColors.clrGrey, + items: ctrl.freightBillList, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + ctrl.selectedFreight.value = selected; + } + }, + hintText: 'Select Freight Number'), + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _commonText( + "Product Name", + ), + SizedBox(height: 8), + CustomDropdown( + backClr: AppColors.clrD9, + borderClr: AppColors.clrGrey, + items: ctrl.plantList, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + ctrl.selectedPlant.value = selected; + } + }, + hintText: 'Select Product'), + ], + )), + ], + ), + Padding( + padding: const EdgeInsets.only( + top: 16.0, left: 8, right: 8), + child: Row( + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + _commonText( + "Plant", + ), + SizedBox(height: 8), + CustomDropdown( + backClr: AppColors.clrD9, + borderClr: AppColors.clrGrey, + items: ctrl.plantList, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + ctrl.selectedPlant.value = selected; + } + }, + hintText: 'Select Product'), + + + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + _commonText( + "Trancastion Type", + ), + SizedBox(height: 8), + CustomDropdown( + backClr: AppColors.clrD9, + borderClr: AppColors.clrGrey, + items: ctrl.plantList, + itemLabel: (item) => item, + onSelected: (selected) { + if (selected != null) { + ctrl.selectedPlant.value = selected; + } + }, + hintText: 'Select Product'), + + + ], + )), + SizedBox(width: 16), + Expanded( + child: Column( + children: [ + _commonText( + "" , + ), + SizedBox(height: 8), + Row( + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + CommonBtn( + bkClr: Colors.white, + text: AppStrings.cancel, clickAction: () { + ctrl.isSelected.value = false; + },), + SizedBox(width: 16), + CommonBtn( + text: AppStrings.submit, + textClr: Colors.white, clickAction: () { + ctrl.isSelected.value = false; + }, + ), + ], + ), + ], + ), + ), + ], + ), + ), + + + ], + ), + ) + : SizedBox(), + ), + Obx(() { + switch (ctrl.selectedUser.value) { + case 0: + return GenerateFrightBill(); + case 1: + return ViewFreightBill(); + default: + return PendingGeneration(); + } + }), + ], + ), + ) + ], + ); + } + _commonText(String title) { + return Text( + title, + style: TextStyle( + fontSize: 13, color: Colors.black, fontWeight: FontWeight.w900), + ); + } + +} diff --git a/lib/feature/presentation/screens/transporter/view_model/transport_controller.dart b/lib/feature/presentation/screens/transporter/view_model/transport_controller.dart new file mode 100644 index 0000000..2d2d430 --- /dev/null +++ b/lib/feature/presentation/screens/transporter/view_model/transport_controller.dart @@ -0,0 +1,265 @@ +import 'package:flutter/cupertino.dart'; +import 'package:get/get.dart'; +import 'package:intl/intl.dart'; + +import 'package:shayog/components/styles/app_images.dart'; +import 'package:shayog/services/network/get_requests.dart'; + +import '../../../../../../components/common/common_model.dart'; +import '../../../../../../components/styles/app_strings.dart'; + +import '../../../../../../services/model/generate_freight_model.dart'; +import '../../../../../../services/network/post_request.dart'; +import '../model/view_freight_bill_res_model.dart'; + +class TransportController extends GetxController { + final ScrollController horizontalScrollController = ScrollController(); + final ScrollController verticalScrollController = ScrollController(); + var selectedIndex = 0.obs; + var selectedUser = 0.obs; + var selectPlant = ''.obs; + var selectProduct = ''.obs; + var selectLocation = ''.obs; + var selectTransactionType = ''.obs; + var selectedItem = false.obs; + var grnDetails = [].obs; + var product = [].obs; + var plant = [].obs; + var freightBill = [].obs; + var fromLocation = [].obs; + var grnList = [].obs; + RxBool selectAllField = false.obs; + + void toggleSelection(int index, bool? value) { + grnDetails[index].isSelected = value!; + grnDetails.refresh(); + } + + void selectAll(bool value) { + for (var item in grnDetails) { + item.isSelected = value; + } + selectAllField.value = value; + grnDetails.refresh(); + } + + @override + void onInit() { + getFreightBills(); + viewFreightView(); + super.onInit(); + } + + var transactionType = ['STO', 'InBound']; + + RxList tabs = [ + CommonModel( + title: "Freight Bill\nManagement", + image: AppImages.freightBillManage, + selectionImg: AppImages.freightBillBlue), + CommonModel( + title: "Invoice\nManagement", + image: AppImages.inVoiceManage, + selectionImg: AppImages.invoiceManageBlue), + CommonModel( + title: "Report", + image: AppImages.report, + selectionImg: AppImages.reportBlue), + ].obs; + RxList userTabs = [ + CommonModel(title: AppStrings.generateFreightBill), + CommonModel(title: AppStrings.viewFreightBill), + CommonModel(title: AppStrings.pendingGeneration), + ].obs; + + var isLoading = true.obs; + var grnListLoader = true.obs; + var freightViewLoader = true.obs; + var generateBill = true.obs; + var errorMessage = ''.obs; + + postData() async { + try { + isLoading.value = true; + + Map requestBody = { + "plant": selectPlant.value, + "productNane": selectProduct.value, + "transactionType": selectTransactionType.value, + "fromLocation": selectLocation.value, + "grnFromDate": "", + "grnToDate": "" + }; + + var response = await PostRequests.addFreightBill(requestBody); + if (response != null) { + List flattenedContent = + response.content!.expand((list) => list).toList(); + grnDetails.assignAll(flattenedContent); + } + } finally { + isLoading.value = false; + } + } + + getFreightBills() async { + try { + isLoading.value = true; + + var response = await GetRequests.getFreightBill(); + if (response != null) { + plant.assignAll(response.plant ?? []); + product.assignAll(response.prodect ?? []); + freightBill.assignAll(response.freightBill ?? []); + fromLocation.assignAll(response.fromLocation ?? []); + } + } finally { + isLoading.value = false; + } + } + + final fromTextFieldKey = GlobalKey(); + TextEditingController fromController = TextEditingController(); + DateTime fromSelectedDate = DateTime.now(); // Initialize with a default value + + RxBool dateCheck = false.obs; + RxBool resourceCheck = false.obs; + RxBool lineCheck = false.obs; + + String getFormattedDate(DateTime date) { + return "${date.day.toString().padLeft(2, '0')}-${date.month.toString().padLeft(2, '0')}-${date.year}"; + } + + RxString freightBillNo = "".obs; + + RxBool isSelected = false.obs; + + void toggleContainer() { + isSelected.value = true; + print("isSelected.value..${isSelected.value}"); + } + + RxString selectedPlant = "".obs; + List plantList = [ + "Plant 1", + "Plant 2", + "Plant 3", + "Plant 4", + "Plant 5", + ]; + RxString selectedFreight = "".obs; + List freightBillList = [ + "Plant 1", + "Plant 2", + "Plant 3", + "Plant 4", + "Plant 5", + ]; + + addFreightBill() async { + try { + grnListLoader.value = true; + + // Filter the selected rows + final List> selectedGrns = grnDetails + .where((grn) => grn.isSelected) // Get only the selected rows + .map((grn) => { + "grn_id": grn.grnId, + "grn_no": grn.grnNo, + "plant_code": grn.plantCode, + "material_code": grn.materialCode, + "transporter_code": grn.transporterCode, + "grn_date": grn.grnDate?.toIso8601String(), + "from_location": grn.fromLocation, + "vehicle_no": grn.vehicleNo, + "lr_no": grn.lrNo, + "lr_date": grn.lrDate?.toIso8601String(), + "disp_qty": grn.dispQty, + "net_qty": grn.netQty, + "billing_qty": grn.billingQty, + "freight_rate": grn.freightRate, + "shipment_cost": grn.shipmentCost, + "status_id": grn.statusId + }) + .toList(); + + // Only send the selected data in the request body + var response = await PostRequests.freightBill(selectedGrns); + + print("Selected GRNs>>>${selectedGrns}"); + + if (response != null) { + freightBillNo.value = response.freightBillNo ?? ""; + grnList.assignAll(response.grn ?? []); + } + } finally { + grnListLoader.value = false; + } + } + + /////////////////////// PRIYA //////////////////// + var freightBillData = [].obs; + var currentPage = 0.obs; + var totalPages = 0.obs; + var totalElements = 0.obs; + var pageSize = 2.obs; + var sortField = "grn_date".obs; + var sortDirection = "desc".obs; + + viewFreightView({int? page, String? sort, String? direction}) async { + try { + freightViewLoader.value = true; + + currentPage.value = page ?? currentPage.value; + if (sort != null) sortField.value = sort; + if (direction != null) sortDirection.value = direction; + + Map requestBody = { + "plant": "", + "productNane": "", + "freightBillNo": "", + "transactionType": "", + "fromLocation": "", + "grnFromDate": "", + "grnToDate": "", + "page": currentPage.toString(), + "size": pageSize.toString(), + "sort": "${sortField.value},${sortDirection.value}" + }; + + var response = await PostRequests.viewFreightBill(requestBody); + if (response != null) { + List flattenedContent = + response.content!.expand((list) => list).toList(); + freightBillData.assignAll(flattenedContent); + + totalPages.value = response.totalPages ?? 0; + totalElements.value = response.totalElements ?? 0; + } + } finally { + freightViewLoader.value = false; + } + } + + void nextPage() { + if (currentPage < totalPages.value - 1) { + viewFreightView(page: currentPage.value + 1); + } + } + + void previousPage() { + if (currentPage > 0) { + viewFreightView(page: currentPage.value - 1); + } + } + + void changeSort(String field) { + if (field == sortField.value) { + sortDirection.value = sortDirection.value == "asc" ? "desc" : "asc"; + } else { + sortField.value = field; + sortDirection.value = "desc"; + } + viewFreightView(page: 0); + } +} diff --git a/lib/feature/presentation/screens/transporter/widgets/common_card.dart b/lib/feature/presentation/screens/transporter/widgets/common_card.dart new file mode 100644 index 0000000..bde599c --- /dev/null +++ b/lib/feature/presentation/screens/transporter/widgets/common_card.dart @@ -0,0 +1,148 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:shayog/components/styles/textStyles.dart'; + +import '../../../../../components/common/common_button.dart'; +import '../../../../../components/styles/app_colors.dart'; + +class CommonAlertDialog { + CommonAlertDialog._(); + + static showDialog({ + required String message, + String? negativeText, + required String positiveText, + bool? isShowNegButton, + required VoidCallback negativeBtCallback, + bool? dismissable, + required VoidCallback positiveBtCallback, + Widget? widget, + }) { + Get.dialog( + Dialog( + backgroundColor: Colors.white, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + child: CommonDialogContent( + message: message, + negativeText: negativeText, + positiveText: positiveText, + isShowNegButton: isShowNegButton, + positiveBtCallback: positiveBtCallback, + negativeBtCallback: negativeBtCallback, + widget: widget, + ), + ), + barrierDismissible: dismissable ?? true); + } +} + +class CommonDialogContent extends StatelessWidget { + CommonDialogContent( + {Key? key, + required this.message, + this.negativeText, + required this.positiveText, + this.isShowNegButton, + required this.positiveBtCallback, + required this.negativeBtCallback, + this.widget}) + : super(key: key); + + String message; + String? negativeText; + String? positiveText; + bool? isShowNegButton; + VoidCallback positiveBtCallback; + VoidCallback negativeBtCallback; + Widget? widget; + + @override + Widget build(BuildContext context) { + return SizedBox( + width: 150, + child: ListView( + shrinkWrap: true, + children: [ + widget ?? + Container( + margin: EdgeInsets.only(bottom: 16), + decoration: BoxDecoration( + color: AppColors.primaryClr, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(6), + topRight: Radius.circular(6))), + padding: const EdgeInsets.all(8.0), + child: Align( + alignment: Alignment.bottomRight, + child: InkWell( + onTap: () { + Get.back(); + }, + child: CircleAvatar( + radius: 12, + backgroundColor: AppColors.white, + child: Icon( + Icons.close, + color: AppColors.primaryClr, + size: 12, + )), + ), + ), + ), + + Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Text( + message.tr, + textAlign: TextAlign.center, + style: TextStyle( + fontWeight: FontWeight.bold, fontSize: 12, color: Colors.black), + // style: 14.txtBoldBlack, + ), + ), + Row( + children: [ + Expanded( + child: CommonButton( + textStyle: TextStyle( + fontSize: 10, + color: AppColors.primaryClr, + fontWeight: FontWeight.bold), + borderColor: AppColors.primaryClr, + backgroundColor: Colors.white, + borderRadius: 4, + height: 28, + margin: + EdgeInsets.only(top: 10, bottom: 10, left: 24, right: 4), + text: negativeText ?? "", + clickAction: negativeBtCallback, + elevation: 0, + marginHorizontal: 0, + ), + ), + Expanded( + child: CommonButton( + textStyle: TextStyle( + fontSize: 10, + color: AppColors.primaryClr, + fontWeight: FontWeight.bold), + borderColor: AppColors.primaryClr, + backgroundColor: Colors.white, + borderRadius: 4, + height: 28, + margin: + EdgeInsets.only(top: 10, bottom: 10, left: 2, right: 24), + text: positiveText ?? "", + clickAction: positiveBtCallback, + elevation: 0, + marginHorizontal: 0, + ), + ), + ], + ), + SizedBox(height: 16), + ], + ), + ); + } +} diff --git a/lib/feature/presentation/screens/transporter/widgets/freightbill_dialog.dart b/lib/feature/presentation/screens/transporter/widgets/freightbill_dialog.dart new file mode 100644 index 0000000..8967d01 --- /dev/null +++ b/lib/feature/presentation/screens/transporter/widgets/freightbill_dialog.dart @@ -0,0 +1,289 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import '../../../../../../components/common/common_btn.dart'; +import '../../../../../../components/common/data_cell.dart'; +import '../../../../../../components/styles/app_colors.dart'; +import '../../../../../../components/styles/app_strings.dart'; +import '../view_model/transport_controller.dart'; + class CommonDialog{ + static showDialog({ + + required String message, + + required VoidCallback onclick, + + }) { + Get.dialog( + Dialog( + backgroundColor: Colors.white, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + child: DialogContent(onClick: onclick, + message: message, + + + ), + ), + barrierDismissible: true + ); + } +} +class DialogContent extends StatelessWidget { + DialogContent({super.key,this.message,required this.onClick}); +String? message; + VoidCallback onClick; + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.all(16), + width: 120, + child: Column( + mainAxisSize: MainAxisSize.min + , + + + children: [ + Text( + message ?? "Please Select GRN Details", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12, + color: AppColors.black, + fontWeight: FontWeight.bold), + ), + CommonBtn( + margin: EdgeInsets.only(top: 16), + width: 80, + + borderClr: AppColors.primaryClr, + bkClr: Colors.white, + clickAction: onClick, + // clickAction: () { + // Get.back(); + // }, + text:"OK", + style: TextStyle( + fontSize: 14, + color:AppColors.primaryClr, + fontWeight: FontWeight.bold),) + + + ], + ), + ); + } +} + +void showPopup({ required BuildContext context, String? message,required VoidCallback onClick}) { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + backgroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), // Border radius here + ), + contentPadding: EdgeInsets.zero, + content: Container( + padding: EdgeInsets.all(16), + width: 120, + child: Column( + mainAxisSize: MainAxisSize.min + , + + + children: [ + Text( + message ?? "Please Select GRN Details", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12, + color: AppColors.black, + fontWeight: FontWeight.bold), + ), + CommonBtn( + margin: EdgeInsets.only(top: 16), + width: 80, + + borderClr: AppColors.primaryClr, + bkClr: Colors.white, + clickAction: onClick, + // clickAction: () { + // Get.back(); + // }, + text:"OK", + style: TextStyle( + fontSize: 14, + color:AppColors.primaryClr, + fontWeight: FontWeight.bold),) + + + ], + ), + ), + ); + }, + ); +} + +void showFreightBill(BuildContext context) { + final controller = Get.put(TransportController()); + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + backgroundColor: AppColors.primaryClr, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(0.0), // Border radius here + ), + contentPadding: EdgeInsets.zero, + content: Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: InkWell( + onTap: () { + Get.back(); + }, + child: CircleAvatar( + radius: 12, + backgroundColor: AppColors.white, + child: Icon( + Icons.close, + color: AppColors.primaryClr, + size: 16, + )), + ), + ), + Container( + padding: + EdgeInsets.only(top: 24, left: 16, right: 16, bottom: 16), + color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(right: 13), + height: 20, + width: 20, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.white, + border: Border.all(color: AppColors.green)), + child: Center( + child: Icon( + Icons.done_rounded, + color: AppColors.green, + size: 16, + ), + )), + Text( + "Freight Bill Generate Successfully", + style: TextStyle( + fontSize: 12, + color: AppColors.green, + fontWeight: FontWeight.bold), + ), + ], + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Obx(() => + Text( + "Freight Bill No: ${controller.freightBillNo.value}", + style: TextStyle( + fontSize: 12, + color: AppColors.black, + fontWeight: FontWeight.bold), + ), + ), + ), + Obx(() { + if (controller.grnListLoader.value) { + return Center(child: CircularProgressIndicator()); + } + + if (controller.errorMessage.isNotEmpty) { + return Center(child: Text(controller.errorMessage.value)); + } + + if (controller.grnList.isEmpty) { + return Center(child: Text('No data available.')); + } + return Scrollbar( + thumbVisibility: true, + controller: controller.horizontalScrollController, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + controller: controller.horizontalScrollController, + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey.shade400, + width: 1.0, + ), + ), + child: DataTable( + dataRowHeight: 28, + headingRowHeight: 38, + headingRowColor: WidgetStateProperty.all(AppColors.clrF2), + border: TableBorder( + horizontalInside: BorderSide(color: AppColors.clrGrey), + verticalInside: BorderSide(color: AppColors.clrGrey), + bottom: BorderSide(color: AppColors.clrGrey), + left: BorderSide(color: AppColors.clrGrey), + right: BorderSide(color: AppColors.clrGrey), + top: BorderSide(color: AppColors.clrGrey), + ), + + columns: [ + dataColumn(AppStrings.srNo), + dataColumn(AppStrings.mrnNo), + ], + rows: List.generate( + controller.grnList.length, (index) { + final stoppage = controller.grnList[index]; + + return DataRow( + cells: [ + editableCell(index, "0$index"), + editableCell(index, stoppage), + ], + ); + }), + ), + ), + ), + ); + }), + Align( + alignment: Alignment.bottomRight, + child: CommonBtn( + textClr: AppColors.primaryClr, + borderClr: AppColors.primaryClr, + bkClr: Colors.white, + margin: EdgeInsets.only(top: 24), + text: "Done", + clickAction: (){}), + ) + ], + ), + ) + ], + ), + ); + }, + ); +} + + + + + + diff --git a/lib/feature/presentation/widgets/custom_table.dart b/lib/feature/presentation/widgets/custom_table.dart new file mode 100644 index 0000000..e176e79 --- /dev/null +++ b/lib/feature/presentation/widgets/custom_table.dart @@ -0,0 +1,25 @@ +import 'package:flutter/material.dart'; + +class CustomTable extends StatelessWidget { + CustomTable({super.key,this.text,this.isHeader = false}); +String? text; +bool? isHeader; + @override + Widget build(BuildContext context) { + return Expanded( + child: Container( + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + border: Border.all(color: Colors.black), + color: isHeader == false ? Colors.white : Colors.grey[300], + ), + child: Text( + text ?? "", + style: TextStyle( + fontWeight: isHeader == false ? FontWeight.normal : FontWeight.bold, + ), + ), + ), + ); + } +} diff --git a/lib/feature/presentation/widgets/text_view.dart b/lib/feature/presentation/widgets/text_view.dart new file mode 100644 index 0000000..1bad08b --- /dev/null +++ b/lib/feature/presentation/widgets/text_view.dart @@ -0,0 +1,46 @@ + +import 'package:flutter/material.dart'; +import 'package:shayog/components/styles/textStyles.dart'; + +class TextView extends StatelessWidget { final String text; +final dynamic color; +final dynamic underlineColor; +final TextStyle? style; final bool? underline; final bool? strikeThrough; final dynamic textSize; final bool? capitalise; final int? maxlines; +final TextAlign? textAlign; final String? fontFamily; +final FontWeight? fontWeight; final double? lineHeight; +final FontStyle? fontStyle; +final double? letterSpacing; +final TextOverflow ?overflow; +final EdgeInsets? margin; +final Function()? onTap; +const TextView( {super.key, required this.text, + this.color, + this.style, + this.maxlines, + this.textAlign, + this.underline, + this.textSize, + this.fontFamily, + this.fontWeight, + this.lineHeight, + this.fontStyle, + this.underlineColor, this.strikeThrough, + this.capitalise, + this.letterSpacing, + this.overflow, this.margin, this.onTap}); +@override +Widget build(BuildContext context) { + return + + Padding( + padding: margin ?? EdgeInsets.zero, child: GestureDetector( + onTap: onTap, child: Text( + capitalise != null && capitalise! ? text.toUpperCase() : text, maxLines: maxlines, + overflow: maxlines != null ? TextOverflow.ellipsis : null, textAlign: textAlign, + style: style ?? 14.txtRegularBlack, + ), ), + ); + + +} +} diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..b039c50 --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:sizer/sizer.dart'; +import 'feature/presentation/screens/dashboard/dashboard_screen.dart'; + + +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatelessWidget { + const MyApp({super.key}); + + @override + Widget build(BuildContext context) { + return Sizer( + builder: (context, orientation, deviceType) { + return GetMaterialApp( + debugShowCheckedModeBanner: false, + title: 'Shayog', + home: DashboardScreen(), + ); + }); + } +} + diff --git a/lib/services/model/common_res_model.dart b/lib/services/model/common_res_model.dart new file mode 100644 index 0000000..1fdcc3e --- /dev/null +++ b/lib/services/model/common_res_model.dart @@ -0,0 +1,9 @@ +class CommonResModel { + int statusCode; + String? errorMessage; + String? response; + + CommonResModel({required this.statusCode, this.errorMessage, this.response}); + + +} \ No newline at end of file diff --git a/lib/services/model/generate_bill_res_model.dart b/lib/services/model/generate_bill_res_model.dart new file mode 100644 index 0000000..e2f7651 --- /dev/null +++ b/lib/services/model/generate_bill_res_model.dart @@ -0,0 +1,27 @@ + + +import 'dart:convert'; + +GenerateBillsResModel generateBillsResModelFromJson(String str) => GenerateBillsResModel.fromJson(json.decode(str)); + +String generateBillsResModelToJson(GenerateBillsResModel data) => json.encode(data.toJson()); + +class GenerateBillsResModel { + final String? freightBillNo; + final List? grn; + + GenerateBillsResModel({ + this.freightBillNo, + this.grn, + }); + + factory GenerateBillsResModel.fromJson(Map json) => GenerateBillsResModel( + freightBillNo: json["freightBillNo"], + grn: json["grn"] == null ? [] : List.from(json["grn"]!.map((x) => x)), + ); + + Map toJson() => { + "freightBillNo": freightBillNo, + "grn": grn == null ? [] : List.from(grn!.map((x) => x)), + }; +} diff --git a/lib/services/model/generate_freight_model.dart b/lib/services/model/generate_freight_model.dart new file mode 100644 index 0000000..cd13bfc --- /dev/null +++ b/lib/services/model/generate_freight_model.dart @@ -0,0 +1,246 @@ + + +import 'dart:convert'; + +GenerateFreightBills generateFreightBillsFromJson(String str) => GenerateFreightBills.fromJson(json.decode(str)); + +String generateFreightBillsToJson(GenerateFreightBills data) => json.encode(data.toJson()); + +class GenerateFreightBills { + final List>? content; + final Pageable? pageable; + final bool? last; + final int? totalElements; + final int? totalPages; + final int? size; + final int? number; + final Sort? sort; + final bool? first; + final int? numberOfElements; + final bool? empty; + + + GenerateFreightBills({ + this.content, + this.pageable, + this.last, + this.totalElements, + this.totalPages, + this.size, + this.number, + this.sort, + this.first, + this.numberOfElements, + this.empty, + }); + + factory GenerateFreightBills.fromJson(Map json) => GenerateFreightBills( + content: json["content"] == null ? [] : List>.from(json["content"]!.map((x) => List.from(x.map((x) => Content.fromJson(x))))), + pageable: json["pageable"] == null ? null : Pageable.fromJson(json["pageable"]), + last: json["last"], + totalElements: json["totalElements"], + totalPages: json["totalPages"], + size: json["size"], + number: json["number"], + sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]), + first: json["first"], + numberOfElements: json["numberOfElements"], + empty: json["empty"], + ); + + Map toJson() => { + "content": content == null ? [] : List.from(content!.map((x) => List.from(x.map((x) => x.toJson())))), + "pageable": pageable?.toJson(), + "last": last, + "totalElements": totalElements, + "totalPages": totalPages, + "size": size, + "number": number, + "sort": sort?.toJson(), + "first": first, + "numberOfElements": numberOfElements, + "empty": empty, + }; +} + +class Content { + final int? grnId; + final String? grnNo; + final String? plantCode; + final String? materialCode; + final CodeValue? codeValue; + final String? transporterCode; + final DateTime? grnDate; + final String? fromLocation; + final String? vehicleNo; + // final FromLocation? fromLocation; + // final VehicleNo? vehicleNo; + final String? lrNo; + final DateTime? lrDate; + final double? dispQty; + final double? netQty; + final double? billingQty; + final int? freightRate; + final double? shipmentCost; + final int? statusId; + bool isSelected; + + Content({ + this.grnId, + this.grnNo, + this.plantCode, + this.materialCode, + this.codeValue, + this.transporterCode, + this.grnDate, + this.fromLocation, + this.vehicleNo, + this.lrNo, + this.lrDate, + this.dispQty, + this.netQty, + this.billingQty, + this.freightRate, + this.shipmentCost, + this.statusId, + this.isSelected = false, + }); + + factory Content.fromJson(Map json) => Content( + grnId: json["grn_id"], + grnNo: json["grn_no"], + plantCode: json["plant_code"], + materialCode: json["material_code"], + codeValue: codeValueValues.map[json["code_value"]]!, + transporterCode: json["transporter_code"], + grnDate: json["grn_date"] == null ? null : DateTime.parse(json["grn_date"]), + // fromLocation: fromLocationValues.map[json["from_location"]]!, + // vehicleNo: vehicleNoValues.map[json["vehicle_no"]]!, + fromLocation: json["from_location"]!, + vehicleNo: json["vehicle_no"]!, + lrNo: json["lr_no"], + lrDate: json["lr_date"] == null ? null : DateTime.parse(json["lr_date"]), + dispQty: json["disp_qty"]?.toDouble(), + netQty: json["net_qty"]?.toDouble(), + billingQty: json["billing_qty"]?.toDouble(), + freightRate: json["freight_rate"], + shipmentCost: json["shipment_cost"]?.toDouble(), + statusId: json["status_id"], + ); + + Map toJson() => { + "grn_id": grnId, + "grn_no": grnNo, + "plant_code": plantCode, + "material_code": materialCode, + "code_value": codeValueValues.reverse[codeValue], + "transporter_code": transporterCode, + "grn_date": "${grnDate!.year.toString().padLeft(4, '0')}-${grnDate!.month.toString().padLeft(2, '0')}-${grnDate!.day.toString().padLeft(2, '0')}", + "from_location": fromLocationValues.reverse[fromLocation], + "vehicle_no": vehicleNoValues.reverse[vehicleNo], + "lr_no": lrNo, + "lr_date": "${lrDate!.year.toString().padLeft(4, '0')}-${lrDate!.month.toString().padLeft(2, '0')}-${lrDate!.day.toString().padLeft(2, '0')}", + "disp_qty": dispQty, + "net_qty": netQty, + "billing_qty": billingQty, + "freight_rate": freightRate, + "shipment_cost": shipmentCost, + "status_id": statusId, + }; +} + +enum CodeValue { + INBOUND +} + +final codeValueValues = EnumValues({ + "INBOUND": CodeValue.INBOUND +}); + +enum FromLocation { + NOIDA_UP_TEST +} + +final fromLocationValues = EnumValues({ + "NOIDA(UP-TEST)": FromLocation.NOIDA_UP_TEST +}); + +enum VehicleNo { + RJ07_GC9764 +} + +final vehicleNoValues = EnumValues({ + "RJ07GC9764": VehicleNo.RJ07_GC9764 +}); + +class Pageable { + final Sort? sort; + final int? offset; + final int? pageSize; + final int? pageNumber; + final bool? unpaged; + final bool? paged; + + Pageable({ + this.sort, + this.offset, + this.pageSize, + this.pageNumber, + this.unpaged, + this.paged, + }); + + factory Pageable.fromJson(Map json) => Pageable( + sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]), + offset: json["offset"], + pageSize: json["pageSize"], + pageNumber: json["pageNumber"], + unpaged: json["unpaged"], + paged: json["paged"], + ); + + Map toJson() => { + "sort": sort?.toJson(), + "offset": offset, + "pageSize": pageSize, + "pageNumber": pageNumber, + "unpaged": unpaged, + "paged": paged, + }; +} + +class Sort { + final bool? empty; + final bool? sorted; + final bool? unsorted; + + Sort({ + this.empty, + this.sorted, + this.unsorted, + }); + + factory Sort.fromJson(Map json) => Sort( + empty: json["empty"], + sorted: json["sorted"], + unsorted: json["unsorted"], + ); + + Map toJson() => { + "empty": empty, + "sorted": sorted, + "unsorted": unsorted, + }; +} + +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/services/network/ApiUrls.dart b/lib/services/network/ApiUrls.dart new file mode 100644 index 0000000..7962463 --- /dev/null +++ b/lib/services/network/ApiUrls.dart @@ -0,0 +1,36 @@ +class ApiUrls { + ApiUrls._(); + + static const String baseUrl = "http://localhost:9098/"; + static const String baseUrlImage = + "https://codingacademy.world/early_eyes/public/images/user/"; + static const addFreightBill = + 'bill/grndetails?page=0&size=20&sort=grn_date,desc'; + static const getFreightBills = 'bill/dropdown'; + static const generateFreightBill = + 'http://localhost:9098/bill/addFreightBill'; + static const createUser = 'http://localhost:9090/api/users/createUser'; + static const editUser = + 'http://localhost:9090/api/users/update?userEmpTransCode='; + static const getAllUser = + 'http://localhost:9090/api/users/userdetails?page=0&size=8&sort=last_updated_on,desc'; + + static const viewFreightBill = + 'http://localhost:9098/bill/freightbill?page=0&size=20&sort=grn_date,desc'; + static const addUserType = + 'http://localhost:9090/api/user-types/createUserType'; + static const dropDownList = + 'http://localhost:9090/api/user-roles/userrole_dropdown'; + static const plantMapping = 'http://localhost:9090/userplant/fetchPlants'; + static const checkStatus = + 'http://localhost:9090/api/user-types/update-status/'; + + static const getInternalUserDropdown = + 'http://localhost:9090/api/user-roles/userrole_dropdown'; + static const fetchEmailsAndEmpCode = + 'http://localhost:9090/api/user-roles/fetchRoles'; + static const selectAndAssignRole = + "http://localhost:9090/api/user-roles/assignRoles"; + static const assignPlantRole = "http://localhost:9090/userplant/assignPlants"; + static const userTypeDetails = "http://localhost:9090/api/user-types/usertypedetails?page=0&size=15&sort=last_updated_on,desc"; +} diff --git a/lib/services/network/delete_request.dart b/lib/services/network/delete_request.dart new file mode 100644 index 0000000..9ab8cb4 --- /dev/null +++ b/lib/services/network/delete_request.dart @@ -0,0 +1,18 @@ + +import 'package:shayog/services/network/remote_services.dart'; + +import 'ApiUrls.dart'; + +class DeleteRequests { + DeleteRequests._(); + + // static Future deleteChild(String id) async { + // var apiResponse = await RemoteService.simpleDelete( + // '${ApiUrls.deleteChild}$id'); + // if (apiResponse != null) { + // return deleteChildResModelFromJson(apiResponse.response!); + // } else { + // return null; + // } + // } +} \ No newline at end of file diff --git a/lib/services/network/get_requests.dart b/lib/services/network/get_requests.dart new file mode 100644 index 0000000..7f60456 --- /dev/null +++ b/lib/services/network/get_requests.dart @@ -0,0 +1,40 @@ +import 'package:shayog/feature/presentation/screens/admin/user_management/model/get_internal_user_model.dart'; +import 'package:shayog/services/network/remote_services.dart'; + +import '../../feature/presentation/screens/admin/user_management/model/dropdown_res_model.dart'; +import '../../feature/presentation/screens/transporter/model/freightbill_res_model.dart'; +import 'ApiUrls.dart'; + +class GetRequests { + GetRequests._(); + + static Future getFreightBill() async { + var apiResponse = + await RemoteService.simpleGet("${ApiUrls.getFreightBills}"); + if (apiResponse != null) { + return freightBillsResModelFromJson(apiResponse.response!); + } else { + return null; + } + } + + static Future dropDownList() async { + var apiResponse = await RemoteService.getData("${ApiUrls.dropDownList}"); + if (apiResponse != null) { + return dropDownResModelFromJson(apiResponse.response!); + } else { + return null; + } + } + + static Future getInternalUserDropDown() async { + var apiResponse = + await RemoteService.simpleGet9090(ApiUrls.getInternalUserDropdown); + if (apiResponse != null) { + print('valuess ${apiResponse.response}'); + return internalUserDropModelFromJson(apiResponse.response!); + } else { + return null; + } + } +} diff --git a/lib/services/network/post_request.dart b/lib/services/network/post_request.dart new file mode 100644 index 0000000..5c9947d --- /dev/null +++ b/lib/services/network/post_request.dart @@ -0,0 +1,184 @@ +import 'package:shayog/feature/presentation/screens/admin/user_management/model/check_status_res_model.dart'; +import 'package:shayog/feature/presentation/screens/admin/user_management/model/create_user_model.dart'; +import 'package:shayog/feature/presentation/screens/admin/user_management/model/plant_mapping_res_model.dart'; +import 'package:shayog/services/network/remote_services.dart'; +import '../../feature/presentation/screens/admin/user_management/model/assign_plants_res_model.dart'; +import '../../feature/presentation/screens/admin/user_management/model/edit_user_res_model.dart'; +import '../../feature/presentation/screens/admin/user_management/model/fetch_internal_user_model/fetch_internal_user_model.dart'; +import '../../feature/presentation/screens/admin/user_management/model/getAllUserResModel.dart'; +import '../../feature/presentation/screens/admin/user_management/model/select_assign_role_model/select_assign_role_model.dart'; +import '../../feature/presentation/screens/admin/user_management/model/user_type_details_res_model.dart'; +import '../../feature/presentation/screens/admin/user_management/model/user_type_res_model.dart'; +import '../../feature/presentation/screens/transporter/model/view_freight_bill_res_model.dart'; +import '../model/generate_bill_res_model.dart'; +import '../model/generate_freight_model.dart'; +import 'ApiUrls.dart'; + +class PostRequests { + PostRequests._(); + + static Future addFreightBill( + Map requestBody) async { + var apiResponse = + await RemoteService.simplePost(requestBody, ApiUrls.addFreightBill); + + if (apiResponse != null) { + return generateFreightBillsFromJson(apiResponse.response!); + } else { + return null; + } + } + + // static Future generateBill( + // Map requestBody) async { + // var apiResponse = await RemoteService.simplePost( + // requestBody, ApiUrls.generateFreightBill); + // + // if (apiResponse != null) { + // return generateFreightBillsFromJson(apiResponse.response!); + // } else { + // return null; + // } + // } + + static Future freightBill( + List> requestBody) async { + var apiResponse = + await RemoteService.postData(requestBody, ApiUrls.generateFreightBill); + + if (apiResponse != null) { + return generateBillsResModelFromJson(apiResponse.response!); + } else { + return null; + } + } + + static Future createUser( + List> requestBody) async { + var apiResponse = + await RemoteService.postData(requestBody, ApiUrls.createUser); + + if (apiResponse != null) { + return createUserResModelFromJson(apiResponse.response!); + } else { + return null; + } + } + + static Future getAllUser( + Map requestBody) async { + var apiResponse = + await RemoteService.postUser(requestBody, ApiUrls.getAllUser); + + if (apiResponse != null) { + return getAllUserResModelFromJson(apiResponse.response!); + } else { + return null; + } + } + + static Future editUser( + Map requestBody, String id) async { + var apiResponse = + await RemoteService.simplePut(requestBody, '${ApiUrls.editUser}$id'); + if (apiResponse != null) { + print( + 'edit api work here ${requestBody.length} and ${ApiUrls.editUser}$id and.. ${apiResponse?.response?.length}'); + return editUserResModelFromJson(apiResponse.response!); + } else { + return null; + } + } + + static Future viewFreightBill( + Map requestBody) async { + var apiResponse = + await RemoteService.postUser(requestBody, ApiUrls.viewFreightBill); + + if (apiResponse != null) { + return viewFreightBillResModelFromJson(apiResponse.response!); + } else { + return null; + } + } + + static Future addUserType( + Map requestBody) async { + var apiResponse = + await RemoteService.postUser(requestBody, ApiUrls.addUserType); + + if (apiResponse != null) { + return userTypeResModelFromJson(apiResponse.response!); + } else { + return null; + } + } + + static Future plantMapping( + Map requestBody) async { + var apiResponse = + await RemoteService.postUser(requestBody, ApiUrls.plantMapping); + + if (apiResponse != null) { + return fetchPlantResModelFromJson(apiResponse.response!); + } else { + return null; + } + } + + + static Future checkStatus( + Map requestBody, int id) async { + var apiResponse = + await RemoteService.simplePatch(requestBody, '${ApiUrls.checkStatus}$id'); + if (apiResponse != null) { + print( + 'edit api work here ${requestBody.length} and ${ApiUrls.checkStatus}$id and.. ${apiResponse.response?.length}'); + return checkStatusResModelFromJson(apiResponse.response!); + } else { + return null; + } + } + + static Future fetchEmailsAndEmpCodes( + Map requestBody) async { + var apiResponse = await RemoteService.postUser( + requestBody, ApiUrls.fetchEmailsAndEmpCode); + if (apiResponse != null) { + return fetchInternalUserModelFromJson(apiResponse.response!); + } else { + return null; + } + } + + static Future selectAssignRole( + Map requestBody) async { + var apiResponse = + await RemoteService.postUser(requestBody, ApiUrls.selectAndAssignRole); + if (apiResponse != null) { + return selectAssignRoleModelFromJson(apiResponse.response!); + } else { + return null; + } + } + static Future selectPlantRole( + Map requestBody) async { + var apiResponse = + await RemoteService.postUser(requestBody, ApiUrls.assignPlantRole); + if (apiResponse != null) { + return assignPlantResModelFromJson(apiResponse.response!); + } else { + return null; + } + } + static Future userTypeDetails( + Map requestBody) async { + var apiResponse = await RemoteService.postUser( + requestBody, ApiUrls.userTypeDetails); + if (apiResponse != null) { + return userTypeDetailsResModelFromJson(apiResponse.response!); + } else { + return null; + } + } +} diff --git a/lib/services/network/remote_services.dart b/lib/services/network/remote_services.dart new file mode 100644 index 0000000..75e0e68 --- /dev/null +++ b/lib/services/network/remote_services.dart @@ -0,0 +1,295 @@ +import 'dart:convert'; +import 'package:flutter/cupertino.dart'; +import 'package:get/get.dart'; +import 'package:http/http.dart' as http; +import 'package:shayog/services/prefrences/prefrences.dart'; +import 'package:shayog/utils/helpers.dart'; +import '../../utils/alert_service.dart'; +import '../model/common_res_model.dart'; +import 'ApiUrls.dart'; + +class RemoteService { + static var client = http.Client(); + + static const String _baseUrl = ApiUrls.baseUrl; + + static Map getHeaders() { + // String? bearerToken = Preferences.getPref(Preferences.authToken) as String?; + Map headers = { + "Accept": "application/json", + "Content-Type": "application/json;charset=utf-8" + }; + // if (bearerToken != null) { + // headers.addAll({"Authorization": "Bearer$bearerToken"});} + return headers; + } + + static Future> getHeadersFileUpload() async { + String? bearerToken = Preferences.getPref(Preferences.authToken) as String?; + Map headers = { + // "Accept": "application/json", + // "Content-Type": "application/json;charset=utf-8" + }; + + if (bearerToken != null) { + headers.addAll({"Authorization": "Bearer $bearerToken"}); + } + return headers; + } + + static Future simplePost( + Map requestBody, String endUrl) async { + var body = json.encode(requestBody); + final response = await http.post(Uri.parse(_baseUrl + endUrl), + headers: getHeaders(), body: body); + print('${response.body}response'); + print(_baseUrl + endUrl); + print('${response.statusCode}response'); + var responseCode = response.statusCode; + + if (Helpers.isResponseSuccessful(responseCode)) { + return CommonResModel(statusCode: responseCode, response: response.body); + } else { + print(response.body); + + try { + final map = jsonDecode(response.body) as Map; + AppAlerts.alert(message: '${map['message']}'); + + throw map['message']; + } catch (e) { + return null; + } + } + } + + static Future simplePut( + Map requestBody, String endUrl) async { + // var isConnected = await InternetConnection.isConnected(); + // + // if (!isConnected) { + // return null; + // } + + Helpers.printLog( + screenName: 'Remote_Service_simple_put', + message: "request_data = $requestBody"); + debugPrint('request_url = ${endUrl}'); + var body = json.encode(requestBody); + final response = + await http.put(Uri.parse(endUrl), headers: getHeaders(), body: body); + + Helpers.printLog( + screenName: 'Remote_Service_simple_put', + message: "response = ${response.body}"); + debugPrint('request_url = ${_baseUrl + endUrl}'); + var responseCode = response.statusCode; + if (Helpers.isResponseSuccessful(responseCode)) { + return CommonResModel(statusCode: responseCode, response: response.body); + } else { + return null; + } + } + static Future simplePatch( + Map requestBody, String endUrl) async { + // var isConnected = await InternetConnection.isConnected(); + // + // if (!isConnected) { + // return null; + // } + + Helpers.printLog( + screenName: 'Remote_Service_simple_put', + message: "request_data = $requestBody"); + debugPrint('request_url = ${endUrl}'); + var body = json.encode(requestBody); + final response = + await http.patch(Uri.parse(endUrl), headers: getHeaders(), body: body); + + Helpers.printLog( + screenName: 'Remote_Service_simple_put', + message: "response = ${response.body}"); + debugPrint('request_url = ${endUrl}'); + var responseCode = response.statusCode; + if (Helpers.isResponseSuccessful(responseCode)) { + return CommonResModel(statusCode: responseCode, response: response.body); + } else { + return null; + } + } + + static Future simpleGet(String endUrl) async { + final response = + await http.get(Uri.parse(_baseUrl + endUrl), headers: getHeaders()); + + Helpers.printLog( + screenName: 'Remote_Service_simple_get', + message: "response = ${response.body}"); + debugPrint('request_url = ${_baseUrl + endUrl}'); + debugPrint('request_headers = ${getHeaders().toString()}'); + var responseCode = response.statusCode; + if (Helpers.isResponseSuccessful(responseCode)) { + return CommonResModel(statusCode: responseCode, response: response.body); + } else { + try { + final map = jsonDecode(response.body) as Map; + AppAlerts.alert(message: '${map['message']}'); + + throw map['message']; + } catch (e) { + return null; + } + } + } + + static Future getData(String endUrl) async { + final response = await http.get(Uri.parse(endUrl), headers: getHeaders()); + + Helpers.printLog( + screenName: 'Remote_Service_simple_get', + message: "response = ${response.body}"); + debugPrint('request_url = ${endUrl}'); + debugPrint('request_headers = ${getHeaders().toString()}'); + var responseCode = response.statusCode; + if (Helpers.isResponseSuccessful(responseCode)) { + return CommonResModel(statusCode: responseCode, response: response.body); + } else { + try { + final map = jsonDecode(response.body) as Map; + AppAlerts.alert(message: '${map['message']}'); + + throw map['message']; + } catch (e) { + return null; + } + } + } + + static Future uploadPhotosPost( + List paths, String endUrl) async { + // var isConnected = await InternetConnection.isConnected(); + // + // if (!isConnected) { + // return null; + // } + + http.MultipartRequest request = + http.MultipartRequest('POST', Uri.parse(_baseUrl + endUrl)); + request.headers.addAll(await getHeadersFileUpload()); + for (String path in paths) { + request.files.add(await http.MultipartFile.fromPath('file', path)); + } + + http.StreamedResponse streamedResponse = await request.send(); + // var responseBytes = await streamedResponse.stream.toBytes(); + // var responseString = utf8.decode(responseBytes); + + var response = await http.Response.fromStream(streamedResponse); + Helpers.printLog( + screenName: 'Remote_Service_upload_photos_post', + message: "response = ${response.body}"); + var responseCode = response.statusCode; + if (Helpers.isResponseSuccessful(responseCode)) { + return CommonResModel(statusCode: responseCode, response: response.body); + } else { + Get.snackbar('error'.tr, 'message_server_error'.tr); + return null; + } + } + + static Future simpleDelete(String endUrl) async { + final response = + await http.delete(Uri.parse(_baseUrl + endUrl), headers: getHeaders()); + + print('${response.body}response'); + print('${_baseUrl + endUrl}Url'); + print('${response.statusCode}response'); + var responseCode = response.statusCode; + if (Helpers.isResponseSuccessful(responseCode)) { + return CommonResModel(statusCode: responseCode, response: response.body); + } else { + try { + final map = jsonDecode(response.body) as Map; + AppAlerts.alert(message: '${map['message']}'); + + throw map['message']; + } catch (e) { + return null; + } + } + } + + static Future postData( + List> requestBody, String endUrl) async { + var body = json.encode(requestBody); + final response = + await http.post(Uri.parse(endUrl), headers: getHeaders(), body: body); + print('${response.body}response'); + print(_baseUrl + endUrl); + print('${response.statusCode}response'); + var responseCode = response.statusCode; + + if (Helpers.isResponseSuccessful(responseCode)) { + return CommonResModel(statusCode: responseCode, response: response.body); + } else { + print(response.body); + + try { + final map = jsonDecode(response.body) as Map; + AppAlerts.alert(message: '${map['message']}'); + + throw map['message']; + } catch (e) { + return null; + } + } + } + + static Future postUser( + Map requestBody, String endUrl) async { + var body = json.encode(requestBody); + final response = + await http.post(Uri.parse(endUrl), headers: getHeaders(), body: body); + print('${response.body}response'); + print(endUrl); + print('${response.statusCode}response'); + var responseCode = response.statusCode; + + if (Helpers.isResponseSuccessful(responseCode)) { + return CommonResModel(statusCode: responseCode, response: response.body); + } else { + print(response.body); + + try { + final map = jsonDecode(response.body) as Map; + AppAlerts.alert(message: '${map['message']}'); + print("'${map['message']}'"); + + throw map['message']; + } catch (e) { + return null; + } + } + } + + static Future simpleGet9090(String endUrl) async { + final response = await http.get(Uri.parse(endUrl), headers: getHeaders()); + Helpers.printLog( + screenName: 'Remote_Service_simple_get', + message: "response = ${response.body}"); + debugPrint('request_url ===>>>${endUrl}'); + debugPrint('request_headers = ${getHeaders().toString()}'); + var responseCode = response.statusCode; + if (Helpers.isResponseSuccessful(responseCode)) { + return CommonResModel(statusCode: responseCode, response: response.body); + } else { + try { + final map = jsonDecode(response.body) as Map; + AppAlerts.alert(message: '${map['message']}'); + throw map['message']; + } catch (e) { + return null; + } + } + } +} diff --git a/lib/services/prefrences/prefrences.dart b/lib/services/prefrences/prefrences.dart new file mode 100644 index 0000000..f7aec52 --- /dev/null +++ b/lib/services/prefrences/prefrences.dart @@ -0,0 +1,57 @@ + + + + +import 'package:shared_preferences/shared_preferences.dart'; + +class Preferences { + + static const _uidKey = 'uid_early_eyes'; + static const authToken = 'pref_auth_token'; + static const prefKeyIsFirstLaunch = 'pref_key_is_first_launch'; + static const prefKeyUser= 'pref_key_user'; + static const prefKeyStudent= 'pref_key_student'; + static const prefKeyTutor= 'pref_key_tutor'; + static const prefKeyParent = 'pref_key_parent'; + static const userRoleKey = 'pref_key_user_role'; + + static late SharedPreferences _prefs; + + static Future createInstance() async { + _prefs = await SharedPreferences.getInstance(); + return; + } + + + static void removeUserData(){ + _prefs.remove(userToken); + _prefs.remove(prefKeyUser); + _prefs.remove(authToken); + + } + + //-----------------[Auth Token]----------------------------------------------- + static String get userToken => _prefs.getString(authToken) ?? ''; + + static set userToken(String? token) { + _prefs.setString(authToken, token ?? ''); + } + + static Object? getPref(String key) { + return _prefs.get(key); + } + static void save2Pref(String key, dynamic value) { + if (value is bool) { + _prefs.setBool(key, value); + } else if (value is int) { + _prefs.setInt(key, value); + } else if (value is double) { + _prefs.setDouble(key, value); + } else if (value is String) { + // print('key = $key, value = $value'); + _prefs.setString(key, value); + } else { + // throw Exception("Attempting to save non-primitive preference"); + } + } +} diff --git a/lib/utils/alert_service.dart b/lib/utils/alert_service.dart new file mode 100644 index 0000000..7d4ce66 --- /dev/null +++ b/lib/utils/alert_service.dart @@ -0,0 +1,36 @@ + + + +import 'package:get/get.dart'; + +import '../components/styles/app_colors.dart'; + +class AppAlerts{ + + AppAlerts._(); + + + + static error(String message){ + Get.closeAllSnackbars(); + Get.snackbar('error'.tr, message,colorText: AppColors.black); + } + static success(String message){ + Get.closeAllSnackbars(); + Get.snackbar('success'.tr, message,colorText: AppColors.black); + } + + static alert({String? title,required String message}){ + Get.closeAllSnackbars(); + Get.snackbar(title??'Alert', message,colorText: AppColors.black); + } + + + + + + + + + +} \ No newline at end of file diff --git a/lib/utils/apiUtils.dart b/lib/utils/apiUtils.dart new file mode 100644 index 0000000..e5d70a8 --- /dev/null +++ b/lib/utils/apiUtils.dart @@ -0,0 +1,92 @@ +// import 'dart:convert'; +// import 'dart:io'; +// +// +// import 'package:get/get.dart'; +// +// +// +// class ApiUtils { +// static Map bodyToMap(Response data) => +// data.body is Map +// ? data.body +// : jsonDecode(data.body) as Map; +// +// static Future hitApi(Future> apiRequest) async { +// // try { +// await _checkConnectivity(); +// final result = await apiRequest; +// // AppUtils.logEr(result.error); +// +// if (result.isSuccessful) { +// return result; +// } else { +// var errorData; +// +// if(result.error != null && result.error is String){ +// final error = result.error as String; +// final map = jsonDecode(error) as Map; +// +// errorData = map['message']; +// throw errorData; +// }else{ +// throw Exception(_throwException(result.statusCode)); +// } +// +// } +// } +// +// static String _throwException(int statusCode) { +// String error = ''; +// switch (statusCode) { +// case 400: +// error = 'BadRequestException'; +// case 401: +// error = 'UnauthorisedException'; +// case 403: +// error = 'access to the requested resource is forbidden'; +// case 500: +// error = 'Internal Server Error'; +// default: +// error = ''; +// } +// return error; +// } +// +// static Future _checkConnectivity() async { +// if(await _NetworkInfo(InternetConnectionChecker()).isConnected){ +// return ; +// }else{ +// throw const InternetFailure(error: 'Internet not connected'); +// } +// +// } +// +// +// static ResponseData getExceptionData(e){ +// return ResponseData(isSuccess: false, +// exception: e is Exception ? e : Exception(e), +// failure: e is Failure ? e : null +// ); +// } +// +// static ResponseData wrapResponseData(T data){ +// return ResponseData(isSuccess: true, data: data); +// } +// } +// +// +// abstract class _INetworkInfo { +// Future get isConnected; +// } +// +// class _NetworkInfo implements _INetworkInfo { +// final InternetConnectionChecker connectionChecker; +// _NetworkInfo(this.connectionChecker); +// @override +// Future get isConnected async => Platform.isAndroid || Platform.isIOS +// ? await connectionChecker.hasConnection +// : true; +// } +// +// diff --git a/lib/utils/extensions.dart b/lib/utils/extensions.dart new file mode 100644 index 0000000..83bc68e --- /dev/null +++ b/lib/utils/extensions.dart @@ -0,0 +1,16 @@ + +import 'package:flutter/material.dart'; + + + +extension TextEditControllerExtn on TextEditingController{ + String get getText => text.trim(); +} + +extension NumExtn on num{ + get numToDouble => this is int ? this.toDouble() : num; +} + + + + diff --git a/lib/utils/helpers.dart b/lib/utils/helpers.dart new file mode 100644 index 0000000..17fa140 --- /dev/null +++ b/lib/utils/helpers.dart @@ -0,0 +1,40 @@ +import 'package:flutter/cupertino.dart'; + +import '../services/network/ApiUrls.dart'; + + +class Helpers { + Helpers._(); + static const bool isDebug = true; + static String getCompleteUrl(String? url) { + if (url == null) return ""; + + if (url.startsWith('http')) { + return url; + } else { + return ApiUrls.baseUrlImage+ url; + } + } + static printLog({required String screenName, required String message}) { + if (isDebug) debugPrint("$screenName ==== $message"); + } + + static bool isResponseSuccessful(int code) { + return code >= 200 && code < 300; + } + + static String getImgUrl(String? url) { + debugPrint("url ======= = $url"); + + if (url == null) return ''; + if (url.startsWith('http')) { + return url; + } else { + return ApiUrls.baseUrlImage + url; + } + } + + + + +} diff --git a/lib/utils/inputFormats.dart b/lib/utils/inputFormats.dart new file mode 100644 index 0000000..e650bc0 --- /dev/null +++ b/lib/utils/inputFormats.dart @@ -0,0 +1,15 @@ +import 'package:flutter/services.dart'; + +class InputFormats { + static var validEmailExp = RegExp( + r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+"); + + static RegExp validPasswordExp = + RegExp(r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[!@#\$&*~]).{8,}$'); + + static final RegExp validNameExp = RegExp('[a-zA-Z]'); + + static final List phoneNo = [ + FilteringTextInputFormatter.digitsOnly + ]; +} diff --git a/lib/utils/validations.dart b/lib/utils/validations.dart new file mode 100644 index 0000000..c49efea --- /dev/null +++ b/lib/utils/validations.dart @@ -0,0 +1,63 @@ +import 'inputFormats.dart'; + +class Validations { + Validations._(); + + static String? checkEmailValidations(String? value) { + var enteredValue = value?.trim() ?? ''; + if (enteredValue.isEmpty) { + return 'Please Enter Your Email'; + } else if (!InputFormats.validEmailExp.hasMatch(enteredValue)) { + return 'Please Enter a valid Email'; + } else { + return null; + } + } + + static String? checkPhoneValidations(String? value) { + var enteredValue = value?.trim() ?? ''; + if (enteredValue.isEmpty) { + return 'Please Enter Your Mobile Number'; + } else if (enteredValue.length != 10) { + return "Please Enter a Valid Number"; + } else { + return null; + } + } + + static String? checkNameValidations(String? value) { + var enteredValue = value?.trim() ?? ''; + if (enteredValue.isEmpty) { + return 'Please Enter Your Full Name'; + } else { + return null; + } + } + + static String? checkLastName(String? value) { + var enteredValue = value?.trim() ?? ''; + if (enteredValue.isEmpty) { + return 'Please Enter Your Last Name'; + } else { + return null; + } + } + + static String? employeeCode(String? value) { + var enteredValue = value?.trim() ?? ''; + if (enteredValue.isEmpty) { + return "Please Enter Your Employee Code"; + } else { + return null; + } + } + + static String? checkEmptyFieldValidations(String? value) { + var enteredValue = value?.trim() ?? ''; + if (enteredValue.isEmpty) { + return "This field is required"; + } else { + return null; + } + } +} 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..44e1587 --- /dev/null +++ b/linux/CMakeLists.txt @@ -0,0 +1,128 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.13) +project(runner LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "shayog") +# The unique GTK application identifier for this application. See: +# https://wiki.gnome.org/HowDoI/ChooseApplicationID +set(APPLICATION_ID "com.example.shayog") + +# 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) + +# Application build; see runner/CMakeLists.txt. +add_subdirectory("runner") + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) + +# Only the install-generated bundle's copy of the executable will launch +# correctly, since the resources must in the right relative locations. To avoid +# people trying to run the unbundled copy, put it in a subdirectory instead of +# the default top-level location. +set_target_properties(${BINARY_NAME} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" +) + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# By default, "installing" just makes a relocatable bundle in the build +# directory. +set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +# Start with a clean build bundle directory every time. +install(CODE " + file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") + " COMPONENT Runtime) + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) + install(FILES "${bundled_library}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endforeach(bundled_library) + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") + install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() 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..e71a16d --- /dev/null +++ b/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void fl_register_plugins(FlPluginRegistry* registry) { +} 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..2e1de87 --- /dev/null +++ b/linux/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +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/runner/CMakeLists.txt b/linux/runner/CMakeLists.txt new file mode 100644 index 0000000..e97dabc --- /dev/null +++ b/linux/runner/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.13) +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} + "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 preprocessor definitions for the application ID. +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") + +# Add dependency libraries. Add any application-specific dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) + +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") diff --git a/linux/runner/main.cc b/linux/runner/main.cc new file mode 100644 index 0000000..e7c5c54 --- /dev/null +++ b/linux/runner/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/runner/my_application.cc b/linux/runner/my_application.cc new file mode 100644 index 0000000..3fa6578 --- /dev/null +++ b/linux/runner/my_application.cc @@ -0,0 +1,130 @@ +#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, "shayog"); + 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, "shayog"); + } + + 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 GApplication::startup. +static void my_application_startup(GApplication* application) { + //MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application startup. + + G_APPLICATION_CLASS(my_application_parent_class)->startup(application); +} + +// Implements GApplication::shutdown. +static void my_application_shutdown(GApplication* application) { + //MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application shutdown. + + G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); +} + +// 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_APPLICATION_CLASS(klass)->startup = my_application_startup; + G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; + G_OBJECT_CLASS(klass)->dispose = my_application_dispose; +} + +static void my_application_init(MyApplication* self) {} + +MyApplication* my_application_new() { + // Set the program name to the application ID, which helps various systems + // like GTK and desktop environments map this running application to its + // corresponding .desktop file. This ensures better integration by allowing + // the application to be recognized beyond its binary name. + g_set_prgname(APPLICATION_ID); + + return MY_APPLICATION(g_object_new(my_application_get_type(), + "application-id", APPLICATION_ID, + "flags", G_APPLICATION_NON_UNIQUE, + nullptr)); +} diff --git a/linux/runner/my_application.h b/linux/runner/my_application.h new file mode 100644 index 0000000..72271d5 --- /dev/null +++ b/linux/runner/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..c2efd0b --- /dev/null +++ b/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1 @@ +#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..c2efd0b --- /dev/null +++ b/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1 @@ +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 0000000..724bb2a --- /dev/null +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,12 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + +import shared_preferences_foundation + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) +} diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..04643a6 --- /dev/null +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,705 @@ +// !$*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 */; }; +/* 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 /* shayog.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "shayog.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 = ""; }; + 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 = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 331C80D2294CF70F00263BE5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + 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 */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* shayog.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 = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C80D4294CF70F00263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 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 = ( + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* shayog.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 1510; + 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 */ + 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"; + }; +/* 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; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.shayog.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/shayog.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/shayog"; + }; + name = Debug; + }; + 331C80DC294CF71000263BE5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.shayog.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/shayog.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/shayog"; + }; + name = Release; + }; + 331C80DD294CF71000263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.shayog.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/shayog.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/shayog"; + }; + name = Profile; + }; + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + 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; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + 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; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + 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; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + 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; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + 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; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + 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..05b5664 --- /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..1d526a1 --- /dev/null +++ b/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + 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..b3c1761 --- /dev/null +++ b/macos/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import Cocoa +import FlutterMacOS + +@main +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } + + override func applicationSupportsSecureRestorableState(_ app: 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..ce25ad6 --- /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 = shayog + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.example.shayog + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2025 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..61f3bd1 --- /dev/null +++ b/macos/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Cocoa +import FlutterMacOS +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..fe417b7 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,418 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + 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" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + collection: + dependency: transitive + description: + name: collection + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf + url: "https://pub.dev" + source: hosted + version: "1.19.0" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" + url: "https://pub.dev" + source: hosted + version: "2.1.3" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" + source: hosted + version: "5.0.0" + 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" + get: + dependency: "direct main" + description: + name: get + sha256: e4e7335ede17452b391ed3b2ede016545706c01a02292a6c97619705e7d2a85e + url: "https://pub.dev" + source: hosted + version: "4.6.6" + http: + dependency: "direct main" + description: + name: http + sha256: fe7ab022b76f3034adc518fb6ea04a82387620e19977665ea18d30a1cf43442f + url: "https://pub.dev" + source: hosted + version: "1.3.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + intl: + dependency: "direct main" + description: + name: intl + sha256: "00f33b908655e606b86d2ade4710a231b802eec6f11e87e4ea3783fd72077a50" + url: "https://pub.dev" + source: hosted + version: "0.20.1" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" + url: "https://pub.dev" + source: hosted + version: "10.0.7" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" + url: "https://pub.dev" + source: hosted + version: "3.0.8" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 + url: "https://pub.dev" + source: hosted + version: "5.1.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + url: "https://pub.dev" + source: hosted + version: "1.15.0" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + pixel_snap: + dependency: transitive + description: + name: pixel_snap + sha256: "677410ea37b07cd37ecb6d5e6c0d8d7615a7cf3bd92ba406fd1ac57e937d1fb0" + url: "https://pub.dev" + source: hosted + version: "0.1.5" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: a752ce92ea7540fc35a0d19722816e04d0e72828a4200e83a98cf1a1eb524c9a + url: "https://pub.dev" + source: hosted + version: "2.3.5" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "138b7bbbc7f59c56236e426c37afb8f78cbc57b094ac64c440e0bb90e380a4f5" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03" + url: "https://pub.dev" + source: hosted + version: "2.5.4" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: d2ca4132d3946fec2184261726b355836a82c33d7d5b67af32692aff18a4684e + url: "https://pub.dev" + source: hosted + version: "2.4.2" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + sizer: + dependency: "direct main" + description: + name: sizer + sha256: "6f68f574b6dd052e87c4abf67fe4feb316651fab02430ef7e53e991c15acfcb7" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + 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: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" + url: "https://pub.dev" + source: hosted + version: "1.12.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" + url: "https://pub.dev" + source: hosted + version: "1.3.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: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" + url: "https://pub.dev" + source: hosted + version: "0.7.3" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b + url: "https://pub.dev" + source: hosted + version: "14.3.0" + vph_common_widgets: + dependency: transitive + description: + name: vph_common_widgets + sha256: "596f6655cd67d3aba8f81e77d2c5148d86378c4f19469acf06afc84009606c09" + url: "https://pub.dev" + source: hosted + version: "0.0.3" + vph_web_date_picker: + dependency: "direct main" + description: + name: vph_web_date_picker + sha256: "31c250b98128b22e0252c97a7d50511cfd7c59e37c7873276e57f1060c47b9f9" + url: "https://pub.dev" + source: hosted + version: "0.0.6" + web: + dependency: transitive + description: + name: web + sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb + url: "https://pub.dev" + source: hosted + version: "1.1.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" +sdks: + dart: ">=3.6.1 <4.0.0" + flutter: ">=3.24.0" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..afc69ba --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,107 @@ +name: shayog +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.6.1 + +# 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.8 + get: ^4.6.6 + http: ^1.3.0 + shared_preferences: ^2.3.5 + sizer: ^3.0.5 + intl: ^0.20.1 + vph_web_date_picker: ^0.0.6 + + +dev_dependencies: + 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: ^5.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/fonts/ + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # 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: Anek_Latin-Bold + fonts: + - asset: assets/fonts/AnekLatin-Bold.ttf + - family: Anek_Latin-ExtraBold + fonts: + - asset: assets/fonts/AnekLatin-ExtraBold.ttf + - family: Anek_Latin-SemiBold + fonts: + - asset: assets/fonts/AnekLatin-SemiBold.ttf + - family: Anek_Latin-Medium + fonts: + - asset: assets/fonts/AnekLatin-Medium.ttf + - family: Anek_Latin-Regular + fonts: + - asset: assets/fonts/AnekLatin-Regular.ttf + - family: Anek_Latin-Light + fonts: + - asset: assets/fonts/AnekLatin-Light.ttf + - family: Anek_Latin-Thin + fonts: + - asset: assets/fonts/AnekLatin-Thin.ttf + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package diff --git a/test/widget_test.dart b/test/widget_test.dart new file mode 100644 index 0000000..7dd4c57 --- /dev/null +++ b/test/widget_test.dart @@ -0,0 +1,30 @@ +// 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:shayog/main.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget( 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..7af4001 --- /dev/null +++ b/web/index.html @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + shayog + + + + + + diff --git a/web/manifest.json b/web/manifest.json new file mode 100644 index 0000000..98f8b1d --- /dev/null +++ b/web/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "shayog", + "short_name": "shayog", + "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..17a9c5b --- /dev/null +++ b/windows/.gitignore @@ -0,0 +1,17 @@ +flutter/ephemeral/ + +# Visual Studio user_management-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..efb9921 --- /dev/null +++ b/windows/CMakeLists.txt @@ -0,0 +1,108 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.14) +project(shayog 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 "shayog") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(VERSION 3.14...3.25) + +# 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() + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +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..903f489 --- /dev/null +++ b/windows/flutter/CMakeLists.txt @@ -0,0 +1,109 @@ +# 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") + +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + +# === 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" + ${FLUTTER_TARGET_PLATFORM} $ + 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..8b6d468 --- /dev/null +++ b/windows/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void RegisterPlugins(flutter::PluginRegistry* registry) { +} 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..b93c4c3 --- /dev/null +++ b/windows/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +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..5126f0a --- /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", "shayog" "\0" + VALUE "FileVersion", VERSION_AS_STRING "\0" + VALUE "InternalName", "shayog" "\0" + VALUE "LegalCopyright", "Copyright (C) 2025 com.example. All rights reserved." "\0" + VALUE "OriginalFilename", "shayog.exe" "\0" + VALUE "ProductName", "shayog" "\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..955ee30 --- /dev/null +++ b/windows/runner/flutter_window.cpp @@ -0,0 +1,71 @@ +#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(); + }); + + // Flutter can complete the first frame before the "show window" callback is + // registered. The following call ensures a frame is pending to ensure the + // window is shown. It is a no-op if the first frame hasn't completed yet. + flutter_controller_->ForceRedraw(); + + 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..6d28d77 --- /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 presentation. +class FlutterWindow : public Win32Window { + public: + // Creates a new FlutterWindow hosting a Flutter presentation 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..d55c274 --- /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"shayog", 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..153653e --- /dev/null +++ b/windows/runner/runner.exe.manifest @@ -0,0 +1,14 @@ + + + + + PerMonitorV2 + + + + + + + + + diff --git a/windows/runner/utils.cpp b/windows/runner/utils.cpp new file mode 100644 index 0000000..3a0b465 --- /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(); + } + unsigned 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_