diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 17d9de068a3b7d3697a0c051fbdabf4cd5fe2b9d..870e0c86da9e44f0d7bdf0d69d5d84068e30f917 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"path_provider","dependencies":[]}]} \ No newline at end of file +{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"google_maps_flutter","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","dependencies":[]},{"name":"path_provider","dependencies":[]}]} \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4cfb91bf51135db32fff7416340c2118cf1f6e5a..b898ffa03b3f30ad68ef97ce577ef5f96d87cca3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,26 +1,44 @@ stages: + - lint - test + - sonarqube - deploy - show variables: APP_NAME: "bisaGo" +image: michael09/flutter:latest + +Lint: + stage: lint + script: + - flutter analyze + Test: stage: test - image: jro7/flutter_lcov script: - - echo Testing $APP_NAME - - flutter doctor -v + - flutter test --machine > tests.output - flutter test --coverage - lcov --summary coverage/lcov.info - - genhtml coverage/lcov.info --output=coverage coverage: '/lines......: \d+\.\d+\%/' artifacts: name: mobile-coverage paths: - $CI_PROJECT_DIR/coverage +Sonarqube: + dependencies: + - Test + stage: sonarqube + before_script: + - export PATH=$PATH:/sdk/flutter/bin/cache/dart-sdk/bin + - flutter pub get + script: + - sonar-scanner -Dsonar.login=$SONARQUBE_TOKEN -Dsonar.branch.name=$CI_COMMIT_REF_NAME -Dsonar.projectKey=$SONARQUBE_PROJECT_KEY + only: + - master + - staging DeployToProduction: @@ -35,7 +53,6 @@ DeployToProduction: refs: - master before_script: - - wget --quiet --output-document=flutter.tar.xz https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.12.13+hotfix.7-stable.tar.xz && tar xf flutter.tar.xz -C / - export PATH=$PATH:/flutter/bin - apt-get update && apt-get install gnupg -y - curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt-get install -y nodejs @@ -61,7 +78,6 @@ DeployToStaging: refs: - staging before_script: - - wget --quiet --output-document=flutter.tar.xz https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.12.13+hotfix.7-stable.tar.xz && tar xf flutter.tar.xz -C / - export PATH=$PATH:/flutter/bin - apt-get update && apt-get install gnupg -y - curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt-get install -y nodejs @@ -87,7 +103,6 @@ DeployToDevelopment: refs: - /^US-.*$/ before_script: - - wget --quiet --output-document=flutter.tar.xz https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.12.13+hotfix.7-stable.tar.xz && tar xf flutter.tar.xz -C / - export PATH=$PATH:/flutter/bin - apt-get update && apt-get install gnupg -y - curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt-get install -y nodejs diff --git a/android/app/build.gradle b/android/app/build.gradle index 3429514798da079f2d4097ca77bbe6274d7e1931..191a87db47db43b4c6e8ddf24d24a53afb03aa97 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -21,9 +21,13 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } +def localPropertyApiToken = localProperties.getProperty("MAPS_API_KEY") +def systemEnvApiToken = System.getenv('MAPS_API_KEY') + apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +def MAPS_API_KEY = localPropertyApiToken != null ? localPropertyApiToken : systemEnvApiToken android { compileSdkVersion 28 @@ -44,12 +48,13 @@ android { versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + manifestPlaceholders = [MAPS_API_KEY: MAPS_API_KEY] } buildTypes { release { // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. + // Signing with the debug keys for now, so flutter run --release works. signingConfig signingConfigs.debug } } @@ -64,4 +69,4 @@ dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' -} +} \ No newline at end of file diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 38838990d69858f983edbee6e8acf5a32c10ef0a..eac51190b63296f719b720b468a0f4f39846afba 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -4,4 +4,5 @@ to allow setting breakpoints, to provide hot reload, etc. --> + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 5f22d9a5476526119d4480cafcc364e70e0cca40..6782f488f66280a2a535ddcd63842c11e2fdde0b 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -8,7 +8,7 @@ + android:icon="@mipmap/launcher_icon"> + android:value="${MAPS_API_KEY}"/> diff --git a/android/app/src/main/res/mipmap-hdpi/launcher_icon.png b/android/app/src/main/res/mipmap-hdpi/launcher_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..77d7fa183cfe94bec5e53f3f8f634ff1ef422884 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/launcher_icon.png b/android/app/src/main/res/mipmap-mdpi/launcher_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..c83fa7614bc85964ca364e966dda34f61fa97248 Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png b/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..a31c0801ba39b64f67346a05c88aee3681541bb3 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png b/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..efec05dd687ab7ebc29c34da5270650ca42d2812 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png b/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..214f1299f3e68381d9db562d339fd6648d8f7892 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png differ diff --git a/android/build.gradle b/android/build.gradle index 3100ad2d55532e58ed44b53dd3c2a04c5bcaf160..6f110de1f2998db83a12f1904667881a7f470604 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -8,6 +8,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:3.5.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath 'com.google.gms:google-services:4.2.0' } } @@ -17,7 +18,6 @@ allprojects { jcenter() } } - rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" @@ -28,4 +28,4 @@ subprojects { task clean(type: Delete) { delete rootProject.buildDir -} +} \ No newline at end of file diff --git a/android/gradle.properties b/android/gradle.properties index 38c8d4544ff1c4419409796aa6c1caee2c262ff7..28276e2ce4a982395bef4f2ee1878f64cc6f0f42 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -2,3 +2,6 @@ org.gradle.jvmargs=-Xmx1536M android.enableR8=true android.useAndroidX=true android.enableJetifier=true +android.enableJetifier=true +android.useAndroidX=true +org.gradle.jvmargs=-Xmx1536M diff --git a/assets/icon/2x/current_loc.png b/assets/icon/2x/current_loc.png new file mode 100644 index 0000000000000000000000000000000000000000..1c55a3058fc5c1429bac6949380435d055b2c689 Binary files /dev/null and b/assets/icon/2x/current_loc.png differ diff --git a/assets/icon/2x/icon_launcher.png b/assets/icon/2x/icon_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..2c188192f166ed99579ec79c664074e12fd25e99 Binary files /dev/null and b/assets/icon/2x/icon_launcher.png differ diff --git a/assets/icon/3x/current_loc.png b/assets/icon/3x/current_loc.png new file mode 100644 index 0000000000000000000000000000000000000000..930d897dceee528d3c2b13135718a712246099f8 Binary files /dev/null and b/assets/icon/3x/current_loc.png differ diff --git a/assets/icon/3x/icon_launcher.png b/assets/icon/3x/icon_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..cf5be9783e1ab2b8561990ea143d0082d4183eb8 Binary files /dev/null and b/assets/icon/3x/icon_launcher.png differ diff --git a/assets/icon/current_loc.png b/assets/icon/current_loc.png new file mode 100644 index 0000000000000000000000000000000000000000..08fc2db183a39b330b1526f39c681d9518b67539 Binary files /dev/null and b/assets/icon/current_loc.png differ diff --git a/assets/icon/icon_launcher.png b/assets/icon/icon_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..7c82fa986afdb49514350a6e24dbb1998727f9be Binary files /dev/null and b/assets/icon/icon_launcher.png differ diff --git a/assets/icon/loc.png b/assets/icon/loc.png new file mode 100644 index 0000000000000000000000000000000000000000..a7c8787a3af5b53f89978d11d8af32d2a032697f Binary files /dev/null and b/assets/icon/loc.png differ diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig index 592ceee85b89bd111b779db6116b130509ab6d4b..e8efba114687be7d0e4e5d026a31f5efd04d20bf 100644 --- a/ios/Flutter/Debug.xcconfig +++ b/ios/Flutter/Debug.xcconfig @@ -1 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig index 592ceee85b89bd111b779db6116b130509ab6d4b..399e9340e6f617f68676161ad4a64edcbe483115 100644 --- a/ios/Flutter/Release.xcconfig +++ b/ios/Flutter/Release.xcconfig @@ -1 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Podfile b/ios/Podfile new file mode 100644 index 0000000000000000000000000000000000000000..b30a428b5e77ede0fd1d2cb7009f930e42d8def1 --- /dev/null +++ b/ios/Podfile @@ -0,0 +1,90 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '9.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def parse_KV_file(file, separator='=') + file_abs_path = File.expand_path(file) + if !File.exists? file_abs_path + return []; + end + generated_key_values = {} + skip_line_start_symbols = ["#", "/"] + File.foreach(file_abs_path) do |line| + next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } + plugin = line.split(pattern=separator) + if plugin.length == 2 + podname = plugin[0].strip() + path = plugin[1].strip() + podpath = File.expand_path("#{path}", file_abs_path) + generated_key_values[podname] = podpath + else + puts "Invalid plugin specification: #{line}" + end + end + generated_key_values +end + +target 'Runner' do + use_frameworks! + use_modular_headers! + + # Flutter Pod + + copied_flutter_dir = File.join(__dir__, 'Flutter') + copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') + copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') + unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) + # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. + # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. + # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. + + generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') + unless File.exist?(generated_xcode_build_settings_path) + raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) + cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; + + unless File.exist?(copied_framework_path) + FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) + end + unless File.exist?(copied_podspec_path) + FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) + end + end + + # Keep pod path relative so it can be checked into Podfile.lock. + pod 'Flutter', :path => 'Flutter' + + # Plugin Pods + + # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock + # referring to absolute paths on developers' machines. + system('rm -rf .symlinks') + system('mkdir -p .symlinks/plugins') + plugin_pods = parse_KV_file('../.flutter-plugins') + plugin_pods.each do |name, path| + symlink = File.join('.symlinks', 'plugins', name) + File.symlink(path, symlink) + pod name, :path => File.join(symlink, 'ios') + end +end + +# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. +install! 'cocoapods', :disable_input_output_paths => true + +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['ENABLE_BITCODE'] = 'NO' + end + end +end diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index b0b73cb408abdca327f4490f43bcaa3d8985e9d7..e6fbe067943bc4bdfa163df12b63f83ad2c499ee 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -17,6 +17,7 @@ 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 */; }; + A713680F956827CC800E5882 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 608DBD9F25B5A1E158194D12 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -37,11 +38,14 @@ /* 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 = ""; }; + 27B4326A6F124C13099D180A /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; + 608DBD9F25B5A1E158194D12 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 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 = ""; }; + 94561A220A1B4EFA7831E0FC /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 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 = ""; }; 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; @@ -50,6 +54,7 @@ 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 = ""; }; + F7D6823AE5698B88142C285E /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -59,12 +64,24 @@ files = ( 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, + A713680F956827CC800E5882 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 829932E47EADAEFD209551C7 /* Pods */ = { + isa = PBXGroup; + children = ( + 94561A220A1B4EFA7831E0FC /* Pods-Runner.debug.xcconfig */, + F7D6823AE5698B88142C285E /* Pods-Runner.release.xcconfig */, + 27B4326A6F124C13099D180A /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -84,6 +101,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, + 829932E47EADAEFD209551C7 /* Pods */, + F0491B426155A7C9E1ADB1A7 /* Frameworks */, ); sourceTree = ""; }; @@ -118,6 +137,14 @@ name = "Supporting Files"; sourceTree = ""; }; + F0491B426155A7C9E1ADB1A7 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 608DBD9F25B5A1E158194D12 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -125,12 +152,15 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + 45875E25277A3BB7443A1483 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + A6A877344DE185CEA8904842 /* [CP] Embed Pods Frameworks */, + 17BFDE4BCED4D29A440D5CB6 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -189,6 +219,21 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 17BFDE4BCED4D29A440D5CB6 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -203,6 +248,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; }; + 45875E25277A3BB7443A1483 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -217,6 +284,21 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + A6A877344DE185CEA8904842 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata index 1d526a16ed0f1cd0c2409d848bf489b93fefa3b2..21a3cc14c74e969ab1548274a8512ebfecc40f78 100644 --- a/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + 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 index dc9ada4725e9b0ddb1deab583e5b5102493aa332..300ae2f80ad2814cc466704e147c06059e78e345 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png 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 index 28c6bf03016f6c994b70f38d1b7346e5831b531f..ada4b7fe4d79380d3e1dae5a73fc2fee19c833a7 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png 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 index 2ccbfd967d9697cd4b83225558af2911e9571c9b..8eea4dd22c0f64e7e2e729c1bf4429e382c01287 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png 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 index f091b6b0bca859a3f474b03065bef75ba58a9e4c..9d8723cce631060e3706563d92eed7a599334f5e 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png 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 index 4cde12118dda48d71e01fcb589a74d069c5d7cb5..1eacd7844cd572c44122b00b633ff674b09f3ced 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png 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 index d0ef06e7edb86cdfe0d15b4b0d98334a86163658..d7c6ebbeb3447d068bc1740d810dc31400202935 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png 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 index dcdc2306c28505ebc0b6c3a359c4d252bf626b9f..11656b43ffd81643db2f44232753f5734558448c 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png 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 index 2ccbfd967d9697cd4b83225558af2911e9571c9b..8eea4dd22c0f64e7e2e729c1bf4429e382c01287 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png 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 index c8f9ed8f5cee1c98386d13b17e89f719e83555b2..b23aabf9ee96e2e82b91c7cd3b8af95e39079d59 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png 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 index a6d6b8609df07bf62e5100a53a01510388bd2b22..7bb01ba0916c018d6b493da8b33167bed53a08b1 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png 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-50x50@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png new file mode 100644 index 0000000000000000000000000000000000000000..2dbb06f0c78bc1d593744c560c79a902218b7ab5 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..a2cc47629e4fc439af429f37995d8fa3785f3ece Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png new file mode 100644 index 0000000000000000000000000000000000000000..e292b43465108f58c1c77f37bd77be4967009a33 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..d877aba55fc7f9500f2377807f4b55dee73974d3 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.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 index a6d6b8609df07bf62e5100a53a01510388bd2b22..7bb01ba0916c018d6b493da8b33167bed53a08b1 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png 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 index 75b2d164a5a98e212cca15ea7bf2ab5de5108680..e35743855f7dd22f7aba64ae49f5fd72bb0e7c45 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png 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-72x72@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png new file mode 100644 index 0000000000000000000000000000000000000000..77d7fa183cfe94bec5e53f3f8f634ff1ef422884 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..efec05dd687ab7ebc29c34da5270650ca42d2812 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.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 index c4df70d39da7941ef3f6dcb7f06a192d8dcb308d..4dbd42d651705769af62603611dfccc3b46cb768 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png 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 index 6a84f41e14e27f4b11f16f9ee39279ac98f8d5ac..837710082fe7d5b9a57fbcfe87c56b999a8893a3 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png 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 index d0e1f58536026aebc4f1f70e481f6993c9ff088d..d67bc9485fe151a679841955dc61a110f4f37e0d 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/lib/app.dart b/lib/app.dart new file mode 100644 index 0000000000000000000000000000000000000000..f5a00dfb9b5822c8be96289a04ace48f9c1df934 --- /dev/null +++ b/lib/app.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; +import 'package:ppl_disabilitas/page/dashboard/dashboard.dart'; + +class BisaGo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'bisaGo', + theme: ThemeData( + fontFamily: 'Muli', + backgroundColor: Colors.white, + ), + home: Dashboard(), + ); + } +} diff --git a/lib/component/bisago_appbar.dart b/lib/component/bisago_appbar.dart new file mode 100644 index 0000000000000000000000000000000000000000..e32af12651aae7289ffd82946141b165098d1465 --- /dev/null +++ b/lib/component/bisago_appbar.dart @@ -0,0 +1,30 @@ +import 'package:flutter/material.dart'; +import 'package:ppl_disabilitas/config/styles.dart'; + +class BisaGoAppBar extends StatelessWidget implements PreferredSizeWidget { + @override + final Size preferredSize = Size.fromHeight(55); + @override + Widget build(BuildContext context) { + return AppBar( + elevation: 15, + centerTitle: true, + backgroundColor: greenPrimary, + title: Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + Padding(padding: EdgeInsets.all(doubleSpace), + child: Text( + "bisaGo", + style: TextStyle( + fontSize: 25, + fontFamily: 'Comfortaa', + fontWeight: FontWeight.w800), + ),) + + ], + ), + ); + } +} diff --git a/lib/component/bisago_drawer.dart b/lib/component/bisago_drawer.dart new file mode 100644 index 0000000000000000000000000000000000000000..19155fdf546b7675355a5c04162ecd8b43978fda --- /dev/null +++ b/lib/component/bisago_drawer.dart @@ -0,0 +1,93 @@ +import 'package:flutter/material.dart'; +import 'package:ppl_disabilitas/config/styles.dart'; + +class BisaGoDrawer extends StatelessWidget { + final List> drawerList = [ + {'title': 'Beranda', 'icon': Icons.home}, + {'title': 'Riwayat Pencarian', 'icon': Icons.history}, + {'title': 'Tentang Aplikasi', 'icon': Icons.info}, + {'title': 'Log out', 'icon': Icons.keyboard_backspace} + ]; + + @override + Widget build(BuildContext context) { + List menus = drawerList.map((menu) { + return _createListTile( + context: context, icon: menu['icon'], title: menu['title']); + }).toList(); + List drawerItem = [ + Container( + height: 130, + child: DrawerHeader( + decoration: BoxDecoration( + color: greenPrimary, + ), + child: Row( + children: [ + FloatingActionButton( + backgroundColor: Colors.white, + elevation: 0, + onPressed: () => {}, + ), + Padding( + padding: EdgeInsets.all(doubleSpace), + child: Text( + 'Nama Orang', + style: TextStyle( + fontSize: 20, + color: Colors.white, + fontFamily: 'Muli', + ), + ), + ), + ], + ), + ), + ), + Container( + decoration: + BoxDecoration(border: Border(top: BorderSide(color: Colors.white))), + ), + ]; + menus.forEach((menu) { + drawerItem.add(menu); + }); + return Theme( + data: Theme.of(context).copyWith( + canvasColor: greenPrimary, + ), + child: Drawer( + child: ListView(padding: EdgeInsets.zero, children: drawerItem), + ), + ); + } + + Widget _createListTile({BuildContext context, IconData icon, String title}) { + return Container( + child: ListTile( + leading: Icon( + icon, + color: Colors.white, + size: 30, + ), + title: Text( + title, + style: TextStyle( + fontSize: 20, + color: Colors.white, + fontFamily: 'Muli', + ), + ), + onTap: () { + Navigator.pop(context); + }, + ), + decoration: new BoxDecoration( + color: greenPrimary, + border: new Border( + bottom: new BorderSide(color: Colors.white), + ), + ), + ); + } +} diff --git a/lib/config/strings.dart b/lib/config/strings.dart index 1ea733ee1ace43fca3f9d713a28d6d2949b3838b..f680bdbc8eb6ac533121eaa2f9de0da036523dac 100644 --- a/lib/config/strings.dart +++ b/lib/config/strings.dart @@ -1,16 +1,16 @@ // Frequently used strings are stored here // No hardcoding string view files. Store here. -final String DEV_BASE_URL = "poipole.herokuapp.com"; -final String BASE_URL = "poipole.herokuapp.com"; -String KEY = ""; -String CSRF = ""; -String SESSION_ID = ""; +final String devBaseURL = "poipole.herokuapp.com"; +final String baseURL = "poipole.herokuapp.com"; +String key = ""; +String csrf = ""; +String sessionID = ""; setKey(String key) { - KEY = key; + key = key; } setSessionId(String sessionId) { - SESSION_ID = sessionId; + sessionID = sessionId; } \ No newline at end of file diff --git a/lib/config/styles.dart b/lib/config/styles.dart index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..3b140b67428cd2b3e08642963582324ae7d0420e 100644 --- a/lib/config/styles.dart +++ b/lib/config/styles.dart @@ -0,0 +1,21 @@ +import 'package:flutter/material.dart'; + +final Color greenPrimary = Color(0xff3A903A); +final Color redPrimary = Color(0xffC60000); +final Color bluePrimary = Color(0xff537AC6); + +final double smallSpace = 4.0; +final double regularSpace = 8.0; +final double doubleSpace = 16.0; +final double tripleSpace = 32.0; +final double quartetSpace = 64.0; +final double spaceFourtyEight = 48.0; + +final List regularShadow = [ + BoxShadow( + blurRadius: 4, + color: Colors.black.withOpacity(0.25), + offset: Offset(0, 0)) +]; +final BorderRadius regularBorderRadius = BorderRadius.circular(10); +final BorderRadius doubleBorderRadius = BorderRadius.circular(20); diff --git a/lib/flavor/flavor.dart b/lib/flavor/flavor.dart index e1508bf0c46a7068aaf370a55a46f6cfad1bc0d6..09201b9c32fa3cd40c726742a9164dc3768f497f 100644 --- a/lib/flavor/flavor.dart +++ b/lib/flavor/flavor.dart @@ -7,9 +7,9 @@ class ApiFlavor { static String getBaseUrl() { if (ApiFlavor.flavor == BuildFlavor.development.toString()) { - return DEV_BASE_URL; + return devBaseURL; } else { - return BASE_URL; + return baseURL; } } diff --git a/lib/main.dart b/lib/main.dart index 4ed6580765258a9ac737ab7948dde4e5fe17c9bc..aaab915666b9af6288858f0d23c2cfa1106286f8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,97 +1,9 @@ import 'package:flutter/material.dart'; +import 'package:ppl_disabilitas/app.dart'; import 'flavor/flavor.dart'; void main() { ApiFlavor.flavor = BuildFlavor.production.toString(); - runApp(MyApp()); -} -class MyApp extends StatelessWidget { - // This widget is the root of your application. - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'Flutter Demo', - theme: ThemeData( - // This is the theme of your application. - // - // Try running your application with "flutter run". You'll see the - // application has a blue toolbar. Then, without quitting the app, try - // changing the primarySwatch below to Colors.green and then invoke - // "hot reload" (press "r" in the console where you ran "flutter run", - // or simply save your changes to "hot reload" in a Flutter IDE). - // Notice that the counter didn't reset back to zero; the application - // is not restarted. - primarySwatch: Colors.blue, - ), - home: MyHomePage(title: 'bisaGo'), - ); - } -} - -class MyHomePage extends StatefulWidget { - MyHomePage({Key key, this.title}) : super(key: key); - - // This widget is the home page of your application. It is stateful, meaning - // that it has a State object (defined below) that contains fields that affect - // how it looks. - - // This class is the configuration for the state. It holds the values (in this - // case the title) provided by the parent (in this case the App widget) and - // used by the build method of the State. Fields in a Widget subclass are - // always marked "final". - - final String title; - - @override - _MyHomePageState createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State { - - @override - Widget build(BuildContext context) { - // This method is rerun every time setState is called, for instance as done - // by the _incrementCounter method above. - // - // The Flutter framework has been optimized to make rerunning build methods - // fast, so that you can just rebuild anything that needs updating rather - // than having to individually change instances of widgets. - return Scaffold( - appBar: AppBar( - // Here we take the value from the MyHomePage object that was created by - // the App.build method, and use it to set our appbar title. - title: Text(widget.title, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30)), - backgroundColor: Color(0xff3a903a) - - ), - body: Center( - // Center is a layout widget. It takes a single child and positions it - // in the middle of the parent. - child: Column( - // Column is also a layout widget. It takes a list of children and - // arranges them vertically. By default, it sizes itself to fit its - // children horizontally, and tries to be as tall as its parent. - // - // Invoke "debug painting" (press "p" in the console, choose the - // "Toggle Debug Paint" action from the Flutter Inspector in Android - // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) - // to see the wireframe for each widget. - // - // Column has various properties to control how it sizes itself and - // how it positions its children. Here we use mainAxisAlignment to - // center the children vertically; the main axis here is the vertical - // axis because Columns are vertical (the cross axis would be - // horizontal). - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - 'Hello World', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40) - ), - ], - ), - ), - - ); - } -} + runApp(BisaGo()); +} \ No newline at end of file diff --git a/lib/main_dev.dart b/lib/main_dev.dart index c20de18f73673f33c4e8659aa3f5ebba4e21f63c..606b2d7f8e1a6d839fcae9ac697d7aad7f7fa337 100644 --- a/lib/main_dev.dart +++ b/lib/main_dev.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; +import 'package:ppl_disabilitas/app.dart'; import 'flavor/flavor.dart'; -import 'main.dart'; void main() { ApiFlavor.flavor = BuildFlavor.development.toString(); - runApp(MyApp()); + runApp(BisaGo()); } \ No newline at end of file diff --git a/lib/page/dashboard/dashboard.dart b/lib/page/dashboard/dashboard.dart new file mode 100644 index 0000000000000000000000000000000000000000..751e766639d3b351fcd935843632292147a71533 --- /dev/null +++ b/lib/page/dashboard/dashboard.dart @@ -0,0 +1,182 @@ +import 'dart:async'; +import 'package:location/location.dart'; +import 'package:flutter/material.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:ppl_disabilitas/component/bisago_appbar.dart'; +import 'package:ppl_disabilitas/component/bisago_drawer.dart'; +import 'package:ppl_disabilitas/config/styles.dart'; +import 'package:ppl_disabilitas/page/pencarian/pencarian.dart'; + +class Dashboard extends StatefulWidget { + DashboardState createState() => DashboardState(); +} + +class DashboardState extends State { + final Completer _controller = Completer(); + final double cameraZoom = 16; + final LatLng defaultLocation = LatLng(-6.1753924, 106.8249641); + final String currentLocationIconAsset = "assets/icon/current_loc.png"; + Location location; + Set _markers = Set(); + LocationData currentLocation; + BitmapDescriptor currentLocationIcon; + + @override + void initState() { + super.initState(); + location = new Location(); + enableLocationService(); + location.onLocationChanged().listen((LocationData cLoc) { + currentLocation = cLoc; + updatePinOnMap(); + }); + setSourceAndDestinationIcons(); + setInitialLocation(); + _markers.add(contohMarker); + } + + void enableLocationService() async { + bool _serviceEnabled; + PermissionStatus _permissionGranted; + + _serviceEnabled = await location.serviceEnabled(); + if (!_serviceEnabled) { + _serviceEnabled = await location.requestService(); + if (!_serviceEnabled) { + return; + } + } + + _permissionGranted = await location.hasPermission(); + if (_permissionGranted == PermissionStatus.DENIED) { + _permissionGranted = await location.requestPermission(); + if (_permissionGranted != PermissionStatus.GRANTED) { + return; + } + } + } + + void _navigateToPencarianPage(BuildContext context) { + final route = MaterialPageRoute(builder: (_) => Pencarian()); + Navigator.of(context).push(route); + } + + static const textFieldKey = Key('Text Field Mau Kemana'); + @override + Widget build(BuildContext context) { + return Scaffold( + drawer: BisaGoDrawer(), + body: Stack(children: [ + _buildGoogleMap(context), + InkWell( + key: Key("Navigate to Pencarian"), + onTap: () => _navigateToPencarianPage(context), + child: Container( + key: Key("Container Text Field"), + margin: EdgeInsets.only( + left: doubleSpace, right: doubleSpace, top: doubleSpace), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: doubleBorderRadius, + boxShadow: regularShadow), + child: TextFormField( + enabled: false, + key: Key("Text Field Mau Kemana"), + decoration: InputDecoration( + prefixIcon: Icon( + Icons.search, + color: greenPrimary, + size: 25, + ), + border: InputBorder.none, + fillColor: Colors.white, + labelText: 'Kamu mau kemana?', + labelStyle: TextStyle( + color: greenPrimary, + fontSize: 20, + fontFamily: 'Muli', + fontWeight: FontWeight.w700), + suffixIcon: IconButton( + key: Key("IconButton Text Field"), + icon: Icon( + Icons.mic, + color: greenPrimary, + size: 25, + ), + onPressed: () {})), + onTap: () => _navigateToPencarianPage(context), + ), + ), + ), + ]), + appBar: PreferredSize( + preferredSize: Size.fromHeight(55), + child: BisaGoAppBar(), + key: Key("Scaffold Text Field"), + ), + ); + } + + Marker contohMarker = Marker( + markerId: MarkerId("contoh1"), + position: LatLng(-6.365474, 106.828157), + infoWindow: InfoWindow(title: "Fasilkom"), + icon: BitmapDescriptor.defaultMarkerWithHue( + BitmapDescriptor.hueViolet, + ), + ); + + Widget _buildGoogleMap(BuildContext context) { + CameraPosition initialCameraPosition = CameraPosition( + target: defaultLocation, + zoom: cameraZoom, + ); + if (currentLocation != null) { + initialCameraPosition = CameraPosition( + target: LatLng(currentLocation.latitude, currentLocation.longitude), + zoom: cameraZoom, + ); + } + return Container( + key: Key("Container GoogleMap"), + height: MediaQuery.of(context).size.height, + width: MediaQuery.of(context).size.width, + child: GoogleMap( + key: Key("Google Map"), + markers: _markers, + mapType: MapType.normal, + initialCameraPosition: initialCameraPosition, + onMapCreated: (GoogleMapController controller) { + _controller.complete(controller); + }, + ), + ); + } + + void setSourceAndDestinationIcons() async { + currentLocationIcon = await BitmapDescriptor.fromAssetImage( + ImageConfiguration(devicePixelRatio: 5), currentLocationIconAsset); + } + + void updatePinOnMap() async { + CameraPosition cPosition = CameraPosition( + zoom: cameraZoom, + target: LatLng(currentLocation.latitude, currentLocation.longitude), + ); + final GoogleMapController controller = await _controller.future; + controller.animateCamera(CameraUpdate.newCameraPosition(cPosition)); + setState(() { + var pinPosition = + LatLng(currentLocation.latitude, currentLocation.longitude); + _markers.removeWhere((m) => m.markerId.value == 'currentLocationPin'); + _markers.add(Marker( + markerId: MarkerId('currentLocationPin'), + position: pinPosition, + icon: currentLocationIcon)); + }); + } + + void setInitialLocation() async { + currentLocation = await location.getLocation(); + } +} diff --git a/lib/page/pencarian/pencarian.dart b/lib/page/pencarian/pencarian.dart new file mode 100644 index 0000000000000000000000000000000000000000..52742d32265c1ea6fcfa38aa22b8b9f9c7fd0455 --- /dev/null +++ b/lib/page/pencarian/pencarian.dart @@ -0,0 +1,169 @@ +import 'package:flutter/material.dart'; +import 'package:ppl_disabilitas/config/styles.dart'; + +class Pencarian extends StatefulWidget { + @override + PencarianState createState() => PencarianState(); +} + +class PencarianState extends State { + Widget appBarText = Text("Pencarian Lokasi"); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: greenPrimary, + leading: IconButton( + icon: Icon(Icons.arrow_back_ios, size: 25), + key: Key("Back Icon Key"), + onPressed: () => Navigator.pop(context, 'Take me back')), + title: Container( + margin: EdgeInsets.only(top: doubleSpace, bottom: doubleSpace), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: doubleBorderRadius, + boxShadow: regularShadow), + child: TextFormField( + key: Key("Text Field Mau Kemana"), + decoration: InputDecoration( + contentPadding: EdgeInsets.all(0), + isDense: false, + prefixIcon: Icon( + Icons.search, + color: greenPrimary, + size: 25, + ), + border: InputBorder.none, + fillColor: Colors.white, + labelText: 'Kamu mau kemana?', + labelStyle: TextStyle( + color: greenPrimary, + fontSize: 18, + fontFamily: 'Muli', + fontWeight: FontWeight.w700), + suffixIcon: IconButton( + icon: Icon( + Icons.mic, + color: greenPrimary, + size: 25, + ), + onPressed: () {})), + ), + ), + ), + body: ListView( + padding: const EdgeInsets.all(8), + children: [ + Padding( + padding: EdgeInsets.only(left: doubleSpace, top: 10), + child: Text( + 'Hasil Pencarian', + style: TextStyle( + fontSize: 15, + color: Colors.black, + fontFamily: 'Muli', + ), + ), + ), + Container( + height: 90, + color: Colors.transparent, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CircleAvatar( + backgroundColor: greenPrimary, + child: Text('Test'), + ), + Padding( + padding: EdgeInsets.all(doubleSpace), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Margo City', + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w800, + color: Colors.black, + fontFamily: 'Muli', + ), + ), + Text( + 'Jl. Margonda Raya No.358, Kemir...', + style: TextStyle( + fontSize: 15, + color: Colors.black, + fontFamily: 'Muli', + ), + ), + ], + ), + ), + Icon( + Icons.arrow_forward_ios, + color: Colors.grey[400], + size: 20, + ) + ], + ), + ), + Container( + decoration: BoxDecoration( + border: Border(top: BorderSide(color: Colors.grey[400]))), + ), + Container( + height: 90, + color: Colors.transparent, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CircleAvatar( + backgroundColor: greenPrimary, + child: Text('Test'), + ), + Padding( + padding: EdgeInsets.all(doubleSpace), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Margo City', + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w800, + color: Colors.black, + fontFamily: 'Muli', + ), + ), + Text( + 'Jl. Margonda Raya No.358, Kemir...', + style: TextStyle( + fontSize: 15, + color: Colors.black, + fontFamily: 'Muli', + ), + ), + ], + ), + ), + Icon( + Icons.arrow_forward_ios, + color: Colors.grey[400], + size: 20, + ) + ], + ), + ), + Container( + decoration: BoxDecoration( + border: Border(top: BorderSide(color: Colors.grey[400]))), + ), + ], + ), + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 1b41f5ac096ca76a352a87fae0127243843e3ef9..ae56d3c0f6386d9f2fbe37c351089ac8c83107d7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -21,16 +21,27 @@ dependencies: sdk: flutter http: ^0.12.0+2 path_provider: ^0.4.1 + mockito: ^4.1.1 intl: - + location: ^2.5.3 + flutter_polyline_points: ^0.1.0 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^0.1.2 + google_maps_flutter: ^0.5.24+1 + flutter_dotenv: ^2.1.0 dev_dependencies: flutter_test: sdk: flutter + flutter_launcher_icons: ^0.7.4 + +flutter_icons: + android: "launcher_icon" + ios: true + image_path: "assets/icon/icon_launcher.png" + #mockito: ^4.1.1 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec @@ -44,9 +55,10 @@ flutter: uses-material-design: true # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg + assets: + - assets/icon/loc.png + - assets/icon/current_loc.png + - assets/icon/icon_launcher.png # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. diff --git a/test/navigation_test.dart b/test/navigation_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..5efeb5a7adad639a471953e152104d448aaab716 --- /dev/null +++ b/test/navigation_test.dart @@ -0,0 +1,64 @@ +import 'package:flutter/material.dart'; +import 'package:mockito/mockito.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:ppl_disabilitas/page/dashboard/dashboard.dart'; + + +class MockNavigatorObserver extends Mock implements NavigatorObserver {} + +void main() { + group('Dashboard navigation tests', () { + NavigatorObserver mockObserver; + + setUp(() { + mockObserver = MockNavigatorObserver(); + }); + + Future _buildDashboardPage(WidgetTester tester) async { + await tester.pumpWidget(MaterialApp( + home: Dashboard(), + + /// This mocked observer will now receive all navigation events + /// that happen in our app. + navigatorObservers: [mockObserver], + )); + + /// The tester.pumpWidget() call above just built our app widget + /// and triggered the pushObserver method on the mockObserver once. + verify(mockObserver.didPush(any, any)); + } + + Future _navigateToPencarianPage(WidgetTester tester) async { + final textFieldKey = Key("Text Field Mau Kemana"); + await tester.tap(find.byKey(textFieldKey)); + await tester.pumpAndSettle(); + } + + testWidgets( + 'when tapping text form field, should navigate to pencarina page', + (WidgetTester tester) async { + final textFieldKeyPencarian = Key("Text Field Mau Kemana"); + await _buildDashboardPage(tester); + await _navigateToPencarianPage(tester); + verify(mockObserver.didPush(any, any)); + expect(find.byKey(textFieldKeyPencarian), findsOneWidget); + + }); + + testWidgets('tapping the back button should navigate back to the dashboard', + (WidgetTester tester) async { + final backIconKey = Key("Back Icon Key"); + await _buildDashboardPage(tester); + await _navigateToPencarianPage(tester); + final Route pushedRoute =verify(mockObserver.didPush(captureAny, any)).captured.single; + String popResult; + pushedRoute.popped.then((result) => popResult = result); + await tester.tap(find.byKey(backIconKey)); + await tester.pumpAndSettle(); + expect(popResult, 'Take me back'); + + + + }); + }); +} \ No newline at end of file diff --git a/test/pencarian_test.dart b/test/pencarian_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..43546747e61eccf3c9b60b39e43965a131a56741 --- /dev/null +++ b/test/pencarian_test.dart @@ -0,0 +1,30 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility that Flutter provides. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:ppl_disabilitas/page/pencarian/pencarian.dart'; + + +void main() { + testWidgets('display list view in pencarian', (WidgetTester tester) async { + // Provide the childWidget to the Container. + await tester.pumpWidget(MaterialApp(home: Pencarian())); + // Search for the childWidget in the tree and verify it exists. + expect(find.byType(ListView), findsOneWidget); + expect(find.byType(Container), findsNWidgets(7)); + expect(find.byType(Icon), findsNWidgets(5)); + }); + + testWidgets('finds a text field in pencarian', (WidgetTester tester) async { + final textFieldKey = Key("Text Field Mau Kemana"); + await tester.pumpWidget(MaterialApp(home: Pencarian())); + expect(find.byKey(textFieldKey), findsOneWidget); + }); + +} diff --git a/test/widget_test.dart b/test/widget_test.dart index d5193c1a5479b96e0ab1e76ef8f2d64c6e1c61b4..64ff19cde4d9c836113b4f46d92b9d1054db2c80 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -1,21 +1,54 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import 'package:ppl_disabilitas/main.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:ppl_disabilitas/app.dart'; +import 'package:ppl_disabilitas/page/dashboard/dashboard.dart'; void main() { - testWidgets('Hello World smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); + testWidgets('finds a text field in dashboard', (WidgetTester tester) async { + final containerTextField = Key("Container Text Field"); + final iconButtonTextField = Key("IconButton Text Field"); + final textFieldKey = Key("Text Field Mau Kemana"); + final scaffoldTextFieldKey = Key("Scaffold Text Field"); + // Provide the childWidget to the Container. + await tester.pumpWidget(MaterialApp(home: Dashboard())); + // Search for the childWidget in the tree and verify it exists. + expect(find.byType(Scaffold), findsOneWidget); + expect(find.byType(Stack), findsNWidgets(3)); + expect(find.byType(TextFormField), findsOneWidget); + expect(find.byType(Icon), findsNWidgets(3)); + expect(find.text('Kamu mau kemana?'), findsOneWidget); + expect(find.text('Kamu mau kmn?'), findsNothing); + expect(find.byKey(containerTextField), findsOneWidget); + expect(find.byKey(iconButtonTextField), findsOneWidget); + expect(find.byKey(textFieldKey), findsOneWidget); + expect(find.byKey(scaffoldTextFieldKey), findsOneWidget); + }); + + testWidgets('finds a google map in dashboard', (WidgetTester tester) async { + final containerGoogleMap = Key("Container GoogleMap"); + final googleMapKey = Key("Google Map"); + await tester.pumpWidget(MaterialApp(home: Dashboard())); + expect(find.byType(GoogleMap), findsOneWidget); + expect(find.byType(Container), findsNWidgets(3)); + expect(find.byKey(googleMapKey), findsOneWidget); + expect(find.byKey(containerGoogleMap), findsOneWidget); + }); + + // testWidgets('finds a marker in google map', (WidgetTester tester) async { + // await tester.pumpWidget(MaterialApp(home: Dashboard())); + // expect(find.byType(Marker), findsOneWidget); + // }); + + testWidgets('finds a navigation bar', (WidgetTester tester) async { + await tester.pumpWidget(MaterialApp(home: Dashboard())); + expect(find.byType(Scaffold), findsOneWidget); + expect(find.byType(Theme), findsOneWidget); + expect(find.byType(AppBar), findsOneWidget); + }); - // Verify that our counter starts at 0. - expect(find.text('Hello World'), findsOneWidget); + testWidgets('Shows dashboard on App Start', (WidgetTester tester) async { + await tester.pumpWidget(BisaGo()); + expect(find.byType(Dashboard), findsOneWidget); }); }