commit c72957afb482cdd6d8640a92fe90cf3168e2bb9f Author: Sneha Date: Mon Mar 9 16:35:06 2026 +0530 initial push diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..29a3a50 --- /dev/null +++ b/.gitignore @@ -0,0 +1,43 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.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..9d32c61 --- /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: "b0850beeb25f6d5b10426284f506557f66181b36" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: b0850beeb25f6d5b10426284f506557f66181b36 + base_revision: b0850beeb25f6d5b10426284f506557f66181b36 + - platform: android + create_revision: b0850beeb25f6d5b10426284f506557f66181b36 + base_revision: b0850beeb25f6d5b10426284f506557f66181b36 + - platform: ios + create_revision: b0850beeb25f6d5b10426284f506557f66181b36 + base_revision: b0850beeb25f6d5b10426284f506557f66181b36 + - platform: linux + create_revision: b0850beeb25f6d5b10426284f506557f66181b36 + base_revision: b0850beeb25f6d5b10426284f506557f66181b36 + - platform: macos + create_revision: b0850beeb25f6d5b10426284f506557f66181b36 + base_revision: b0850beeb25f6d5b10426284f506557f66181b36 + - platform: web + create_revision: b0850beeb25f6d5b10426284f506557f66181b36 + base_revision: b0850beeb25f6d5b10426284f506557f66181b36 + - platform: windows + create_revision: b0850beeb25f6d5b10426284f506557f66181b36 + base_revision: b0850beeb25f6d5b10426284f506557f66181b36 + + # 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..abaf3fb --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# bookatanker + +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..6f56801 --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks diff --git a/android/app/build.gradle b/android/app/build.gradle new file mode 100644 index 0000000..9a1af90 --- /dev/null +++ b/android/app/build.gradle @@ -0,0 +1,58 @@ +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" +} + +def localProperties = new Properties() +def localPropertiesFile = rootProject.file("local.properties") +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader("UTF-8") { reader -> + localProperties.load(reader) + } +} + +def flutterVersionCode = localProperties.getProperty("flutter.versionCode") +if (flutterVersionCode == null) { + flutterVersionCode = "1" +} + +def flutterVersionName = localProperties.getProperty("flutter.versionName") +if (flutterVersionName == null) { + flutterVersionName = "1.0" +} + +android { + namespace = "com.example.bookatanker" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.example.bookatanker" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutterVersionCode.toInteger() + versionName = flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.debug + } + } +} + +flutter { + source = "../.." +} 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..b0abcbe --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,51 @@ +> + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/java/com/example/bookatanker/MainActivity.java b/android/app/src/main/java/com/example/bookatanker/MainActivity.java new file mode 100644 index 0000000..f4fecff --- /dev/null +++ b/android/app/src/main/java/com/example/bookatanker/MainActivity.java @@ -0,0 +1,6 @@ +package com.example.bookatanker; + +import io.flutter.embedding.android.FlutterActivity; + +public class MainActivity extends 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..3b5b324 --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx4G -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..e1ca574 --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip diff --git a/android/settings.gradle b/android/settings.gradle new file mode 100644 index 0000000..9151bc0 --- /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 "7.3.0" apply false + id "org.jetbrains.kotlin.android" version "1.9.22" apply false +} + +include ":app" diff --git a/images/backbutton_appbar.png b/images/backbutton_appbar.png new file mode 100644 index 0000000..c578949 Binary files /dev/null and b/images/backbutton_appbar.png differ diff --git a/images/final_splash_screen.jpg b/images/final_splash_screen.jpg new file mode 100644 index 0000000..70ab6fe Binary files /dev/null and b/images/final_splash_screen.jpg 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..4a3dd00 --- /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.bookatanker; + 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.bookatanker.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.bookatanker.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.bookatanker.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.bookatanker; + 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.bookatanker; + 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..9074fee --- /dev/null +++ b/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import Flutter +import UIKit + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d36b1fa --- /dev/null +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000..dc9ada4 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..7353c41 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..6ed2d93 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..4cd7b00 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..fe73094 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..321773c Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..502f463 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..e9f5fea Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..84ac32a Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..8953cba Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..0467bf1 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..0bedcf2 --- /dev/null +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000..89c2725 --- /dev/null +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/ios/Runner/Base.lproj/LaunchScreen.storyboard b/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f2e259c --- /dev/null +++ b/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f3c2851 --- /dev/null +++ b/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist new file mode 100644 index 0000000..d7901ee --- /dev/null +++ b/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Bookatanker + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + bookatanker + 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/changepassword.dart b/lib/changepassword.dart new file mode 100644 index 0000000..82d28ee --- /dev/null +++ b/lib/changepassword.dart @@ -0,0 +1,221 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'common/settings.dart'; +import 'confirm_mobilenumber.dart'; + + +class ChangePasswordScreen extends StatefulWidget { + @override + _ChangePasswordScreenState createState() => _ChangePasswordScreenState(); +} + + +class _ChangePasswordScreenState extends State { + final _formKey = GlobalKey(); + final _currentPasswordController = TextEditingController(); + final _newPasswordController = TextEditingController(); + final _confirmPasswordController = TextEditingController(); + + bool _obscureCurrent = true; + bool _obscureNew = true; + bool _obscureConfirm = true; + + void _savePassword() { + if (_formKey.currentState!.validate()) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text("Password changed successfully")), + ); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBar( + backgroundColor: Colors.white, + elevation: 0, + surfaceTintColor: Colors.transparent, // <- remove M3 tint + scrolledUnderElevation: 0, // <- keep white when scrolled + title: Text( + "Change Password", + style: fontTextStyle(16, Color(0xFF000000), FontWeight.w800), + ), + iconTheme: IconThemeData(color: Color(0XFF2A2A2A)), + leading: GestureDetector( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: + const EdgeInsets.fromLTRB(8, 8, 8, 8), // Add padding if needed + child: Image.asset( + 'images/backbutton_appbar.png', // Replace with your image path + fit: BoxFit.contain, + color: Color(0XFF2A2A2A), + height: 24, + width: 24, + ), + ), + ), + ), + + body: SingleChildScrollView( + // ✅ Prevents overflow + padding: const EdgeInsets.fromLTRB(20, 28, 20, 20), + child: Form( + key: _formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 26), + Text( + "You can only change your password once every 14 days.\nYou can change your password again on XY Dec 2024", + style: fontTextStyle(12, Color(0xFF7E7F80), FontWeight.w400), + ), + SizedBox(height: 20), + + Text("Current Password", + style: + fontTextStyle(12, Color(0xFF101214), FontWeight.w700)), + SizedBox(height: 8), + TextFormField( + controller: _currentPasswordController, + obscureText: _obscureCurrent, + decoration: InputDecoration( + border: OutlineInputBorder(), + hintText: "Enter current password", + hintStyle: + fontTextStyle(14, Color(0xFF2A2A2A), FontWeight.w400), + suffixIcon: IconButton( + icon: Icon(_obscureCurrent + ? Icons.visibility_off + : Icons.visibility), + onPressed: () { + setState(() { + _obscureCurrent = !_obscureCurrent; + }); + }, + ), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return "Please enter current password"; + } + return null; + }, + ), + SizedBox(height: 16), + + // New Password + Text("New Password*", + style: fontTextStyle(12, Color(0xFF101214), FontWeight.w700)), + SizedBox(height: 8), + TextFormField( + controller: _newPasswordController, + obscureText: _obscureNew, + decoration: InputDecoration( + border: OutlineInputBorder(), + hintText: "Enter new password", + hintStyle: + fontTextStyle(14, Color(0xFF2A2A2A), FontWeight.w400), + suffixIcon: IconButton( + icon: Icon(_obscureNew + ? Icons.visibility_off + : Icons.visibility), + onPressed: () { + setState(() { + _obscureNew = !_obscureNew; + }); + }, + ), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return "Please enter new password"; + } else if (value.length < 6) { + return "Password must be at least 6 characters"; + } + return null; + }, + ), + SizedBox(height: 16), + + // Confirm Password + Text("Confirm Password*", + style: fontTextStyle(12, Color(0xFF101214), FontWeight.w700)), + + SizedBox(height: 8), + + TextFormField( + controller: _confirmPasswordController, + obscureText: _obscureConfirm, + decoration: InputDecoration( + border: OutlineInputBorder(), + hintText: "Confirm new password", + hintStyle: + fontTextStyle(14, Color(0xFF2A2A2A), FontWeight.w400), + suffixIcon: IconButton( + icon: Icon(_obscureConfirm + ? Icons.visibility_off + : Icons.visibility), + onPressed: () { + setState(() { + _obscureConfirm = !_obscureConfirm; + }); + }, + ), + ), + validator: (value) { + if (value != _newPasswordController.text) { + return "Passwords do not match"; + } + return null; + }, + ), + SizedBox(height: 24), + + // Save and Login button + SizedBox( + width: double.infinity, + child: ElevatedButton( + onPressed: _savePassword, + style: ElevatedButton.styleFrom( + padding: EdgeInsets.symmetric(vertical: 16), + backgroundColor: Color(0xFF101214), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30), + ), + ), + child: Text( + "Save and Login", + style: fontTextStyle(14, Color(0xFFFFFFFF), FontWeight.w600), + ), + + ), + ), + SizedBox(height: 40), + + // Forgot Password link + Center( + child: TextButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute(builder: (_) => ConfirmMobileScreen()), + ); + }, + child: Text( + "Forgot Password?", + style: fontTextStyle(14, Color(0xFF101214), FontWeight.w600), + ), + ), + ), + SizedBox(height: 20), + ], + ), + ), + ), + ); + } +} diff --git a/lib/common/LocationPage.dart b/lib/common/LocationPage.dart new file mode 100644 index 0000000..72ee3b4 --- /dev/null +++ b/lib/common/LocationPage.dart @@ -0,0 +1,98 @@ + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:geocoding/geocoding.dart'; + +class LocationPage extends StatefulWidget { + const LocationPage({Key? key}) : super(key: key); + @override + State createState() => _LocationPageState(); +} + +class _LocationPageState extends State { + String? _currentAddress; + Position? _currentPosition; + + Future _handleLocationPermission() async { + bool serviceEnabled; + LocationPermission permission; + + serviceEnabled = await Geolocator.isLocationServiceEnabled(); + if (!serviceEnabled) { + ScaffoldMessenger.of(context).showSnackBar(const SnackBar( + content: Text( + 'Location services are disabled. Please enable the services'))); + return false; + } + permission = await Geolocator.checkPermission(); + if (permission == LocationPermission.denied) { + permission = await Geolocator.requestPermission(); + if (permission == LocationPermission.denied) { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Location permissions are denied'))); + return false; + } + } + if (permission == LocationPermission.deniedForever) { + ScaffoldMessenger.of(context).showSnackBar(const SnackBar( + content: Text( + 'Location permissions are permanently denied, we cannot request permissions.'))); + return false; + } + return true; + } + + Future _getCurrentPosition() async { + final hasPermission = await _handleLocationPermission(); + + if (!hasPermission) return; + await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high) + .then((Position position) { + setState(() => _currentPosition = position); + _getAddressFromLatLng(_currentPosition!); + }).catchError((e) { + debugPrint(e); + }); + } + + Future _getAddressFromLatLng(Position position) async { + await placemarkFromCoordinates( + _currentPosition!.latitude, _currentPosition!.longitude) + .then((List placemarks) { + + Placemark place = placemarks[0]; + _currentAddress = '${place.street}, ${place.subLocality}, ${place.locality}, ${place.postalCode}, ${place.country}'; + print(place); + + setState(() { + }); + }).catchError((e) { + debugPrint(e); + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text("Location Page")), + body: SafeArea( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('LAT: ${_currentPosition?.latitude ?? ""}'), + Text('LNG: ${_currentPosition?.longitude ?? ""}'), + Text('ADDRESS: ${_currentAddress ?? ""}'), + const SizedBox(height:32), + ElevatedButton( + onPressed: _getCurrentPosition, + child: const Text("Get Current Location"), + ) + ], + ), + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/common/dashboard.dart b/lib/common/dashboard.dart new file mode 100644 index 0000000..07ba33a --- /dev/null +++ b/lib/common/dashboard.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class Dashboard extends StatefulWidget { + const Dashboard({super.key}); + + @override + State createState() => _DashboardState(); +} + +class _DashboardState extends State { + @override + Widget build(BuildContext context) { + return const Placeholder(); + } +} diff --git a/lib/common/keys.dart b/lib/common/keys.dart new file mode 100644 index 0000000..128da55 --- /dev/null +++ b/lib/common/keys.dart @@ -0,0 +1,6 @@ +class APIKeys { + APIKeys._(); + + static String androidApiKey = "AIzaSyDJpK9RVhlBejtJu9xSGfneuTN6HOfJgSM"; + static String iosApiKey = "YOUR IOS KEY HERE"; +} diff --git a/lib/common/place_picker.dart b/lib/common/place_picker.dart new file mode 100644 index 0000000..f55b297 --- /dev/null +++ b/lib/common/place_picker.dart @@ -0,0 +1,250 @@ +import 'package:flutter/material.dart'; +import 'package:google_maps_place_picker_mb/google_maps_place_picker.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'dart:io' show Platform; +import 'package:google_maps_flutter_android/google_maps_flutter_android.dart'; +import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'; + +class GooglePlacePicker extends StatefulWidget { + GooglePlacePicker({Key? key}) : super(key: key); + static final kInitialPosition = LatLng(17.4167312, 78.4519109); + + final GoogleMapsFlutterPlatform mapsImplementation = + GoogleMapsFlutterPlatform.instance; + + @override + State createState() => _GooglePlacePickerState(); +} + +class _GooglePlacePickerState extends State { + PickResult? selectedPlace; + bool _showPlacePickerInContainer = false; + bool _showGoogleMapInContainer = false; + + bool _mapsInitialized = false; + String _mapsRenderer = "latest"; + + void initRenderer() { + if (_mapsInitialized) return; + if (widget.mapsImplementation is GoogleMapsFlutterAndroid) { + switch (_mapsRenderer) { + case "legacy": + (widget.mapsImplementation as GoogleMapsFlutterAndroid) + .initializeWithRenderer(AndroidMapRenderer.legacy); + break; + case "latest": + (widget.mapsImplementation as GoogleMapsFlutterAndroid) + .initializeWithRenderer(AndroidMapRenderer.latest); + break; + } + } + setState(() { + _mapsInitialized = true; + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("Google Map Place Picker Demo"), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (!_mapsInitialized && + widget.mapsImplementation + is GoogleMapsFlutterAndroid) ...[ + Switch( + value: (widget.mapsImplementation + as GoogleMapsFlutterAndroid) + .useAndroidViewSurface, + onChanged: (value) { + setState(() { + (widget.mapsImplementation + as GoogleMapsFlutterAndroid) + .useAndroidViewSurface = value; + }); + }), + Text("Hybrid Composition"), + ] + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (!_mapsInitialized && + widget.mapsImplementation + is GoogleMapsFlutterAndroid) ...[ + Text("Renderer: "), + Radio( + groupValue: _mapsRenderer, + value: "auto", + onChanged: (value) { + setState(() { + _mapsRenderer = "auto"; + }); + }), + Text("Auto"), + Radio( + groupValue: _mapsRenderer, + value: "legacy", + onChanged: (value) { + setState(() { + _mapsRenderer = "legacy"; + }); + }), + Text("Legacy"), + Radio( + groupValue: _mapsRenderer, + value: "latest", + onChanged: (value) { + setState(() { + _mapsRenderer = "latest"; + }); + }), + Text("Latest"), + ] + ], + ), + !_showPlacePickerInContainer + ? ElevatedButton( + child: Text("Load Place Picker"), + onPressed: () { + initRenderer(); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return PlacePicker( + resizeToAvoidBottomInset: + false, // only works in page mode, less flickery + apiKey: Platform.isAndroid + ? "AIzaSyB4FhQFeC9JMeIadUwIO6HkoD4UFG6N-HM" + : "IOS API KEY", + hintText: "Find a place ...", + searchingText: "Please wait ...", + selectText: "Select place", + outsideOfPickAreaText: "Place not in area", + initialPosition: GooglePlacePicker.kInitialPosition, + useCurrentLocation: true, + selectInitialPosition: true, + usePinPointingSearch: true, + usePlaceDetailSearch: true, + zoomGesturesEnabled: true, + zoomControlsEnabled: true, + onMapCreated: (GoogleMapController controller) { + print("Map created"); + }, + onPlacePicked: (PickResult result) { + print( + "Place picked: ${result.formattedAddress}"); + setState(() { + selectedPlace = result; + Navigator.of(context).pop(); + }); + }, + onMapTypeChanged: (MapType mapType) { + print( + "Map type changed to ${mapType.toString()}"); + }, + ); + }, + ), + ); + }, + ) + : Container(), + !_showPlacePickerInContainer + ? ElevatedButton( + child: Text("Load Place Picker in Container"), + onPressed: () { + initRenderer(); + setState(() { + _showPlacePickerInContainer = true; + }); + }, + ) + : Container( + width: MediaQuery.of(context).size.width * 0.75, + height: MediaQuery.of(context).size.height * 0.35, + child: PlacePicker( + //forceAndroidLocationManager: true, + apiKey: Platform.isAndroid + ? "AIzaSyB4FhQFeC9JMeIadUwIO6HkoD4UFG6N-HM" + : "IOS API KEY", + hintText: "Find a place ...", + searchingText: "Please wait ...", + selectText: "Select place", + initialPosition: GooglePlacePicker.kInitialPosition, + useCurrentLocation: true, + selectInitialPosition: true, + usePinPointingSearch: true, + usePlaceDetailSearch: true, + zoomGesturesEnabled: true, + zoomControlsEnabled: true, + onPlacePicked: (PickResult result) { + setState(() { + selectedPlace = result; + _showPlacePickerInContainer = false; + }); + }, + onTapBack: () { + setState(() { + _showPlacePickerInContainer = false; + }); + })), + if (selectedPlace != null) ...[ + Text(selectedPlace!.formattedAddress!), + Text("(lat: " + + selectedPlace!.geometry!.location.lat.toString() + + ", lng: " + + selectedPlace!.geometry!.location.lng.toString() + + ")"), + ], + // #region Google Map Example without provider + _showPlacePickerInContainer + ? Container() + : ElevatedButton( + child: Text("Toggle Google Map w/o Provider"), + onPressed: () { + initRenderer(); + setState(() { + _showGoogleMapInContainer = + !_showGoogleMapInContainer; + }); + }, + ), + !_showGoogleMapInContainer + ? Container() + : Container( + width: MediaQuery.of(context).size.width * 0.75, + height: MediaQuery.of(context).size.height * 0.25, + child: GoogleMap( + zoomGesturesEnabled: false, + zoomControlsEnabled: false, + myLocationButtonEnabled: false, + compassEnabled: false, + mapToolbarEnabled: false, + initialCameraPosition: new CameraPosition( + target: GooglePlacePicker.kInitialPosition, zoom: 15), + mapType: MapType.normal, + myLocationEnabled: true, + onMapCreated: (GoogleMapController controller) {}, + onCameraIdle: () {}, + onCameraMoveStarted: () {}, + onCameraMove: (CameraPosition position) {}, + )), + !_showGoogleMapInContainer ? Container() : TextField(), + // #endregion + ], + ), + )); + } +} + diff --git a/lib/common/preloader.dart b/lib/common/preloader.dart new file mode 100644 index 0000000..2b3711b --- /dev/null +++ b/lib/common/preloader.dart @@ -0,0 +1,33 @@ +import 'package:bookatanker/common/settings.dart'; +import 'package:flutter/material.dart'; + +class Dialogs { + static Future showLoadingDialog(BuildContext context, GlobalKey key) async { + return showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return new WillPopScope( + onWillPop: () async => false, + child: SimpleDialog( + key: key, + backgroundColor: Colors.white, + children: [ + Center( + child: Column(children: [ + CircularProgressIndicator( + valueColor: new AlwaysStoppedAnimation(primaryColor), + ), + SizedBox( + height: 10, + ), + Text( + AppSettings.preloadText, + style: PreloaderText(), + ), + ]), + ) + ])); + }); + } +} \ No newline at end of file diff --git a/lib/common/settings.dart b/lib/common/settings.dart new file mode 100644 index 0000000..7e197b3 --- /dev/null +++ b/lib/common/settings.dart @@ -0,0 +1,4442 @@ +import 'dart:io'; +import 'dart:typed_data'; +import 'package:bookatanker/common/preloader.dart'; +import 'package:flutter/material.dart'; +import 'dart:convert'; +import 'package:flutter/services.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:http/http.dart' as http; +import 'package:fluttertoast/fluttertoast.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:intl/intl.dart'; +import 'dart:async'; +import 'package:geolocator/geolocator.dart'; +import 'package:dio/dio.dart'; + +//const Color primaryColor = Color(0XFF0D4E84); +//const Color primaryColor = Color(0XFF075A7C); +const Color primaryColor = Color(0XFF1D7AFC); +const Color tankLocationColor = Color(0XFFF3E998); +const Color typeOfWaterColor = Color(0XFFCE93D8); +const Color newTextColor = Color(0XFF424242); +const Color secondaryColor = Color(0XFFBFE0ED); +const Color greyColor = Color(0XFF7E7F80); +const Color textFieldStartColor = Colors.grey; +const Color screenBackgroundColor = Color(0XFFBFE0ED); +const Color screenBackgroundColord = Colors.black12; +const Color dashboardbackground = Color(0XFFF5F5F5); + +Color AppBarGradient_1 = Color(0XFF4D317D); + + +String capitalizeFirstLetter(String text) { + if (text.isEmpty) return text; + return text[0].toUpperCase() + text.substring(1).toLowerCase(); +} + +TextStyle PreloaderText() { + return TextStyle(color:primaryColor); +} + +TextStyle labelTextStyle() { + return TextStyle(color: primaryColor, fontSize: 12,fontWeight: FontWeight.bold); +} + +TextStyle newTextStyle() { + return TextStyle(color:newTextColor,fontWeight: FontWeight.bold ); +} + +TextStyle labelTextStyleRed() { + return TextStyle(color: Colors.red, fontSize: 12,fontWeight: FontWeight.bold); +} + +TextStyle labelTextStyleMotorRunning() { + return TextStyle(color: primaryColor, fontSize: 16); +} +TextStyle labelTextStylewithBold() { + return TextStyle(color: primaryColor, fontSize: 12,fontWeight: FontWeight.bold); +} + +TextStyle haveMotorTextStyle() { + return TextStyle( + color: Colors.red, fontSize: 12, fontWeight: FontWeight.bold); +} + +TextStyle textButtonStyle() { + return TextStyle(color: primaryColor, fontSize: 15); +} + +TextStyle iconBelowTextStyle() { + return TextStyle(fontSize: 10, color: primaryColor); +} + +TextStyle valuesTextStyle() { + return TextStyle( + fontSize: 12, + color: Colors.black, + fontWeight: FontWeight.bold, + ); +} +TextStyle valuesTextStyleConsumption() { + return TextStyle( + fontSize: 12, + color: Colors.red, + fontWeight: FontWeight.bold, + ); +} +TextStyle valuesTextStyleCapacity() { + return TextStyle( + fontSize: 14, + color: Colors.red, + fontWeight: FontWeight.bold, + ); +} +TextStyle valuesTextStyleRed() { + return TextStyle( + fontSize: 12, + color: Colors.red, + fontWeight: FontWeight.bold, + ); +} +TextStyle valuesTextStyleBig() { + return TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + ); +} + +TextStyle valuesTextStyleBigImportant() { + return TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + color: Colors.red + ); +} +TextStyle valuesTextStyleImportant() { + return TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: Colors.red + ); +} +TextStyle valuesTextStyleImportantMotorRunning() { + return TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + color: Colors.red + ); +} + +TextStyle valuesTextStyleForDisplayLastUpdatedTime() { + return TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: primaryColor + ); +} + + +TextStyle valuesTextStyleForOrders() { + return TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + color: primaryColor + ); +} +TextStyle lablesTextStyleForOrders() { + return TextStyle( + fontSize: 14, + ); +} + +TextStyle tabTextStyle() { + return TextStyle( + fontSize: 12, + ); +} +TextStyle valuesTextStyleWithoutTextSize() { + return TextStyle( + fontWeight: FontWeight.bold, + ); +} + +TextStyle startAndStopHeading() { + return TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + color: primaryColor, + ); +} + +Text capacitySuffixText() { + return Text('in Ltrs.'); +} + +Text dimensionSuffixText() { + return Text('in fts'); +} + +TextStyle dashboardTextStyle() { + return TextStyle( + color: primaryColor, + fontSize: 12, + fontWeight: FontWeight.bold, + ); +} + +TextStyle labelTextStyleBold() { + return TextStyle( + fontSize: 12, + color: primaryColor, + fontWeight: FontWeight.bold, + ); +} + +TextStyle labelTextStyleButton() { + return TextStyle( + fontSize: 12, + color: Colors.white, + fontWeight: FontWeight.bold, + ); +} + +TextStyle labelTextStyleCapacity() { + return TextStyle( + fontSize: 14, + color: primaryColor, + fontWeight: FontWeight.bold, + ); +} + +TextStyle radioItemsTextStyle() { + return TextStyle(color: primaryColor,fontSize: 11,fontWeight: FontWeight.bold); +} + +TextStyle serverIssueTextStyle() { + return TextStyle(color: Colors.red, fontSize: 15); +} + +TextStyle bottomSheetValuesTextStyle() { + return TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + overflow: TextOverflow.ellipsis, + ); +} + +TextStyle wrapTextStyle() { + return TextStyle( + color: primaryColor, + fontSize: 12, + fontWeight: FontWeight.bold, + overflow: TextOverflow.ellipsis, + ); +} +TextStyle wrapTextStyleStartMotor() { + return TextStyle( + color: Colors.black, + fontSize: 15, + fontWeight: FontWeight.bold, + overflow: TextOverflow.ellipsis, + ); +} + +TextStyle wrapTextStyleBlack() { + return TextStyle( + color: Colors.black, + fontSize: 12, + fontWeight: FontWeight.bold, + overflow: TextOverflow.ellipsis, + ); +} + +TextStyle withoutWrapTextStyle() { + return TextStyle( + color: primaryColor, + fontSize: 12, + fontWeight: FontWeight.bold, + ); +} + + +TextStyle elevatedButtonTextStyle() { + return TextStyle( + fontSize: 16, + ); +} +TextStyle underLineTextStyle() { + return TextStyle( + color: primaryColor, + decoration: TextDecoration.underline, + + ); +} + +TextStyle fontTextStyle(double fontSize,Color fontColor,FontWeight weight) { + return GoogleFonts.inter( + textStyle: TextStyle( + fontSize: fontSize, + fontWeight: weight, + color:fontColor, + ), + ); +} + +TextStyle fontTextStylewithUnderline(double fontSize,Color fontColor,FontWeight weight, Color underlineColor) { + return GoogleFonts.inter( + textStyle: TextStyle( + fontSize: fontSize, + fontWeight: weight, + color:fontColor, + decoration: TextDecoration.underline, + decorationColor: underlineColor, + decorationThickness: 1, + ), + ); +} +TextStyle italicFontTextStyle(double fontSize, Color fontColor, FontWeight weight) { + return GoogleFonts.roboto( + textStyle: TextStyle( + fontSize: fontSize, + fontWeight: weight, + color: fontColor, + fontStyle: FontStyle.italic, + ), + ); +} +TextStyle fontTextStyleHeight(double fontSize,Color fontColor,FontWeight weight,double height) { + return GoogleFonts.inter( + textStyle: TextStyle( + fontSize: fontSize, + fontWeight: weight, + color:fontColor, + height: height + ), + ); +} +TextStyle fontTextStyleUnderline(double fontSize,Color fontColor,FontWeight weight) { + return GoogleFonts.inter( + textStyle: TextStyle( + fontSize: fontSize, + fontWeight: weight, + color:fontColor, + decoration: TextDecoration.underline, + ), + ); +} + + +InputDecoration textFormFieldDecoration(IconData icon,var text){ + return InputDecoration( + counterText: '', + filled: false, + fillColor: Colors.white, + /*prefixIcon: Icon( + icon, + color: Colors.white, + ),*/ + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor, + width: 1, )), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: Color(0XFF1D7AFC),width: 2,), + ), + + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor), + ), + labelText: text, + labelStyle:fontTextStyle(14,Color(0XFF7E7F80),FontWeight.w400), + /* TextStyle(color: greyColor, fontWeight: FontWeight.bold //<-- SEE HERE + ),*/ + ); +} + +InputDecoration searchTextFormFieldDecoration(var path,var text){ + return InputDecoration( + counterText: '', + filled: true, + fillColor: Color(0XFFE8F2FF), + prefixIcon:Padding( + padding: EdgeInsets.all(15.0), // Adjust the padding around the image + child: Image.asset( + path, // Path to your image + width: 24, // Set the width + height: 24, // Set the height + color: Color(0XFF7E7F80), // Optional: Set color filter if needed + fit: BoxFit.contain, // Ensure the image is contained within the available space + ), + ), + hintText: text, + hintStyle: fontTextStyle(12, Color(0XFF646566), FontWeight.w400), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(30.0), + borderSide: BorderSide( + color: Color(0XFFE8F2FF), + width: 1, + )), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(30.0), + borderSide: BorderSide( + color: Color(0XFFE8F2FF), + width: 2, + ), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(30.0), + borderSide: BorderSide(color: Color(0XFFE8F2FF)), + ), + ); +} + + +String capitalizeFirst(String text) { + if (text.isEmpty) return text; + return text[0].toUpperCase() + text.substring(1); +} + +InputDecoration textFormFieldDecorationHintText(IconData icon,var text){ + return InputDecoration( + counterText: '', + filled: false, + fillColor: Colors.white, + /*prefixIcon: Icon( + icon, + color: Colors.white, + ),*/ + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor, + width: 1, )), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: Color(0XFF1D7AFC),width: 2,), + ), + + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor), + ), + hintText: text, + hintStyle:fontTextStyle(14,Color(0XFF7E7F80),FontWeight.w400), + /* TextStyle(color: greyColor, fontWeight: FontWeight.bold //<-- SEE HERE + ),*/ + ); +} + +InputDecoration textFormFieldDecorationWithoutLabelText(){ + return InputDecoration( + counterText: '', + filled: false, + fillColor: Colors.white, + + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: Color(0XFF939495), + width: 1, )), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: Color(0XFF939495),width: 1,), + ), + + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: Color(0XFF939495)), + ), + + ); +} + +InputDecoration DisableTextFormFieldDecoration(){ + return InputDecoration( + counterText: '', + filled: false, + fillColor: Colors.white, + + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: Color(0XFF939495), + width: 1, )), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: Color(0XFF939495),width: 1,), + ), + + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: Color(0XFF939495)), + ), + + ); +} + +InputDecoration textFormFieldDecorationWithoutLabelTextWithEnableBorder(){ + return InputDecoration( + counterText: '', + filled: false, + fillColor: Colors.white, + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor, + width: 1, )), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: Color(0XFF1D7AFC),width: 2,), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor), + ), + labelStyle:fontTextStyle(14,Color(0XFF7E7F80),FontWeight.w400), + ); +} + +InputDecoration textFormFieldDecorationWithoutLabelTextWithErrorText(msg){ + return InputDecoration( + counterText: '', + filled: false, + fillColor: Colors.white, + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor, + width: 1, )), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: Color(0XFF1D7AFC),width: 2,), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor), + ), + errorText: msg, + errorStyle:fontTextStyle(14,Color(0XFFE2483D),FontWeight.w400), + ); +} + +InputDecoration textFormFieldDecorationForSuffixText(IconData icon,var text,var suffixText){ + return InputDecoration( + counterText: '', + filled: false, + fillColor: Colors.white, + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor, + width: 1, )), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: Color(0XFF1D7AFC),width: 2,), + ), + + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor), + ), + labelText: text, + suffix: Text('mins'), + labelStyle:fontTextStyle(14,Color(0XFF7E7F80),FontWeight.w400), + /* TextStyle(color: greyColor, fontWeight: FontWeight.bold //<-- SEE HERE + ),*/ + ); +} + +InputDecoration textFormFieldDecorationForDateRange(var path,var text){ + return InputDecoration( + counterText: '', + filled: false, + fillColor: Colors.white, + suffixIcon:IconButton( + icon: Image.asset( + path, // Path to your image asset + width: 24, // Set the width + height: 24, // Set the height + color: Color(0XFF7E7F80), + fit: BoxFit.contain, // Ensure the image is contained within the given space + ), + onPressed: () { + // Define the action for the icon if necessary + print('Suffix icon pressed'); + }, + ), + + + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor, + width: 1, )), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: Color(0XFF1D7AFC),width: 2,), + ), + + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor), + ), + labelText: text, + labelStyle:fontTextStyle(14,Color(0XFF939495),FontWeight.w400), + /* TextStyle(color: greyColor, fontWeight: FontWeight.bold //<-- SEE HERE + ),*/ + ); +} + +InputDecoration textFormFieldDecorationForSuffix(var path,var text){ + return InputDecoration( + counterText: '', + filled: false, + fillColor: Colors.white, + suffixIcon: Padding( + padding: EdgeInsets.all(12.0), // Adjust the padding around the image + child: Image.asset( + path, // Path to your image + width: 8, // Set the width + height: 8, // Set the height + color: Color(0XFF7E7F80), // Optional: Set color filter if needed + fit: BoxFit.contain, // Ensure the image is contained within the available space + ), + ), + + + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor, + width: 1, )), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor,width: 1,), + ), + + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor), + ), + ); +} + +InputDecoration decorationForDropdown(var path,var text){ + return InputDecoration( + counterText: '', + filled: false, + fillColor: Colors.white, + prefixIcon:Padding( + padding: EdgeInsets.all(15.0), // Adjust the padding around the image + child: Image.asset( + path, // Path to your image + width: 24, // Set the width + height: 24, // Set the height + color: Color(0XFF7E7F80), // Optional: Set color filter if needed + fit: BoxFit.contain, // Ensure the image is contained within the available space + ), + ), + + /*IconButton( + icon: Image.asset( + path, // Path to your image asset + width: 20, // Set the width + height: 20, // Set the height + color: Color(0XFF515253), + fit: BoxFit.contain, // Ensure the image is contained within the given space + ), + onPressed: () { + // Define the action for the icon if necessary + print('Suffix icon pressed'); + }, + ),*/ + + + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor, + width: 1, )), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor,width: 1,), + ), + + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide(color: greyColor), + ), + labelText: text, + labelStyle:fontTextStyle(14,Color(0XFF939495),FontWeight.w400), + /* TextStyle(color: greyColor, fontWeight: FontWeight.bold //<-- SEE HERE + ),*/ + ); +} + +Widget valuesText(var text){ + return Container( + child: Text( + text, + overflow: TextOverflow.ellipsis, + style: valuesTextStyle(), + textScaleFactor: AppSettings.textScaleFactor, + ), + ); +} + +Widget valuesTextConsumption(var text){ + return Container( + child: Text( + text, + overflow: TextOverflow.ellipsis, + style: valuesTextStyleConsumption(), + textScaleFactor: AppSettings.textScaleFactor, + ), + ); +} + +Widget valuesTextMotorStatus(var text){ + Color textColor=Colors.black; + if(text.toString().toLowerCase()=='off'){ + textColor=Colors.red; + } + else{ + textColor=Colors.green; + } + + return Container( + child: Text( + text, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12, + color:textColor, + fontWeight: FontWeight.bold, + ), + textScaleFactor: AppSettings.textScaleFactor, + ), + ); +} + +Widget valuesTextCapacity(var text){ + return Text( + text, + overflow: TextOverflow.ellipsis, + style: valuesTextStyleCapacity(), + textScaleFactor: AppSettings.textScaleFactor, + ); +} + +Widget valuesTextLowTextScaleFactor(var text){ + return Text( + text, + overflow: TextOverflow.ellipsis, + style: valuesTextStyle(), + textScaleFactor: 0.9, + ); +} + +Widget labelsTextLowTextScaleFactor(var text){ + return Text( + text, + overflow: TextOverflow.ellipsis, + style: labelTextStyleBold(), + textScaleFactor: 0.9, + ); +} + +Widget valuesTextNewBig(var text){ + return Text( + text, + overflow: TextOverflow.ellipsis, + style: valuesTextStyleBig(), + textScaleFactor: AppSettings.textScaleFactor, + ); +} + +Widget labelsText(var text){ + return Text( + text, + overflow: TextOverflow.ellipsis, + style: labelTextStyle(), + textScaleFactor: AppSettings.textScaleFactor, + ); +} + +Widget labelsTextFont(var text){ + return Text( + text, + overflow: TextOverflow.ellipsis, + style: fontTextStyle(16,Color(0XFF1D7AFC),FontWeight.w600), + textScaleFactor: AppSettings.textScaleFactor, + ); +} + +Widget labelsTextBold(var text){ + return Text( + text, + overflow: TextOverflow.ellipsis, + style: labelTextStyleBold(), + textScaleFactor: AppSettings.textScaleFactor, + ); +} + +Widget labelsTextButton(var text){ + return Text( + text, + overflow: TextOverflow.ellipsis, + style: labelTextStyleButton(), + textScaleFactor: AppSettings.textScaleFactor, + ); +} + +Widget labelsTextCapacity(var text){ + return Text( + text, + overflow: TextOverflow.ellipsis, + style: labelTextStyleCapacity(), + textScaleFactor: AppSettings.textScaleFactor, + ); +} + + + + + +InputDecoration textFormFieldDecorationForBoxId(IconData icon,var text){ + return InputDecoration( + filled: true, + + fillColor: Colors.white, + prefixIcon: Icon( + icon, + color: primaryColor, + ), + border: OutlineInputBorder(borderSide: BorderSide(color: primaryColor)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: primaryColor), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: primaryColor), + ), + labelText: text, + labelStyle: + TextStyle(color: primaryColor, fontWeight: FontWeight.bold //<-- SEE HERE + ), + ); +} + +final GlobalKey preloaderWindowKey = new GlobalKey(); +Future preloaderWindow(BuildContext context) async { + try { + Dialogs.showLoadingDialog(context, preloaderWindowKey); + } catch (error) {} +} + +class AppSettings { + static SharedPreferences sharedPreferences = + SharedPreferences.getInstance() as SharedPreferences; + static String userName = ''; + static String loginType = ''; + static String accessType = ''; + static String buildingName = ''; + static String userAddress = ''; + static String email = ''; + static String phoneNumber = ''; + static String accessToken = ''; + static String customerId = ''; + static double userLatitude = 0; + static double userLongitude = 0; + static String customerIdsign = ''; + static String profileImage = ''; + static List storedPreferenceValidKeys = ['phone', 'access_token']; + static String preloadText = 'Please wait'; + static String latitude = ''; + static String longitude = ''; + static bool servicestatus = false; + static bool haspermission = false; + static late LocationPermission permission; + static late Position position; + static String long = "", lat = ""; + late StreamSubscription positionStream; + static String fcmId = ''; + static double textScaleFactor = 1.1; + static String serverToken = + 'AAAAA66BLaA:APA91bHcmbyiNN8hCL-t-M9oH-u7ZMOl74fcImMM2DQZLgdyY98Wu9XxME-CTPcjpjU6Yy48ouxISrOMb9lpa3PJofh8qciUKMNxV2al-bDvGvPP_VVaH0mrTHzR56hdkGy1Zl-0frDO'; + static String profilePictureUrl = ''; + + + //api urls + //static String host = 'http://34.100.133.20:5000/api/'; + //static String host = 'http://35.207.198.4:3000/api/'; + + //public host + static String host = 'http://armintaaqua.com:3000/api/'; + + // local host + //static String host = 'http://10.10.1.127:5000/api/'; + static String addTanksUrl = host + 'addTanks'; + static String addTankerUrl = host + 'addTankers'; + static String addBoreUrl = host + 'addBores'; + static String addGovtPipelinesUrl = host + 'addGovtPIpeline'; + static String loginUrl = host + 'login'; + static String signUpUrl = host + 'users'; + static String verifyPhnUrl = host + 'phone'; + static String getTanksDataUrl = host + 'getTanks'; + static String getParticularTankConnectionsDataUrl = host + 'getConnectionsInfoOfParticularTank'; + static String getIotDataUrl = host + 'APIRead'; + static String capacityCaluculateUrl = host + 'calculateCapacity'; + static String getBoresDataUrl = host + 'getBores'; + static String UpdateBoresUrl = host + 'updateBores'; + static String UpdateTankerUrl = host + 'updateTankers'; + static String connectRequestUrl = host + 'users/friend-request'; + static String disconnectRequestUrl = host + 'friend-request/reject'; + static String cancelOrderUrl = host + 'deleteBookingInfo'; + static String UpdateGovtPipelinesUrl = host + 'updatePipeline'; + static String bookATankerUrl = host + 'bookingData'; + static String updateProfileUrl = host + 'update/currentUser'; + static String profilePicUrl = host + 'users/profile-picture'; + static String uploadPicUrl = host + 'uploads-user'; + static String getBookingTankerDetails = host + 'getTankersBookingdetails'; + static String getPendingOrdersForConfirmationUrl = + host + 'pendingconformation'; + static String getOrdersYetDeliveryUrl = host + 'accepted'; + static String getCancelledOrdersUrl = host + 'rejected'; + static String getDeliveredOrdersUrl = host + 'delivered'; + static String getAllOrdersUrl = host + 'orders'; + static String getCustomerPlansUrl = host + 'getuserRequestbookingsforplansforcustomer'; + static String getTankersDataUrl = host + 'getallTankers'; + static String getSupplierAllTankersDataUrl = host + 'getTankers'; + static String getCartItemsUrl = host + 'cart'; + static String getAllSuppliersDataUrl = host + 'getSupplierswithoutbooking'; + static String getConnectedSuppliersDataUrl = host + 'connectedSuppliers'; + static String getPendingSuppliersDataUrl = host + 'pendingSuppliers'; + static String getDisconnectedSuppliersDataUrl = host + 'rejectSuppliers'; + static String getGovtPipelinesDataUrl = host + 'getPipelines'; + static String deleteTankUrl = host + 'deleteTank'; + static String deleteBoreUrl = host + 'deleteBore'; + static String deleteGovtPipelineUrl = host + 'deletePipeline'; + static String deleteTankerUrl = host + 'deleteTanker'; + static String updateTankUrl = host + 'updateTanks'; + static String createConnectionsUrl = host + 'createConnections'; + static String UpdateConnectionsUrl = host + 'updateConnections'; + static String deleteTankConnectionsUrl = host + 'deleteTankConnections'; + static String getTankLevelsDataUrl = host + 'getTanklevels'; + static String getinitialwaterlevel = host + 'updateTanklevels'; + static String getConsumptionDataUrl = host + 'consumption'; + static String getConsumptionDataDateWiseOfAllTanksUrl = host + 'consumptiondatewiseofalltanks'; + static String resetTokenUrl = host + 'reset_token'; + static String startAndStopUrl = host + 'motorAction'; + static String getUserAccountsUrl = host + 'userAccounts'; + static String getUserSupplierAccountsUrl = host + 'UserSupplierAccounts'; + static String forgotPasswordUrl = host + 'forgotpassword'; + static String forgotChangePasswordUrl = host + 'forgot-change-password'; + static String ChangePasswordUrl = host + 'changePassword'; + static String resetPasswordUrl = host + 'resetpassword'; + static String acceptBookingRequestsUrl = host + 'ordernow'; + static String readMotorStatusUrl = host + 'motor/readMotorIotStatus'; + static String changeMotorStatusUrl = host + 'motor/changeMotorStatus'; + static String updateTankMinMaxPercentageUrl = host + 'update_auto_percentage'; + static String updateMotorModeUrl = host + 'update_auto_mode'; + static String getBlocksDataUrl = host + 'getBlockData'; + static String getConsumptionDataForParticulartankUrl = host + 'consumptionofparticulartank'; + static String addStaffUrl = host + 'createstaff'; + static String viewStaffDataUrl = host + 'currentUser'; + static String deleteStaffUrl = host + 'deletestaff'; + static String updateStaffUrl = host + 'editstaff'; + static String getMotorHistoryDataUrl = host + 'getTankmotordata'; + static String updateTankStatusUrl = host + 'updatetankstatus'; + static String getMinMaxLevelsOfAllTanksUrl = host + 'getCustomerAutoPercentages'; + static String getPumpsAndUsersDataUrl = host + 'getPumpsAndUsers'; + static String blockStaffUrl = host + 'blockstaff'; + static String pauseNotificationUrl = host + 'sendNotificationDailyPreference'; + static String timeBasedNotificationUrl = host + 'sendNotificationDaily'; + static String lowLevelNotificationUrl = host + 'sendNotificationLowWaterLevel'; + static String criticalLowLevelNotificationUrl = host + 'sendNotificationCriticallyWaterLevel'; + static String automaticNotificationUrl = host + 'sendNotificationAutomaticStartAndStop'; + static String manualNotificationUrl = host + 'sendNotificationManualStartAndStop'; + static String removeFavouritesUrl = host + 'deletefavoratesupplier'; + static String addFavouriteUrl = host + 'addingfavoratesupplier'; + static String getAllFavouritesDataUrl = host + 'favorites'; + static String getSuppliersForBookingUrl = host + 'suppliersforbooking'; + static String requestOrderUrl = host + 'requestedbookings'; + static String requestPlanUrl = host + 'requestedplanbookings'; + static String getAcceptedOrdersDataFromSupplierUrl = host + 'getuserRequestbookings'; + static String getAcceptedPlansFromSupplierUrl = host + 'getuserRequestbookingsforplansforcustomer'; + static String getSuppliersForPlanUrl = host + 'plan/suppliers'; + static String acceptOrderRequestsUrl = host + 'request-advance-amount'; + static String acceptPlanRequestsUrl = host + 'customer/recurring/respond'; + static String getAcceptedOrdersUrl = host + 'getAllTankersBookingdetailsofuser'; + static String acceptPlanRequestsWithPaymentUrl = host + 'user/recurring/payment'; + static String updateTankNamehileDeliveryUrl = host + 'update-tank-name-while-delivery'; + static String updateBookingDetailsByIdUrl = host + 'get_tanker_booking'; + static String rescheduleOrderUrl = host + 'tanker/reSchedule'; + static String cancelPlanOrderUrl = host + 'cancelOrder'; + static String getAdvanceTransactionsByCustomerUrl = host + 'advance/transactions/customer'; + static String payAdvanceUrl = host + 'advance/pay'; + static String getAdvanceTransactionsBySupplierAndCustomerUrl = host + 'advance/transactions'; + static String addAdvanceTopUpUrl = host + 'advance/transactions'; + static String verifyRazorpayPaymentUrl = host + 'advance/transactions'; + static String createRazorpayOrderUrl = host + 'advance/transactions'; + static String cancelTankerBookingUrl = host + 'update-tank-cancel-status'; + static String getSupplierBookingsUrl = host + 'getuserRequestbookingsforplansforcustomer'; + static String recurringDateActionUrl = host + 'recurring-booking/date-action'; + + static File? updatedImage; + static String image = ''; + static var api = { + 'signIn': host + '/login', + }; + + /*Formatter*/ + static String formNum(String s) { + var comma = NumberFormat('#,##,###', 'en_IN'); + return comma.format( + int.parse(s), + ); + } + + static String formDouble(dynamic s) { + var comma = NumberFormat('#,##,###.##', 'en_IN'); + + if (s == null) return "0.00"; + + String str = s.toString().trim(); + if (str.isEmpty) return "0.00"; + + try { + return comma.format(double.parse(str)); + } catch (e) { + return "0.00"; // fallback if it's not a valid number + } + } + static String moneyConvertion(String value) { + var comma = NumberFormat('#,##,###.00', 'en_IN'); + return comma.format( + double.parse(value), + ); + } + /* Preloader */ + static GlobalKey preLoaderKey = new GlobalKey(); + static Future preLoaderDialog(BuildContext context) async { + try { + preLoaderKey = new GlobalKey(); + Dialogs.showLoadingDialog(context, preLoaderKey); + } catch (error) {} + } + + ////request headers with content type + static Future> buildRequestHeaders() async { + Map _headers = new Map(); + _headers[HttpHeaders.contentTypeHeader] = 'application/json'; + _headers['Authorization'] = accessToken; + return _headers; + } + + static Future> buildRequestHeaders1() async { + Map _headers = new Map(); + _headers[HttpHeaders.contentTypeHeader] = 'application/json'; + return _headers; + } + + //request headers without content type + static Future> buildPutRequestHeaders() async { + Map _headers = new Map(); + _headers['Authorization'] = accessToken; + return _headers; + } + + static Future> + buildPutRequestHeadersForResetToken() async { + Map _headers = new Map(); + return _headers; + } + + // Shared preferences save,get and clear data + static saveData(String _key, _value, type) async { + sharedPreferences = await SharedPreferences.getInstance(); + + if (type == 'STRING') { + await sharedPreferences.setString(_key, _value.toString()); + } else if (type == 'INTEGER') { + await sharedPreferences.setInt(_key, _value); + } else if (type == 'BOOL') { + await sharedPreferences.setBool(_key, _value); + } else if (type == 'DOUBLE') { + await sharedPreferences.setDouble(_key, _value); + } + } + + static getData(String _key, type) async { + sharedPreferences = await SharedPreferences.getInstance(); + if (type == 'STRING') { + return sharedPreferences.getString(_key) ?? ''; + } else if (type == 'INTEGER') { + return sharedPreferences.getInt(_key) ?? -1; + } else if (type == 'BOOL') { + return sharedPreferences.getBool(_key) ?? -1; + } else if (type == 'DOUBLE') { + return sharedPreferences.getDouble(_key) ?? -1; + } + } + + static clearSharedPreferences() async { + sharedPreferences = await SharedPreferences.getInstance(); + await sharedPreferences.clear(); + } + + /*Sign in check*/ + static Future isSigIn() async { + bool isSignInCheck = true; + for (var eachKey in storedPreferenceValidKeys) { + if (await getData(eachKey, 'STRING') == '') { + isSignInCheck = false; + } + } + return isSignInCheck; + } + + static Future internetConnectivity() async { + try { + final result = await InternetAddress.lookup('google.com'); + if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) { + return true; + } + } on SocketException catch (_) { + return false; + } + return false; + } + + /*Apis Starts here*/ + + static Future login(payload) async { + var response = await http.post(Uri.parse(loginUrl), + body: json.encode(payload), + headers: {'Content-type': 'application/json'}); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response['simplydata']['error']); + + if (_response['simplydata']['error'] == false) { + await saveAvailableReportAndLocationsInMemory(_response); + //await saveProfilePic(_response); + return true; + } else { + return false; + } + } catch (e) { + // display error toast + return false; + } + } else { + return false; + } + } + + static Future signUp(payload) async { + var response = await http.post(Uri.parse(signUpUrl), + body: json.encode(payload), + headers: {'Content-type': 'application/json'}); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + customerIdsign = _response['armintatankdata']['customerId']; + print(_response); + return true; + } catch (e) { + // display error toast + return false; + } + } else { + return false; + } + } + + + + + + + static Future verifyPhn(payload) async { + var response = await http.post(Uri.parse(verifyPhnUrl), + body: json.encode(payload), + headers: {'Content-type': 'application/json'}); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); + if (_response['armintatankdata']['error'] == false) { + return true; + } else { + return false; + } + } catch (e) { + // display error toast + return false; + } + } else { + return false; + } + } + + static Future updateProfile(payload) async { + var uri = Uri.parse(updateProfileUrl + '/' + customerId); + try { + var response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + var _response = json.decode(response.body); + + userName = _response['username']; + phoneNumber = _response['phone']; + email = _response['emails'][0]['email']; + + return true; + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future updateProfilePicture(payload) async { + var uri = Uri.parse(profilePicUrl + '/' + customerId); + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); + return true; + } catch (e) { + // display error toast + return false; + } + } else { + return false; + } + } + + static Future uploadrofileImageHTTPNew(file) async { + var request = http.MultipartRequest( + 'POST', Uri.parse(uploadPicUrl + '/' + customerId)); + request.files.add( + await http.MultipartFile.fromPath('file', file.path) + ); + var res = await request.send(); + var response = await http.Response.fromStream(res); + return response.body; + } + + static Future addTanks(payload) async { + var uri = Uri.parse(addTanksUrl + '/' + customerId); + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); + return true; + } catch (e) { + // display error toast + return false; + } + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + static Future addStaff(payload) async { + var uri = Uri.parse(addStaffUrl + '/' + customerId); + var response = await http.post(uri, body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); + return true; + } catch (e) { + // display error toast + return false; + } + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + static Future viewStaff(payload) async { + var uri = Uri.parse(viewStaffDataUrl); + //uri = uri.replace(query: 'customerId=$customerId'); + + var response = await http.post(uri, body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future updateStaff(phone,payload) async { + var uri = Uri.parse(updateStaffUrl + '/' + customerId+ '/' + phone); + + try { + var response = await http.put(uri, body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future blockStaff(phone) async { + var uri = Uri.parse(blockStaffUrl + '/' + customerId+ '/' + phone); + + try { + var response = await http.patch(uri,headers: await buildPutRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, headers: await buildPutRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future deleteStaff(phone) async { + var uri = Uri.parse(deleteStaffUrl + '/' + customerId+ '/' + phone); + + try { + var response = await http.delete(uri, headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.delete(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future getTanks() async { + var uri = Uri.parse(getTanksDataUrl); + uri = uri.replace(query: 'customerId=$customerId'); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getParticularTankConnections(payload) async { + var uri = Uri.parse(getParticularTankConnectionsDataUrl+'/'+customerId); + //uri = uri.replace(query: 'customerId=$customerId'); + + var response = await http.put(uri, body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getIotDataNew() async { + var uri = Uri.parse(getIotDataUrl); + uri = uri.replace(query: 'hardwareId=56789'); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getTankLevels() async { + var uri = Uri.parse(getTankLevelsDataUrl + '/' + customerId); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + + static Future pauseNotificationsData(payload) async { + var uri = Uri.parse(pauseNotificationUrl); + + try { + var response = await http.post(uri, + body: json.encode(payload), + headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); // You can inspect this response further for success + return true; + } catch (e) { + print("Error decoding response: $e"); + return false; + } + } else { + print("Request failed with status: ${response.statusCode}"); + print("Response body: ${response.body}"); + return false; + } + } catch (e) { + print("Error during request: $e"); + return false; + } + } + + static Future timeBasedNotificationsData(payload) async { + var uri = Uri.parse(timeBasedNotificationUrl); + + try { + var response = await http.post(uri, + body: json.encode(payload), + headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); // You can inspect this response further for success + return true; + } catch (e) { + print("Error decoding response: $e"); + return false; + } + } else { + print("Request failed with status: ${response.statusCode}"); + print("Response body: ${response.body}"); + return false; + } + } catch (e) { + print("Error during request: $e"); + return false; + } + } + + static Future lowLevelNotificationsData(payload) async { + var uri = Uri.parse(lowLevelNotificationUrl); + + try { + var response = await http.post(uri, + body: json.encode(payload), + headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); // You can inspect this response further for success + return true; + } catch (e) { + print("Error decoding response: $e"); + return false; + } + } else { + print("Request failed with status: ${response.statusCode}"); + print("Response body: ${response.body}"); + return false; + } + } catch (e) { + print("Error during request: $e"); + return false; + } + } + + + static Future criticalLowLevelNotificationsData(payload) async { + var uri = Uri.parse(criticalLowLevelNotificationUrl); + + try { + var response = await http.post(uri, + body: json.encode(payload), + headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); // You can inspect this response further for success + return true; + } catch (e) { + print("Error decoding response: $e"); + return false; + } + } else { + print("Request failed with status: ${response.statusCode}"); + print("Response body: ${response.body}"); + return false; + } + } catch (e) { + print("Error during request: $e"); + return false; + } + } + + static Future automaticNotificationsData(payload) async { + var uri = Uri.parse(automaticNotificationUrl); + + try { + var response = await http.post(uri, + body: json.encode(payload), + headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); // You can inspect this response further for success + return true; + } catch (e) { + print("Error decoding response: $e"); + return false; + } + } else { + print("Request failed with status: ${response.statusCode}"); + print("Response body: ${response.body}"); + return false; + } + } catch (e) { + print("Error during request: $e"); + return false; + } + } + + + static Future manualNotificationsData(payload) async { + var uri = Uri.parse(manualNotificationUrl); + + try { + var response = await http.post(uri, + body: json.encode(payload), + headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); // You can inspect this response further for success + return true; + } catch (e) { + print("Error decoding response: $e"); + return false; + } + } else { + print("Request failed with status: ${response.statusCode}"); + print("Response body: ${response.body}"); + return false; + } + } catch (e) { + print("Error during request: $e"); + return false; + } + } + + + static Future capacityCaluculate(payload) async { + var uri = Uri.parse(capacityCaluculateUrl); + + var response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future deleteTank(tankName, payload) async { + var uri = Uri.parse(deleteTankUrl + '/' + customerId); + uri = uri.replace(query: 'tankName=$tankName'); + + try { + var response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future updateTank(tankName, payload) async { + var uri = Uri.parse(updateTankUrl + '/' + customerId); + uri = uri.replace(query: 'tankName=$tankName'); + + try { + var response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future updateTankMinMaxPercentage(payload) async { + var uri = Uri.parse(updateTankMinMaxPercentageUrl + '/' + customerId); + + try { + var response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future updateTankStatus(payload) async { + var uri = Uri.parse(updateTankStatusUrl + '/' + customerId); + + try { + var response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future updateMotorMode(payload) async { + var uri = Uri.parse(updateMotorModeUrl + '/' + customerId); + + try { + var response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future addTankers(payload) async { + var uri = Uri.parse(addTankerUrl + '/' + customerId); + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); + return true; + } catch (e) { + // display error toast + return false; + } + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + static Future getTankers() async { + var uri = Uri.parse(getTankersDataUrl); + //uri = uri.replace(query: 'customerId=$customerId'); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getAllTankers(var supplierId) async { + var uri = Uri.parse(getSupplierAllTankersDataUrl); + uri = uri.replace(query: 'supplierId=$supplierId'); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getCartItems() async { + var uri = Uri.parse(getCartItemsUrl+ '/' + customerId); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + + static Future getAllSuppliers() async { + var uri = Uri.parse(getAllSuppliersDataUrl+'/'+customerId); + //uri = uri.replace(query: 'customerId=$customerId'); + + var response = await http.post(uri,headers: await buildPutRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri,headers: await buildPutRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getConnetcedSuppliers() async { + var uri = Uri.parse(getConnectedSuppliersDataUrl + '/' + customerId); + //uri = uri.replace(query: 'customerId=$customerId'); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getPendingSuppliers() async { + var uri = Uri.parse(getPendingSuppliersDataUrl + '/' + customerId); + //uri = uri.replace(query: 'customerId=$customerId'); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getDisconnectedSuppliers() async { + var uri = Uri.parse(getDisconnectedSuppliersDataUrl + '/' + customerId); + //uri = uri.replace(query: 'customerId=$customerId'); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future updateTanker(tankerName, payload) async { + var uri = Uri.parse(UpdateTankerUrl + '/' + customerId); + uri = uri.replace(query: 'tankerName=$tankerName'); + + try { + var response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future deleteTanker(tankerName) async { + var uri = Uri.parse(deleteTankerUrl + '/' + customerId); + uri = uri.replace(query: 'tankerName=$tankerName'); + + try { + var response = + await http.put(uri, headers: await buildPutRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = + await http.put(uri, headers: await buildPutRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future getUpdateTankLevelsInitial() async { + var uri = Uri.parse(getinitialwaterlevel + "/" + customerId); + var response = await http.put(uri, headers: await buildPutRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, headers: await buildPutRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future addBores(payload) async { + var uri = Uri.parse(addBoreUrl + '/' + customerId); + + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); + return true; + } catch (e) { + // display error toast + return false; + } + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + static Future getBores() async { + var uri = Uri.parse(getBoresDataUrl); + uri = uri.replace(query: 'customerId=$customerId'); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future updateBore(boreName, payload) async { + var uri = Uri.parse(UpdateBoresUrl + '/' + customerId); + uri = uri.replace(query: 'boreName=$boreName'); + + try { + var response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future deleteBore(boreName) async { + var uri = Uri.parse(deleteBoreUrl + '/' + customerId); + uri = uri.replace(query: 'boreName=$boreName'); + + try { + var response = + await http.put(uri, headers: await buildPutRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = + await http.put(uri, headers: await buildPutRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future addGovtPipelines(payload) async { + var uri = Uri.parse(addGovtPipelinesUrl + '/' + customerId); + + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); + return true; + } catch (e) { + // display error toast + return false; + } + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + static Future getGovtPipelines() async { + var uri = Uri.parse(getGovtPipelinesDataUrl); + uri = uri.replace(query: 'customerId=$customerId'); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future updateGovtPipeline(pipelineName, payload) async { + var uri = Uri.parse(UpdateGovtPipelinesUrl + '/' + customerId); + uri = uri.replace(query: 'Name=$pipelineName'); + + try { + var response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future deleteGovtPipeline(pipelineName) async { + var uri = Uri.parse(deleteGovtPipelineUrl + '/' + customerId); + uri = uri.replace(query: 'Name=$pipelineName'); + + try { + var response = + await http.put(uri, headers: await buildPutRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = + await http.put(uri, headers: await buildPutRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future createConnections(payload) async { + var uri = Uri.parse(createConnectionsUrl + '/' + customerId); + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); + return true; + } catch (e) { + print(e); + return false; + } + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + static Future updateConnections(payload) async { + var uri = Uri.parse(UpdateConnectionsUrl + '/' + customerId); + + try { + var response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future deleteTankConnection(tankName) async { + var uri = Uri.parse(deleteTankConnectionsUrl + '/' + customerId); + uri = uri.replace(query: 'tankName=$tankName'); + + try { + var response = + await http.put(uri, headers: await buildPutRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = + await http.put(uri, headers: await buildPutRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future bookATanker(payload) async { + var uri = Uri.parse(bookATankerUrl + '/' + customerId); + + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); + return response.body; + } catch (e) { + print(e); + return ''; + } + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getBookedTankerDetails(tankerName) async { + var uri = Uri.parse(getBookingTankerDetails + '/' + customerId); + uri = uri.replace(query: 'tankerName=$tankerName'); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + var _response = json.decode(response.body); + //print(_response); + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getPendingOrdersForConfirmation() async { + var uri = Uri.parse(getPendingOrdersForConfirmationUrl + '/' + customerId); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getOrdersYetDelivery() async { + var uri = Uri.parse(getOrdersYetDeliveryUrl + '/' + customerId); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getDeliveredOrders() async { + var uri = Uri.parse(getDeliveredOrdersUrl + '/' + customerId); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getCancelledOrders() async { + var uri = Uri.parse(getCancelledOrdersUrl + '/' + customerId); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getAllOrders() async { + var uri = Uri.parse(getAllOrdersUrl); + uri = uri.replace(query: 'customerId=$customerId'); + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getCustomerPlans() async { + var uri = Uri.parse(getCustomerPlansUrl+'/'+customerId); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getAcceptedOrdersDataFromSupplier() async { + var uri = Uri.parse(getAcceptedOrdersDataFromSupplierUrl+'/'+customerId); + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getAcceptedPlansFromSupplier() async { + var uri = Uri.parse(getAcceptedPlansFromSupplierUrl+'/'+customerId); + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getConsumptionData(payload) async { + var uri = Uri.parse(getConsumptionDataUrl + '/' + customerId); + + var response = await http.put(uri,body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri,body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getMotorHistoryData(payload) async { + var uri = Uri.parse(getMotorHistoryDataUrl + '/' + customerId); + + var response = await http.put(uri,body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri,body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getConsumptionDataDateWiseOfAllTanks(payload) async { + var uri = Uri.parse(getConsumptionDataDateWiseOfAllTanksUrl + '/' + customerId); + + var response = await http.put(uri,body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri,body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getConsumptionDataForParticularTank(payload) async { + var uri = Uri.parse(getConsumptionDataForParticulartankUrl + '/' + customerId); + + var response = await http.put(uri,body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri,body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getBlocks() async { + var uri = Uri.parse(getBlocksDataUrl + '/' + customerId); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri,headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getPumpsAndUsers() async { + var uri = Uri.parse(getPumpsAndUsersDataUrl + '/' + customerId); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri,headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future resetToken() async { + var uri = Uri.parse(resetTokenUrl + '/' + customerId); + + try { + // var response = await http.get(uri, headers: await buildPutRequestHeaders()); + var response = await http.get(uri, + headers: await buildPutRequestHeadersForResetToken()); + if (response.statusCode == 200) { + print(response.body); + var res = jsonDecode(response.body); + print(res); + + accessToken = res['access_token']; + return true; + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future startAndStop(payload) async { + var uri = Uri.parse(startAndStopUrl + '/' + customerId); + //uri = uri.replace(query: 'Name=$pipelineName'); + + try { + var response = await http.put(uri, body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future startAndStopResponse(payload) async { + var uri = Uri.parse(startAndStopUrl + '/' + customerId); + //uri = uri.replace(query: 'Name=$pipelineName'); + + try { + var response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + return response.body; + } catch (e) { + print(e); + return ''; + } + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } catch (e) { + print(e); + return ''; + } + } + + static Future connectRequest(payload) async { + var uri = Uri.parse(connectRequestUrl); + try { + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future disconnectRequest(payload) async { + var uri = Uri.parse(disconnectRequestUrl); + try { + var response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future cancelOrder(var bookingId) async { + var uri = Uri.parse(cancelOrderUrl + '/' + bookingId); + try { + var response = + await http.put(uri, headers: await buildPutRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = + await http.put(uri, headers: await buildPutRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future cancelOrderNew(var bookingId, payload) async { + var response = await http.post( + Uri.parse(acceptBookingRequestsUrl + '/' + bookingId), + body: json.encode(payload), + headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); + return true; + } catch (e) { + // display error toast + return false; + } + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post( + Uri.parse(acceptBookingRequestsUrl + '/' + bookingId), + body: json.encode(payload), + headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + static Future getUserAccounts() async { + var uri = Uri.parse(getUserAccountsUrl + '/' + customerId); + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getUserSupplierAccounts(var payload) async { + var uri = Uri.parse(getUserSupplierAccountsUrl + '/' + customerId); + var response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future forgotPassword(payload) async { + var uri = Uri.parse(forgotPasswordUrl); + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); + return true; + } catch (e) { + // display error toast + return false; + } + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + static Future forgotChangePassword(payload) async { + var uri = Uri.parse(forgotChangePasswordUrl); + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response['simplydata']['error']); + + if (_response['simplydata']['error'] == false) { + await saveAvailableReportAndLocationsInMemory(_response); + //await saveProfilePic(_response); + return true; + } else { + return false; + } + } catch (e) { + // display error toast + return false; + } + /* try { + var _response = json.decode(response.body); + print(_response); + return true; + } catch (e) { + // display error toast + return false; + }*/ + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + static Future ChangePassword(payload) async { + var uri = Uri.parse(ChangePasswordUrl); + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response['armintatankdata']['error']); + + if (_response['armintatankdata']['error'] == false) { + return true; + } else { + return false; + } + } catch (e) { + // display error toast + return false; + } + /* try { + var _response = json.decode(response.body); + print(_response); + return true; + } catch (e) { + // display error toast + return false; + }*/ + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + static Future resetPassword(payload) async { + var uri = Uri.parse(resetPasswordUrl); + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + print(_response); + return true; + } catch (e) { + // display error toast + return false; + } + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + static Future sendNotification(var body, var titile) async { + final postUrl = 'https://fcm.googleapis.com/fcm/send'; + var token = fcmId; + print('token : $token'); + + final data = { + "notification": {"body": body, "title": titile}, + "priority": "high", + "data": { + "click_action": "FLUTTER_NOTIFICATION_CLICK", + "id": "1", + "status": "done" + }, + "to": "$token" + }; + + final headers = { + 'content-type': 'application/json', + 'Authorization': 'key=$serverToken', + }; + + BaseOptions options = BaseOptions( + headers: headers, + ); + + try { + final response = await Dio(options).post(postUrl, data: data); + + if (response.statusCode == 200) { + longSuccessToast('Request notification sent to supplier'); + } else { + print('notification sending failed'); + // on failure do sth + } + } catch (e) { + print('exception $e'); + } + } + + static Future sendNotificationFromApp(var body, var titile) async { + http.post( + Uri.parse('https://fcm.googleapis.com/fcm/send'), + headers: { + 'Content-Type': 'application/json', + 'Authorization': 'key=$serverToken', + }, + body: jsonEncode( + { + 'notification': { + 'title': titile, + 'body': body, + }, + 'priority': 'high', + 'data': { + 'click_action': 'FLUTTER_NOTIFICATION_CLICK', + 'id': '1', + 'status': 'done' + }, + 'to': fcmId, + }, + ), + ); + } + + static Future readMotorStatus() async { + var uri = Uri.parse(readMotorStatusUrl); + uri = uri.replace(query: 'motor_id=12345'); + try { + var response = await http.get(uri, headers: await buildRequestHeaders1()); + + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } catch (e) { + print(e); + return ''; + } + } + + static Future changeMotorStatus(payload) async { + var uri = Uri.parse(changeMotorStatusUrl); + try { + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders1()); + + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } catch (e) { + print(e); + return ''; + } + } + + static Future getMinMaxLevelsOfAllTanks() async { + var uri = Uri.parse(getMinMaxLevelsOfAllTanksUrl+ '/' + customerId); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future removeFavourites(supplierId) async { + var uri = Uri.parse(removeFavouritesUrl + '/' + customerId); + uri = uri.replace(query: 'supplierId=$supplierId'); + try { + var response = await http.delete(uri, headers: await buildPutRequestHeaders()); + + if (response.statusCode == 200) { + var _response = json.decode(response.body); + + return true; + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future addFavourites(supplierId) async { + var uri = Uri.parse(addFavouriteUrl + '/' + customerId); + uri = uri.replace(query: 'supplierId=$supplierId'); + try { + var response = await http.put(uri, headers: await buildPutRequestHeaders()); + + if (response.statusCode == 200) { + var _response = json.decode(response.body); + + return true; + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + + static Future getAllFavourites() async { + var uri = Uri.parse(getAllFavouritesDataUrl + '/' + customerId); + //uri = uri.replace(query: 'customerId=$customerId'); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future getSuppliersForBooking(payload) async { + var uri = Uri.parse(getSuppliersForBookingUrl + '/' + customerId); + //uri = uri.replace(query: 'customerId=$customerId'); + + var response = await http.post(uri, body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future requestOrder(payload) async { + var uri = Uri.parse(requestOrderUrl); + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + return true; + + } catch (e) { + // display error toast + return false; + } + + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + static Future requestPlan(payload) async { + var uri = Uri.parse(requestPlanUrl); + var response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + try { + var _response = json.decode(response.body); + return true; + + } catch (e) { + // display error toast + return false; + } + + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + static Future getSuppliersForPlan(payload) async { + var uri = Uri.parse(getSuppliersForPlanUrl + '/' + customerId); + //uri = uri.replace(query: 'customerId=$customerId'); + + var response = await http.post(uri, body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post(uri, body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future acceptOrderRequests(payload,dbId) async { + + var uri = Uri.parse(acceptOrderRequestsUrl+'/'+dbId+'/supplier/advance'); + + var response = await http.put(uri, body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri,body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + static Future acceptPlanRequestsWithPayment(payload,dbId) async { + + var uri = Uri.parse(acceptPlanRequestsWithPaymentUrl+'/'+dbId); + + var response = await http.put(uri, body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri,body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + static Future> acceptPlanRequests(payload, dbId) async { + var uri = Uri.parse(acceptPlanRequestsUrl + '/' + dbId); + + var response = await http.post( + uri, + body: json.encode(payload), + headers: await buildRequestHeaders(), + ); + + if (response.statusCode == 200) { + return jsonDecode(response.body); + } + + // If unauthorized, refresh token + if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.post( + uri, + body: json.encode(payload), + headers: await buildRequestHeaders(), + ); + + if (response.statusCode == 200) { + return jsonDecode(response.body); + } + } + } + + // Default fallback + return {"status_code": 0}; + } + + static Future getAcceptedOrders() async { + var uri = Uri.parse(getAcceptedOrdersUrl+'/'+customerId); + //uri = uri.replace(query: 'customerId=$customerId'); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future updateTankNameWhileDelivery(dbId,payload) async { + var uri = Uri.parse(updateTankNamehileDeliveryUrl + '/' + dbId); + + try { + var response = await http.put(uri, body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri, body: json.encode(payload), headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ""; + } + } else { + return ""; + } + } else { + return ""; + } + } catch (e) { + print(e); + return ""; + } + } + + static Future updateBookingDetailsById(dbId) async { + var uri = Uri.parse(updateBookingDetailsByIdUrl + '/' + dbId); + + try { + var response = await http.get(uri,headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ""; + } + } else { + return ""; + } + } else { + return ""; + } + } catch (e) { + print(e); + return ""; + } + } + + static Future rescheduleOrder(dbId,payload) async { + var uri = Uri.parse(rescheduleOrderUrl + '/' + customerId+ '/' + dbId); + + try { + var response = await http.put(uri,body: json.encode(payload),headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.put(uri,body: json.encode(payload),headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ""; + } + } else { + return ""; + } + } else { + return ""; + } + } catch (e) { + print(e); + return ""; + } + } + + static Future cancelPlanOrder(String dbId) async { + final uri = Uri.parse('$cancelPlanOrderUrl/$customerId/$dbId'); + + try { + print("CANCEL PLAN URL => $uri"); + + var response = await http.patch( + uri, + ); + + if (response.statusCode == 200) { + return response.body; + } + + print("CANCEL ERROR ${response.statusCode} => ${response.body}"); + return ""; + + } catch (e) { + print("CANCEL EXCEPTION => $e"); + return ""; + } + } + + static Future getAdvanceTransactionsByCustomer() async { + var uri = Uri.parse(getAdvanceTransactionsByCustomerUrl + '/' + customerId); + //uri = uri.replace(query: 'customerId=$customerId'); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + static Future payAdvance({ + required String transactionId, + required Map payload, + }) async { + var uri = Uri.parse(payAdvanceUrl + '/' + transactionId); + + var response = await http.put( + uri, + body: json.encode(payload), + headers: await buildRequestHeaders(), + ); + + if (response.statusCode == 200) { + return true; + } + + // 🔁 Retry on token expiry + if (response.statusCode == 401) { + final refreshed = await resetToken(); + if (refreshed) { + response = await http.put( + uri, + body: json.encode(payload), + headers: await buildRequestHeaders(), + ); + return response.statusCode == 200; + } + } + + return false; + } + + static Future getAdvanceTransactionsBySupplierAndCustomer( + String supplierId, + String customerId, + ) async { + var uri = Uri.parse("$getAdvanceTransactionsBySupplierAndCustomerUrl/$supplierId/$customerId"); + + + final response = await http.get( + uri, + headers: await buildRequestHeaders(), + ); + + if (response.statusCode == 200) { + return response.body; + } else { + throw Exception("Failed to fetch transactions"); + } + } + + static Future addAdvanceTopUp( + String supplierId, + String customerId, + double amount, + String paymentType, { + String gatewayTxnId = "", + }) async { + var uri = Uri.parse(addAdvanceTopUpUrl); + + final response = await http.post( + uri, + headers: await buildRequestHeaders(), + body: jsonEncode({ + "supplierId": supplierId, + "customerId": customerId, + "advance_amount": amount, + "payment_type": paymentType, + "gateway_txn_id": gatewayTxnId, + }), + ); + + if (response.statusCode == 200) { + return response.body; + } else { + throw Exception("Failed to top up credit"); + } + } + + static Future createRazorpayOrder({ + required double amount, + required String supplierId, + required String customerId, + }) async { + var uri = Uri.parse(createRazorpayOrderUrl); + + final response = await http.post( + uri, + headers: await buildRequestHeaders(), + body: jsonEncode({ + "amount": amount, + "supplierId": supplierId, + "customerId": customerId, + }), + ); + + if (response.statusCode == 200) { + return response.body; // must return: { "order_id": "...", "key_id": "rzp_test..." } + } else { + throw Exception("Failed to create Razorpay order"); + } + } + + static Future verifyRazorpayPayment({ + required String razorpayPaymentId, + required String razorpayOrderId, + required String razorpaySignature, + }) async { + var uri = Uri.parse(verifyRazorpayPaymentUrl); + + final response = await http.post( + uri, + headers: await buildRequestHeaders(), + body: jsonEncode({ + "razorpay_payment_id": razorpayPaymentId, + "razorpay_order_id": razorpayOrderId, + "razorpay_signature": razorpaySignature, + }), + ); + + if (response.statusCode == 200) { + return response.body; + } else { + throw Exception("Failed to verify Razorpay payment"); + } + } + + static Future cancelTankerBooking( + String bookingId, + String status, + String reason, + ) async { + try { + var uri = Uri.parse("$cancelTankerBookingUrl/$bookingId"); + + var payload = json.encode({ + "status": status, // "cancelled" + "reason": reason, + }); + + var response = await http.put( + uri, + body: payload, + headers: await buildRequestHeaders(), + ); + + if (response.statusCode == 200) { + return true; + } + + // 🔁 Token expired → retry + if (response.statusCode == 401) { + bool refreshed = await resetToken(); + if (!refreshed) return false; + + response = await http.put( + uri, + body: payload, + headers: await buildRequestHeaders(), + ); + + return response.statusCode == 200; + } + + return false; + } catch (e) { + debugPrint("❌ cancelTankerBooking error: $e"); + return false; + } + } + + static Future getSupplierBookings() async { + var uri = Uri.parse("$getSupplierBookingsUrl/${AppSettings.customerId}"); + + + final response = await http.get( + uri, + headers: await buildRequestHeaders(), + ); + + if (response.statusCode == 200) { + return response.body; + } else { + throw Exception("Failed to fetch transactions"); + } + } + + static Future recurringDateAction( + String bookingId, + Map payload, + ) async { + + final url = Uri.parse("$recurringDateActionUrl/${bookingId}"); + + + final response = await http.post( + url, + headers: await buildRequestHeaders(), + body: jsonEncode(payload), + ); + + if (response.statusCode != 200) { + throw Exception( + "Recurring date action failed: ${response.body}", + ); + } + } + + + /*Apis ends here*/ + + //save data local + static Future saveAvailableReportAndLocationsInMemory( + dynamic input) async { + // save login name information + await saveData('username', input['simplydata']['username'], 'STRING'); + await saveData('logintype', input['simplydata']['loginType'], 'STRING'); + await saveData('all_motor_access', input['simplydata']['all_motor_access'], 'STRING'); + await saveData('buildingname', input['simplydata']['buildingName'], 'STRING'); + await saveData( + 'access_token', input['simplydata']['access_token'], 'STRING'); + await saveData('phone', input['simplydata']['phone'], 'STRING'); + await saveData('email', input['simplydata']['email'][0]['email'], 'STRING'); + await saveData('customerId', input['simplydata']['customerId'], 'STRING'); + await saveData('profile', input['simplydata']['picture'], 'STRING'); + await saveData('user_address', input['simplydata']['address1'], 'STRING'); + if(input['simplydata']['latitude']==0){ + input['simplydata']['latitude']=0.0; + } + if(input['simplydata']['longitude']==0){ + input['simplydata']['longitude']=0.0; + } + await saveData('latitude', input['simplydata']['latitude'], 'DOUBLE'); + await saveData('longitude', input['simplydata']['longitude'], 'DOUBLE'); + await saveData('fcmId', input['simplydata']['fcmId'], 'STRING'); + + //latitude,longitude + await loadDataFromMemory(); + } + + static Future saveProfile(dynamic image) async { + // save login name information + await saveData('profile', image.toString(), 'STRING'); + //await loadDataFromMemory(); + } + + static Uint8List convertBase64Image(String base64String) { + return Base64Decoder().convert(base64String.split(',').last); + } + + static Future loadDataFromMemory() async { + userName = await getData('username', 'STRING'); + loginType = await getData('logintype', 'STRING'); + accessType = await getData('all_motor_access', 'STRING'); + buildingName = await getData('buildingname', 'STRING'); + accessToken = await getData('access_token', 'STRING'); + email = await getData('email', 'STRING'); + userAddress = await getData('user_address', 'STRING'); + phoneNumber = await getData('phone', 'STRING'); + customerId = await getData('customerId', 'STRING'); + userLatitude = await getData('latitude', 'DOUBLE'); + userLongitude = await getData('longitude', 'DOUBLE'); + profilePictureUrl = await getData('profile', 'STRING'); + fcmId = await getData('fcmId', 'STRING'); + //profileImage=await getData('profile', 'STRING'); + getProfile(); + } + + static String getStringFromBytes(var data) { + final buffer = data.buffer; + var list = buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); + var bufferdata = utf8.decode(list); + String bs4str = base64.encode(list); + Uint8List decodedbytes = base64.decode(bs4str); +//OR + // String bs4str1 = base64Encode(imgbytes); + String s = new String.fromCharCodes(list); + var outputAsUint8List = new Uint8List.fromList(s.codeUnits); + return bufferdata; + } + + static Uint8List image1(dynamicList) { + List intList = + dynamicList.cast().toList(); //This is the magical line. + Uint8List data = Uint8List.fromList(intList); + return data; + } + + static Future getProfile() async { + final image1 = await getData('profile', 'STRING'); + + //Io.File.fromUri(imageFile.uri) + + var x = image1; + + if (image1 == null) return; + + if (image1 == '') { + updatedImage = null; + } else if (image1 == 'null') { + updatedImage = null; + } else { + final imageTemp = File(image1); + updatedImage = imageTemp; + } + + print(updatedImage); + } + + //assign saved values to variables + static Future saveProfilePic(dynamic input) async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + +// your custom int list + List mList = input['simplydata']['picture']['data']; + + print(mList.length); + //input['simplydata']['picture']['data'];[0,1,2,3] + +// convert your custom list to string list + List stringsList = mList.map((i) => i.toString()).toList(); + +// store your string list in shared prefs + prefs.setStringList("stringList", stringsList); + + // String bar = utf8.decode(bytes); + + //String convertedValue = utf8.decode(mList); + } + + static Widget noDataUI(String _tabName) { + _tabName = _tabName ?? ''; + return Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image( + image: AssetImage('images/no_data.png'), + width: 200, + ), + SizedBox( + height: 8, + ), + Text( + 'There is no data to show you right now.', + style: TextStyle( + fontSize: 12, + color: Colors.grey[600], + fontFamily: 'Swis2', + ), + ), + SizedBox( + height: 5, + ), + Text( + _tabName, + style: TextStyle(fontSize: 15, fontFamily: 'Swis1'), + ), + ], + ), + ); + } + + static appBar(String title) { + title = title ?? ''; + return AppBar( + backgroundColor: Colors.white, + elevation: 0, + scrolledUnderElevation: 0, + titleSpacing: 0, + title: Text(title,style: fontTextStyle(14,Color(0XFF2A2A2A),FontWeight.w500),), + iconTheme: IconThemeData(color: Color(0XFF2A2A2A)), + actions: [ + Row( + children: [ + Padding(padding: EdgeInsets.fromLTRB(10,10,0,10), + child: IconButton( + icon: Image( + image: AssetImage('images/customercare_appbar.png') + + ), + onPressed: (){ + + }, + ), + ), + + Padding(padding: EdgeInsets.fromLTRB(0,10,10,10), + child: IconButton( + icon: Image.asset( + 'images/notification_appbar.png', // Example URL image + ), + onPressed: (){ + + }, + ), + ) + ], + ) + ], + ); + } + + static SupplierAppBar(String title,context) { + title = title ?? ''; + return AppBar( + backgroundColor: Colors.white, + elevation: 0, + scrolledUnderElevation: 0, + titleSpacing: 0, + title: Text( + title, + style: fontTextStyle(14, Color(0XFF2A2A2A), FontWeight.w500), + ), + iconTheme: IconThemeData(color: Color(0XFF2A2A2A)), + actions: [ + Row( + children: [ + Padding( + padding: EdgeInsets.fromLTRB(10, 10, 0, 10), + child: IconButton( + icon: Image( + image: + AssetImage('images/calender_supplier_landing.png')), + onPressed: () {}, + ), + ), + Padding( + padding: EdgeInsets.fromLTRB(0, 10, 10, 10), + child: IconButton( + icon: Image.asset( + 'images/notification_appbar.png', // Example URL image + ), + onPressed: () {}, + ), + ) + ], + ) + ], + leading: GestureDetector( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: + const EdgeInsets.fromLTRB(8, 8, 8, 8), // Add padding if needed + child: Image.asset( + 'images/backbutton_appbar.png', // Replace with your image path + fit: BoxFit.contain, + color: Color(0XFF2A2A2A), + height: 24, + width: 24, + ), + ), + ), + ); + } + + + static appBarWithoutActions(String title) { + title = title ?? ''; + return AppBar( + backgroundColor: Colors.white, + elevation: 0, + scrolledUnderElevation: 0, + titleSpacing: 0, + title: Text( + title, + style: fontTextStyle(14, Color(0XFF2A2A2A), FontWeight.w500), + ), + iconTheme: IconThemeData(color: Color(0XFF2A2A2A)), + ); + } + + static supplierAppBarWithoutActions(String title,context) { + title = title ?? ''; + return AppBar( + backgroundColor: Colors.white, + elevation: 0, + scrolledUnderElevation: 0, + titleSpacing: 0, + title: Text( + title, + style: fontTextStyle(14, Color(0XFF101214), FontWeight.w500), + ), + iconTheme: IconThemeData(color: Color(0XFF2A2A2A)), + leading: GestureDetector( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.fromLTRB( + 8, 8, 8, 8), // Add padding if needed + child: Image.asset( + 'images/backbutton_appbar.png', + height: 24, + width: 24,// Replace with your image path + fit: BoxFit.contain, // Adjust the fit + ), + ), + ), + ); + } + + static supplierAppBarWithActionsText(String title,context) { + title = title ?? ''; + return AppBar( + backgroundColor: Colors.white, + elevation: 0, + scrolledUnderElevation: 0, + titleSpacing: 0, + title: Text( + title, + style: fontTextStyle(14, Color(0XFF101214), FontWeight.w500), + ), + iconTheme: IconThemeData(color: Color(0XFF2A2A2A)), + leading: GestureDetector( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.fromLTRB( + 8, 8, 8, 8), // Add padding if needed + child: Image.asset( + 'images/backbutton_appbar.png', + height: 24, + width: 24,// Replace with your image path + fit: BoxFit.contain, // Adjust the fit + ), + ), + ), + actions: [ + Padding(padding: EdgeInsets.all(8), + child: TextButton( + onPressed: () async { + }, + child: Text('HELP', + style: fontTextStyle(14,Color(0XFF1D7AFC),FontWeight.w600),), + ),) + ], + ); + } + + static void longFailedToast(String message) { + Fluttertoast.showToast( + msg: message, + toastLength: Toast.LENGTH_LONG, + gravity: ToastGravity.BOTTOM, + timeInSecForIosWeb: 1, + backgroundColor: Colors.red, + textColor: Colors.white, + fontSize: 16.0); + } + + + static void longSuccessToast(String message) { + Fluttertoast.showToast( + msg: message, + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.BOTTOM, + timeInSecForIosWeb: 1, + backgroundColor: Colors.green, + textColor: Colors.white, + fontSize: 16.0); + } + + /*location*/ + static checkGps() async { + servicestatus = await Geolocator.isLocationServiceEnabled(); + if (servicestatus) { + permission = await Geolocator.checkPermission(); + + if (permission == LocationPermission.denied) { + permission = await Geolocator.requestPermission(); + if (permission == LocationPermission.denied) { + print('Location permissions are denied'); + } else if (permission == LocationPermission.deniedForever) { + print("'Location permissions are permanently denied"); + } else { + haspermission = true; + } + } else { + haspermission = true; + } + + if (haspermission) { + /*setState(() { + //refresh the UI + });*/ + + await getLocation(); + } + } else { + print("GPS Service is not enabled, turn on GPS location"); + } + } + + static getLocation() async { + position = await Geolocator.getCurrentPosition( + desiredAccuracy: LocationAccuracy.high); + /*print(position.longitude); //Output: 80.24599079 + print(position.latitude);*/ //Output: 29.6593457 + + long = await position.longitude.toString(); + lat = await position.latitude.toString(); + + /*setState(() { + //refresh UI + });*/ + + LocationSettings locationSettings = LocationSettings( + accuracy: LocationAccuracy.high, //accuracy of the location data + distanceFilter: 100, //minimum distance (measured in meters) a + //device must move horizontally before an update event is generated; + ); + + StreamSubscription positionStream = + Geolocator.getPositionStream(locationSettings: locationSettings) + .listen((Position position) { + print(position.longitude); //Output: 80.24599079 + print(position.latitude); //Output: 29.6593457 + + long = position.longitude.toString(); + lat = position.latitude.toString(); + + /*setState(() { + //refresh UI on update + });*/ + }); + } +} diff --git a/lib/common/splash_screen.dart b/lib/common/splash_screen.dart new file mode 100644 index 0000000..341e70b --- /dev/null +++ b/lib/common/splash_screen.dart @@ -0,0 +1,99 @@ +import 'package:bookatanker/common/settings.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; +import '../login.dart'; +import 'package:firebase_core/firebase_core.dart'; + +import 'dashboard.dart'; + +void main() async{ + SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); + await Firebase.initializeApp(); + //FirebaseMessaging.onBackgroundMessage(_messageHandler); + runApp(new Splash()); +} + + +class Splash extends StatelessWidget { + // This widget is the root of your application. + @override + Widget build(BuildContext context) { + return MaterialApp( + debugShowCheckedModeBanner: false, + title: 'Aquick Driver', + theme: new ThemeData( + primarySwatch: Colors.blue, + ), + home: new SplashScreen(), + ); + } +} + +class SplashScreen extends StatefulWidget { + const SplashScreen({ super.key }); + + @override + State createState() => _SplashScreenState(); +} + +class _SplashScreenState extends State { + + final storage = FlutterSecureStorage( + aOptions: AndroidOptions( + resetOnError: true, + encryptedSharedPreferences: true, + ), + ); + + Future _checkLoginStatus() async { + await Future.delayed(Duration(seconds: 2)); // Simulate splash delay + String? authToken = await storage.read(key: 'authToken'); + if (authToken != null) { + await AppSettings.loadDataFromMemory(); + //AppSettings.fcmId=await AppSettings.getData('FCM_TOKEN', 'STRING'); + Navigator.pushReplacement( + context, + MaterialPageRoute(builder: (context) => Dashboard()), + ); + } else { + // Navigate to Login Screen otherwise + Navigator.pushReplacement( + context, + MaterialPageRoute(builder: (context) => LoginScreen()), + ); + } + } + + + + @override + void initState() { + + //loginCheck(); + super.initState(); + _checkLoginStatus(); + /* Future.delayed( + const Duration(seconds: 3), + () => Navigator.push( + context, + MaterialPageRoute(builder: (context) => _defaultHome), + ));*/ + } + @override + Widget build(BuildContext context) { + return Scaffold( + body: Stack( + children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage(image: AssetImage("images/final_splash_screen.jpg"), fit: BoxFit.fill,), + ), + ), + + ], + ) + ); + } + +} \ No newline at end of file diff --git a/lib/confirm_mobilenumber.dart b/lib/confirm_mobilenumber.dart new file mode 100644 index 0000000..d75b905 --- /dev/null +++ b/lib/confirm_mobilenumber.dart @@ -0,0 +1,138 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'common/settings.dart'; +import 'otp.dart'; + + +class ConfirmMobileScreen extends StatefulWidget { + const ConfirmMobileScreen({super.key}); + + @override + State createState() => _ConfirmMobileScreenState(); +} + +class _ConfirmMobileScreenState extends State { + final TextEditingController mobileController = TextEditingController(); + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, // ✅ Full white background + appBar: AppBar( + backgroundColor: Colors.white, + elevation: 0, + iconTheme: IconThemeData(color: Color(0XFF2A2A2A)), + leading: GestureDetector( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: + const EdgeInsets.fromLTRB(8, 8, 8, 8), // Add padding if needed + child: Image.asset( + 'images/backbutton_appbar.png', // Replace with your image path + fit: BoxFit.contain, + color: Color(0XFF2A2A2A), + height: 24, + width: 24, + ), + ), + ), + title: Text( + "Confirm Mobile Number", + style: fontTextStyle(16, Color(0xFF000000), FontWeight.w800), + ), + centerTitle: true, + ), + body: Padding( + padding: const EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 30), + + Center( + child: Text( + "Enter registered mobile number", + style: fontTextStyle(16, Color(0xFF101214), FontWeight.w800), + textAlign: TextAlign.center, + ), + ), + + const SizedBox(height: 40), + + // Label + Text( + "Mobile Number", + style: fontTextStyle(12, Color(0xFF2F3036), FontWeight.w700), + ), + const SizedBox(height: 8), + + // TextField + TextField( + controller: mobileController, + keyboardType: TextInputType.phone, + inputFormatters: [ + LengthLimitingTextInputFormatter(10), // max 10 digits + FilteringTextInputFormatter.digitsOnly, // only digits + ], + decoration: InputDecoration( + border: const OutlineInputBorder(), + hintText: "Enter your number", + hintStyle: fontTextStyle(14, Color(0xFF2A2A2A), FontWeight.w400), + ), + ), + + const SizedBox(height: 40), + + // Continue button + SizedBox( + width: double.infinity, + height: 50, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: const Color(0XFF101214), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30), + ), + ), + onPressed: () { + + String mobile = mobileController.text.trim(); + + if (mobile.length == 10) { + + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OtpScreen( + mobileNumber: mobile, // ✅ PASS NUMBER + ), + ), + ); + + } else { + + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text("Please enter 10 digits ❌"), + ), + ); + + } + }, + child: Text( + "Continue", + style: fontTextStyle( + 14, + Colors.white, + FontWeight.w600), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/createpassword.dart b/lib/createpassword.dart new file mode 100644 index 0000000..a158419 --- /dev/null +++ b/lib/createpassword.dart @@ -0,0 +1,233 @@ +import 'package:flutter/material.dart'; +import 'changepassword.dart'; +import 'common/settings.dart'; + + +class CreatePasswordScreen extends StatefulWidget { + const CreatePasswordScreen({super.key}); + + @override + _CreatePasswordScreenState createState() => _CreatePasswordScreenState(); +} + +class _CreatePasswordScreenState extends State { + final _formKey = GlobalKey(); + final _newPasswordController = TextEditingController(); + final _confirmPasswordController = TextEditingController(); + + bool _obscureNew = true; + bool _obscureConfirm = true; + + @override + void dispose() { + _newPasswordController.dispose(); + _confirmPasswordController.dispose(); + super.dispose(); + } + + Future _savePassword() async { + if (!_formKey.currentState!.validate()) return; + + // TODO: call your API to set password here + // await yourApi.setPassword(_newPasswordController.text); + + // Optional: show success then navigate + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text("Password changed successfully")), + ); + + // Small delay so the SnackBar is noticeable (optional) + await Future.delayed(const Duration(milliseconds: 300)); + + if (!mounted) return; + + // ✅ Navigate to Select Tour Tanker page and clear back stack + Navigator.pushAndRemoveUntil( + context, + MaterialPageRoute( + builder: (_) => ChangePasswordScreen(), // replace with your actual page + ), + (route) => false, + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: true, // shifts UI up when keyboard opens + backgroundColor: Colors.white, + appBar: AppBar( + backgroundColor: Colors.white, + elevation: 0, + surfaceTintColor: Colors.transparent, // <- remove M3 tint + scrolledUnderElevation: 0, + + title: Text( + "Change Password", + style: fontTextStyle(14, Color(0xFF101214), FontWeight.w500), + ), + iconTheme: IconThemeData(color: Color(0XFF2A2A2A)), + leading: GestureDetector( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: + const EdgeInsets.fromLTRB(8, 8, 8, 8), // Add padding if needed + child: Image.asset( + 'images/backbutton_appbar.png', // Replace with your image path + fit: BoxFit.contain, + color: Color(0XFF2A2A2A), + height: 24, + width: 24, + ), + ), + ), + ), + body: SingleChildScrollView( + padding: const EdgeInsets.all(20.0), + physics: const BouncingScrollPhysics(), + child: Form( + key: _formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + // Centered title & subtitle with top padding + Padding( + padding: const EdgeInsets.only(top: 40, bottom: 24), + child: Column( + children: [ + Text( + "Create Password", + textAlign: TextAlign.center, + style: fontTextStyle(16, Color(0xFF000000),FontWeight.w800,), + ), + SizedBox(height: 6), + Text( + "Create a strong password for your account", + textAlign: TextAlign.center, + style: fontTextStyle(12, Color(0xFF7E7F80), FontWeight.w400, + ), + ), + ], + ), + ), + + // New Password + Align( + alignment: Alignment.centerLeft, + child: Text( + "New Password*", + style: fontTextStyle(12, Color(0xFF101214), FontWeight.w700, + ), + ), + ), + const SizedBox(height: 8), + TextFormField( + controller: _newPasswordController, + obscureText: _obscureNew, + decoration: InputDecoration( + border: const OutlineInputBorder(), + hintText: "Enter new password", + hintStyle: fontTextStyle(14, Color(0xFF2A2A2A), FontWeight.w400, + ), + suffixIcon: IconButton( + icon: Icon( + _obscureNew ? Icons.visibility_off : Icons.visibility, + ), + onPressed: () => setState(() { + _obscureNew = !_obscureNew; + }), + ), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return "Please enter new password"; + } + if (value.length < 6) { + return "Password must be at least 6 characters"; + } + return null; + }, + ), + const SizedBox(height: 20), + + // Confirm Password + Align( + alignment: Alignment.centerLeft, + child: Text( + "Confirm Password*", + style: fontTextStyle(12, Color(0xFF101214), FontWeight.w700, + ), + ), + ), + const SizedBox(height: 8), + TextFormField( + controller: _confirmPasswordController, + obscureText: _obscureConfirm, + decoration: InputDecoration( + border: const OutlineInputBorder(), + hintText: "Confirm new password", + hintStyle: fontTextStyle(14, Color(0xFF2A2A2A), FontWeight.w400, + ), + suffixIcon: IconButton( + icon: Icon( + _obscureConfirm ? Icons.visibility_off : Icons.visibility, + ), + onPressed: () => setState(() { + _obscureConfirm = !_obscureConfirm; + }), + ), + ), + validator: (value) { + if (value != _newPasswordController.text) { + return "Passwords do not match"; + } + return null; + }, + ), + const SizedBox(height: 30), + + // Save & Login Button + SizedBox( + width: double.infinity, + child: ElevatedButton( + onPressed: _savePassword, + style: ElevatedButton.styleFrom( + padding: const EdgeInsets.symmetric(vertical: 16), + backgroundColor: Color(0XFF101214), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30), + ), + ), + child: Text( + "Save and Continue", + style: fontTextStyle(14, Color(0xFFFFFFFF), FontWeight.w600, + ), + ), + ), + ), + ], + ), + ), + ), + ); + } +} + +class SelectTourTankerPage extends StatelessWidget { + const SelectTourTankerPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text("Select Tour Tanker")), + body: const Center( + child: Text( + "Select Tour Tanker page goes here", + style: TextStyle(fontSize: 16), + ), + ), + ); + } +} diff --git a/lib/google_maps_place_picker_mb/google_maps_place_picker.dart b/lib/google_maps_place_picker_mb/google_maps_place_picker.dart new file mode 100644 index 0000000..f9466bf --- /dev/null +++ b/lib/google_maps_place_picker_mb/google_maps_place_picker.dart @@ -0,0 +1,7 @@ +library google_maps_place_picker_mb; + +export 'src/models/pick_result.dart'; +export 'src/components/floating_card.dart'; +export 'src/components/rounded_frame.dart'; +export 'src/models/circle_area.dart'; +export 'src/place_picker.dart'; diff --git a/lib/google_maps_place_picker_mb/providers/place_provider.dart b/lib/google_maps_place_picker_mb/providers/place_provider.dart new file mode 100644 index 0000000..e665b36 --- /dev/null +++ b/lib/google_maps_place_picker_mb/providers/place_provider.dart @@ -0,0 +1,161 @@ +import 'dart:async'; + +import 'package:flutter/widgets.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:google_maps_webservice/geocoding.dart'; +import 'package:google_maps_webservice/places.dart'; +import 'package:http/http.dart'; +import 'package:provider/provider.dart'; + +import '../src/models/pick_result.dart'; +import '../src/place_picker.dart'; + +class PlaceProvider extends ChangeNotifier { + PlaceProvider( + String apiKey, + String? proxyBaseUrl, + Client? httpClient, + Map apiHeaders, + ) { + places = GoogleMapsPlaces( + apiKey: apiKey, + baseUrl: proxyBaseUrl, + httpClient: httpClient, + apiHeaders: apiHeaders as Map?, + ); + + geocoding = GoogleMapsGeocoding( + apiKey: apiKey, + baseUrl: proxyBaseUrl, + httpClient: httpClient, + apiHeaders: apiHeaders as Map?, + ); + } + + static PlaceProvider of(BuildContext context, {bool listen = true}) => + Provider.of(context, listen: listen); + + late GoogleMapsPlaces places; + late GoogleMapsGeocoding geocoding; + String? sessionToken; + bool isOnUpdateLocationCooldown = false; + LocationAccuracy? desiredAccuracy; + bool isAutoCompleteSearching = false; + + Future updateCurrentLocation(bool forceAndroidLocationManager) async { + bool serviceEnabled; + LocationPermission permission; + + // Test if location services are enabled. + serviceEnabled = await Geolocator.isLocationServiceEnabled(); + if (!serviceEnabled) { + // Location services are not enabled don't continue + // accessing the position and request users of the + // App to enable the location services. + return Future.error('Location services are disabled.'); + } + + permission = await Geolocator.checkPermission(); + if (permission == LocationPermission.denied) { + permission = await Geolocator.requestPermission(); + if (permission == LocationPermission.denied) { + // Permissions are denied, next time you could try + // requesting permissions again (this is also where + // Android's shouldShowRequestPermissionRationale + // returned true. According to Android guidelines + // your App should show an explanatory UI now. + return Future.error('Location permissions are denied'); + } + } + + if (permission == LocationPermission.deniedForever) { + // Permissions are denied forever, handle appropriately. + return Future.error( + 'Location permissions are permanently denied, we cannot request permissions.'); + } + + Position position = await Geolocator.getCurrentPosition( + desiredAccuracy: LocationAccuracy.best, + ); + + currentPosition = position; + + // notifyListeners(); + } + + Position? _currentPosition; + Position? get currentPosition => _currentPosition; + set currentPosition(Position? newPosition) { + _currentPosition = newPosition; + notifyListeners(); + } + + Timer? _debounceTimer; + Timer? get debounceTimer => _debounceTimer; + set debounceTimer(Timer? timer) { + _debounceTimer = timer; + notifyListeners(); + } + + CameraPosition? _previousCameraPosition; + CameraPosition? get prevCameraPosition => _previousCameraPosition; + setPrevCameraPosition(CameraPosition? prePosition) { + _previousCameraPosition = prePosition; + } + + CameraPosition? _currentCameraPosition; + CameraPosition? get cameraPosition => _currentCameraPosition; + setCameraPosition(CameraPosition? newPosition) { + _currentCameraPosition = newPosition; + } + + PickResult? _selectedPlace; + PickResult? get selectedPlace => _selectedPlace; + set selectedPlace(PickResult? result) { + _selectedPlace = result; + notifyListeners(); + } + + SearchingState _placeSearchingState = SearchingState.Idle; + SearchingState get placeSearchingState => _placeSearchingState; + set placeSearchingState(SearchingState newState) { + _placeSearchingState = newState; + notifyListeners(); + } + + GoogleMapController? _mapController; + GoogleMapController? get mapController => _mapController; + set mapController(GoogleMapController? controller) { + _mapController = controller; + notifyListeners(); + } + + PinState _pinState = PinState.Preparing; + PinState get pinState => _pinState; + set pinState(PinState newState) { + _pinState = newState; + notifyListeners(); + } + + bool _isSeachBarFocused = false; + bool get isSearchBarFocused => _isSeachBarFocused; + set isSearchBarFocused(bool focused) { + _isSeachBarFocused = focused; + notifyListeners(); + } + + MapType _mapType = MapType.normal; + MapType get mapType => _mapType; + setMapType(MapType mapType, {bool notify = false}) { + _mapType = mapType; + if (notify) notifyListeners(); + } + + switchMapType() { + _mapType = MapType.values[(_mapType.index + 1) % MapType.values.length]; + if (_mapType == MapType.none) _mapType = MapType.normal; + + notifyListeners(); + } +} diff --git a/lib/google_maps_place_picker_mb/providers/search_provider.dart b/lib/google_maps_place_picker_mb/providers/search_provider.dart new file mode 100644 index 0000000..88d6520 --- /dev/null +++ b/lib/google_maps_place_picker_mb/providers/search_provider.dart @@ -0,0 +1,16 @@ +import 'package:flutter/widgets.dart'; +import 'package:provider/provider.dart'; + +class SearchProvider extends ChangeNotifier { + static SearchProvider of(BuildContext context, {bool listen = true}) => + Provider.of(context, listen: listen); + + String prevSearchTerm = ""; + String _searchTerm = ""; + String get searchTerm => _searchTerm; + + set searchTerm(String newValue) { + _searchTerm = newValue; + notifyListeners(); + } +} diff --git a/lib/google_maps_place_picker_mb/src/autocomplete_search.dart b/lib/google_maps_place_picker_mb/src/autocomplete_search.dart new file mode 100644 index 0000000..cfd5976 --- /dev/null +++ b/lib/google_maps_place_picker_mb/src/autocomplete_search.dart @@ -0,0 +1,341 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:google_maps_webservice/places.dart'; +import 'package:provider/provider.dart'; +import 'package:bookatanker/google_maps_place_picker_mb/google_maps_place_picker.dart'; +import 'package:bookatanker/google_maps_place_picker_mb/providers/place_provider.dart'; +import 'package:bookatanker/google_maps_place_picker_mb/providers/search_provider.dart'; +import 'package:bookatanker/google_maps_place_picker_mb/src/components/prediction_tile.dart'; +import 'package:bookatanker/google_maps_place_picker_mb/src/components/rounded_frame.dart'; +import 'package:bookatanker/google_maps_place_picker_mb/src/controllers/autocomplete_search_controller.dart'; + +class AutoCompleteSearch extends StatefulWidget { + const AutoCompleteSearch( + {Key? key, + required this.sessionToken, + required this.onPicked, + required this.appBarKey, + this.hintText = "Search here", + this.searchingText = "Searching...", + this.hidden = false, + this.height = 40, + this.contentPadding = EdgeInsets.zero, + this.debounceMilliseconds, + this.onSearchFailed, + required this.searchBarController, + this.autocompleteOffset, + this.autocompleteRadius, + this.autocompleteLanguage, + this.autocompleteComponents, + this.autocompleteTypes, + this.strictbounds, + this.region, + this.initialSearchString, + this.searchForInitialValue, + this.autocompleteOnTrailingWhitespace}) + : super(key: key); + + final String? sessionToken; + final String? hintText; + final String? searchingText; + final bool hidden; + final double height; + final EdgeInsetsGeometry contentPadding; + final int? debounceMilliseconds; + final ValueChanged onPicked; + final ValueChanged? onSearchFailed; + final SearchBarController searchBarController; + final num? autocompleteOffset; + final num? autocompleteRadius; + final String? autocompleteLanguage; + final List? autocompleteTypes; + final List? autocompleteComponents; + final bool? strictbounds; + final String? region; + final GlobalKey appBarKey; + final String? initialSearchString; + final bool? searchForInitialValue; + final bool? autocompleteOnTrailingWhitespace; + + @override + AutoCompleteSearchState createState() => AutoCompleteSearchState(); +} + +class AutoCompleteSearchState extends State { + TextEditingController controller = TextEditingController(); + FocusNode focus = FocusNode(); + OverlayEntry? overlayEntry; + SearchProvider provider = SearchProvider(); + + @override + void initState() { + super.initState(); + if (widget.initialSearchString != null) { + WidgetsBinding.instance.addPostFrameCallback((_) { + controller.text = widget.initialSearchString!; + if (widget.searchForInitialValue!) { + _onSearchInputChange(); + } + }); + } + controller.addListener(_onSearchInputChange); + focus.addListener(_onFocusChanged); + + widget.searchBarController.attach(this); + } + + @override + void dispose() { + controller.removeListener(_onSearchInputChange); + controller.dispose(); + + focus.removeListener(_onFocusChanged); + focus.dispose(); + _clearOverlay(); + + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return !widget.hidden + ? ChangeNotifierProvider.value( + value: provider, + child: RoundedFrame( + height: widget.height, + padding: const EdgeInsets.only(right: 10), + color: Theme.of(context).brightness == Brightness.dark + ? Colors.black54 + : Colors.white, + borderRadius: BorderRadius.circular(20), + elevation: 4.0, + child: Row( + children: [ + SizedBox(width: 10), + Icon(Icons.search), + SizedBox(width: 10), + Expanded(child: _buildSearchTextField()), + _buildTextClearIcon(), + ], + ), + ), + ) + : Container(); + } + + Widget _buildSearchTextField() { + return TextField( + controller: controller, + focusNode: focus, + decoration: InputDecoration( + hintText: widget.hintText, + border: InputBorder.none, + errorBorder: InputBorder.none, + enabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, + disabledBorder: InputBorder.none, + focusedErrorBorder: InputBorder.none, + isDense: true, + contentPadding: widget.contentPadding, + ), + ); + } + + Widget _buildTextClearIcon() { + return Selector( + selector: (_, provider) => provider.searchTerm, + builder: (_, data, __) { + if (data.length > 0) { + return Padding( + padding: const EdgeInsets.only(right: 8.0), + child: GestureDetector( + child: Icon( + Icons.clear, + color: Theme.of(context).brightness == Brightness.dark + ? Colors.white + : Colors.black, + ), + onTap: () { + clearText(); + }, + ), + ); + } else { + return SizedBox(width: 10); + } + }); + } + + _onSearchInputChange() { + if (!mounted) return; + this.provider.searchTerm = controller.text; + + PlaceProvider provider = PlaceProvider.of(context, listen: false); + + if (controller.text.isEmpty) { + provider.debounceTimer?.cancel(); + _searchPlace(controller.text); + return; + } + + if (controller.text.trim() == this.provider.prevSearchTerm.trim()) { + provider.debounceTimer?.cancel(); + return; + } + + if (!widget.autocompleteOnTrailingWhitespace! && + controller.text.substring(controller.text.length - 1) == " ") { + provider.debounceTimer?.cancel(); + return; + } + + if (provider.debounceTimer?.isActive ?? false) { + provider.debounceTimer!.cancel(); + } + + provider.debounceTimer = + Timer(Duration(milliseconds: widget.debounceMilliseconds!), () { + _searchPlace(controller.text.trim()); + }); + } + + _onFocusChanged() { + PlaceProvider provider = PlaceProvider.of(context, listen: false); + provider.isSearchBarFocused = focus.hasFocus; + provider.debounceTimer?.cancel(); + provider.placeSearchingState = SearchingState.Idle; + } + + _searchPlace(String searchTerm) { + this.provider.prevSearchTerm = searchTerm; + + _clearOverlay(); + + if (searchTerm.length < 1) return; + + _displayOverlay(_buildSearchingOverlay()); + + _performAutoCompleteSearch(searchTerm); + } + + _clearOverlay() { + if (overlayEntry != null) { + overlayEntry!.remove(); + overlayEntry = null; + } + } + + _displayOverlay(Widget overlayChild) { + _clearOverlay(); + + final RenderBox? appBarRenderBox = + widget.appBarKey.currentContext!.findRenderObject() as RenderBox?; + final translation = appBarRenderBox?.getTransformTo(null).getTranslation(); + final Offset offset = translation != null + ? Offset(translation.x, translation.y) + : Offset(0.0, 0.0); + final screenWidth = MediaQuery.of(context).size.width; + + overlayEntry = OverlayEntry( + builder: (context) => Positioned( + top: appBarRenderBox!.paintBounds.shift(offset).top + + appBarRenderBox.size.height, + left: screenWidth * 0.025, + right: screenWidth * 0.025, + child: Material( + elevation: 4.0, + child: overlayChild, + ), + ), + ); + + Overlay.of(context)!.insert(overlayEntry!); + } + + Widget _buildSearchingOverlay() { + return Container( + padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 24), + child: Row( + children: [ + SizedBox( + height: 24, + width: 24, + child: CircularProgressIndicator(strokeWidth: 3), + ), + SizedBox(width: 24), + Expanded( + child: Text( + widget.searchingText ?? "Searching...", + style: TextStyle(fontSize: 16), + ), + ) + ], + ), + ); + } + + Widget _buildPredictionOverlay(List predictions) { + return ListBody( + children: predictions + .map( + (p) => PredictionTile( + prediction: p, + onTap: (selectedPrediction) { + resetSearchBar(); + widget.onPicked(selectedPrediction); + }, + ), + ) + .toList(), + ); + } + + _performAutoCompleteSearch(String searchTerm) async { + PlaceProvider provider = PlaceProvider.of(context, listen: false); + + if (searchTerm.isNotEmpty) { + final PlacesAutocompleteResponse response = + await provider.places.autocomplete( + searchTerm, + sessionToken: widget.sessionToken, + location: provider.currentPosition == null + ? null + : Location( + lat: provider.currentPosition!.latitude, + lng: provider.currentPosition!.longitude), + offset: widget.autocompleteOffset, + radius: widget.autocompleteRadius, + language: widget.autocompleteLanguage, + types: widget.autocompleteTypes ?? const [], + components: widget.autocompleteComponents ?? const [], + strictbounds: widget.strictbounds ?? false, + region: widget.region, + ); + + if (response.errorMessage?.isNotEmpty == true || + response.status == "REQUEST_DENIED") { + if (widget.onSearchFailed != null) { + widget.onSearchFailed!(response.status); + } + return; + } + + _displayOverlay(_buildPredictionOverlay(response.predictions)); + } + } + + clearText() { + provider.searchTerm = ""; + controller.clear(); + } + + resetSearchBar() { + clearText(); + focus.unfocus(); + } + + clearOverlay() { + _clearOverlay(); + } +} diff --git a/lib/google_maps_place_picker_mb/src/components/animated_pin.dart b/lib/google_maps_place_picker_mb/src/components/animated_pin.dart new file mode 100644 index 0000000..a39499a --- /dev/null +++ b/lib/google_maps_place_picker_mb/src/components/animated_pin.dart @@ -0,0 +1,58 @@ +import 'package:flutter/material.dart'; + +class AnimatedPin extends StatefulWidget { + AnimatedPin({ + Key? key, + this.child, + }); + + final Widget? child; + + @override + _AnimatedPinState createState() => _AnimatedPinState(); +} + +class _AnimatedPinState extends State + with TickerProviderStateMixin { + late AnimationController _controller; + + @override + void initState() { + super.initState(); + _controller = AnimationController( + duration: const Duration(seconds: 1), + vsync: this, + )..repeat(); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return JumpingContainer(controller: _controller, child: widget.child); + } +} + +class JumpingContainer extends AnimatedWidget { + const JumpingContainer({ + Key? key, + required AnimationController controller, + this.child, + }) : super(key: key, listenable: controller); + + final Widget? child; + + Animation get _progress => listenable as Animation; + + @override + Widget build(BuildContext context) { + return Transform.translate( + offset: Offset(0, -10 + _progress.value * 10), + child: child, + ); + } +} diff --git a/lib/google_maps_place_picker_mb/src/components/floating_card.dart b/lib/google_maps_place_picker_mb/src/components/floating_card.dart new file mode 100644 index 0000000..f7f24ba --- /dev/null +++ b/lib/google_maps_place_picker_mb/src/components/floating_card.dart @@ -0,0 +1,47 @@ +import 'package:flutter/material.dart'; +import 'package:bookatanker/google_maps_place_picker_mb/src/components/rounded_frame.dart'; + +class FloatingCard extends StatelessWidget { + const FloatingCard({ + Key? key, + this.topPosition, + this.leftPosition, + this.rightPosition, + this.bottomPosition, + this.width, + this.height, + this.borderRadius = BorderRadius.zero, + this.elevation = 0.0, + this.color, + this.child, + }) : super(key: key); + + final double? topPosition; + final double? leftPosition; + final double? bottomPosition; + final double? rightPosition; + final double? width; + final double? height; + final BorderRadius borderRadius; + final double elevation; + final Color? color; + final Widget? child; + + @override + Widget build(BuildContext context) { + return Positioned( + top: topPosition, + left: leftPosition, + right: rightPosition, + bottom: bottomPosition, + child: RoundedFrame( + width: width, + height: height, + borderRadius: borderRadius, + elevation: elevation, + color: color, + child: child, + ), + ); + } +} diff --git a/lib/google_maps_place_picker_mb/src/components/prediction_tile.dart b/lib/google_maps_place_picker_mb/src/components/prediction_tile.dart new file mode 100644 index 0000000..60934b7 --- /dev/null +++ b/lib/google_maps_place_picker_mb/src/components/prediction_tile.dart @@ -0,0 +1,81 @@ +import 'package:flutter/material.dart'; +import 'package:google_maps_webservice/places.dart'; + +class PredictionTile extends StatelessWidget { + final Prediction prediction; + final ValueChanged? onTap; + + PredictionTile({required this.prediction, this.onTap}); + + @override + Widget build(BuildContext context) { + return ListTile( + leading: Icon(Icons.location_on), + title: RichText( + text: TextSpan( + children: _buildPredictionText(context), + ), + ), + onTap: () { + if (onTap != null) { + onTap!(prediction); + } + }, + ); + } + + List _buildPredictionText(BuildContext context) { + final List result = []; + final textColor = Colors.black; + + if (prediction.matchedSubstrings.length > 0) { + MatchedSubstring matchedSubString = prediction.matchedSubstrings[0]; + // There is no matched string at the beginning. + if (matchedSubString.offset > 0) { + result.add( + TextSpan( + text: prediction.description + ?.substring(0, matchedSubString.offset as int?), + style: TextStyle( + color: textColor, fontSize: 16, fontWeight: FontWeight.w300), + ), + ); + } + + // Matched strings. + result.add( + TextSpan( + text: prediction.description?.substring( + matchedSubString.offset as int, + matchedSubString.offset + matchedSubString.length as int?), + style: TextStyle( + color: textColor, fontSize: 16, fontWeight: FontWeight.w500), + ), + ); + + // Other strings. + if (matchedSubString.offset + matchedSubString.length < + (prediction.description?.length ?? 0)) { + result.add( + TextSpan( + text: prediction.description?.substring( + matchedSubString.offset + matchedSubString.length as int), + style: TextStyle( + color: textColor, fontSize: 16, fontWeight: FontWeight.w300), + ), + ); + } + // If there is no matched strings, but there are predicts. (Not sure if this happens though) + } else { + result.add( + TextSpan( + text: prediction.description, + style: TextStyle( + color: textColor, fontSize: 16, fontWeight: FontWeight.w300), + ), + ); + } + + return result; + } +} diff --git a/lib/google_maps_place_picker_mb/src/components/rounded_frame.dart b/lib/google_maps_place_picker_mb/src/components/rounded_frame.dart new file mode 100644 index 0000000..db8b602 --- /dev/null +++ b/lib/google_maps_place_picker_mb/src/components/rounded_frame.dart @@ -0,0 +1,51 @@ +import 'package:flutter/material.dart'; + +class RoundedFrame extends StatelessWidget { + const RoundedFrame({ + Key? key, + this.margin, + this.padding, + this.width, + this.height, + this.child, + this.color, + this.borderRadius = BorderRadius.zero, + this.borderColor = Colors.transparent, + this.elevation = 0.0, + this.materialType, + }) : super(key: key); + + final EdgeInsetsGeometry? margin; + final EdgeInsetsGeometry? padding; + final double? width; + final double? height; + final Widget? child; + final Color? color; + final Color borderColor; + final BorderRadius borderRadius; + final double elevation; + final MaterialType? materialType; + + @override + Widget build(BuildContext context) { + return Container( + width: width, + height: height, + margin: margin, + padding: padding, + child: Material( + type: color == Colors.transparent + ? MaterialType.transparency + : materialType ?? MaterialType.canvas, + color: color, + shape: RoundedRectangleBorder( + borderRadius: borderRadius, side: BorderSide(color: borderColor)), + elevation: elevation, + child: ClipRRect( + borderRadius: borderRadius, + child: child, + ), + ), + ); + } +} diff --git a/lib/google_maps_place_picker_mb/src/controllers/autocomplete_search_controller.dart b/lib/google_maps_place_picker_mb/src/controllers/autocomplete_search_controller.dart new file mode 100644 index 0000000..c4e8258 --- /dev/null +++ b/lib/google_maps_place_picker_mb/src/controllers/autocomplete_search_controller.dart @@ -0,0 +1,24 @@ +import 'package:flutter/cupertino.dart'; +import 'package:bookatanker/google_maps_place_picker_mb/src/autocomplete_search.dart'; + +class SearchBarController extends ChangeNotifier { + late AutoCompleteSearchState _autoCompleteSearch; + + attach(AutoCompleteSearchState searchWidget) { + _autoCompleteSearch = searchWidget; + } + + /// Just clears text. + clear() { + _autoCompleteSearch.clearText(); + } + + /// Clear and remove focus (Dismiss keyboard) + reset() { + _autoCompleteSearch.resetSearchBar(); + } + + clearOverlay() { + _autoCompleteSearch.clearOverlay(); + } +} diff --git a/lib/google_maps_place_picker_mb/src/google_map_place_picker.dart b/lib/google_maps_place_picker_mb/src/google_map_place_picker.dart new file mode 100644 index 0000000..9f042d5 --- /dev/null +++ b/lib/google_maps_place_picker_mb/src/google_map_place_picker.dart @@ -0,0 +1,612 @@ +import 'dart:async'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:google_maps_webservice/geocoding.dart'; +import 'package:google_maps_webservice/places.dart'; + +import 'package:provider/provider.dart'; +import 'package:tuple/tuple.dart'; +import 'package:bookatanker/google_maps_place_picker_mb/google_maps_place_picker.dart'; +import 'package:bookatanker/google_maps_place_picker_mb/providers/place_provider.dart'; +import 'package:bookatanker/google_maps_place_picker_mb/src/components/animated_pin.dart'; + +typedef SelectedPlaceWidgetBuilder = Widget Function( + BuildContext context, + PickResult? selectedPlace, + SearchingState state, + bool isSearchBarFocused, +); + +typedef PinBuilder = Widget Function( + BuildContext context, + PinState state, +); + +class GoogleMapPlacePicker extends StatelessWidget { + const GoogleMapPlacePicker({ + Key? key, + required this.initialTarget, + required this.appBarKey, + this.selectedPlaceWidgetBuilder, + this.pinBuilder, + this.onSearchFailed, + this.onMoveStart, + this.onMapCreated, + this.debounceMilliseconds, + this.enableMapTypeButton, + this.enableMyLocationButton, + this.onToggleMapType, + this.onMyLocation, + this.onPlacePicked, + this.usePinPointingSearch, + this.usePlaceDetailSearch, + this.selectInitialPosition, + this.language, + this.pickArea, + this.forceSearchOnZoomChanged, + this.hidePlaceDetailsWhenDraggingPin, + this.onCameraMoveStarted, + this.onCameraMove, + this.onCameraIdle, + this.selectText, + this.outsideOfPickAreaText, + this.zoomGesturesEnabled = true, + this.zoomControlsEnabled = false, + this.fullMotion = false, + }) : super(key: key); + + final LatLng initialTarget; + final GlobalKey appBarKey; + + final SelectedPlaceWidgetBuilder? selectedPlaceWidgetBuilder; + final PinBuilder? pinBuilder; + + final ValueChanged? onSearchFailed; + final VoidCallback? onMoveStart; + final MapCreatedCallback? onMapCreated; + final VoidCallback? onToggleMapType; + final VoidCallback? onMyLocation; + final ValueChanged? onPlacePicked; + + final int? debounceMilliseconds; + final bool? enableMapTypeButton; + final bool? enableMyLocationButton; + + final bool? usePinPointingSearch; + final bool? usePlaceDetailSearch; + + final bool? selectInitialPosition; + + final String? language; + final CircleArea? pickArea; + + final bool? forceSearchOnZoomChanged; + final bool? hidePlaceDetailsWhenDraggingPin; + + /// GoogleMap pass-through events: + final Function(PlaceProvider)? onCameraMoveStarted; + final CameraPositionCallback? onCameraMove; + final Function(PlaceProvider)? onCameraIdle; + + // strings + final String? selectText; + final String? outsideOfPickAreaText; + + /// Zoom feature toggle + final bool zoomGesturesEnabled; + final bool zoomControlsEnabled; + + /// Use never scrollable scroll-view with maximum dimensions to prevent unnecessary re-rendering. + final bool fullMotion; + + _searchByCameraLocation(PlaceProvider provider) async { + // We don't want to search location again if camera location is changed by zooming in/out. + if (forceSearchOnZoomChanged == false && + provider.prevCameraPosition != null && + provider.prevCameraPosition!.target.latitude == + provider.cameraPosition!.target.latitude && + provider.prevCameraPosition!.target.longitude == + provider.cameraPosition!.target.longitude) { + provider.placeSearchingState = SearchingState.Idle; + return; + } + + provider.placeSearchingState = SearchingState.Searching; + + final GeocodingResponse response = + await provider.geocoding.searchByLocation( + Location( + lat: provider.cameraPosition!.target.latitude, + lng: provider.cameraPosition!.target.longitude), + language: language, + ); + + if (response.errorMessage?.isNotEmpty == true || + response.status == "REQUEST_DENIED") { + print("Camera Location Search Error: " + response.errorMessage!); + if (onSearchFailed != null) { + onSearchFailed!(response.status); + } + provider.placeSearchingState = SearchingState.Idle; + return; + } + + if (usePlaceDetailSearch!) { + final PlacesDetailsResponse detailResponse = + await provider.places.getDetailsByPlaceId( + response.results[0].placeId, + language: language, + ); + + if (detailResponse.errorMessage?.isNotEmpty == true || + detailResponse.status == "REQUEST_DENIED") { + print("Fetching details by placeId Error: " + + detailResponse.errorMessage!); + if (onSearchFailed != null) { + onSearchFailed!(detailResponse.status); + } + provider.placeSearchingState = SearchingState.Idle; + return; + } + + provider.selectedPlace = + PickResult.fromPlaceDetailResult(detailResponse.result); + } else { + provider.selectedPlace = + PickResult.fromGeocodingResult(response.results[0]); + } + + provider.placeSearchingState = SearchingState.Idle; + } + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + if (this.fullMotion) + SingleChildScrollView( + physics: const NeverScrollableScrollPhysics(), + child: SizedBox( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height, + child: Stack( + alignment: AlignmentDirectional.center, + children: [ + _buildGoogleMap(context), + _buildPin(), + ], + ))), + if (!this.fullMotion) _buildGoogleMap(context), + if (!this.fullMotion) _buildPin(), + _buildFloatingCard(), + _buildMapIcons(context), + _buildZoomButtons() + ], + ); + } + + Widget _buildGoogleMapInner(PlaceProvider? provider, MapType mapType) { + CameraPosition initialCameraPosition = + CameraPosition(target: this.initialTarget, zoom: 15); + return GoogleMap( + zoomGesturesEnabled: this.zoomGesturesEnabled, + zoomControlsEnabled: + false, // we use our own implementation that supports iOS as well, see _buildZoomButtons() + myLocationButtonEnabled: false, + compassEnabled: false, + mapToolbarEnabled: false, + initialCameraPosition: initialCameraPosition, + mapType: mapType, + myLocationEnabled: true, + circles: pickArea != null && pickArea!.radius > 0 + ? Set.from([pickArea]) + : Set(), + onMapCreated: (GoogleMapController controller) { + if (provider == null) return; + provider.mapController = controller; + provider.setCameraPosition(null); + provider.pinState = PinState.Idle; + + // When select initialPosition set to true. + if (selectInitialPosition!) { + provider.setCameraPosition(initialCameraPosition); + _searchByCameraLocation(provider); + } + + if (onMapCreated != null) { + onMapCreated!(controller); + } + }, + onCameraIdle: () { + if (provider == null) return; + if (provider.isAutoCompleteSearching) { + provider.isAutoCompleteSearching = false; + provider.pinState = PinState.Idle; + provider.placeSearchingState = SearchingState.Idle; + return; + } + + // Perform search only if the setting is to true. + if (usePinPointingSearch!) { + // Search current camera location only if camera has moved (dragged) before. + if (provider.pinState == PinState.Dragging) { + // Cancel previous timer. + if (provider.debounceTimer?.isActive ?? false) { + provider.debounceTimer!.cancel(); + } + provider.debounceTimer = + Timer(Duration(milliseconds: debounceMilliseconds!), () { + _searchByCameraLocation(provider); + }); + } + } + + provider.pinState = PinState.Idle; + + if (onCameraIdle != null) { + onCameraIdle!(provider); + } + }, + onCameraMoveStarted: () { + if (provider == null) return; + if (onCameraMoveStarted != null) { + onCameraMoveStarted!(provider); + } + + provider.setPrevCameraPosition(provider.cameraPosition); + + // Cancel any other timer. + provider.debounceTimer?.cancel(); + + // Update state, dismiss keyboard and clear text. + provider.pinState = PinState.Dragging; + + // Begins the search state if the hide details is enabled + if (this.hidePlaceDetailsWhenDraggingPin!) { + provider.placeSearchingState = SearchingState.Searching; + } + + onMoveStart!(); + }, + onCameraMove: (CameraPosition position) { + if (provider == null) return; + provider.setCameraPosition(position); + if (onCameraMove != null) { + onCameraMove!(position); + } + }, + // gestureRecognizers make it possible to navigate the map when it's a + // child in a scroll view e.g ListView, SingleChildScrollView... + gestureRecognizers: Set() + ..add(Factory(() => EagerGestureRecognizer())), + ); + } + + Widget _buildGoogleMap(BuildContext context) { + return Selector( + selector: (_, provider) => provider.mapType, + builder: (_, data, __) => this._buildGoogleMapInner( + PlaceProvider.of(context, listen: false), data)); + } + + Widget _buildPin() { + return Center( + child: Selector( + selector: (_, provider) => provider.pinState, + builder: (context, state, __) { + if (pinBuilder == null) { + return _defaultPinBuilder(context, state); + } else { + return Builder( + builder: (builderContext) => + pinBuilder!(builderContext, state)); + } + }, + ), + ); + } + + Widget _defaultPinBuilder(BuildContext context, PinState state) { + if (state == PinState.Preparing) { + return Container(); + } else if (state == PinState.Idle) { + return Stack( + children: [ + Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.place, size: 36, color: Colors.red), + SizedBox(height: 42), + ], + ), + ), + Center( + child: Container( + width: 5, + height: 5, + decoration: BoxDecoration( + color: Colors.black, + shape: BoxShape.circle, + ), + ), + ), + ], + ); + } else { + return Stack( + children: [ + Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AnimatedPin( + child: Icon(Icons.place, size: 36, color: Colors.red)), + SizedBox(height: 42), + ], + ), + ), + Center( + child: Container( + width: 5, + height: 5, + decoration: BoxDecoration( + color: Colors.black, + shape: BoxShape.circle, + ), + ), + ), + ], + ); + } + } + + Widget _buildFloatingCard() { + return Selector>( + selector: (_, provider) => Tuple4( + provider.selectedPlace, + provider.placeSearchingState, + provider.isSearchBarFocused, + provider.pinState), + builder: (context, data, __) { + if ((data.item1 == null && data.item2 == SearchingState.Idle) || + data.item3 == true || + data.item4 == PinState.Dragging && + this.hidePlaceDetailsWhenDraggingPin!) { + return Container(); + } else { + if (selectedPlaceWidgetBuilder == null) { + return _defaultPlaceWidgetBuilder(context, data.item1, data.item2); + } else { + return Builder( + builder: (builderContext) => selectedPlaceWidgetBuilder!( + builderContext, data.item1, data.item2, data.item3)); + } + } + }, + ); + } + + Widget _buildZoomButtons() { + return Selector>( + selector: (_, provider) => new Tuple2( + provider.mapController, provider.cameraPosition?.target), + builder: (context, data, __) { + if (!this.zoomControlsEnabled || + data.item1 == null || + data.item2 == null) { + return Container(); + } else { + return Positioned( + bottom: 50, + right: 10, + child: Card( + elevation: 4.0, + child: Container( + width: 40, + height: 100, + child: Column( + children: [ + IconButton( + icon: Icon(Icons.add), + onPressed: () async { + double currentZoomLevel = + await data.item1!.getZoomLevel(); + currentZoomLevel = currentZoomLevel + 2; + data.item1!.animateCamera( + CameraUpdate.newCameraPosition( + CameraPosition( + target: data.item2!, + zoom: currentZoomLevel, + ), + ), + ); + }), + SizedBox(height: 2), + IconButton( + icon: Icon(Icons.remove), + onPressed: () async { + double currentZoomLevel = + await data.item1!.getZoomLevel(); + currentZoomLevel = currentZoomLevel - 2; + if (currentZoomLevel < 0) currentZoomLevel = 0; + data.item1!.animateCamera( + CameraUpdate.newCameraPosition( + CameraPosition( + target: data.item2!, + zoom: currentZoomLevel, + ), + ), + ); + }), + ], + ), + ), + ), + ); + } + }, + ); + } + + Widget _defaultPlaceWidgetBuilder( + BuildContext context, PickResult? data, SearchingState state) { + return FloatingCard( + bottomPosition: MediaQuery.of(context).size.height * 0.1, + leftPosition: MediaQuery.of(context).size.width * 0.15, + rightPosition: MediaQuery.of(context).size.width * 0.15, + width: MediaQuery.of(context).size.width * 0.7, + borderRadius: BorderRadius.circular(12.0), + elevation: 4.0, + color: Theme.of(context).cardColor, + child: state == SearchingState.Searching + ? _buildLoadingIndicator() + : _buildSelectionDetails(context, data!), + ); + } + + Widget _buildLoadingIndicator() { + return Container( + height: 48, + child: const Center( + child: SizedBox( + width: 24, + height: 24, + child: CircularProgressIndicator(), + ), + ), + ); + } + + Widget _buildSelectionDetails(BuildContext context, PickResult result) { + bool canBePicked = pickArea == null || + pickArea!.radius <= 0 || + Geolocator.distanceBetween( + pickArea!.center.latitude, + pickArea!.center.longitude, + result.geometry!.location.lat, + result.geometry!.location.lng) <= + pickArea!.radius; + MaterialStateColor buttonColor = MaterialStateColor.resolveWith( + (states) => canBePicked ? Colors.lightGreen : Colors.red); + return Container( + margin: EdgeInsets.all(10), + child: Column( + children: [ + Text( + result.types!.length==1? + result.formattedAddress!:result.name!+', '+result.formattedAddress!, + style: TextStyle(fontSize: 18), + textAlign: TextAlign.center, + ), + SizedBox(height: 10), + (canBePicked && (selectText?.isEmpty ?? true)) || + (!canBePicked && (outsideOfPickAreaText?.isEmpty ?? true)) + ? SizedBox.fromSize( + size: Size(56, 56), // button width and height + child: ClipOval( + child: Material( + child: InkWell( + overlayColor: buttonColor, + onTap: () { + if (canBePicked) { + onPlacePicked!(result); + } + }, + child: Icon( + canBePicked + ? Icons.check_sharp + : Icons.app_blocking_sharp, + color: buttonColor)), + ), + ), + ) + : SizedBox.fromSize( + size: Size(MediaQuery.of(context).size.width * 0.8, + 56), // button width and height + child: ClipRRect( + borderRadius: BorderRadius.circular(10.0), + child: Material( + child: InkWell( + overlayColor: buttonColor, + onTap: () { + if (canBePicked) { + onPlacePicked!(result); + } + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + canBePicked + ? Icons.check_sharp + : Icons.app_blocking_sharp, + color: buttonColor), + SizedBox.fromSize(size: new Size(10, 0)), + Text( + canBePicked + ? selectText! + : outsideOfPickAreaText!, + style: TextStyle(color: buttonColor)) + ], + )), + ), + ), + ) + ], + ), + ); + } + + Widget _buildMapIcons(BuildContext context) { + if (appBarKey.currentContext == null) { + return Container(); + } + final RenderBox appBarRenderBox = + appBarKey.currentContext!.findRenderObject() as RenderBox; + return Positioned( + top: appBarRenderBox.size.height, + right: 15, + child: Column( + children: [ + enableMapTypeButton! + ? Container( + width: 35, + height: 35, + child: RawMaterialButton( + shape: CircleBorder(), + fillColor: Theme.of(context).brightness == Brightness.dark + ? Colors.black54 + : Colors.white, + elevation: 4.0, + onPressed: onToggleMapType, + child: Icon(Icons.layers), + ), + ) + : Container(), + SizedBox(height: 10), + enableMyLocationButton! + ? Container( + width: 35, + height: 35, + child: RawMaterialButton( + shape: CircleBorder(), + fillColor: Theme.of(context).brightness == Brightness.dark + ? Colors.black54 + : Colors.white, + elevation: 4.0, + onPressed: onMyLocation, + child: Icon(Icons.my_location), + ), + ) + : Container(), + ], + ), + ); + } +} diff --git a/lib/google_maps_place_picker_mb/src/models/circle_area.dart b/lib/google_maps_place_picker_mb/src/models/circle_area.dart new file mode 100644 index 0000000..f16b510 --- /dev/null +++ b/lib/google_maps_place_picker_mb/src/models/circle_area.dart @@ -0,0 +1,22 @@ +import 'dart:ui'; + +import 'package:flutter/material.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:uuid/uuid.dart'; + +class CircleArea extends Circle { + CircleArea({ + required LatLng center, + required double radius, + Color? fillColor, + Color? strokeColor, + int strokeWidth = 2, + }) : super( + circleId: CircleId(Uuid().v4()), + center: center, + radius: radius, + fillColor: fillColor ?? Colors.blue.withAlpha(32), + strokeColor: strokeColor ?? Colors.blue.withAlpha(192), + strokeWidth: strokeWidth, + ); +} diff --git a/lib/google_maps_place_picker_mb/src/models/pick_result.dart b/lib/google_maps_place_picker_mb/src/models/pick_result.dart new file mode 100644 index 0000000..15f7ea4 --- /dev/null +++ b/lib/google_maps_place_picker_mb/src/models/pick_result.dart @@ -0,0 +1,91 @@ +import 'package:google_maps_webservice/geocoding.dart'; +import 'package:google_maps_webservice/places.dart'; + +class PickResult { + PickResult({ + this.placeId, + this.geometry, + this.formattedAddress, + this.types, + this.addressComponents, + this.adrAddress, + this.formattedPhoneNumber, + this.id, + this.reference, + this.icon, + this.name, + this.openingHours, + this.photos, + this.internationalPhoneNumber, + this.priceLevel, + this.rating, + this.scope, + this.url, + this.vicinity, + this.utcOffset, + this.website, + this.reviews, + }); + + final String? placeId; + final Geometry? geometry; + final String? formattedAddress; + final List? types; + final List? addressComponents; + + // Below results will not be fetched if 'usePlaceDetailSearch' is set to false (Defaults to false). + final String? adrAddress; + final String? formattedPhoneNumber; + final String? id; + final String? reference; + final String? icon; + final String? name; + final OpeningHoursDetail? openingHours; + final List? photos; + final String? internationalPhoneNumber; + final PriceLevel? priceLevel; + final num? rating; + final String? scope; + final String? url; + final String? vicinity; + final num? utcOffset; + final String? website; + final List? reviews; + + factory PickResult.fromGeocodingResult(GeocodingResult result) { + return PickResult( + placeId: result.placeId, + geometry: result.geometry, + formattedAddress: result.formattedAddress, + types: result.types, + addressComponents: result.addressComponents, + ); + } + + factory PickResult.fromPlaceDetailResult(PlaceDetails result) { + return PickResult( + placeId: result.placeId, + geometry: result.geometry, + formattedAddress: result.formattedAddress, + types: result.types, + addressComponents: result.addressComponents, + adrAddress: result.adrAddress, + formattedPhoneNumber: result.formattedPhoneNumber, + id: result.id, + reference: result.reference, + icon: result.icon, + name: result.name, + openingHours: result.openingHours, + photos: result.photos, + internationalPhoneNumber: result.internationalPhoneNumber, + priceLevel: result.priceLevel, + rating: result.rating, + scope: result.scope, + url: result.url, + vicinity: result.vicinity, + utcOffset: result.utcOffset, + website: result.website, + reviews: result.reviews, + ); + } +} diff --git a/lib/google_maps_place_picker_mb/src/place_picker.dart b/lib/google_maps_place_picker_mb/src/place_picker.dart new file mode 100644 index 0000000..bcf917e --- /dev/null +++ b/lib/google_maps_place_picker_mb/src/place_picker.dart @@ -0,0 +1,535 @@ +import 'dart:async'; +import 'dart:io' show Platform; + +import 'package:flutter/material.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:google_api_headers/google_api_headers.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:google_maps_webservice/places.dart'; +import 'package:http/http.dart'; + +import 'package:provider/provider.dart'; +import 'package:uuid/uuid.dart'; +import 'package:bookatanker/google_maps_place_picker_mb/google_maps_place_picker.dart'; +import 'package:bookatanker/google_maps_place_picker_mb/providers/place_provider.dart'; +import 'package:bookatanker/google_maps_place_picker_mb/src/autocomplete_search.dart'; +import 'package:bookatanker/google_maps_place_picker_mb/src/controllers/autocomplete_search_controller.dart'; +import 'package:bookatanker/google_maps_place_picker_mb/src/google_map_place_picker.dart'; + +typedef IntroModalWidgetBuilder = Widget Function( + BuildContext context, + Function? close, +); + +enum PinState { Preparing, Idle, Dragging } + +enum SearchingState { Idle, Searching } + +class PlacePicker extends StatefulWidget { + const PlacePicker({ + Key? key, + required this.apiKey, + this.onPlacePicked, + required this.initialPosition, + this.useCurrentLocation, + this.desiredLocationAccuracy = LocationAccuracy.high, + this.onMapCreated, + this.hintText, + this.searchingText, + this.selectText, + this.outsideOfPickAreaText, + this.onAutoCompleteFailed, + this.onGeocodingSearchFailed, + this.proxyBaseUrl, + this.httpClient, + this.selectedPlaceWidgetBuilder, + this.pinBuilder, + this.introModalWidgetBuilder, + this.autoCompleteDebounceInMilliseconds = 500, + this.cameraMoveDebounceInMilliseconds = 750, + this.initialMapType = MapType.normal, + this.enableMapTypeButton = true, + this.enableMyLocationButton = true, + this.myLocationButtonCooldown = 10, + this.usePinPointingSearch = true, + this.usePlaceDetailSearch = false, + this.autocompleteOffset, + this.autocompleteRadius, + this.autocompleteLanguage, + this.autocompleteComponents, + this.autocompleteTypes, + this.strictbounds, + this.region, + this.pickArea, + this.selectInitialPosition = false, + this.resizeToAvoidBottomInset = true, + this.initialSearchString, + this.searchForInitialValue = false, + this.forceAndroidLocationManager = false, + this.forceSearchOnZoomChanged = false, + this.automaticallyImplyAppBarLeading = true, + this.autocompleteOnTrailingWhitespace = false, + this.hidePlaceDetailsWhenDraggingPin = true, + this.onTapBack, + this.onCameraMoveStarted, + this.onCameraMove, + this.onCameraIdle, + this.onMapTypeChanged, + this.zoomGesturesEnabled = true, + this.zoomControlsEnabled = false, + }) : super(key: key); + + final String apiKey; + + final LatLng initialPosition; + final bool? useCurrentLocation; + final LocationAccuracy desiredLocationAccuracy; + + final String? hintText; + final String? searchingText; + final String? selectText; + final String? outsideOfPickAreaText; + + final ValueChanged? onAutoCompleteFailed; + final ValueChanged? onGeocodingSearchFailed; + final int autoCompleteDebounceInMilliseconds; + final int cameraMoveDebounceInMilliseconds; + + final MapType initialMapType; + final bool enableMapTypeButton; + final bool enableMyLocationButton; + final int myLocationButtonCooldown; + + final bool usePinPointingSearch; + final bool usePlaceDetailSearch; + + final num? autocompleteOffset; + final num? autocompleteRadius; + final String? autocompleteLanguage; + final List? autocompleteTypes; + final List? autocompleteComponents; + final bool? strictbounds; + final String? region; + + /// If set the picker can only pick addresses in the given circle area. + /// The section will be highlighted. + final CircleArea? pickArea; + + /// If true the [body] and the scaffold's floating widgets should size + /// themselves to avoid the onscreen keyboard whose height is defined by the + /// ambient [MediaQuery]'s [MediaQueryData.viewInsets] `bottom` property. + /// + /// For example, if there is an onscreen keyboard displayed above the + /// scaffold, the body can be resized to avoid overlapping the keyboard, which + /// prevents widgets inside the body from being obscured by the keyboard. + /// + /// Defaults to true. + final bool resizeToAvoidBottomInset; + + final bool selectInitialPosition; + + /// By using default setting of Place Picker, it will result result when user hits the select here button. + /// + /// If you managed to use your own [selectedPlaceWidgetBuilder], then this WILL NOT be invoked, and you need use data which is + /// being sent with [selectedPlaceWidgetBuilder]. + final ValueChanged? onPlacePicked; + + /// optional - builds selected place's UI + /// + /// It is provided by default if you leave it as a null. + /// INPORTANT: If this is non-null, [onPlacePicked] will not be invoked, as there will be no default 'Select here' button. + final SelectedPlaceWidgetBuilder? selectedPlaceWidgetBuilder; + + /// optional - builds customized pin widget which indicates current pointing position. + /// + /// It is provided by default if you leave it as a null. + final PinBuilder? pinBuilder; + + /// optional - builds customized introduction panel. + /// + /// None is provided / the map is instantly accessible if you leave it as a null. + final IntroModalWidgetBuilder? introModalWidgetBuilder; + + /// optional - sets 'proxy' value in google_maps_webservice + /// + /// In case of using a proxy the baseUrl can be set. + /// The apiKey is not required in case the proxy sets it. + /// (Not storing the apiKey in the app is good practice) + final String? proxyBaseUrl; + + /// optional - set 'client' value in google_maps_webservice + /// + /// In case of using a proxy url that requires authentication + /// or custom configuration + final BaseClient? httpClient; + + /// Initial value of autocomplete search + final String? initialSearchString; + + /// Whether to search for the initial value or not + final bool searchForInitialValue; + + /// On Android devices you can set [forceAndroidLocationManager] + /// to true to force the plugin to use the [LocationManager] to determine the + /// position instead of the [FusedLocationProviderClient]. On iOS this is ignored. + final bool forceAndroidLocationManager; + + /// Allow searching place when zoom has changed. By default searching is disabled when zoom has changed in order to prevent unwilling API usage. + final bool forceSearchOnZoomChanged; + + /// Whether to display appbar backbutton. Defaults to true. + final bool automaticallyImplyAppBarLeading; + + /// Will perform an autocomplete search, if set to true. Note that setting + /// this to true, while providing a smoother UX experience, may cause + /// additional unnecessary queries to the Places API. + /// + /// Defaults to false. + final bool autocompleteOnTrailingWhitespace; + + final bool hidePlaceDetailsWhenDraggingPin; + + // Raised when clicking on the back arrow. + // This will not listen for the system back button on Android devices. + // If this is not set, but the back button is visible through automaticallyImplyLeading, + // the Navigator will try to pop instead. + final VoidCallback? onTapBack; + + /// GoogleMap pass-through events: + + /// Callback method for when the map is ready to be used. + /// + /// Used to receive a [GoogleMapController] for this [GoogleMap]. + final MapCreatedCallback? onMapCreated; + + /// Called when the camera starts moving. + /// + /// This can be initiated by the following: + /// 1. Non-gesture animation initiated in response to user actions. + /// For example: zoom buttons, my location button, or marker clicks. + /// 2. Programmatically initiated animation. + /// 3. Camera motion initiated in response to user gestures on the map. + /// For example: pan, tilt, pinch to zoom, or rotate. + final Function(PlaceProvider)? onCameraMoveStarted; + + /// Called repeatedly as the camera continues to move after an + /// onCameraMoveStarted call. + /// + /// This may be called as often as once every frame and should + /// not perform expensive operations. + final CameraPositionCallback? onCameraMove; + + /// Called when camera movement has ended, there are no pending + /// animations and the user has stopped interacting with the map. + final Function(PlaceProvider)? onCameraIdle; + + /// Called when the map type has been changed. + final Function(MapType)? onMapTypeChanged; + + /// Allow user to make visible the zoom button & toggle on & off zoom gestures + final bool zoomGesturesEnabled; + final bool zoomControlsEnabled; + + @override + _PlacePickerState createState() => _PlacePickerState(); +} + +class _PlacePickerState extends State { + GlobalKey appBarKey = GlobalKey(); + late final Future _futureProvider; + PlaceProvider? provider; + SearchBarController searchBarController = SearchBarController(); + bool showIntroModal = true; + + @override + void initState() { + super.initState(); + + _futureProvider = _initPlaceProvider(); + } + + @override + void dispose() { + searchBarController.dispose(); + + super.dispose(); + } + + Future _initPlaceProvider() async { + final headers = await const GoogleApiHeaders().getHeaders(); + final provider = PlaceProvider( + widget.apiKey, + widget.proxyBaseUrl, + widget.httpClient, + headers, + ); + provider.sessionToken = const Uuid().v4(); + provider.desiredAccuracy = widget.desiredLocationAccuracy; + provider.setMapType(widget.initialMapType); + if (widget.useCurrentLocation != null && widget.useCurrentLocation!) { + await provider.updateCurrentLocation(widget.forceAndroidLocationManager); + } + return provider; + } + + @override + Widget build(BuildContext context) { + return WillPopScope( + onWillPop: () { + searchBarController.clearOverlay(); + return Future.value(true); + }, + child: FutureBuilder( + future: _futureProvider, + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const Center(child: CircularProgressIndicator()); + } else if (snapshot.hasData) { + provider = snapshot.data; + + return MultiProvider( + providers: [ + ChangeNotifierProvider.value(value: provider!), + ], + child: Stack(children: [ + Scaffold( + key: ValueKey(provider.hashCode), + resizeToAvoidBottomInset: widget.resizeToAvoidBottomInset, + extendBodyBehindAppBar: true, + appBar: AppBar( + key: appBarKey, + automaticallyImplyLeading: false, + iconTheme: Theme.of(context).iconTheme, + elevation: 0, + backgroundColor: Colors.transparent, + titleSpacing: 0.0, + title: _buildSearchBar(context), + ), + body: _buildMapWithLocation(), + ), + _buildIntroModal(context), + ]), + ); + } + + final children = []; + if (snapshot.hasError) { + children.addAll([ + Icon( + Icons.error_outline, + color: Colors.red, + ), + Padding( + padding: const EdgeInsets.only(top: 16), + child: Text('Error: ${snapshot.error}'), + ) + ]); + } else { + children.add(CircularProgressIndicator()); + } + + return Scaffold( + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: children, + ), + ), + ); + }, + )); + } + + Widget _buildSearchBar(BuildContext context) { + return Row( + children: [ + widget.automaticallyImplyAppBarLeading || widget.onTapBack != null + ? IconButton( + onPressed: () { + if (!showIntroModal || + widget.introModalWidgetBuilder == null) { + if (widget.onTapBack != null) { + widget.onTapBack!(); + return; + } + Navigator.maybePop(context); + } + }, + icon: Icon( + Platform.isIOS ? Icons.arrow_back_ios : Icons.arrow_back, + ), + color: Colors.black.withAlpha(128), + padding: EdgeInsets.zero) + : SizedBox(width: 15), + Expanded( + child: AutoCompleteSearch( + appBarKey: appBarKey, + searchBarController: searchBarController, + sessionToken: provider!.sessionToken, + hintText: widget.hintText, + searchingText: widget.searchingText, + debounceMilliseconds: widget.autoCompleteDebounceInMilliseconds, + onPicked: (prediction) { + _pickPrediction(prediction); + }, + onSearchFailed: (status) { + if (widget.onAutoCompleteFailed != null) { + widget.onAutoCompleteFailed!(status); + } + }, + autocompleteOffset: widget.autocompleteOffset, + autocompleteRadius: widget.autocompleteRadius, + autocompleteLanguage: widget.autocompleteLanguage, + autocompleteComponents: widget.autocompleteComponents, + autocompleteTypes: widget.autocompleteTypes, + strictbounds: widget.strictbounds, + region: widget.region, + initialSearchString: widget.initialSearchString, + searchForInitialValue: widget.searchForInitialValue, + autocompleteOnTrailingWhitespace: + widget.autocompleteOnTrailingWhitespace), + ), + SizedBox(width: 5), + ], + ); + } + + _pickPrediction(Prediction prediction) async { + provider!.placeSearchingState = SearchingState.Searching; + + final PlacesDetailsResponse response = + await provider!.places.getDetailsByPlaceId( + prediction.placeId!, + sessionToken: provider!.sessionToken, + language: widget.autocompleteLanguage, + ); + + if (response.errorMessage?.isNotEmpty == true || + response.status == "REQUEST_DENIED") { + if (widget.onAutoCompleteFailed != null) { + widget.onAutoCompleteFailed!(response.status); + } + return; + } + + provider!.selectedPlace = PickResult.fromPlaceDetailResult(response.result); + + // Prevents searching again by camera movement. + provider!.isAutoCompleteSearching = true; + + await _moveTo(provider!.selectedPlace!.geometry!.location.lat, + provider!.selectedPlace!.geometry!.location.lng); + + provider!.placeSearchingState = SearchingState.Idle; + } + + _moveTo(double latitude, double longitude) async { + GoogleMapController? controller = provider!.mapController; + if (controller == null) return; + + await controller.animateCamera( + CameraUpdate.newCameraPosition( + CameraPosition( + target: LatLng(latitude, longitude), + zoom: 16, + ), + ), + ); + } + + _moveToCurrentPosition() async { + if (provider!.currentPosition != null) { + await _moveTo(provider!.currentPosition!.latitude, + provider!.currentPosition!.longitude); + } + } + + Widget _buildMapWithLocation() { + if (provider!.currentPosition == null) { + return _buildMap(widget.initialPosition); + } + return _buildMap(LatLng(provider!.currentPosition!.latitude, + provider!.currentPosition!.longitude)); + } + + Widget _buildMap(LatLng initialTarget) { + return GoogleMapPlacePicker( + fullMotion: !widget.resizeToAvoidBottomInset, + initialTarget: initialTarget, + appBarKey: appBarKey, + selectedPlaceWidgetBuilder: widget.selectedPlaceWidgetBuilder, + pinBuilder: widget.pinBuilder, + onSearchFailed: widget.onGeocodingSearchFailed, + debounceMilliseconds: widget.cameraMoveDebounceInMilliseconds, + enableMapTypeButton: widget.enableMapTypeButton, + enableMyLocationButton: widget.enableMyLocationButton, + usePinPointingSearch: widget.usePinPointingSearch, + usePlaceDetailSearch: widget.usePlaceDetailSearch, + onMapCreated: widget.onMapCreated, + selectInitialPosition: widget.selectInitialPosition, + language: widget.autocompleteLanguage, + pickArea: widget.pickArea, + forceSearchOnZoomChanged: widget.forceSearchOnZoomChanged, + hidePlaceDetailsWhenDraggingPin: widget.hidePlaceDetailsWhenDraggingPin, + selectText: widget.selectText, + outsideOfPickAreaText: widget.outsideOfPickAreaText, + onToggleMapType: () { + provider!.switchMapType(); + if (widget.onMapTypeChanged != null) { + widget.onMapTypeChanged!(provider!.mapType); + } + }, + onMyLocation: () async { + // Prevent to click many times in short period. + if (provider!.isOnUpdateLocationCooldown == false) { + provider!.isOnUpdateLocationCooldown = true; + Timer(Duration(seconds: widget.myLocationButtonCooldown), () { + provider!.isOnUpdateLocationCooldown = false; + }); + await provider! + .updateCurrentLocation(widget.forceAndroidLocationManager); + await _moveToCurrentPosition(); + } + }, + onMoveStart: () { + searchBarController.reset(); + }, + onPlacePicked: widget.onPlacePicked, + onCameraMoveStarted: widget.onCameraMoveStarted, + onCameraMove: widget.onCameraMove, + onCameraIdle: widget.onCameraIdle, + zoomGesturesEnabled: widget.zoomGesturesEnabled, + zoomControlsEnabled: widget.zoomControlsEnabled, + ); + } + + Widget _buildIntroModal(BuildContext context) { + return StatefulBuilder( + builder: (BuildContext context, StateSetter setState) { + return showIntroModal && widget.introModalWidgetBuilder != null + ? Stack(children: [ + Positioned( + top: 0, + right: 0, + bottom: 0, + left: 0, + child: Material( + type: MaterialType.canvas, + color: Color.fromARGB(128, 0, 0, 0), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.zero, + ), + child: ClipRect(), + ), + ), + widget.introModalWidgetBuilder!(context, () { + setState(() { + showIntroModal = false; + }); + }) + ]) + : Container(); + }); + } +} diff --git a/lib/login.dart b/lib/login.dart new file mode 100644 index 0000000..c04d36b --- /dev/null +++ b/lib/login.dart @@ -0,0 +1,202 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'common/settings.dart'; +import 'otp.dart'; + +class LoginScreen extends StatefulWidget { + const LoginScreen({Key? key}) : super(key: key); + + @override + State createState() => _LoginScreenState(); +} + + +class _LoginScreenState extends State { + final TextEditingController mobileController = TextEditingController(); + final TextEditingController passwordController = TextEditingController(); + + bool isPasswordVisible = false; + + @override + Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: true, // Important + backgroundColor: Colors.white, + body: SafeArea( + child: SingleChildScrollView( // 👈 FIX + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 25), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + const SizedBox(height: 250), + + Text( + "Welcome!", + style: fontTextStyle( + 26, Colors.black, FontWeight.w700), + ), + + const SizedBox(height: 30), + + TextField( + controller: mobileController, + keyboardType: TextInputType.phone, + inputFormatters: [ + LengthLimitingTextInputFormatter(10), // max 10 digits + FilteringTextInputFormatter.digitsOnly, // only digits + ], + decoration: InputDecoration( + border: const OutlineInputBorder(), + hintText: "Enter your number", + hintStyle: fontTextStyle(14, Color(0xFF2A2A2A), FontWeight.w400), + ), + ), + + const SizedBox(height: 15), + + TextField( + controller: passwordController, + obscureText: !isPasswordVisible, + decoration: InputDecoration( + hintText: "Password", + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(8), + ), + suffixIcon: IconButton( + icon: Icon( + isPasswordVisible + ? Icons.visibility + : Icons.visibility_off, + ), + onPressed: () { + setState(() { + isPasswordVisible = + !isPasswordVisible; + }); + }, + ), + ), + ), + + const SizedBox(height: 10), + + Text( + "Forgot Password?", + style: fontTextStyle( + 13, const Color(0XFF1D7AFC), + FontWeight.w500), + ), + + const SizedBox(height: 25), + + SizedBox( + width: double.infinity, + height: 48, + child: ElevatedButton( + onPressed: () {}, + style: ElevatedButton.styleFrom( + backgroundColor: + const Color(0XFF1D7AFC), + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(25), + ), + ), + child: Text( + "Login", + style: fontTextStyle( + 14, Colors.white, + FontWeight.w600), + ), + ), + ), + + const SizedBox(height: 15), + + SizedBox( + width: double.infinity, + height: 48, + child: OutlinedButton( + onPressed: () { + + String mobile = mobileController.text.trim(); + + if (mobile.length != 10) { + + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text("Enter 10 digit mobile number"), + ), + ); + + return; + } + + if (!mobile.startsWith(RegExp(r'[6-9]'))) { + + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text("Mobile must start with 6-9"), + ), + ); + + return; + } + + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + OtpScreen(mobileNumber: mobile), + ), + ); + + }, + style: OutlinedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(25), + ), + ), + child: const Text( + "Login without Password", + style: TextStyle(color: Colors.blue), + ), + ), + ), + + const SizedBox(height: 30), + + const Divider(), + + const SizedBox(height: 20), + + SizedBox( + width: double.infinity, + height: 48, + child: OutlinedButton( + onPressed: () { + + }, + style: OutlinedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(25), + ), + ), + child: const Text( + "Sign Up", + style: TextStyle(color: Colors.blue), + ), + ), + ), + ], + ), + ), + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..083e3c4 --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,27 @@ +import 'package:flutter/material.dart'; +import 'common/splash_screen.dart'; + +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + runApp(MyApp()); +} + +// Create a global navigator key +final GlobalKey navigatorKey = GlobalKey(); + +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + debugShowCheckedModeBanner: false, + title: 'Water Management App', + navigatorKey: navigatorKey, // Set the navigator key + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), + useMaterial3: true, + ), + home: SplashScreen(), // Your initial screen + ); + } +} + diff --git a/lib/otp.dart b/lib/otp.dart new file mode 100644 index 0000000..448dd9b --- /dev/null +++ b/lib/otp.dart @@ -0,0 +1,238 @@ +import 'package:bookatanker/signup.dart'; +import 'package:flutter/material.dart'; +import 'common/settings.dart'; +import 'createpassword.dart'; + + +class OtpScreen extends StatefulWidget { + final String mobileNumber; + + const OtpScreen({ + Key? key, + required this.mobileNumber, + }) : super(key: key); + + @override + State createState() => _OtpScreenState(); +} + +class _OtpScreenState extends State { + + final List _controllers = + List.generate(6, (_) => TextEditingController()); + + @override + void dispose() { + for (var controller in _controllers) { + controller.dispose(); + } + super.dispose(); + } + + String maskMobileNumber(String number) { + if (number.length < 3) return number; + final stars = '*' * (number.length - 3); + final lastThree = number.substring(number.length - 3); + return '$stars$lastThree'; + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + + body: SafeArea( + child: Padding( + padding: const EdgeInsets.all(24.0), + + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + + const SizedBox(height: 100), + + /// Title + Text( + "Enter Confirmation Code", + style: fontTextStyle( + 16, + const Color(0xFF101214), + FontWeight.w600), + ), + + const SizedBox(height: 8), + + /// Mobile Text + Text( + 'A 6-digit code was sent to\n+91 ${maskMobileNumber(widget.mobileNumber)}', + textAlign: TextAlign.center, + style: fontTextStyle( + 12, + const Color(0xFF7E7F80), + FontWeight.w400), + ), + + const SizedBox(height: 30), + + /// OTP Boxes + Row( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: List.generate( + 6, + (index) => SizedBox( + width: 45, + + child: TextField( + controller: + _controllers[index], + + textAlign: TextAlign.center, + + keyboardType: + TextInputType.number, + + maxLength: 1, + + style: fontTextStyle( + 14, + const Color(0xFF2A2A2A), + FontWeight.w400), + + decoration: + InputDecoration( + counterText: "", + + border: + OutlineInputBorder( + borderRadius: + BorderRadius.circular( + 8), + ), + ), + + onChanged: (value) { + + if (value.isNotEmpty && + index < 5) { + + FocusScope.of(context) + .nextFocus(); + + } + + else if (value.isEmpty && + index > 0) { + + FocusScope.of(context) + .previousFocus(); + + } + }, + ), + ), + ), + ), + + const SizedBox(height: 40), + + /// Resend Code + TextButton( + onPressed: () { + + Navigator.push( + context, + MaterialPageRoute( + builder: (_) => + const CreatePasswordScreen(), + ), + ); + + }, + + child: Text( + "Resend Code", + + style: fontTextStyle( + 14, + const Color(0XFF1D7AFC), + FontWeight.w600), + ), + ), + + const SizedBox(height: 20), + + /// Continue Button + SizedBox( + width: double.infinity, + + child: ElevatedButton( + onPressed: () { + + final otp = + _controllers + .map((c) => c.text) + .join(); + + if (otp.length == 6) { + + Navigator.pushReplacement( + context, + + MaterialPageRoute( + builder: (_) => + const SignUpScreen(), + ), + ); + + } + + else { + + ScaffoldMessenger.of( + context) + .showSnackBar( + const SnackBar( + content: Text( + "Please enter 6 digit OTP"), + ), + ); + } + }, + + style: ElevatedButton + .styleFrom( + backgroundColor: + const Color( + 0XFF1D7AFC), + + padding: + const EdgeInsets + .symmetric( + vertical: 16), + + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius.circular( + 30), + ), + ), + + child: Text( + "Continue", + + style: fontTextStyle( + 14, + Colors.white, + FontWeight.w600), + ), + ), + ), + ], + ), + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/signup.dart b/lib/signup.dart new file mode 100644 index 0000000..64cf9f8 --- /dev/null +++ b/lib/signup.dart @@ -0,0 +1,148 @@ +import 'package:flutter/material.dart'; +import 'common/settings.dart'; +import 'otp.dart'; + + +class SignUpScreen extends StatefulWidget { + const SignUpScreen({Key? key}) : super(key: key); + + @override + State createState() => _SignUpScreenState(); +} + +class _SignUpScreenState extends State { + + TextEditingController mobileController = TextEditingController(); + TextEditingController emailController = TextEditingController(); + + @override + Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: true, + backgroundColor: Colors.white, + body: SafeArea( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 25), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + + const SizedBox(height: 120), + + /// Title + Text( + "Sign Up", + style: fontTextStyle( + 22, Colors.black, FontWeight.w700), + ), + + const SizedBox(height: 5), + + /// Subtitle + Text( + "Sign up using your mobile number", + style: fontTextStyle( + 13, + const Color(0xFF7E7F80), + FontWeight.w400), + ), + + const SizedBox(height: 60), + + /// Mobile Number Field + TextField( + controller: mobileController, + keyboardType: TextInputType.phone, + decoration: InputDecoration( + hintText: "Mobile Number *", + hintStyle: fontTextStyle( + 14, + const Color(0xFF7E7F80), + FontWeight.w400), + contentPadding: + const EdgeInsets.symmetric( + horizontal: 15, + vertical: 18), + border: OutlineInputBorder( + borderRadius: + BorderRadius.circular(8), + ), + ), + ), + + const SizedBox(height: 20), + + /// Email Field + TextField( + controller: emailController, + keyboardType: + TextInputType.emailAddress, + decoration: InputDecoration( + hintText: "Email ID (optional)", + hintStyle: fontTextStyle( + 14, + const Color(0xFF7E7F80), + FontWeight.w400), + contentPadding: + const EdgeInsets.symmetric( + horizontal: 15, + vertical: 18), + border: OutlineInputBorder( + borderRadius: + BorderRadius.circular(8), + ), + ), + ), + + const SizedBox(height: 35), + + /// Sign Up Button + SizedBox( + width: double.infinity, + height: 52, + child: ElevatedButton( + onPressed: () { + + if (mobileController.text.isEmpty) { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text("Enter Mobile Number"), + ), + ); + return; + } + + Navigator.push( + context, + MaterialPageRoute( + builder: (_) => OtpScreen( + mobileNumber: mobileController.text, + ), + ), + ); + + }, + style: ElevatedButton.styleFrom( + backgroundColor: const Color(0XFF1D7AFC), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30), + ), + ), + child: Text( + "Sign Up", + style: fontTextStyle( + 15, + Colors.white, + FontWeight.w600), + ), + ), + ), + ], + ), + ), + ), + ), + ); + } +} \ No newline at end of file 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..154bcac --- /dev/null +++ b/linux/CMakeLists.txt @@ -0,0 +1,145 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.10) +project(runner LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "bookatanker") +# The unique GTK application identifier for this application. See: +# https://wiki.gnome.org/HowDoI/ChooseApplicationID +set(APPLICATION_ID "com.example.bookatanker") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(SET CMP0063 NEW) + +# Load bundled libraries from the lib/ directory relative to the binary. +set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") + +# Root filesystem for cross-building. +if(FLUTTER_TARGET_PLATFORM_SYSROOT) + set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +endif() + +# Define build configuration options. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") +endif() + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_14) + target_compile_options(${TARGET} PRIVATE -Wall -Werror) + target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") + target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) + +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") + +# Define the application target. To change its name, change BINARY_NAME above, +# not the value here, or `flutter run` will no longer work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} + "main.cc" + "my_application.cc" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add dependency libraries. Add any application-specific dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) + +# Only the install-generated bundle's copy of the executable will launch +# correctly, since the resources must in the right relative locations. To avoid +# people trying to run the unbundled copy, put it in a subdirectory instead of +# the default top-level location. +set_target_properties(${BINARY_NAME} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" +) + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# By default, "installing" just makes a relocatable bundle in the build +# directory. +set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +# Start with a clean build bundle directory every time. +install(CODE " + file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") + " COMPONENT Runtime) + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) + install(FILES "${bundled_library}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endforeach(bundled_library) + +# 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..3ccd551 --- /dev/null +++ b/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,23 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + +#include +#include +#include + +void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); + file_selector_plugin_register_with_registrar(file_selector_linux_registrar); + g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin"); + flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar); + g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); + url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); +} diff --git a/linux/flutter/generated_plugin_registrant.h b/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..e0f0a47 --- /dev/null +++ b/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake new file mode 100644 index 0000000..9ce94c4 --- /dev/null +++ b/linux/flutter/generated_plugins.cmake @@ -0,0 +1,26 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST + file_selector_linux + flutter_secure_storage_linux + url_launcher_linux +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/linux/main.cc b/linux/main.cc new file mode 100644 index 0000000..e7c5c54 --- /dev/null +++ b/linux/main.cc @@ -0,0 +1,6 @@ +#include "my_application.h" + +int main(int argc, char** argv) { + g_autoptr(MyApplication) app = my_application_new(); + return g_application_run(G_APPLICATION(app), argc, argv); +} diff --git a/linux/my_application.cc b/linux/my_application.cc new file mode 100644 index 0000000..093f67d --- /dev/null +++ b/linux/my_application.cc @@ -0,0 +1,124 @@ +#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, "bookatanker"); + 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, "bookatanker"); + } + + 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() { + return MY_APPLICATION(g_object_new(my_application_get_type(), + "application-id", APPLICATION_ID, + "flags", G_APPLICATION_NON_UNIQUE, + nullptr)); +} diff --git a/linux/my_application.h b/linux/my_application.h new file mode 100644 index 0000000..72271d5 --- /dev/null +++ b/linux/my_application.h @@ -0,0 +1,18 @@ +#ifndef FLUTTER_MY_APPLICATION_H_ +#define FLUTTER_MY_APPLICATION_H_ + +#include + +G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, + GtkApplication) + +/** + * my_application_new: + * + * Creates a new Flutter-based application. + * + * Returns: a new #MyApplication. + */ +MyApplication* my_application_new(); + +#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/macos/.gitignore b/macos/.gitignore new file mode 100644 index 0000000..746adbb --- /dev/null +++ b/macos/.gitignore @@ -0,0 +1,7 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/dgph +**/xcuserdata/ diff --git a/macos/Flutter/Flutter-Debug.xcconfig b/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 0000000..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..ef61c74 --- /dev/null +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,40 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + +import cloud_firestore +import device_info_plus +import file_selector_macos +import firebase_core +import firebase_messaging +import flutter_local_notifications +import flutter_secure_storage_macos +import geolocator_apple +import location +import package_info_plus +import path_provider_foundation +import share_plus +import shared_preferences_foundation +import speech_to_text_macos +import url_launcher_macos + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin")) + DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) + FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) + FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) + FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin")) + FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) + FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) + GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) + LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin")) + FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) + SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) + SpeechToTextMacosPlugin.register(with: registry.registrar(forPlugin: "SpeechToTextMacosPlugin")) + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) +} diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..27c0f64 --- /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 /* bookatanker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "bookatanker.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 /* bookatanker.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 /* bookatanker.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.bookatanker.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/bookatanker.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/bookatanker"; + }; + 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.bookatanker.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/bookatanker.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/bookatanker"; + }; + 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.bookatanker.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/bookatanker.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/bookatanker"; + }; + 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..521d068 --- /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..d53ef64 --- /dev/null +++ b/macos/Runner/AppDelegate.swift @@ -0,0 +1,9 @@ +import Cocoa +import FlutterMacOS + +@NSApplicationMain +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } +} diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..a2ec33f --- /dev/null +++ b/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 0000000..82b6f9d Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 0000000..13b35eb Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 0000000..0a3f5fa Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 0000000..bdb5722 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 0000000..f083318 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 0000000..326c0e7 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 0000000..2f1632c Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/macos/Runner/Base.lproj/MainMenu.xib b/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 0000000..80e867a --- /dev/null +++ b/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/macos/Runner/Configs/AppInfo.xcconfig b/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 0000000..5101ed9 --- /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 = bookatanker + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.example.bookatanker + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2026 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..e099984 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,1626 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _flutterfire_internals: + dependency: transitive + description: + name: _flutterfire_internals + sha256: "37a42d06068e2fe3deddb2da079a8c4d105f241225ba27b7122b37e9865fd8f7" + url: "https://pub.dev" + source: hosted + version: "1.3.35" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + auto_size_text: + dependency: "direct main" + description: + name: auto_size_text + sha256: "3f5261cd3fb5f2a9ab4e2fc3fba84fd9fcaac8821f20a1d4e71f557521b22599" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + card_swiper: + dependency: "direct main" + description: + name: card_swiper + sha256: "21e52a144decbf0054e7cfed8bbe46fc89635e6c86b767eaccfe7d5aeba32528" + url: "https://pub.dev" + source: hosted + version: "3.0.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" + cloud_firestore: + dependency: "direct main" + description: + name: cloud_firestore + sha256: a0f161b92610e078b4962d7e6ebeb66dc9cce0ada3514aeee442f68165d78185 + url: "https://pub.dev" + source: hosted + version: "4.17.5" + cloud_firestore_platform_interface: + dependency: transitive + description: + name: cloud_firestore_platform_interface + sha256: "6a55b319f8d33c307396b9104512e8130a61904528ab7bd8b5402678fca54b81" + url: "https://pub.dev" + source: hosted + version: "6.2.5" + cloud_firestore_web: + dependency: transitive + description: + name: cloud_firestore_web + sha256: "89dfa1304d3da48b3039abbb2865e3d30896ef858e569a16804a99f4362283a9" + url: "https://pub.dev" + source: hosted + version: "3.12.5" + cloudinary_public: + dependency: "direct main" + description: + name: cloudinary_public + sha256: "30c2aac5a31b468e5e955d2bbbac3eebcd1c66c9c7c2ffd75828606503bdda68" + url: "https://pub.dev" + source: hosted + version: "0.23.1" + collection: + dependency: transitive + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670" + url: "https://pub.dev" + source: hosted + version: "0.3.4+2" + crypto: + dependency: transitive + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + date_time_picker: + dependency: "direct main" + description: + name: date_time_picker + sha256: "6923c568bcb67a66ab7e083708d0adbcae8214b41bb84d49febc17e89e06fc4a" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + dbus: + dependency: transitive + description: + name: dbus + sha256: d0c98dcd4f5169878b6cf8f6e0a52403a9dff371a3e2f019697accbf6f44a270 + url: "https://pub.dev" + source: hosted + version: "0.7.12" + device_apps: + dependency: "direct main" + description: + name: device_apps + sha256: e84dc74d55749993fd671148cc0bd53096e1be0c268fc364285511b1d8a4c19b + url: "https://pub.dev" + source: hosted + version: "2.2.0" + device_info_plus: + dependency: "direct main" + description: + name: device_info_plus + sha256: a7fd703482b391a87d60b6061d04dfdeab07826b96f9abd8f5ed98068acc0074 + url: "https://pub.dev" + source: hosted + version: "10.1.2" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + sha256: "0b04e02b30791224b31969eb1b50d723498f402971bff3630bca2ba839bd1ed2" + url: "https://pub.dev" + source: hosted + version: "7.0.2" + device_information: + dependency: "direct main" + description: + name: device_information + sha256: "26dd2630a9db8e0c55f5685a5d515ed40ded24219f5e7f14dcfae5a2bd1f2ddf" + url: "https://pub.dev" + source: hosted + version: "0.0.4" + dio: + dependency: "direct main" + description: + name: dio + sha256: aff32c08f92787a557dd5c0145ac91536481831a01b4648136373cddb0e64f8c + url: "https://pub.dev" + source: hosted + version: "5.9.2" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "2f9e64323a7c3c7ef69567d5c800424a11f8337b8b228bad02524c9fb3c1f340" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + dotted_border: + dependency: "direct main" + description: + name: dotted_border + sha256: "108837e11848ca776c53b30bc870086f84b62ed6e01c503ed976e8f8c7df9c04" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + dropdown_button2: + dependency: "direct main" + description: + name: dropdown_button2 + sha256: b0fe8d49a030315e9eef6c7ac84ca964250155a6224d491c1365061bc974a9e1 + url: "https://pub.dev" + source: hosted + version: "2.3.9" + equatable: + dependency: transitive + description: + name: equatable + sha256: "3e0141505477fd8ad55d6eb4e7776d3fe8430be8e497ccb1521370c3f21a3e2b" + url: "https://pub.dev" + source: hosted + version: "2.0.8" + eventify: + dependency: transitive + description: + name: eventify + sha256: b829429f08586cc2001c628e7499e3e3c2493a1d895fd73b00ecb23351aa5a66 + url: "https://pub.dev" + source: hosted + version: "1.0.1" + 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" + file_selector_linux: + dependency: transitive + description: + name: file_selector_linux + sha256: "54cbbd957e1156d29548c7d9b9ec0c0ebb6de0a90452198683a7d23aed617a33" + url: "https://pub.dev" + source: hosted + version: "0.9.3+2" + file_selector_macos: + dependency: transitive + description: + name: file_selector_macos + sha256: "271ab9986df0c135d45c3cdb6bd0faa5db6f4976d3e4b437cf7d0f258d941bfc" + url: "https://pub.dev" + source: hosted + version: "0.9.4+2" + file_selector_platform_interface: + dependency: transitive + description: + name: file_selector_platform_interface + sha256: a3994c26f10378a039faa11de174d7b78eb8f79e4dd0af2a451410c1a5c3f66b + url: "https://pub.dev" + source: hosted + version: "2.6.2" + file_selector_windows: + dependency: transitive + description: + name: file_selector_windows + sha256: "320fcfb6f33caa90f0b58380489fc5ac05d99ee94b61aa96ec2bff0ba81d3c2b" + url: "https://pub.dev" + source: hosted + version: "0.9.3+4" + firebase_core: + dependency: transitive + description: + name: firebase_core + sha256: "26de145bb9688a90962faec6f838247377b0b0d32cc0abecd9a4e43525fc856c" + url: "https://pub.dev" + source: hosted + version: "2.32.0" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + sha256: "8bcfad6d7033f5ea951d15b867622a824b13812178bfec0c779b9d81de011bbb" + url: "https://pub.dev" + source: hosted + version: "5.4.2" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + sha256: "362e52457ed2b7b180964769c1e04d1e0ea0259fdf7025fdfedd019d4ae2bd88" + url: "https://pub.dev" + source: hosted + version: "2.17.5" + firebase_messaging: + dependency: "direct main" + description: + name: firebase_messaging + sha256: a1662cc95d9750a324ad9df349b873360af6f11414902021f130c68ec02267c4 + url: "https://pub.dev" + source: hosted + version: "14.9.4" + firebase_messaging_platform_interface: + dependency: transitive + description: + name: firebase_messaging_platform_interface + sha256: "87c4a922cb6f811cfb7a889bdbb3622702443c52a0271636cbc90d813ceac147" + url: "https://pub.dev" + source: hosted + version: "4.5.37" + firebase_messaging_web: + dependency: transitive + description: + name: firebase_messaging_web + sha256: "0d34dca01a7b103ed7f20138bffbb28eb0e61a677bf9e78a028a932e2c7322d5" + url: "https://pub.dev" + source: hosted + version: "3.8.7" + fl_chart: + dependency: "direct main" + description: + name: fl_chart + sha256: "74959b99b92b9eebeed1a4049426fd67c4abc3c5a0f4d12e2877097d6a11ae08" + url: "https://pub.dev" + source: hosted + version: "0.69.2" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_card_swiper: + dependency: "direct main" + description: + name: flutter_card_swiper + sha256: "895c6974729b51cf73a35f1b58ab57a0af3293131319e2cbccac3bc57ffcd69f" + url: "https://pub.dev" + source: hosted + version: "7.2.0" + flutter_compass: + dependency: "direct main" + description: + name: flutter_compass + sha256: "1b4d7e6c95a675ec8482b5c9c9ccf1ebf0ced3dbec59dce28ad609da953de850" + url: "https://pub.dev" + source: hosted + version: "0.8.1" + flutter_cupertino_datetime_picker: + dependency: "direct main" + description: + name: flutter_cupertino_datetime_picker + sha256: "631fbd3abed4d1151888e053d2153d905663a3b33ff24bdfa64afbcf750682cb" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + flutter_datetime_picker: + dependency: "direct main" + description: + name: flutter_datetime_picker + sha256: "8e695c63c769350e541951227c2775190ec73ceda774a315b1dc9a99d5facfe5" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + flutter_device_type: + dependency: "direct main" + description: + name: flutter_device_type + sha256: "8f41f2271733f615957924dd1dcd10ef90848bb86b603ae20578f91591b900f3" + url: "https://pub.dev" + source: hosted + version: "0.4.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + flutter_local_notifications: + dependency: "direct main" + description: + name: flutter_local_notifications + sha256: "674173fd3c9eda9d4c8528da2ce0ea69f161577495a9cc835a2a4ecd7eadeb35" + url: "https://pub.dev" + source: hosted + version: "17.2.4" + flutter_local_notifications_linux: + dependency: transitive + description: + name: flutter_local_notifications_linux + sha256: c49bd06165cad9beeb79090b18cd1eb0296f4bf4b23b84426e37dd7c027fc3af + url: "https://pub.dev" + source: hosted + version: "4.0.1" + flutter_local_notifications_platform_interface: + dependency: transitive + description: + name: flutter_local_notifications_platform_interface + sha256: "85f8d07fe708c1bdcf45037f2c0109753b26ae077e9d9e899d55971711a4ea66" + url: "https://pub.dev" + source: hosted + version: "7.2.0" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: "9ee02950848f61c4129af3d6ec84a1cfc0e47931abc746b03e7a3bc3e8ff6eda" + url: "https://pub.dev" + source: hosted + version: "2.0.22" + flutter_polyline_points: + dependency: "direct main" + description: + name: flutter_polyline_points + sha256: "02699e69142f51a248d784b6e3eec524194467fca5f7c4da19699ce2368b6980" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter_secure_storage: + dependency: "direct main" + description: + name: flutter_secure_storage + sha256: "9cad52d75ebc511adfae3d447d5d13da15a55a92c9410e50f67335b6d21d16ea" + url: "https://pub.dev" + source: hosted + version: "9.2.4" + flutter_secure_storage_linux: + dependency: transitive + description: + name: flutter_secure_storage_linux + sha256: be76c1d24a97d0b98f8b54bce6b481a380a6590df992d0098f868ad54dc8f688 + url: "https://pub.dev" + source: hosted + version: "1.2.3" + flutter_secure_storage_macos: + dependency: transitive + description: + name: flutter_secure_storage_macos + sha256: "6c0a2795a2d1de26ae202a0d78527d163f4acbb11cde4c75c670f3a0fc064247" + url: "https://pub.dev" + source: hosted + version: "3.1.3" + flutter_secure_storage_platform_interface: + dependency: transitive + description: + name: flutter_secure_storage_platform_interface + sha256: cf91ad32ce5adef6fba4d736a542baca9daf3beac4db2d04be350b87f69ac4a8 + url: "https://pub.dev" + source: hosted + version: "1.1.2" + flutter_secure_storage_web: + dependency: transitive + description: + name: flutter_secure_storage_web + sha256: f4ebff989b4f07b2656fb16b47852c0aab9fed9b4ec1c70103368337bc1886a9 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + flutter_secure_storage_windows: + dependency: transitive + description: + name: flutter_secure_storage_windows + sha256: b20b07cb5ed4ed74fc567b78a72936203f587eba460af1df11281c9326cd3709 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + flutter_share: + dependency: "direct main" + description: + name: flutter_share + sha256: ae12c1cea13b35926a109824ffac601531e40cb94ad53eeae58625eceb3eaaaa + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_svg: + dependency: "direct main" + description: + name: flutter_svg + sha256: d39e7f95621fc84376bc0f7d504f05c3a41488c562f4a8ad410569127507402c + url: "https://pub.dev" + source: hosted + version: "2.0.9" + flutter_svg_provider: + dependency: "direct main" + description: + name: flutter_svg_provider + sha256: aad5ab28feb23280962820a4b5db4404777c597f62349b3467b4813974a1cb99 + url: "https://pub.dev" + source: hosted + version: "1.0.4" + flutter_switch: + dependency: "direct main" + description: + name: flutter_switch + sha256: b91477f926bba135d2d203d7b24367492662d8d9c3aa6adb960b14c1087d3c41 + url: "https://pub.dev" + source: hosted + version: "0.3.2" + 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" + fluttertoast: + dependency: "direct main" + description: + name: fluttertoast + sha256: "95f349437aeebe524ef7d6c9bde3e6b4772717cf46a0eb6a3ceaddc740b297cc" + url: "https://pub.dev" + source: hosted + version: "8.2.8" + gallery_saver: + dependency: "direct main" + description: + name: gallery_saver + sha256: df8b7e207ca12d64c71e0710a7ee3bc48aa7206d51cc720716fedb1543a66712 + url: "https://pub.dev" + source: hosted + version: "2.3.2" + geocoding: + dependency: "direct main" + description: + name: geocoding + sha256: d580c801cba9386b4fac5047c4c785a4e19554f46be42f4f5e5b7deacd088a66 + url: "https://pub.dev" + source: hosted + version: "3.0.0" + geocoding_android: + dependency: transitive + description: + name: geocoding_android + sha256: "1b13eca79b11c497c434678fed109c2be020b158cec7512c848c102bc7232603" + url: "https://pub.dev" + source: hosted + version: "3.3.1" + geocoding_ios: + dependency: transitive + description: + name: geocoding_ios + sha256: "18ab1c8369e2b0dcb3a8ccc907319334f35ee8cf4cfef4d9c8e23b13c65cb825" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + geocoding_platform_interface: + dependency: transitive + description: + name: geocoding_platform_interface + sha256: "8c2c8226e5c276594c2e18bfe88b19110ed770aeb7c1ab50ede570be8b92229b" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + geolocator: + dependency: "direct main" + description: + name: geolocator + sha256: "5c23f3613f50586c0bbb2b8f970240ae66b3bd992088cf60dd5ee2e6f7dde3a8" + url: "https://pub.dev" + source: hosted + version: "9.0.2" + geolocator_android: + dependency: transitive + description: + name: geolocator_android + sha256: "93906636752ea4d4e778afa981fdfe7409f545b3147046300df194330044d349" + url: "https://pub.dev" + source: hosted + version: "4.3.1" + geolocator_apple: + dependency: transitive + description: + name: geolocator_apple + sha256: c4ecead17985ede9634f21500072edfcb3dba0ef7b97f8d7bc556d2d722b3ba3 + url: "https://pub.dev" + source: hosted + version: "2.3.9" + geolocator_platform_interface: + dependency: transitive + description: + name: geolocator_platform_interface + sha256: "386ce3d9cce47838355000070b1d0b13efb5bc430f8ecda7e9238c8409ace012" + url: "https://pub.dev" + source: hosted + version: "4.2.4" + geolocator_web: + dependency: transitive + description: + name: geolocator_web + sha256: "102e7da05b48ca6bf0a5bda0010f886b171d1a08059f01bfe02addd0175ebece" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + geolocator_windows: + dependency: transitive + description: + name: geolocator_windows + sha256: "4f4218f122a6978d0ad655fa3541eea74c67417440b09f0657238810d5af6bdc" + url: "https://pub.dev" + source: hosted + version: "0.1.3" + get: + dependency: "direct main" + description: + name: get + sha256: "5ed34a7925b85336e15d472cc4cfe7d9ebf4ab8e8b9f688585bf6b50f4c3d79a" + url: "https://pub.dev" + source: hosted + version: "4.7.3" + google_api_headers: + dependency: "direct main" + description: + name: google_api_headers + sha256: b27a55935d5c51cedda8a925f5df8388cc327c94a47fef5a4335e8707e089878 + url: "https://pub.dev" + source: hosted + version: "1.6.0" + google_fonts: + dependency: "direct main" + description: + name: google_fonts + sha256: "6b6f10f0ce3c42f6552d1c70d2c28d764cf22bb487f50f66cca31dcd5194f4d6" + url: "https://pub.dev" + source: hosted + version: "4.0.4" + google_maps: + dependency: transitive + description: + name: google_maps + sha256: "5d410c32112d7c6eb7858d359275b2aa04778eed3e36c745aeae905fb2fa6468" + url: "https://pub.dev" + source: hosted + version: "8.2.0" + google_maps_flutter: + dependency: "direct main" + description: + name: google_maps_flutter + sha256: "621125e35e81ca39ef600e45243d2be93167e61def72bc7207b0c4a635c58506" + url: "https://pub.dev" + source: hosted + version: "2.10.1" + google_maps_flutter_android: + dependency: transitive + description: + name: google_maps_flutter_android + sha256: "10cf27bee8c560f8e69992b3a0f27ddf1d7acbea622ddb13ef3f587848a73f26" + url: "https://pub.dev" + source: hosted + version: "2.14.7" + google_maps_flutter_ios: + dependency: transitive + description: + name: google_maps_flutter_ios + sha256: c7433645c4c9b61c587938cb06072f3dad601239e596b090c0f8f206c1f2ade7 + url: "https://pub.dev" + source: hosted + version: "2.15.2" + google_maps_flutter_platform_interface: + dependency: transitive + description: + name: google_maps_flutter_platform_interface + sha256: "970c8f766c02909c7be282dea923c971f83a88adaf07f8871d0aacebc3b07bb2" + url: "https://pub.dev" + source: hosted + version: "2.11.1" + google_maps_flutter_web: + dependency: transitive + description: + name: google_maps_flutter_web + sha256: a45786ea6691cc7cdbe2cf3ce2c2daf4f82a885745666b4a36baada3a4e12897 + url: "https://pub.dev" + source: hosted + version: "0.5.12" + google_maps_place_picker_mb: + dependency: "direct main" + description: + name: google_maps_place_picker_mb + sha256: "09b62d033857fa3a69fb1afb720b091c0fcbecdf73bc34833448d2809469af13" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + google_maps_webservice: + dependency: "direct main" + description: + name: google_maps_webservice + sha256: d0ae4e4508afd74a3f051565261a3cdbae59db29448f9b6e6beb5674545e1eb7 + url: "https://pub.dev" + source: hosted + version: "0.0.20-nullsafety.5" + google_mobile_ads: + dependency: "direct main" + description: + name: google_mobile_ads + sha256: "4775006383a27a5d86d46f8fb452bfcb17794fc0a46c732979e49a8eb1c8963f" + url: "https://pub.dev" + source: hosted + version: "5.2.0" + html: + dependency: transitive + description: + name: html + sha256: "6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602" + url: "https://pub.dev" + source: hosted + version: "0.15.6" + http: + dependency: "direct main" + description: + name: http + sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + url: "https://pub.dev" + source: hosted + version: "0.13.6" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + image_gallery_saver: + dependency: "direct main" + description: + name: image_gallery_saver + sha256: "0aba74216a4d9b0561510cb968015d56b701ba1bd94aace26aacdd8ae5761816" + url: "https://pub.dev" + source: hosted + version: "2.0.3" + image_picker: + dependency: "direct main" + description: + name: image_picker + sha256: "021834d9c0c3de46bf0fe40341fa07168407f694d9b2bb18d532dc1261867f7a" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + image_picker_android: + dependency: transitive + description: + name: image_picker_android + sha256: "8c5abf0dcc24fe6e8e0b4a5c0b51a5cf30cefdf6407a3213dae61edc75a70f56" + url: "https://pub.dev" + source: hosted + version: "0.8.12+12" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + sha256: "717eb042ab08c40767684327be06a5d8dbb341fe791d514e4b92c7bbe1b7bb83" + url: "https://pub.dev" + source: hosted + version: "3.0.6" + image_picker_ios: + dependency: transitive + description: + name: image_picker_ios + sha256: "05da758e67bc7839e886b3959848aa6b44ff123ab4b28f67891008afe8ef9100" + url: "https://pub.dev" + source: hosted + version: "0.8.12+2" + image_picker_linux: + dependency: transitive + description: + name: image_picker_linux + sha256: "34a65f6740df08bbbeb0a1abd8e6d32107941fd4868f67a507b25601651022c9" + url: "https://pub.dev" + source: hosted + version: "0.2.1+2" + image_picker_macos: + dependency: transitive + description: + name: image_picker_macos + sha256: "1b90ebbd9dcf98fb6c1d01427e49a55bd96b5d67b8c67cf955d60a5de74207c1" + url: "https://pub.dev" + source: hosted + version: "0.2.1+2" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + sha256: "886d57f0be73c4b140004e78b9f28a8914a09e50c2d816bdd0520051a71236a0" + url: "https://pub.dev" + source: hosted + version: "2.10.1" + image_picker_windows: + dependency: transitive + description: + name: image_picker_windows + sha256: "6ad07afc4eb1bc25f3a01084d28520496c4a3bb0cb13685435838167c9dcedeb" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + intl: + dependency: "direct main" + description: + name: intl + sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91" + url: "https://pub.dev" + source: hosted + version: "0.17.0" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + url: "https://pub.dev" + source: hosted + version: "10.0.4" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + 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: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + url: "https://pub.dev" + source: hosted + version: "3.0.0" + location: + dependency: "direct main" + description: + name: location + sha256: "6463a242973bf247e3fb1c7722919521b98026978ee3b5177202e103a39c145e" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + location_platform_interface: + dependency: transitive + description: + name: location_platform_interface + sha256: "1e535ccc8b4a9612de4e4319871136b45d2b5d1fb0c2a8bf99687242bf7ca5f7" + url: "https://pub.dev" + source: hosted + version: "5.0.0" + location_web: + dependency: transitive + description: + name: location_web + sha256: "613597b489beb396f658c6f4358dd383c5ed0a1402d95e287642a5f2d8171cb0" + url: "https://pub.dev" + source: hosted + version: "5.0.3" + 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: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + url: "https://pub.dev" + source: hosted + version: "0.8.0" + meta: + dependency: transitive + description: + name: meta + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + url: "https://pub.dev" + source: hosted + version: "1.12.0" + mime: + dependency: transitive + description: + name: mime + sha256: "801fd0b26f14a4a58ccb09d5892c3fbdeff209594300a542492cf13fba9d247a" + url: "https://pub.dev" + source: hosted + version: "1.0.6" + multi_select_flutter: + dependency: "direct main" + description: + name: multi_select_flutter + sha256: "503857b415d390d29159df8a9d92d83c6aac17aaf1c307fb7bcfc77d097d20ed" + url: "https://pub.dev" + source: hosted + version: "4.1.3" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + overlay_support: + dependency: "direct main" + description: + name: overlay_support + sha256: fc39389bfd94e6985e1e13b2a88a125fc4027608485d2d4e2847afe1b2bb339c + url: "https://pub.dev" + source: hosted + version: "2.1.0" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + sha256: "7e76fad405b3e4016cd39d08f455a4eb5199723cf594cd1b8916d47140d93017" + url: "https://pub.dev" + source: hosted + version: "4.2.0" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6" + url: "https://pub.dev" + source: hosted + version: "2.0.1" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + path_drawing: + dependency: transitive + description: + name: path_drawing + sha256: bbb1934c0cbb03091af082a6389ca2080345291ef07a5fa6d6e078ba8682f977 + url: "https://pub.dev" + source: hosted + version: "1.0.1" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + path_provider: + dependency: "direct main" + description: + name: path_provider + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "6f01f8e37ec30b07bc424b4deabac37cacb1bc7e2e515ad74486039918a37eb7" + url: "https://pub.dev" + source: hosted + version: "2.2.10" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "4843174df4d288f5e29185bd6e72a6fbdf5a4a4602717eed565497429f179942" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + 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" + pedantic: + dependency: transitive + description: + name: pedantic + sha256: "67fc27ed9639506c856c840ccce7594d0bdcd91bc8d53d6e52359449a1d50602" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + permission_handler: + dependency: "direct main" + description: + name: permission_handler + sha256: "18bf33f7fefbd812f37e72091a15575e72d5318854877e0e4035a24ac1113ecb" + url: "https://pub.dev" + source: hosted + version: "11.3.1" + permission_handler_android: + dependency: transitive + description: + name: permission_handler_android + sha256: "71bbecfee799e65aff7c744761a57e817e73b738fedf62ab7afd5593da21f9f1" + url: "https://pub.dev" + source: hosted + version: "12.0.13" + permission_handler_apple: + dependency: transitive + description: + name: permission_handler_apple + sha256: f000131e755c54cf4d84a5d8bd6e4149e262cc31c5a8b1d698de1ac85fa41023 + url: "https://pub.dev" + source: hosted + version: "9.4.7" + permission_handler_html: + dependency: transitive + description: + name: permission_handler_html + sha256: "38f000e83355abb3392140f6bc3030660cfaef189e1f87824facb76300b4ff24" + url: "https://pub.dev" + source: hosted + version: "0.1.3+5" + permission_handler_platform_interface: + dependency: transitive + description: + name: permission_handler_platform_interface + sha256: e9c8eadee926c4532d0305dff94b85bf961f16759c3af791486613152af4b4f9 + url: "https://pub.dev" + source: hosted + version: "4.2.3" + permission_handler_windows: + dependency: transitive + description: + name: permission_handler_windows + sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e" + url: "https://pub.dev" + source: hosted + version: "0.2.1" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + url: "https://pub.dev" + source: hosted + version: "6.0.2" + photo_view: + dependency: "direct main" + description: + name: photo_view + sha256: "1fc3d970a91295fbd1364296575f854c9863f225505c28c46e0a03e48960c75e" + url: "https://pub.dev" + source: hosted + version: "0.15.0" + pinch_zoom: + dependency: "direct main" + description: + name: pinch_zoom + sha256: "12a0050d45f93adbf372903caef4146bafefda3dba3fdd460579d33f35b7d6cb" + url: "https://pub.dev" + source: hosted + version: "2.0.1" + 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" + provider: + dependency: "direct main" + description: + name: provider + sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272" + url: "https://pub.dev" + source: hosted + version: "6.1.5+1" + qr: + dependency: transitive + description: + name: qr + sha256: "5a1d2586170e172b8a8c8470bbbffd5eb0cd38a66c0d77155ea138d3af3a4445" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + qr_flutter: + dependency: "direct main" + description: + name: qr_flutter + sha256: "5095f0fc6e3f71d08adef8feccc8cea4f12eec18a2e31c2e8d82cb6019f4b097" + url: "https://pub.dev" + source: hosted + version: "4.1.0" + razorpay_flutter: + dependency: "direct main" + description: + name: razorpay_flutter + sha256: a90e05bb571fd1df5b7846d2173cb9cf1e07ec6d57df48068a05c152be177311 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + sanitize_html: + dependency: transitive + description: + name: sanitize_html + sha256: "12669c4a913688a26555323fb9cec373d8f9fbe091f2d01c40c723b33caa8989" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + share: + dependency: "direct main" + description: + name: share + sha256: "97e6403f564ed1051a01534c2fc919cb6e40ea55e60a18ec23cee6e0ce19f4be" + url: "https://pub.dev" + source: hosted + version: "2.0.4" + share_plus: + dependency: "direct main" + description: + name: share_plus + sha256: "3ef39599b00059db0990ca2e30fca0a29d8b37aae924d60063f8e0184cf20900" + url: "https://pub.dev" + source: hosted + version: "7.2.2" + share_plus_platform_interface: + dependency: transitive + description: + name: share_plus_platform_interface + sha256: "251eb156a8b5fa9ce033747d73535bf53911071f8d3b6f4f0b578505ce0d4496" + url: "https://pub.dev" + source: hosted + version: "3.4.0" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: "95f9997ca1fb9799d494d0cb2a780fd7be075818d59f00c43832ed112b158a82" + url: "https://pub.dev" + source: hosted + version: "2.3.3" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "480ba4345773f56acda9abf5f50bd966f581dac5d514e5fc4a18c62976bbba7e" + url: "https://pub.dev" + source: hosted + version: "2.3.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: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 + url: "https://pub.dev" + source: hosted + version: "2.4.3" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + simple_gesture_detector: + dependency: transitive + description: + name: simple_gesture_detector + sha256: ba2cd5af24ff20a0b8d609cec3f40e5b0744d2a71804a2616ae086b9c19d19a3 + url: "https://pub.dev" + source: hosted + version: "0.2.1" + sizer: + dependency: "direct main" + description: + name: sizer + sha256: d2b3cb6cbc4a637f508dacd786bae55df31e5fc088044248a43e4fd1e050c117 + url: "https://pub.dev" + source: hosted + version: "2.0.15" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + smooth_page_indicator: + dependency: "direct main" + description: + name: smooth_page_indicator + sha256: b21ebb8bc39cf72d11c7cfd809162a48c3800668ced1c9da3aade13a32cf6c1c + url: "https://pub.dev" + source: hosted + version: "1.2.1" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + speech_to_text: + dependency: "direct main" + description: + name: speech_to_text + sha256: "57fef1d41bdebe298e84842c89bb4ac91f31cdbec7830c8cb1fc6b91d03abd42" + url: "https://pub.dev" + source: hosted + version: "6.6.0" + speech_to_text_macos: + dependency: transitive + description: + name: speech_to_text_macos + sha256: e685750f7542fcaa087a5396ee471e727ec648bf681f4da83c84d086322173f6 + url: "https://pub.dev" + source: hosted + version: "1.1.0" + speech_to_text_platform_interface: + dependency: transitive + description: + name: speech_to_text_platform_interface + sha256: a1935847704e41ee468aad83181ddd2423d0833abe55d769c59afca07adb5114 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.dev" + source: hosted + version: "2.1.1" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + syncfusion_flutter_charts: + dependency: "direct main" + description: + name: syncfusion_flutter_charts + sha256: "0222ac9d8cb6c671f014effe9bd5c0aef35eadb16471355345ba87cc0ac007b3" + url: "https://pub.dev" + source: hosted + version: "20.4.54" + syncfusion_flutter_core: + dependency: transitive + description: + name: syncfusion_flutter_core + sha256: "3979f0b1c5a97422cadae52d476c21fa3e0fb671ef51de6cae1d646d8b99fe1f" + url: "https://pub.dev" + source: hosted + version: "20.4.54" + syncfusion_flutter_datepicker: + dependency: "direct main" + description: + name: syncfusion_flutter_datepicker + sha256: e4d4794d54f3a315046031d431a27e0d7350544b1bef0bcd1d2acf58f940dd37 + url: "https://pub.dev" + source: hosted + version: "20.4.54" + table_calendar: + dependency: "direct main" + description: + name: table_calendar + sha256: "7f1270313c0cdb245b583ed8518982c01d4a7e95869b3c30abcbae3b642c45d0" + url: "https://pub.dev" + source: hosted + version: "3.0.8" + 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: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + url: "https://pub.dev" + source: hosted + version: "0.7.0" + timezone: + dependency: transitive + description: + name: timezone + sha256: "2236ec079a174ce07434e89fcd3fcda430025eb7692244139a9cf54fdcf1fc7d" + url: "https://pub.dev" + source: hosted + version: "0.9.4" + tuple: + dependency: "direct main" + description: + name: tuple + sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151 + url: "https://pub.dev" + source: hosted + version: "2.0.2" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + universal_io: + dependency: transitive + description: + name: universal_io + sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + upi_india: + dependency: "direct main" + description: + name: upi_india + sha256: "483f1425ee8f0897397861b107e50b3aa195fec71215f86e906b625e841e90dd" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603" + url: "https://pub.dev" + source: hosted + version: "6.3.1" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: f0c73347dfcfa5b3db8bc06e1502668265d39c08f310c29bff4e28eea9699f79 + url: "https://pub.dev" + source: hosted + version: "6.3.9" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: "7f2022359d4c099eea7df3fdf739f7d3d3b9faf3166fb1dd390775176e0b76cb" + url: "https://pub.dev" + source: hosted + version: "6.3.3" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2" + url: "https://pub.dev" + source: hosted + version: "3.2.2" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e" + url: "https://pub.dev" + source: hosted + version: "2.3.3" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77" + url: "https://pub.dev" + source: hosted + version: "3.1.4" + uuid: + dependency: "direct main" + description: + name: uuid + sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + url: "https://pub.dev" + source: hosted + version: "3.0.7" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: "4ac59808bbfca6da38c99f415ff2d3a5d7ca0a6b4809c71d9cf30fba5daf9752" + url: "https://pub.dev" + source: hosted + version: "1.1.10+1" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: f3247e7ab0ec77dc759263e68394990edc608fb2b480b80db8aa86ed09279e33 + url: "https://pub.dev" + source: hosted + version: "1.1.10+1" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: "18489bdd8850de3dd7ca8a34e0c446f719ec63e2bab2e7a8cc66a9028dd76c5a" + url: "https://pub.dev" + source: hosted + version: "1.1.10+1" + 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: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" + url: "https://pub.dev" + source: hosted + version: "14.2.1" + web: + dependency: transitive + description: + name: web + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + url: "https://pub.dev" + source: hosted + version: "0.5.1" + webview_flutter: + dependency: transitive + description: + name: webview_flutter + sha256: "6869c8786d179f929144b4a1f86e09ac0eddfe475984951ea6c634774c16b522" + url: "https://pub.dev" + source: hosted + version: "4.8.0" + webview_flutter_android: + dependency: transitive + description: + name: webview_flutter_android + sha256: ed021f27ae621bc97a6019fb601ab16331a3db4bf8afa305e9f6689bdb3edced + url: "https://pub.dev" + source: hosted + version: "3.16.8" + webview_flutter_platform_interface: + dependency: transitive + description: + name: webview_flutter_platform_interface + sha256: "7cb32b21825bd65569665c32bb00a34ded5779786d6201f5350979d2d529940d" + url: "https://pub.dev" + source: hosted + version: "2.13.0" + webview_flutter_wkwebview: + dependency: transitive + description: + name: webview_flutter_wkwebview + sha256: "9c62cc46fa4f2d41e10ab81014c1de470a6c6f26051a2de32111b2ee55287feb" + url: "https://pub.dev" + source: hosted + version: "3.14.0" + win32: + dependency: transitive + description: + name: win32 + sha256: "68d1e89a91ed61ad9c370f9f8b6effed9ae5e0ede22a270bdfa6daf79fc2290a" + url: "https://pub.dev" + source: hosted + version: "5.5.4" + win32_registry: + dependency: transitive + description: + name: win32_registry + sha256: "21ec76dfc731550fd3e2ce7a33a9ea90b828fdf19a5c3bcf556fa992cfa99852" + url: "https://pub.dev" + source: hosted + version: "1.1.5" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + url: "https://pub.dev" + source: hosted + version: "6.5.0" +sdks: + dart: ">=3.4.4 <4.0.0" + flutter: ">=3.22.0" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..618f87c --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,89 @@ +name: bookatanker +description: "A new Flutter project." +publish_to: 'none' + +version: 1.0.0+1 + +environment: + sdk: '>=3.4.4 <4.0.0' + +dependencies: + flutter: + sdk: flutter + + cupertino_icons: ^1.0.2 + location: ^7.0.0 + geolocator: ^9.0.2 + google_api_headers: ^1.2.0 + google_maps_flutter: ^2.2.3 + google_maps_webservice: ^0.0.20-nullsafety.5 + http: ^0.13.5 + provider: ^6.0.5 + tuple: ^2.0.1 + uuid: ^3.0.7 + flutter_svg_provider: ^1.0.3 + flutter_svg: ^2.0.9 + fluttertoast: ^8.1.2 + shared_preferences: ^2.0.15 + sizer: ^2.0.11 + geocoding: ^3.0.0 + image_picker: ^1.1.2 + url_launcher: ^6.1.9 + intl: ^0.17.0 + google_maps_place_picker_mb: ^3.0.2 + flutter_datetime_picker: ^1.5.1 + date_time_picker: ^2.1.0 + flutter_cupertino_datetime_picker: ^3.0.0 + card_swiper: ^3.0.1 + firebase_messaging: ^14.9.1 + flutter_local_notifications: ^17.2.1+2 + cloud_firestore: ^4.17.5 + flutter_device_type: ^0.4.0 + device_information: ^0.0.4 + device_info_plus: ^10.1.0 + overlay_support: ^2.1.0 + dio: ^5.1.1 + flutter_polyline_points: ^1.0.0 + get: ^4.6.5 + permission_handler: ^11.3.1 + cloudinary_public: ^0.23.1 + google_mobile_ads: ^5.1.0 + photo_view: ^0.15.0 + pinch_zoom: ^2.0.0 + flutter_switch: ^0.3.2 + auto_size_text: ^3.0.0 + fl_chart: ^0.69.0 + syncfusion_flutter_charts: ^20.4.54 + path_provider: ^2.0.15 + gallery_saver: ^2.3.0 + syncfusion_flutter_datepicker: ^20.4.54 + share_plus: ^7.0.2 + flutter_share: ^2.0.0 + share: ^2.0.4 + flutter_secure_storage: ^9.0.0 + google_fonts: ^4.0.4 + flutter_card_swiper: ^7.0.2 + multi_select_flutter: ^4.0.0 + table_calendar: ^3.0.2 + speech_to_text: ^6.6.0 + smooth_page_indicator: ^1.2.1 + device_apps: ^2.2.0 + dropdown_button2: ^2.3.9 + razorpay_flutter: ^1.4.0 + upi_india: ^3.0.1 + flutter_compass: ^0.8.1 + dotted_border: ^2.0.0 + qr_flutter: ^4.1.0 + image_gallery_saver: ^2.0.3 + + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^3.0.0 + + +flutter: + assets: + - images/ # <— use your root images/ folder + uses-material-design: true \ No newline at end of file diff --git a/test/widget_test.dart b/test/widget_test.dart new file mode 100644 index 0000000..bf7b645 --- /dev/null +++ b/test/widget_test.dart @@ -0,0 +1,29 @@ +// 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:bookatanker/main.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.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..fed8c4e --- /dev/null +++ b/web/index.html @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + bookatanker + + + + + + diff --git a/web/manifest.json b/web/manifest.json new file mode 100644 index 0000000..c5d1cff --- /dev/null +++ b/web/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "bookatanker", + "short_name": "bookatanker", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "icons/Icon-maskable-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/Icon-maskable-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/windows/.gitignore b/windows/.gitignore new file mode 100644 index 0000000..d492d0d --- /dev/null +++ b/windows/.gitignore @@ -0,0 +1,17 @@ +flutter/ephemeral/ + +# Visual Studio user-specific files. +*.suo +*.user +*.userosscache +*.sln.docstates + +# Visual Studio build-related files. +x64/ +x86/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt new file mode 100644 index 0000000..e9f7722 --- /dev/null +++ b/windows/CMakeLists.txt @@ -0,0 +1,108 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.14) +project(bookatanker 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 "bookatanker") + +# 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..95d171b --- /dev/null +++ b/windows/flutter/generated_plugin_registrant.cc @@ -0,0 +1,35 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +void RegisterPlugins(flutter::PluginRegistry* registry) { + CloudFirestorePluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("CloudFirestorePluginCApi")); + FileSelectorWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FileSelectorWindows")); + FirebaseCorePluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); + FlutterSecureStorageWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); + GeolocatorWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("GeolocatorWindows")); + PermissionHandlerWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); + SharePlusWindowsPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); + UrlLauncherWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("UrlLauncherWindows")); +} diff --git a/windows/flutter/generated_plugin_registrant.h b/windows/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..dc139d8 --- /dev/null +++ b/windows/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void RegisterPlugins(flutter::PluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake new file mode 100644 index 0000000..ff2764a --- /dev/null +++ b/windows/flutter/generated_plugins.cmake @@ -0,0 +1,31 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST + cloud_firestore + file_selector_windows + firebase_core + flutter_secure_storage_windows + geolocator_windows + permission_handler_windows + share_plus + url_launcher_windows +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/windows/runner/CMakeLists.txt b/windows/runner/CMakeLists.txt new file mode 100644 index 0000000..394917c --- /dev/null +++ b/windows/runner/CMakeLists.txt @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 3.14) +project(runner LANGUAGES CXX) + +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} WIN32 + "flutter_window.cpp" + "main.cpp" + "utils.cpp" + "win32_window.cpp" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" + "Runner.rc" + "runner.exe.manifest" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the build version. +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") + +# Disable Windows macros that collide with C++ standard library functions. +target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") + +# Add dependency libraries and include directories. Add any application-specific +# dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) +target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc new file mode 100644 index 0000000..f8a9bb2 --- /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", "bookatanker" "\0" + VALUE "FileVersion", VERSION_AS_STRING "\0" + VALUE "InternalName", "bookatanker" "\0" + VALUE "LegalCopyright", "Copyright (C) 2026 com.example. All rights reserved." "\0" + VALUE "OriginalFilename", "bookatanker.exe" "\0" + VALUE "ProductName", "bookatanker" "\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..6da0652 --- /dev/null +++ b/windows/runner/flutter_window.h @@ -0,0 +1,33 @@ +#ifndef RUNNER_FLUTTER_WINDOW_H_ +#define RUNNER_FLUTTER_WINDOW_H_ + +#include +#include + +#include + +#include "win32_window.h" + +// A window that does nothing but host a Flutter view. +class FlutterWindow : public Win32Window { + public: + // Creates a new FlutterWindow hosting a Flutter view running |project|. + explicit FlutterWindow(const flutter::DartProject& project); + virtual ~FlutterWindow(); + + protected: + // Win32Window: + bool OnCreate() override; + void OnDestroy() override; + LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, + LPARAM const lparam) noexcept override; + + private: + // The project to run. + flutter::DartProject project_; + + // The Flutter instance hosted by this window. + std::unique_ptr flutter_controller_; +}; + +#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/windows/runner/main.cpp b/windows/runner/main.cpp new file mode 100644 index 0000000..fef680c --- /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"bookatanker", origin, size)) { + return EXIT_FAILURE; + } + window.SetQuitOnClose(true); + + ::MSG msg; + while (::GetMessage(&msg, nullptr, 0, 0)) { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + + ::CoUninitialize(); + return EXIT_SUCCESS; +} diff --git a/windows/runner/resource.h b/windows/runner/resource.h new file mode 100644 index 0000000..66a65d1 --- /dev/null +++ b/windows/runner/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Runner.rc +// +#define IDI_APP_ICON 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/windows/runner/resources/app_icon.ico b/windows/runner/resources/app_icon.ico new file mode 100644 index 0000000..c04e20c Binary files /dev/null and b/windows/runner/resources/app_icon.ico differ diff --git a/windows/runner/runner.exe.manifest b/windows/runner/runner.exe.manifest new file mode 100644 index 0000000..a42ea76 --- /dev/null +++ b/windows/runner/runner.exe.manifest @@ -0,0 +1,20 @@ + + + + + PerMonitorV2 + + + + + + + + + + + + + + + diff --git a/windows/runner/utils.cpp b/windows/runner/utils.cpp new file mode 100644 index 0000000..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_