├── .gitignore
├── .metadata
├── LICENSE
├── README.md
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── flutter_rest_api_image_upload
│ │ │ │ └── flutter_rest_api_image_upload
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── drawable-v21
│ │ │ └── launch_background.xml
│ │ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-night
│ │ │ └── styles.xml
│ │ │ └── values
│ │ │ └── styles.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── assets
├── icons
│ └── Camera Icon.svg
└── images
│ ├── no image.jpeg
│ └── no_user.jpg
├── home.png
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── WorkspaceSettings.xcsettings
└── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon-App-1024x1024@1x.png
│ │ ├── Icon-App-20x20@1x.png
│ │ ├── Icon-App-20x20@2x.png
│ │ ├── Icon-App-20x20@3x.png
│ │ ├── Icon-App-29x29@1x.png
│ │ ├── Icon-App-29x29@2x.png
│ │ ├── Icon-App-29x29@3x.png
│ │ ├── Icon-App-40x40@1x.png
│ │ ├── Icon-App-40x40@2x.png
│ │ ├── Icon-App-40x40@3x.png
│ │ ├── Icon-App-60x60@2x.png
│ │ ├── Icon-App-60x60@3x.png
│ │ ├── Icon-App-76x76@1x.png
│ │ ├── Icon-App-76x76@2x.png
│ │ └── Icon-App-83.5x83.5@2x.png
│ └── LaunchImage.imageset
│ │ ├── Contents.json
│ │ ├── LaunchImage.png
│ │ ├── LaunchImage@2x.png
│ │ ├── LaunchImage@3x.png
│ │ └── README.md
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ └── Runner-Bridging-Header.h
├── lib
├── controllers
│ ├── galleryController.dart
│ ├── profileController.dart
│ └── vehicleController.dart
├── main.dart
├── models
│ ├── gallery.dart
│ ├── profile.dart
│ └── vehicle.dart
├── services
│ ├── gallery_service.dart
│ ├── profile_service.dart
│ └── vehicle_service.dart
├── utilities
│ └── const.dart
├── views
│ ├── gallery
│ │ ├── add_gallery_screen.dart
│ │ └── view_gallery_screen.dart
│ ├── home
│ │ └── home_screen.dart
│ ├── profile
│ │ ├── add_profile_screen.dart
│ │ └── view_profile_screen.dart
│ └── vehicle
│ │ ├── add_vehicle_screen.dart
│ │ └── view_vehicle_screem.dart
└── widgets
│ └── loading_button.dart
├── pubspec.lock
├── pubspec.yaml
└── test
└── widget_test.dart
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | **/ios/Flutter/.last_build_id
26 | .dart_tool/
27 | .flutter-plugins
28 | .flutter-plugins-dependencies
29 | .packages
30 | .pub-cache/
31 | .pub/
32 | /build/
33 |
34 | # Web related
35 | lib/generated_plugin_registrant.dart
36 |
37 | # Symbolication related
38 | app.*.symbols
39 |
40 | # Obfuscation related
41 | app.*.map.json
42 |
43 | # Android Studio will place build artifacts here
44 | /android/app/debug
45 | /android/app/profile
46 | /android/app/release
47 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: f4abaa0735eba4dfd8f33f73363911d63931fe03
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Sameera Perera
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [![Contributors][contributors-shield]][contributors-url]
2 | [![Forks][forks-shield]][forks-url]
3 | [![Stargazers][stars-shield]][stars-url]
4 | [![Issues][issues-shield]][issues-url]
5 | [![LinkedIn][linkedin-shield]][linkedin-url]
6 |
7 |
8 |
Flutter Image Upload To REST API Complete Example || Single/Multiple/Dynamic Upload
9 |
10 |
11 | [![Product Name Screen Shot][product-screenshot]](https://example.com)
12 |
13 | This example will cover all you need to know about flutter image upload to REST API.
14 | This complete example will cover single image upload with data, multiple images upload with data and, dynamic numbers of images upload with data.
15 | For this example i used [Express-js-REST-API](https://github.com/Sameera-Perera/Express-Js-REST-API-Image-Uploade-Complete-Example).
16 |
17 | ### Built With
18 | Used below plugings for this project
19 |
20 | * get: ^4.3.8
21 | * dio: ^4.0.0
22 | * flutter_svg: ^0.22.0
23 | * image_picker: ^0.8.3+3
24 |
25 |
26 |
27 | ## Getting Started
28 |
29 | To get a local copy up and running follow these simple example steps.
30 |
31 | ### Installation
32 |
33 | 1. Clone the repo
34 | ```sh
35 | git clone https://github.com/Sameera-Perera/Flutter-image-upload-complete-example.git
36 | ```
37 | 2. Install packages
38 | ```sh
39 | flutter pub get
40 | ```
41 | 3. Run your API.(https://github.com/Sameera-Perera/Express-Js-REST-API-Image-Uploade-Complete-Example)
42 |
43 | 5. Change API base url `\lib\utilities\const.dart`
44 | ```sh
45 | const baseURL = 'http://192.168.1.4:3000/api';
46 | ```
47 |
48 |
49 |
50 | ## Usage
51 |
52 | Demo video flutter app - https://youtu.be/Zhd4uBEkXBk
53 |
54 | Demo video REST API - https://youtu.be/t6hiHIqSnQg
55 |
56 |
57 |
58 |
59 | ## License
60 |
61 | Distributed under the MIT License. See `LICENSE` for more information.
62 |
63 |
64 |
65 | ## Contact
66 |
67 | You Tube - [@programming_night](https://www.youtube.com/channel/UCKn8mSyZt_qwXK1Kzr6hA9w) - Programming Night
68 |
69 | Project Link: [https://github.com/Sameera-Perera/Flutter-image-upload-complete-example](https://github.com/Sameera-Perera/Flutter-image-upload-complete-example)
70 |
71 |
72 |
73 | [contributors-shield]: https://img.shields.io/github/contributors/Sameera-Perera/Flutter-image-upload-complete-example.svg?style=for-the-badge
74 | [contributors-url]: https://github.com/Sameera-Perera/Flutter-image-upload-complete-example/graphs/contributors
75 | [forks-shield]: https://img.shields.io/github/forks/Sameera-Perera/Flutter-image-upload-complete-example.svg?style=for-the-badge
76 | [forks-url]: https://github.com/Sameera-Perera/Flutter-image-upload-complete-example/network/members
77 | [stars-shield]: https://img.shields.io/github/stars/Sameera-Perera/Flutter-image-upload-complete-example.svg?style=for-the-badge
78 | [stars-url]: https://github.com/Sameera-Perera/Flutter-image-upload-complete-example/stargazers
79 | [issues-shield]: https://img.shields.io/github/issues/Sameera-Perera/Flutter-image-upload-complete-example.svg?style=for-the-badge
80 | [issues-url]: https://github.com/Sameera-Perera/Flutter-image-upload-complete-example/issues
81 |
82 | [linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
83 | [linkedin-url]: http://www.linkedin.com/in/sameera-perera-1148081b8
84 | [product-screenshot]: home.png
85 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion 30
30 |
31 | sourceSets {
32 | main.java.srcDirs += 'src/main/kotlin'
33 | }
34 |
35 | defaultConfig {
36 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
37 | applicationId "com.example.flutter_rest_api_image_upload.flutter_rest_api_image_upload"
38 | minSdkVersion 16
39 | targetSdkVersion 30
40 | versionCode flutterVersionCode.toInteger()
41 | versionName flutterVersionName
42 | }
43 |
44 | buildTypes {
45 | release {
46 | // TODO: Add your own signing config for the release build.
47 | // Signing with the debug keys for now, so `flutter run --release` works.
48 | signingConfig signingConfigs.debug
49 | }
50 | }
51 | }
52 |
53 | flutter {
54 | source '../..'
55 | }
56 |
57 | dependencies {
58 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
59 | }
60 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
13 |
17 |
21 |
26 |
30 |
31 |
32 |
33 |
34 |
35 |
37 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_rest_api_image_upload/flutter_rest_api_image_upload/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_rest_api_image_upload.flutter_rest_api_image_upload
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.3.50'
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:4.1.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | jcenter()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | project.evaluationDependsOn(':app')
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
7 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/assets/icons/Camera Icon.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/images/no image.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/assets/images/no image.jpeg
--------------------------------------------------------------------------------
/assets/images/no_user.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/assets/images/no_user.jpg
--------------------------------------------------------------------------------
/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/home.png
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.mode1v3
2 | *.mode2v3
3 | *.moved-aside
4 | *.pbxuser
5 | *.perspectivev3
6 | **/*sync/
7 | .sconsign.dblite
8 | .tags*
9 | **/.vagrant/
10 | **/DerivedData/
11 | Icon?
12 | **/Pods/
13 | **/.symlinks/
14 | profile
15 | xcuserdata
16 | **/.generated/
17 | Flutter/App.framework
18 | Flutter/Flutter.framework
19 | Flutter/Flutter.podspec
20 | Flutter/Generated.xcconfig
21 | Flutter/ephemeral/
22 | Flutter/app.flx
23 | Flutter/app.zip
24 | Flutter/flutter_assets/
25 | Flutter/flutter_export_environment.sh
26 | ServiceDefinitions.json
27 | Runner/GeneratedPluginRegistrant.*
28 |
29 | # Exceptions to above rules.
30 | !default.mode1v3
31 | !default.mode2v3
32 | !default.pbxuser
33 | !default.perspectivev3
34 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
16 | /* End PBXBuildFile section */
17 |
18 | /* Begin PBXCopyFilesBuildPhase section */
19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
20 | isa = PBXCopyFilesBuildPhase;
21 | buildActionMask = 2147483647;
22 | dstPath = "";
23 | dstSubfolderSpec = 10;
24 | files = (
25 | );
26 | name = "Embed Frameworks";
27 | runOnlyForDeploymentPostprocessing = 0;
28 | };
29 | /* End PBXCopyFilesBuildPhase section */
30 |
31 | /* Begin PBXFileReference section */
32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
45 | /* End PBXFileReference section */
46 |
47 | /* Begin PBXFrameworksBuildPhase section */
48 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
49 | isa = PBXFrameworksBuildPhase;
50 | buildActionMask = 2147483647;
51 | files = (
52 | );
53 | runOnlyForDeploymentPostprocessing = 0;
54 | };
55 | /* End PBXFrameworksBuildPhase section */
56 |
57 | /* Begin PBXGroup section */
58 | 9740EEB11CF90186004384FC /* Flutter */ = {
59 | isa = PBXGroup;
60 | children = (
61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
65 | );
66 | name = Flutter;
67 | sourceTree = "";
68 | };
69 | 97C146E51CF9000F007C117D = {
70 | isa = PBXGroup;
71 | children = (
72 | 9740EEB11CF90186004384FC /* Flutter */,
73 | 97C146F01CF9000F007C117D /* Runner */,
74 | 97C146EF1CF9000F007C117D /* Products */,
75 | );
76 | sourceTree = "";
77 | };
78 | 97C146EF1CF9000F007C117D /* Products */ = {
79 | isa = PBXGroup;
80 | children = (
81 | 97C146EE1CF9000F007C117D /* Runner.app */,
82 | );
83 | name = Products;
84 | sourceTree = "";
85 | };
86 | 97C146F01CF9000F007C117D /* Runner */ = {
87 | isa = PBXGroup;
88 | children = (
89 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
92 | 97C147021CF9000F007C117D /* Info.plist */,
93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
97 | );
98 | path = Runner;
99 | sourceTree = "";
100 | };
101 | /* End PBXGroup section */
102 |
103 | /* Begin PBXNativeTarget section */
104 | 97C146ED1CF9000F007C117D /* Runner */ = {
105 | isa = PBXNativeTarget;
106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
107 | buildPhases = (
108 | 9740EEB61CF901F6004384FC /* Run Script */,
109 | 97C146EA1CF9000F007C117D /* Sources */,
110 | 97C146EB1CF9000F007C117D /* Frameworks */,
111 | 97C146EC1CF9000F007C117D /* Resources */,
112 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
114 | );
115 | buildRules = (
116 | );
117 | dependencies = (
118 | );
119 | name = Runner;
120 | productName = Runner;
121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
122 | productType = "com.apple.product-type.application";
123 | };
124 | /* End PBXNativeTarget section */
125 |
126 | /* Begin PBXProject section */
127 | 97C146E61CF9000F007C117D /* Project object */ = {
128 | isa = PBXProject;
129 | attributes = {
130 | LastUpgradeCheck = 1020;
131 | ORGANIZATIONNAME = "";
132 | TargetAttributes = {
133 | 97C146ED1CF9000F007C117D = {
134 | CreatedOnToolsVersion = 7.3.1;
135 | LastSwiftMigration = 1100;
136 | };
137 | };
138 | };
139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
140 | compatibilityVersion = "Xcode 9.3";
141 | developmentRegion = en;
142 | hasScannedForEncodings = 0;
143 | knownRegions = (
144 | en,
145 | Base,
146 | );
147 | mainGroup = 97C146E51CF9000F007C117D;
148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
149 | projectDirPath = "";
150 | projectRoot = "";
151 | targets = (
152 | 97C146ED1CF9000F007C117D /* Runner */,
153 | );
154 | };
155 | /* End PBXProject section */
156 |
157 | /* Begin PBXResourcesBuildPhase section */
158 | 97C146EC1CF9000F007C117D /* Resources */ = {
159 | isa = PBXResourcesBuildPhase;
160 | buildActionMask = 2147483647;
161 | files = (
162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
166 | );
167 | runOnlyForDeploymentPostprocessing = 0;
168 | };
169 | /* End PBXResourcesBuildPhase section */
170 |
171 | /* Begin PBXShellScriptBuildPhase section */
172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
173 | isa = PBXShellScriptBuildPhase;
174 | buildActionMask = 2147483647;
175 | files = (
176 | );
177 | inputPaths = (
178 | );
179 | name = "Thin Binary";
180 | outputPaths = (
181 | );
182 | runOnlyForDeploymentPostprocessing = 0;
183 | shellPath = /bin/sh;
184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
185 | };
186 | 9740EEB61CF901F6004384FC /* Run Script */ = {
187 | isa = PBXShellScriptBuildPhase;
188 | buildActionMask = 2147483647;
189 | files = (
190 | );
191 | inputPaths = (
192 | );
193 | name = "Run Script";
194 | outputPaths = (
195 | );
196 | runOnlyForDeploymentPostprocessing = 0;
197 | shellPath = /bin/sh;
198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
199 | };
200 | /* End PBXShellScriptBuildPhase section */
201 |
202 | /* Begin PBXSourcesBuildPhase section */
203 | 97C146EA1CF9000F007C117D /* Sources */ = {
204 | isa = PBXSourcesBuildPhase;
205 | buildActionMask = 2147483647;
206 | files = (
207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
209 | );
210 | runOnlyForDeploymentPostprocessing = 0;
211 | };
212 | /* End PBXSourcesBuildPhase section */
213 |
214 | /* Begin PBXVariantGroup section */
215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
216 | isa = PBXVariantGroup;
217 | children = (
218 | 97C146FB1CF9000F007C117D /* Base */,
219 | );
220 | name = Main.storyboard;
221 | sourceTree = "";
222 | };
223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
224 | isa = PBXVariantGroup;
225 | children = (
226 | 97C147001CF9000F007C117D /* Base */,
227 | );
228 | name = LaunchScreen.storyboard;
229 | sourceTree = "";
230 | };
231 | /* End PBXVariantGroup section */
232 |
233 | /* Begin XCBuildConfiguration section */
234 | 249021D3217E4FDB00AE95B9 /* Profile */ = {
235 | isa = XCBuildConfiguration;
236 | buildSettings = {
237 | ALWAYS_SEARCH_USER_PATHS = NO;
238 | CLANG_ANALYZER_NONNULL = YES;
239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
240 | CLANG_CXX_LIBRARY = "libc++";
241 | CLANG_ENABLE_MODULES = YES;
242 | CLANG_ENABLE_OBJC_ARC = YES;
243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
244 | CLANG_WARN_BOOL_CONVERSION = YES;
245 | CLANG_WARN_COMMA = YES;
246 | CLANG_WARN_CONSTANT_CONVERSION = YES;
247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
249 | CLANG_WARN_EMPTY_BODY = YES;
250 | CLANG_WARN_ENUM_CONVERSION = YES;
251 | CLANG_WARN_INFINITE_RECURSION = YES;
252 | CLANG_WARN_INT_CONVERSION = YES;
253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
258 | CLANG_WARN_STRICT_PROTOTYPES = YES;
259 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
260 | CLANG_WARN_UNREACHABLE_CODE = YES;
261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
263 | COPY_PHASE_STRIP = NO;
264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
265 | ENABLE_NS_ASSERTIONS = NO;
266 | ENABLE_STRICT_OBJC_MSGSEND = YES;
267 | GCC_C_LANGUAGE_STANDARD = gnu99;
268 | GCC_NO_COMMON_BLOCKS = YES;
269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
271 | GCC_WARN_UNDECLARED_SELECTOR = YES;
272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
273 | GCC_WARN_UNUSED_FUNCTION = YES;
274 | GCC_WARN_UNUSED_VARIABLE = YES;
275 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
276 | MTL_ENABLE_DEBUG_INFO = NO;
277 | SDKROOT = iphoneos;
278 | SUPPORTED_PLATFORMS = iphoneos;
279 | TARGETED_DEVICE_FAMILY = "1,2";
280 | VALIDATE_PRODUCT = YES;
281 | };
282 | name = Profile;
283 | };
284 | 249021D4217E4FDB00AE95B9 /* Profile */ = {
285 | isa = XCBuildConfiguration;
286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
287 | buildSettings = {
288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
289 | CLANG_ENABLE_MODULES = YES;
290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
291 | ENABLE_BITCODE = NO;
292 | INFOPLIST_FILE = Runner/Info.plist;
293 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
294 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterrestapiimageupload.flutterRestApiImageUpload;
295 | PRODUCT_NAME = "$(TARGET_NAME)";
296 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
297 | SWIFT_VERSION = 5.0;
298 | VERSIONING_SYSTEM = "apple-generic";
299 | };
300 | name = Profile;
301 | };
302 | 97C147031CF9000F007C117D /* Debug */ = {
303 | isa = XCBuildConfiguration;
304 | buildSettings = {
305 | ALWAYS_SEARCH_USER_PATHS = NO;
306 | CLANG_ANALYZER_NONNULL = YES;
307 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
308 | CLANG_CXX_LIBRARY = "libc++";
309 | CLANG_ENABLE_MODULES = YES;
310 | CLANG_ENABLE_OBJC_ARC = YES;
311 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
312 | CLANG_WARN_BOOL_CONVERSION = YES;
313 | CLANG_WARN_COMMA = YES;
314 | CLANG_WARN_CONSTANT_CONVERSION = YES;
315 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
316 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
317 | CLANG_WARN_EMPTY_BODY = YES;
318 | CLANG_WARN_ENUM_CONVERSION = YES;
319 | CLANG_WARN_INFINITE_RECURSION = YES;
320 | CLANG_WARN_INT_CONVERSION = YES;
321 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
322 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
323 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
324 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
325 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
326 | CLANG_WARN_STRICT_PROTOTYPES = YES;
327 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
328 | CLANG_WARN_UNREACHABLE_CODE = YES;
329 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
330 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
331 | COPY_PHASE_STRIP = NO;
332 | DEBUG_INFORMATION_FORMAT = dwarf;
333 | ENABLE_STRICT_OBJC_MSGSEND = YES;
334 | ENABLE_TESTABILITY = YES;
335 | GCC_C_LANGUAGE_STANDARD = gnu99;
336 | GCC_DYNAMIC_NO_PIC = NO;
337 | GCC_NO_COMMON_BLOCKS = YES;
338 | GCC_OPTIMIZATION_LEVEL = 0;
339 | GCC_PREPROCESSOR_DEFINITIONS = (
340 | "DEBUG=1",
341 | "$(inherited)",
342 | );
343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
345 | GCC_WARN_UNDECLARED_SELECTOR = YES;
346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
347 | GCC_WARN_UNUSED_FUNCTION = YES;
348 | GCC_WARN_UNUSED_VARIABLE = YES;
349 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
350 | MTL_ENABLE_DEBUG_INFO = YES;
351 | ONLY_ACTIVE_ARCH = YES;
352 | SDKROOT = iphoneos;
353 | TARGETED_DEVICE_FAMILY = "1,2";
354 | };
355 | name = Debug;
356 | };
357 | 97C147041CF9000F007C117D /* Release */ = {
358 | isa = XCBuildConfiguration;
359 | buildSettings = {
360 | ALWAYS_SEARCH_USER_PATHS = NO;
361 | CLANG_ANALYZER_NONNULL = YES;
362 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
363 | CLANG_CXX_LIBRARY = "libc++";
364 | CLANG_ENABLE_MODULES = YES;
365 | CLANG_ENABLE_OBJC_ARC = YES;
366 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
367 | CLANG_WARN_BOOL_CONVERSION = YES;
368 | CLANG_WARN_COMMA = YES;
369 | CLANG_WARN_CONSTANT_CONVERSION = YES;
370 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
371 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
372 | CLANG_WARN_EMPTY_BODY = YES;
373 | CLANG_WARN_ENUM_CONVERSION = YES;
374 | CLANG_WARN_INFINITE_RECURSION = YES;
375 | CLANG_WARN_INT_CONVERSION = YES;
376 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
377 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
378 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
379 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
380 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
381 | CLANG_WARN_STRICT_PROTOTYPES = YES;
382 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
383 | CLANG_WARN_UNREACHABLE_CODE = YES;
384 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
385 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
386 | COPY_PHASE_STRIP = NO;
387 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
388 | ENABLE_NS_ASSERTIONS = NO;
389 | ENABLE_STRICT_OBJC_MSGSEND = YES;
390 | GCC_C_LANGUAGE_STANDARD = gnu99;
391 | GCC_NO_COMMON_BLOCKS = YES;
392 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
393 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
394 | GCC_WARN_UNDECLARED_SELECTOR = YES;
395 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
396 | GCC_WARN_UNUSED_FUNCTION = YES;
397 | GCC_WARN_UNUSED_VARIABLE = YES;
398 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
399 | MTL_ENABLE_DEBUG_INFO = NO;
400 | SDKROOT = iphoneos;
401 | SUPPORTED_PLATFORMS = iphoneos;
402 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
403 | TARGETED_DEVICE_FAMILY = "1,2";
404 | VALIDATE_PRODUCT = YES;
405 | };
406 | name = Release;
407 | };
408 | 97C147061CF9000F007C117D /* Debug */ = {
409 | isa = XCBuildConfiguration;
410 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
411 | buildSettings = {
412 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
413 | CLANG_ENABLE_MODULES = YES;
414 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
415 | ENABLE_BITCODE = NO;
416 | INFOPLIST_FILE = Runner/Info.plist;
417 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
418 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterrestapiimageupload.flutterRestApiImageUpload;
419 | PRODUCT_NAME = "$(TARGET_NAME)";
420 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
421 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
422 | SWIFT_VERSION = 5.0;
423 | VERSIONING_SYSTEM = "apple-generic";
424 | };
425 | name = Debug;
426 | };
427 | 97C147071CF9000F007C117D /* Release */ = {
428 | isa = XCBuildConfiguration;
429 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
430 | buildSettings = {
431 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
432 | CLANG_ENABLE_MODULES = YES;
433 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
434 | ENABLE_BITCODE = NO;
435 | INFOPLIST_FILE = Runner/Info.plist;
436 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
437 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterrestapiimageupload.flutterRestApiImageUpload;
438 | PRODUCT_NAME = "$(TARGET_NAME)";
439 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
440 | SWIFT_VERSION = 5.0;
441 | VERSIONING_SYSTEM = "apple-generic";
442 | };
443 | name = Release;
444 | };
445 | /* End XCBuildConfiguration section */
446 |
447 | /* Begin XCConfigurationList section */
448 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
449 | isa = XCConfigurationList;
450 | buildConfigurations = (
451 | 97C147031CF9000F007C117D /* Debug */,
452 | 97C147041CF9000F007C117D /* Release */,
453 | 249021D3217E4FDB00AE95B9 /* Profile */,
454 | );
455 | defaultConfigurationIsVisible = 0;
456 | defaultConfigurationName = Release;
457 | };
458 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
459 | isa = XCConfigurationList;
460 | buildConfigurations = (
461 | 97C147061CF9000F007C117D /* Debug */,
462 | 97C147071CF9000F007C117D /* Release */,
463 | 249021D4217E4FDB00AE95B9 /* Profile */,
464 | );
465 | defaultConfigurationIsVisible = 0;
466 | defaultConfigurationName = Release;
467 | };
468 | /* End XCConfigurationList section */
469 | };
470 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
471 | }
472 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sameera-Perera/Flutter-image-upload-complete-example/46663c86151df40d8161a2fba9e188b0463be3c6/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | 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.
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | flutter_rest_api_image_upload
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/lib/controllers/galleryController.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:dio/dio.dart' as Dio;
4 | import 'package:flutter/material.dart';
5 | import 'package:flutter_rest_api_image_upload/models/gallery.dart';
6 | import 'package:flutter_rest_api_image_upload/services/gallery_service.dart';
7 | import 'package:flutter_rest_api_image_upload/services/profile_service.dart';
8 | import 'package:get/get.dart';
9 | import 'package:image_picker/image_picker.dart';
10 |
11 | class GalleryController extends GetxController {
12 | TextEditingController name = new TextEditingController();
13 | List pickedFile = [];
14 | var isLoading = false.obs;
15 | final formKey = GlobalKey();
16 | List galleries = List.empty(growable: true).obs;
17 |
18 | void selectImage() async {
19 | try {
20 | pickedFile = (await ImagePicker().pickMultiImage())!;
21 | } finally {
22 | if (Get.isBottomSheetOpen ?? true) Get.back();
23 | update();
24 | }
25 | }
26 |
27 | void create() async {
28 | try {
29 | isLoading(true);
30 | if (formKey.currentState!.validate()) {
31 | var arr = [];
32 | for (var img in pickedFile) {
33 | arr.add(await Dio.MultipartFile.fromFile(img.path,
34 | filename: img.path.split('/').last));
35 | }
36 | Dio.FormData formData = new Dio.FormData.fromMap({
37 | "name": name.text,
38 | "images": arr
39 | });
40 |
41 | bool result = await GalleryServices.create(formData);
42 | if (result) clearController();
43 | }
44 | } catch (e) {} finally {
45 | isLoading(false);
46 | }
47 | }
48 |
49 | void fetch() async {
50 | try {
51 | isLoading(true);
52 | var _data = await GalleryServices.fetch();
53 | if (_data != null) {
54 | galleries.assignAll(galleryFromJson(jsonEncode(_data)));
55 | }
56 | } finally {
57 | isLoading(false);
58 | }
59 | }
60 |
61 | void clearController() {
62 | name.clear();
63 | pickedFile.clear();
64 | update();
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/lib/controllers/profileController.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:dio/dio.dart' as Dio;
4 | import 'package:flutter/material.dart';
5 | import 'package:flutter_rest_api_image_upload/models/profile.dart';
6 | import 'package:flutter_rest_api_image_upload/services/profile_service.dart';
7 | import 'package:get/get.dart';
8 | import 'package:image_picker/image_picker.dart';
9 |
10 | class ProfileController extends GetxController {
11 | TextEditingController firstName = new TextEditingController();
12 | TextEditingController lastName = new TextEditingController();
13 | TextEditingController address = new TextEditingController();
14 | TextEditingController contactNumber = new TextEditingController();
15 | XFile? pickedFile;
16 | var isLoading = false.obs;
17 | final formKey = GlobalKey();
18 | List profiles = List.empty(growable: true).obs;
19 |
20 | void selectImage(ImageSource imageSource) async {
21 | try {
22 | pickedFile = await ImagePicker().pickImage(source: imageSource);
23 | } finally {
24 | if (Get.isBottomSheetOpen ?? true) Get.back();
25 | update();
26 | }
27 | }
28 |
29 | void create() async {
30 | try {
31 | isLoading(true);
32 | if(formKey.currentState!.validate()){
33 | if (pickedFile != null) {
34 | Dio.FormData formData = new Dio.FormData.fromMap({
35 | "first_name": firstName.text,
36 | "last_name": lastName.text,
37 | "address": address.text,
38 | "contact_number": contactNumber.text,
39 | "profile_picture": await Dio.MultipartFile.fromFile(pickedFile!.path,
40 | filename: pickedFile!.path.split('/').last)
41 | });
42 |
43 | bool result = await ProfileServices.create(formData);
44 | if (result) clearController();
45 | } else {}
46 | }
47 | } catch (e) {} finally {
48 | isLoading(false);
49 | }
50 | }
51 |
52 | void fetch() async {
53 | try {
54 | isLoading(true);
55 | var _data = await ProfileServices.fetch();
56 | if(_data!=null){
57 | profiles.assignAll(profileFromJson(jsonEncode(_data)));
58 | }
59 | } finally {
60 | isLoading(false);
61 | }
62 | }
63 |
64 | void clearController() {
65 | firstName.clear();
66 | lastName.clear();
67 | address.clear();
68 | contactNumber.clear();
69 | pickedFile = null;
70 | update();
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/lib/controllers/vehicleController.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:dio/dio.dart' as Dio;
4 | import 'package:flutter/material.dart';
5 | import 'package:flutter_rest_api_image_upload/models/vehicle.dart';
6 | import 'package:flutter_rest_api_image_upload/services/profile_service.dart';
7 | import 'package:flutter_rest_api_image_upload/services/vehicle_service.dart';
8 | import 'package:get/get.dart';
9 | import 'package:image_picker/image_picker.dart';
10 |
11 | class VehicleController extends GetxController {
12 | TextEditingController name = new TextEditingController();
13 | TextEditingController year = new TextEditingController();
14 | XFile? pickedFile1;
15 | XFile? pickedFile2;
16 | var isLoading = false.obs;
17 | final formKey = GlobalKey();
18 | List vehicles = List.empty(growable: true).obs;
19 |
20 | void selectImage1(ImageSource imageSource) async {
21 | try {
22 | pickedFile1 = await ImagePicker().pickImage(source: imageSource);
23 | } finally {
24 | if (Get.isBottomSheetOpen ?? true) Get.back();
25 | update();
26 | }
27 | }
28 |
29 | void selectImage2(ImageSource imageSource) async {
30 | try {
31 | pickedFile2 = await ImagePicker().pickImage(source: imageSource);
32 | } finally {
33 | if (Get.isBottomSheetOpen ?? true) Get.back();
34 | update();
35 | }
36 | }
37 |
38 | void create() async {
39 | try {
40 | isLoading(true);
41 | if(formKey.currentState!.validate()){
42 | if (pickedFile1 != null) {
43 | Dio.FormData formData = new Dio.FormData.fromMap({
44 | "name": name.text,
45 | "year": year.text,
46 | "image_1": await Dio.MultipartFile.fromFile(pickedFile1!.path,
47 | filename: pickedFile1!.path.split('/').last),
48 | "image_2": await Dio.MultipartFile.fromFile(pickedFile2!.path,
49 | filename: pickedFile2!.path.split('/').last)
50 | });
51 |
52 | bool result = await VehicleServices.create(formData);
53 | if (result) clearController();
54 | } else {}
55 | }
56 | } catch (e) {} finally {
57 | isLoading(false);
58 | }
59 | }
60 |
61 | void fetch() async {
62 | try {
63 | isLoading(true);
64 | var _data = await VehicleServices.fetch();
65 | if(_data!=null){
66 | vehicles.assignAll(vehicleFromJson(jsonEncode(_data)));
67 | }
68 | } finally {
69 | isLoading(false);
70 | }
71 | }
72 |
73 | void clearController() {
74 | name.clear();
75 | year.clear();
76 | pickedFile1 = null;
77 | pickedFile2 = null;
78 | update();
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_rest_api_image_upload/views/home/home_screen.dart';
3 | import 'package:get/get.dart';
4 |
5 | void main() async {
6 | WidgetsFlutterBinding.ensureInitialized();
7 |
8 | runApp(MyApp());
9 | }
10 |
11 | class MyApp extends StatelessWidget {
12 | @override
13 | Widget build(BuildContext context) {
14 | return GetMaterialApp(
15 | debugShowCheckedModeBanner: false,
16 | home: HomeScreen(),
17 | themeMode: ThemeMode.system,
18 | );
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/lib/models/gallery.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | List galleryFromJson(String str) => List.from(json.decode(str).map((x) => Gallery.fromJson(x)));
4 |
5 | String galleryToJson(List data) => json.encode(List.from(data.map((x) => x.toJson())));
6 |
7 | class Gallery {
8 | Gallery({
9 | required this.id,
10 | required this.name,
11 | required this.images,
12 | });
13 |
14 | final int id;
15 | final String name;
16 | final List images;
17 |
18 | factory Gallery.fromJson(Map json) => Gallery(
19 | id: json["id"],
20 | name: json["name"],
21 | images: List.from(json["images"].map((x) => ImageData.fromJson(x))),
22 | );
23 |
24 | Map toJson() => {
25 | "id": id,
26 | "name": name,
27 | "images": List.from(images.map((x) => x.toJson())),
28 | };
29 | }
30 |
31 | class ImageData {
32 | ImageData({
33 | required this.id,
34 | required this.url,
35 | });
36 |
37 | final int id;
38 | final String url;
39 |
40 | factory ImageData.fromJson(Map json) => ImageData(
41 | id: json["id"],
42 | url: json["url"],
43 | );
44 |
45 | Map toJson() => {
46 | "id": id,
47 | "url": url,
48 | };
49 | }
50 |
--------------------------------------------------------------------------------
/lib/models/profile.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | List profileFromJson(String str) => List.from(json.decode(str).map((x) => Profile.fromJson(x)));
4 |
5 | String profileToJson(List data) => json.encode(List.from(data.map((x) => x.toJson())));
6 |
7 | class Profile {
8 | Profile({
9 | required this.id,
10 | required this.firstName,
11 | required this.lastName,
12 | required this.address,
13 | required this.contactNumber,
14 | required this.profilePicture,
15 | });
16 |
17 | final int id;
18 | final String firstName;
19 | final String lastName;
20 | final String address;
21 | final String contactNumber;
22 | final String profilePicture;
23 |
24 | factory Profile.fromJson(Map json) => Profile(
25 | id: json["id"],
26 | firstName: json["first_name"],
27 | lastName: json["last_name"],
28 | address: json["address"],
29 | contactNumber: json["contact_number"],
30 | profilePicture: json["profile_picture"],
31 | );
32 |
33 | Map toJson() => {
34 | "id": id,
35 | "first_name": firstName,
36 | "last_name": lastName,
37 | "address": address,
38 | "contact_number": contactNumber,
39 | "profile_picture": profilePicture,
40 | };
41 | }
42 |
--------------------------------------------------------------------------------
/lib/models/vehicle.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | List vehicleFromJson(String str) => List.from(json.decode(str).map((x) => Vehicle.fromJson(x)));
4 |
5 | String vehicleToJson(List data) => json.encode(List.from(data.map((x) => x.toJson())));
6 |
7 | class Vehicle {
8 | Vehicle({
9 | required this.id,
10 | required this.name,
11 | required this.year,
12 | required this.image1,
13 | required this.image2,
14 | });
15 |
16 | final int id;
17 | final String name;
18 | final String year;
19 | final String image1;
20 | final String image2;
21 |
22 | factory Vehicle.fromJson(Map json) => Vehicle(
23 | id: json["id"],
24 | name: json["name"],
25 | year: json["year"],
26 | image1: json["image_1"],
27 | image2: json["image_2"],
28 | );
29 |
30 | Map toJson() => {
31 | "id": id,
32 | "name": name,
33 | "year": year,
34 | "image_1": image1,
35 | "image_2": image2,
36 | };
37 | }
38 |
--------------------------------------------------------------------------------
/lib/services/gallery_service.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:dio/dio.dart';
4 | import 'package:flutter/cupertino.dart';
5 | import 'package:flutter/material.dart';
6 | import 'package:flutter_rest_api_image_upload/utilities/const.dart';
7 | import 'package:get/get.dart' as GetX;
8 |
9 | class GalleryServices {
10 | static Future create(FormData data) async {
11 | try {
12 | Response response =
13 | await Dio().post(
14 | "$baseURL/galleries",
15 | data: data,
16 | );
17 | if(response.statusCode==201){
18 | GetX.Get.snackbar('Successfully','New Profile Added',
19 | backgroundColor: Colors.white,
20 | duration: Duration(seconds: 4),
21 | animationDuration: Duration(milliseconds: 900),
22 | margin: EdgeInsets.only(top: 5, left: 10, right: 10)
23 | );
24 | return true;
25 | }
26 | return false;
27 | } catch(e){
28 | return false;
29 | }
30 | }
31 |
32 | static Future fetch() async {
33 | try{
34 | var response = await Dio().get(
35 | "$baseURL/galleries"
36 | ).timeout(Duration(seconds: 10));
37 | if(response.statusCode == 200) {
38 | return response.data;
39 | }
40 | else{
41 | // AppSnack.showSnack('Login fail','Invalid pin');
42 | return null;
43 | }
44 | } catch(e){
45 | return null;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/lib/services/profile_service.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:dio/dio.dart';
4 | import 'package:flutter/cupertino.dart';
5 | import 'package:flutter/material.dart';
6 | import 'package:flutter_rest_api_image_upload/utilities/const.dart';
7 | import 'package:get/get.dart' as GetX;
8 |
9 | class ProfileServices {
10 | static Future create(FormData data) async {
11 | try {
12 | Response response =
13 | await Dio().post(
14 | "$baseURL/profiles",
15 | data: data,
16 | );
17 | if(response.statusCode==201){
18 | GetX.Get.snackbar('Successfully','New Profile Added',
19 | backgroundColor: Colors.white,
20 | duration: Duration(seconds: 4),
21 | animationDuration: Duration(milliseconds: 900),
22 | margin: EdgeInsets.only(top: 5, left: 10, right: 10)
23 | );
24 | return true;
25 | }
26 | return false;
27 | } catch(e){
28 | return false;
29 | }
30 | }
31 |
32 | static Future fetch() async {
33 | try{
34 | var response = await Dio().get(
35 | "$baseURL/profiles"
36 | ).timeout(Duration(seconds: 10));
37 | if(response.statusCode == 200) {
38 | return response.data;
39 | }
40 | else{
41 | // AppSnack.showSnack('Login fail','Invalid pin');
42 | return null;
43 | }
44 | } catch(e){
45 | return null;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/lib/services/vehicle_service.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:dio/dio.dart';
4 | import 'package:flutter/cupertino.dart';
5 | import 'package:flutter/material.dart';
6 | import 'package:flutter_rest_api_image_upload/utilities/const.dart';
7 | import 'package:get/get.dart' as GetX;
8 |
9 | class VehicleServices {
10 | static Future create(FormData data) async {
11 | try {
12 | Response response =
13 | await Dio().post(
14 | "$baseURL/vehicles",
15 | data: data,
16 | );
17 | if(response.statusCode==201){
18 | GetX.Get.snackbar('Successfully','New Profile Added',
19 | backgroundColor: Colors.white,
20 | duration: Duration(seconds: 4),
21 | animationDuration: Duration(milliseconds: 900),
22 | margin: EdgeInsets.only(top: 5, left: 10, right: 10)
23 | );
24 | return true;
25 | }
26 | return false;
27 | } catch(e){
28 | return false;
29 | }
30 | }
31 |
32 | static Future fetch() async {
33 | try{
34 | var response = await Dio().get(
35 | "$baseURL/vehicles"
36 | ).timeout(Duration(seconds: 10));
37 | if(response.statusCode == 200) {
38 | return response.data;
39 | }
40 | else{
41 | // AppSnack.showSnack('Login fail','Invalid pin');
42 | return null;
43 | }
44 | } catch(e){
45 | return null;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/lib/utilities/const.dart:
--------------------------------------------------------------------------------
1 | const baseURL = 'http://192.168.1.4:3000/api';
--------------------------------------------------------------------------------
/lib/views/gallery/add_gallery_screen.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_rest_api_image_upload/controllers/galleryController.dart';
5 | import 'package:flutter_rest_api_image_upload/widgets/loading_button.dart';
6 | import 'package:get/get.dart';
7 |
8 | class AddGalleryScreen extends StatefulWidget {
9 | @override
10 | _AddGalleryScreenState createState() => _AddGalleryScreenState();
11 | }
12 |
13 | class _AddGalleryScreenState extends State {
14 | ScrollController _scrollController = new ScrollController();
15 | final galleryController = Get.put(GalleryController());
16 |
17 | @override
18 | void initState() {
19 | // TODO: implement initState
20 | galleryController.clearController();
21 | super.initState();
22 | }
23 |
24 | @override
25 | Widget build(BuildContext context) {
26 | final node = FocusScope.of(context);
27 | return Scaffold(
28 | appBar: AppBar(
29 | title: Text('Add Gallery'),
30 | ),
31 | body: Container(
32 | child: SingleChildScrollView(
33 | controller: _scrollController,
34 | padding: EdgeInsets.symmetric(vertical: 20, horizontal: 20),
35 | child: Form(
36 | key: galleryController.formKey,
37 | autovalidateMode: AutovalidateMode.disabled,
38 | child: Column(
39 | crossAxisAlignment: CrossAxisAlignment.start,
40 | children: [
41 | // GetBuilder(
42 | // builder: (_c) => Container(
43 | // decoration: BoxDecoration(
44 | // boxShadow: [
45 | // BoxShadow(
46 | // color: Colors.grey.withOpacity(0.3),
47 | // blurRadius: 40,
48 | // ),
49 | // ],
50 | // ),
51 | // child: SizedBox(
52 | // height: 115,
53 | // width: 115,
54 | // child: Stack(
55 | // clipBehavior: Clip.none, fit: StackFit.expand,
56 | // children: [
57 | // CircleAvatar(
58 | // backgroundImage: profileController.pickedFile!=null
59 | // ? FileImage(
60 | // File(profileController.pickedFile!.path),
61 | // // height: 300.0,
62 | // // fit: BoxFit.scaleDown,
63 | // )
64 | // : AssetImage('assets/images/no_user.jpg') as ImageProvider,
65 | // ),
66 | // Positioned(
67 | // right: -16,
68 | // bottom: 0,
69 | // child: SizedBox(
70 | // height: 46,
71 | // width: 46,
72 | // child: FlatButton(
73 | // shape: RoundedRectangleBorder(
74 | // borderRadius: BorderRadius.circular(50),
75 | // side: BorderSide(color: Colors.white),
76 | // ),
77 | // color: Colors.grey[200],
78 | // onPressed: () {
79 | // Get.bottomSheet(
80 | // Container(
81 | // decoration: BoxDecoration(
82 | // color: Colors.white,
83 | // borderRadius: const BorderRadius.only(
84 | // topLeft: Radius.circular(16.0),
85 | // topRight: Radius.circular(16.0)),
86 | // ),
87 | // child: Wrap(
88 | // alignment: WrapAlignment.end,
89 | // crossAxisAlignment: WrapCrossAlignment.end,
90 | // children: [
91 | // ListTile(
92 | // leading: Icon(Icons.camera),
93 | // title: Text('Camera'),
94 | // onTap: () {
95 | // profileController.selectImage(ImageSource.camera);
96 | // },
97 | // ),
98 | // ListTile(
99 | // leading: Icon(Icons.image),
100 | // title: Text('Gallery'),
101 | // onTap: () {
102 | // profileController.selectImage(ImageSource.gallery);
103 | // },
104 | // ),
105 | // ],
106 | // ),
107 | // ),
108 | // );
109 | // },
110 | // child: SvgPicture.asset("assets/icons/Camera Icon.svg"),
111 | // ),
112 | // ),
113 | // )
114 | // ],
115 | // ),
116 | // ),
117 | // ),
118 | // ),
119 | // SizedBox(height: 40),
120 | TextFormField(
121 | keyboardType: TextInputType.name,
122 | controller: galleryController.name,
123 | onEditingComplete: () => node.nextFocus(),
124 | validator: (String? value) {
125 | if (value!.isEmpty) {
126 | return 'Enter your last name';
127 | }
128 | return null;
129 | },
130 | decoration: InputDecoration(
131 | labelText: "Name",
132 | ),
133 | ),
134 | SizedBox(height: 10),
135 | InkWell(
136 | onTap: () {
137 | galleryController.selectImage();
138 | },
139 | child: Ink(
140 | decoration: BoxDecoration(
141 | color: Colors.grey,
142 | borderRadius: BorderRadius.circular(8),
143 | ),
144 | height: 40,
145 | width: 125,
146 | child: Center(
147 | child: Text(
148 | 'Add Image',
149 | style: TextStyle(
150 | color: Colors.white,
151 | fontSize: 18,
152 | fontWeight: FontWeight.w500,
153 | ),
154 | ),
155 | ),
156 | ),
157 | ),
158 | SizedBox(height: 10),
159 | GetBuilder(
160 | builder: (_c) => GridView.builder(
161 | controller: _scrollController,
162 | shrinkWrap: true,
163 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
164 | crossAxisCount: 3,
165 | crossAxisSpacing: 10,
166 | mainAxisSpacing: 10),
167 | itemCount: galleryController.pickedFile.length,
168 | itemBuilder: (BuildContext ctx, index) {
169 | return Image(
170 | image: FileImage(
171 | File(galleryController.pickedFile[index].path),
172 | ),
173 | fit: BoxFit.cover,
174 | );
175 | }),
176 | ),
177 | SizedBox(height: 40),
178 | Obx(() {
179 | if (galleryController.isLoading.value)
180 | return LoadingButton(
181 | onClick: () async {},
182 | color: Colors.blue,
183 | childWidget: Center(
184 | child: CircularProgressIndicator(
185 | backgroundColor: Colors.white,
186 | ),
187 | ),
188 | );
189 | else
190 | return LoadingButton(
191 | onClick: () async {
192 | galleryController.create();
193 | },
194 | color: Colors.blue,
195 | childWidget: Center(
196 | child: Row(
197 | mainAxisAlignment:
198 | MainAxisAlignment.center,
199 | children: [
200 | Text(
201 | 'Continue',
202 | style: TextStyle(
203 | color: Colors.white,
204 | fontSize: 18,
205 | fontWeight: FontWeight.w500,
206 | ),
207 | ),
208 | ],
209 | )
210 | ),
211 | );
212 | }),
213 | SizedBox(height: 10),
214 | ],
215 | ),
216 | ),
217 | ),
218 | ),
219 | );
220 | }
221 | }
222 |
--------------------------------------------------------------------------------
/lib/views/gallery/view_gallery_screen.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_rest_api_image_upload/controllers/galleryController.dart';
3 | import 'package:flutter_rest_api_image_upload/models/gallery.dart';
4 | import 'package:get/get.dart';
5 |
6 | class ViewGalleryScreen extends StatefulWidget {
7 | @override
8 | _ViewGalleryScreenState createState() => _ViewGalleryScreenState();
9 | }
10 |
11 | class _ViewGalleryScreenState extends State {
12 | final galleryController = Get.put(GalleryController());
13 |
14 | @override
15 | void initState() {
16 | // TODO: implement initState
17 | super.initState();
18 | WidgetsBinding.instance!.addPostFrameCallback((_) {
19 | galleryController.fetch();
20 | });
21 | }
22 |
23 | @override
24 | Widget build(BuildContext context) {
25 | return Scaffold(
26 | body: Container(
27 | child: Obx((){
28 | if(!galleryController.isLoading.value)
29 | return ListView.builder(
30 | shrinkWrap: true,
31 | itemCount: galleryController.galleries.length,
32 | scrollDirection: Axis.vertical,
33 | itemBuilder: (BuildContext context, int index) {
34 | return GalleryCard(gallery: galleryController.galleries[index]);
35 | },
36 | );
37 | else
38 | return Container(
39 | child: Center(
40 | child: CircularProgressIndicator(
41 | color: Colors.blueAccent,
42 | ),
43 | ),
44 | );
45 | }),
46 | ),
47 | );
48 | }
49 | }
50 |
51 | class GalleryCard extends StatelessWidget {
52 | final Gallery gallery;
53 | const GalleryCard({required this.gallery});
54 | @override
55 | Widget build(BuildContext context) {
56 | return Container(
57 | margin: EdgeInsets.symmetric(horizontal: 20,vertical: 10),
58 | padding: EdgeInsets.all(20),
59 | decoration: BoxDecoration(
60 | color: Colors.white,
61 | borderRadius: BorderRadius.all(Radius.circular(8)),
62 | boxShadow: [
63 | BoxShadow(
64 | color: Colors.grey.withOpacity(0.2),
65 | offset: Offset(1.1, 1.1),
66 | blurRadius: 10.0),
67 | ],
68 | ),
69 | child: Column(
70 | crossAxisAlignment: CrossAxisAlignment.start,
71 | mainAxisAlignment: MainAxisAlignment.spaceAround,
72 | children: [
73 | Column(
74 | mainAxisAlignment: MainAxisAlignment.start,
75 | crossAxisAlignment: CrossAxisAlignment.start,
76 | children: [
77 | Text(
78 | 'Name',
79 | textAlign: TextAlign.center,
80 | style: TextStyle(
81 | // fontFamily: AppTheme.fontName,
82 | fontWeight: FontWeight.w500,
83 | fontSize: 16,
84 | letterSpacing: -0.1,
85 | color: Colors.black87),
86 | ),
87 | Text(
88 | '${gallery.name}',
89 | textAlign: TextAlign.center,
90 | style: TextStyle(
91 | fontWeight: FontWeight.w600,
92 | fontSize: 28,
93 | color: Colors.black,
94 | ),
95 | ),
96 | GridView.builder(
97 | shrinkWrap: true,
98 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
99 | crossAxisCount: 3,
100 | crossAxisSpacing: 10,
101 | mainAxisSpacing: 10),
102 | itemCount: gallery.images.length,
103 | itemBuilder: (BuildContext ctx, index) {
104 | return Image(
105 | image: NetworkImage(
106 | gallery.images[index].url,
107 | ),
108 | fit: BoxFit.cover,
109 | );
110 | })
111 | ],
112 | ),
113 | ],
114 | ),
115 | );
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/lib/views/home/home_screen.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_rest_api_image_upload/views/gallery/add_gallery_screen.dart';
3 | import 'package:flutter_rest_api_image_upload/views/gallery/view_gallery_screen.dart';
4 | import 'package:flutter_rest_api_image_upload/views/profile/add_profile_screen.dart';
5 | import 'package:flutter_rest_api_image_upload/views/profile/view_profile_screen.dart';
6 | import 'package:flutter_rest_api_image_upload/views/vehicle/add_vehicle_screen.dart';
7 | import 'package:flutter_rest_api_image_upload/views/vehicle/view_vehicle_screem.dart';
8 | import 'package:flutter_rest_api_image_upload/widgets/loading_button.dart';
9 | import 'package:get/get.dart';
10 |
11 | class HomeScreen extends StatelessWidget {
12 | const HomeScreen({Key? key}) : super(key: key);
13 |
14 | @override
15 | Widget build(BuildContext context) {
16 | return Scaffold(
17 | body: Container(
18 | child: Padding(
19 | padding: EdgeInsets.symmetric(horizontal: 20, vertical: 50),
20 | child: Column(
21 | mainAxisAlignment: MainAxisAlignment.center,
22 | children: [
23 | Text("Single Image & Data"),
24 | SizedBox(height: 5,),
25 | LoadingButton(
26 | onClick: () async {
27 | Get.to(()=>AddProfileScreen());
28 | },
29 | color: Colors.amber,
30 | childWidget: Center(
31 | child: Padding(
32 | padding: EdgeInsets.only(left: 16.0, right: 16.0),
33 | child: Row(
34 | mainAxisAlignment:
35 | MainAxisAlignment.center,
36 | children: [
37 | Text(
38 | 'Add Profile',
39 | style: TextStyle(
40 | color: Colors.white,
41 | fontSize: 18,
42 | fontWeight: FontWeight.w500,
43 | ),
44 | ),
45 | ],
46 | ),
47 | )
48 | ),
49 | ),
50 | SizedBox(
51 | height: 10,
52 | ),
53 | LoadingButton(
54 | onClick: () async {
55 | Get.to(()=>ViewProfileScreen());
56 | },
57 | color: Colors.amber,
58 | childWidget: Center(
59 | child: Padding(
60 | padding: EdgeInsets.only(left: 16.0, right: 16.0),
61 | child: Row(
62 | mainAxisAlignment:
63 | MainAxisAlignment.center,
64 | children: [
65 | Text(
66 | 'View Profile',
67 | style: TextStyle(
68 | color: Colors.white,
69 | fontSize: 18,
70 | fontWeight: FontWeight.w500,
71 | ),
72 | ),
73 | ],
74 | ),
75 | )
76 | ),
77 | ),
78 | SizedBox(
79 | height: 25,
80 | ),
81 | Text("Multiple Image & Data"),
82 | SizedBox(height: 5,),
83 | LoadingButton(
84 | onClick: () async {
85 | Get.to(()=>AddVehicleScreen());
86 | },
87 | color: Colors.lightGreen,
88 | childWidget: Center(
89 | child: Padding(
90 | padding: EdgeInsets.only(left: 16.0, right: 16.0),
91 | child: Row(
92 | mainAxisAlignment:
93 | MainAxisAlignment.center,
94 | children: [
95 | Text(
96 | 'Add Vehicle',
97 | style: TextStyle(
98 | color: Colors.white,
99 | fontSize: 18,
100 | fontWeight: FontWeight.w500,
101 | ),
102 | ),
103 | ],
104 | ),
105 | )
106 | ),
107 | ),
108 | SizedBox(
109 | height: 10,
110 | ),
111 | LoadingButton(
112 | onClick: () async {
113 | Get.to(()=>ViewVehicleScreen());
114 | },
115 | color: Colors.lightGreen,
116 | childWidget: Center(
117 | child: Padding(
118 | padding: EdgeInsets.only(left: 16.0, right: 16.0),
119 | child: Row(
120 | mainAxisAlignment:
121 | MainAxisAlignment.center,
122 | children: [
123 | Text(
124 | 'View Vehicle',
125 | style: TextStyle(
126 | color: Colors.white,
127 | fontSize: 18,
128 | fontWeight: FontWeight.w500,
129 | ),
130 | ),
131 | ],
132 | ),
133 | )
134 | ),
135 | ),
136 | SizedBox(
137 | height: 25,
138 | ),
139 | Text("Dynamic Number Of Image & Data"),
140 | SizedBox(height: 5,),
141 | LoadingButton(
142 | onClick: () async {
143 | Get.to(()=>AddGalleryScreen());
144 | },
145 | color: Colors.lightBlue,
146 | childWidget: Center(
147 | child: Padding(
148 | padding: EdgeInsets.only(left: 16.0, right: 16.0),
149 | child: Row(
150 | mainAxisAlignment:
151 | MainAxisAlignment.center,
152 | children: [
153 | Text(
154 | 'Add Gallery',
155 | style: TextStyle(
156 | color: Colors.white,
157 | fontSize: 18,
158 | fontWeight: FontWeight.w500,
159 | ),
160 | ),
161 | ],
162 | ),
163 | )
164 | ),
165 | ),
166 | SizedBox(
167 | height: 10,
168 | ),
169 | LoadingButton(
170 | onClick: () async {
171 | Get.to(ViewGalleryScreen());
172 | },
173 | color: Colors.lightBlue,
174 | childWidget: Center(
175 | child: Padding(
176 | padding: EdgeInsets.only(left: 16.0, right: 16.0),
177 | child: Row(
178 | mainAxisAlignment:
179 | MainAxisAlignment.center,
180 | children: [
181 | Text(
182 | 'View Gallery',
183 | style: TextStyle(
184 | color: Colors.white,
185 | fontSize: 18,
186 | fontWeight: FontWeight.w500,
187 | ),
188 | ),
189 | ],
190 | ),
191 | )
192 | ),
193 | ),
194 | ],
195 | ),
196 | ),
197 | ),
198 | );
199 | }
200 | }
201 |
--------------------------------------------------------------------------------
/lib/views/profile/add_profile_screen.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:flutter/cupertino.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:flutter_rest_api_image_upload/controllers/profileController.dart';
6 | import 'package:flutter_rest_api_image_upload/widgets/loading_button.dart';
7 | import 'package:flutter_svg/svg.dart';
8 | import 'package:get/get.dart';
9 | import 'package:image_picker/image_picker.dart';
10 |
11 | class AddProfileScreen extends StatefulWidget {
12 | @override
13 | _AddProfileScreenState createState() => _AddProfileScreenState();
14 | }
15 |
16 | class _AddProfileScreenState extends State {
17 | final profileController = Get.put(ProfileController());
18 |
19 | @override
20 | void initState() {
21 | // TODO: implement initState
22 | profileController.clearController();
23 | super.initState();
24 | }
25 |
26 | @override
27 | Widget build(BuildContext context) {
28 | final node = FocusScope.of(context);
29 | return Scaffold(
30 | appBar: AppBar(
31 | title: Text(
32 | 'Add Profile'
33 | ),
34 | ),
35 | body: Container(
36 | child: Center(
37 | child: SingleChildScrollView(
38 | padding: EdgeInsets.symmetric(vertical: 20, horizontal: 20),
39 | child: Form(
40 | key: profileController.formKey,
41 | autovalidateMode: AutovalidateMode.disabled,
42 | child: Column(
43 | children: [
44 | GetBuilder(
45 | builder: (_c) => Container(
46 | decoration: BoxDecoration(
47 | boxShadow: [
48 | BoxShadow(
49 | color: Colors.grey.withOpacity(0.3),
50 | blurRadius: 40,
51 | ),
52 | ],
53 | ),
54 | child: SizedBox(
55 | height: 115,
56 | width: 115,
57 | child: Stack(
58 | clipBehavior: Clip.none, fit: StackFit.expand,
59 | children: [
60 | CircleAvatar(
61 | backgroundImage: profileController.pickedFile!=null
62 | ? FileImage(
63 | File(profileController.pickedFile!.path),
64 | // height: 300.0,
65 | // fit: BoxFit.scaleDown,
66 | )
67 | : AssetImage('assets/images/no_user.jpg') as ImageProvider,
68 | ),
69 | Positioned(
70 | right: -16,
71 | bottom: 0,
72 | child: SizedBox(
73 | height: 46,
74 | width: 46,
75 | child: FlatButton(
76 | shape: RoundedRectangleBorder(
77 | borderRadius: BorderRadius.circular(50),
78 | side: BorderSide(color: Colors.white),
79 | ),
80 | color: Colors.grey[200],
81 | onPressed: () {
82 | Get.bottomSheet(
83 | Container(
84 | decoration: BoxDecoration(
85 | color: Colors.white,
86 | borderRadius: const BorderRadius.only(
87 | topLeft: Radius.circular(16.0),
88 | topRight: Radius.circular(16.0)),
89 | ),
90 | child: Wrap(
91 | alignment: WrapAlignment.end,
92 | crossAxisAlignment: WrapCrossAlignment.end,
93 | children: [
94 | ListTile(
95 | leading: Icon(Icons.camera),
96 | title: Text('Camera'),
97 | onTap: () {
98 | profileController.selectImage(ImageSource.camera);
99 | },
100 | ),
101 | ListTile(
102 | leading: Icon(Icons.image),
103 | title: Text('Gallery'),
104 | onTap: () {
105 | profileController.selectImage(ImageSource.gallery);
106 | },
107 | ),
108 | ],
109 | ),
110 | ),
111 | );
112 | },
113 | child: SvgPicture.asset("assets/icons/Camera Icon.svg"),
114 | ),
115 | ),
116 | )
117 | ],
118 | ),
119 | ),
120 | ),
121 | ),
122 | SizedBox(height: 40),
123 | TextFormField(
124 | keyboardType: TextInputType.name,
125 | controller: profileController.firstName,
126 | onEditingComplete: () => node.nextFocus(),
127 | validator: (String? value) {
128 | if (value!.isEmpty) {
129 | return 'Enter your last name';
130 | }
131 | return null;
132 | },
133 | decoration: InputDecoration(
134 | labelText: "First name",
135 | ),
136 | ),
137 | SizedBox(height: 10),
138 | TextFormField(
139 | keyboardType: TextInputType.name,
140 | controller: profileController.lastName,
141 | onEditingComplete: () => node.nextFocus(),
142 | validator: (String? value) {
143 | if (value!.isEmpty) {
144 | return 'Enter your last name';
145 | }
146 | return null;
147 | },
148 | decoration: InputDecoration(
149 | labelText: "Last name",
150 | ),
151 | ),
152 | SizedBox(height: 10),
153 | TextFormField(
154 | keyboardType: TextInputType.streetAddress,
155 | controller: profileController.address,
156 | onEditingComplete: () => node.nextFocus(),
157 | validator: (String? value) {
158 | if (value!.isEmpty) {
159 | return 'Enter your last name';
160 | }
161 | return null;
162 | },
163 | decoration: InputDecoration(
164 | labelText: "Address",
165 | ),
166 | ),
167 | SizedBox(height: 10),
168 | TextFormField(
169 | keyboardType: TextInputType.phone,
170 | controller: profileController.contactNumber,
171 | onEditingComplete: () => node.nextFocus(),
172 | validator: (String? value) {
173 | if (value!.isEmpty) {
174 | return 'Enter your last name';
175 | }
176 | return null;
177 | },
178 | decoration: InputDecoration(
179 | labelText: "Contact Number",
180 | ),
181 | ),
182 | SizedBox(height: 30),
183 | Obx(() {
184 | if (profileController.isLoading.value)
185 | return LoadingButton(
186 | onClick: () async {},
187 | color: Colors.blue,
188 | childWidget: Center(
189 | child: CircularProgressIndicator(
190 | backgroundColor: Colors.white,
191 | ),
192 | ),
193 | );
194 | else
195 | return LoadingButton(
196 | onClick: () async {
197 | profileController.create();
198 | },
199 | color: Colors.blue,
200 | childWidget: Center(
201 | child: Row(
202 | mainAxisAlignment:
203 | MainAxisAlignment.center,
204 | children: [
205 | Text(
206 | 'Continue',
207 | style: TextStyle(
208 | color: Colors.white,
209 | fontSize: 18,
210 | fontWeight: FontWeight.w500,
211 | ),
212 | ),
213 | ],
214 | )
215 | ),
216 | );
217 | }),
218 | SizedBox(height: 10),
219 | ],
220 | ),
221 | ),
222 | ),
223 | ),
224 | ),
225 | );
226 | }
227 | }
228 |
--------------------------------------------------------------------------------
/lib/views/profile/view_profile_screen.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_rest_api_image_upload/controllers/profileController.dart';
3 | import 'package:flutter_rest_api_image_upload/models/profile.dart';
4 | import 'package:get/get.dart';
5 |
6 | class ViewProfileScreen extends StatefulWidget {
7 | @override
8 | _ViewProfileScreenState createState() => _ViewProfileScreenState();
9 | }
10 |
11 | class _ViewProfileScreenState extends State {
12 | final profileController = Get.put(ProfileController());
13 |
14 | @override
15 | void initState() {
16 | // TODO: implement initState
17 | super.initState();
18 | WidgetsBinding.instance!.addPostFrameCallback((_) {
19 | profileController.fetch();
20 | });
21 | }
22 |
23 | @override
24 | Widget build(BuildContext context) {
25 | return Scaffold(
26 | body: Container(
27 | child: Obx((){
28 | if(!profileController.isLoading.value)
29 | return ListView.builder(
30 | shrinkWrap: true,
31 | itemCount: profileController.profiles.length,
32 | scrollDirection: Axis.vertical,
33 | itemBuilder: (BuildContext context, int index) {
34 | return ProfileCard(profile: profileController.profiles[index]);
35 | },
36 | );
37 | else
38 | return Container(
39 | child: Center(
40 | child: CircularProgressIndicator(
41 | color: Colors.blueAccent,
42 | ),
43 | ),
44 | );
45 | }),
46 | ),
47 | );
48 | }
49 | }
50 |
51 | class ProfileCard extends StatelessWidget {
52 | final Profile profile;
53 | const ProfileCard({required this.profile});
54 | @override
55 | Widget build(BuildContext context) {
56 | return Container(
57 | margin: EdgeInsets.symmetric(horizontal: 20,vertical: 10),
58 | padding: EdgeInsets.all(20),
59 | decoration: BoxDecoration(
60 | color: Colors.white,
61 | borderRadius: BorderRadius.all(Radius.circular(8)),
62 | boxShadow: [
63 | BoxShadow(
64 | color: Colors.grey.withOpacity(0.2),
65 | offset: Offset(1.1, 1.1),
66 | blurRadius: 10.0),
67 | ],
68 | ),
69 | child: Row(
70 | crossAxisAlignment: CrossAxisAlignment.start,
71 | mainAxisAlignment: MainAxisAlignment.spaceAround,
72 | children: [
73 | Flexible(
74 | flex: 2,
75 | child: Column(
76 | crossAxisAlignment: CrossAxisAlignment.start,
77 | mainAxisAlignment: MainAxisAlignment.start,
78 | children: [
79 | Column(
80 | mainAxisAlignment: MainAxisAlignment.start,
81 | crossAxisAlignment: CrossAxisAlignment.start,
82 | children: [
83 | Text(
84 | 'Name',
85 | textAlign: TextAlign.center,
86 | style: TextStyle(
87 | // fontFamily: AppTheme.fontName,
88 | fontWeight: FontWeight.w500,
89 | fontSize: 16,
90 | letterSpacing: -0.1,
91 | color: Colors.black87),
92 | ),
93 | Text(
94 | '${profile.firstName} ${profile.lastName}',
95 | textAlign: TextAlign.center,
96 | style: TextStyle(
97 | fontWeight: FontWeight.w600,
98 | fontSize: 28,
99 | color: Colors.black,
100 | ),
101 | )
102 | ],
103 | ),
104 | SizedBox(height: 10,),
105 | Column(
106 | mainAxisAlignment: MainAxisAlignment.start,
107 | crossAxisAlignment: CrossAxisAlignment.start,
108 | children: [
109 | Text(
110 | 'Address',
111 | textAlign: TextAlign.center,
112 | style: TextStyle(
113 | // fontFamily: AppTheme.fontName,
114 | fontWeight: FontWeight.w500,
115 | fontSize: 16,
116 | letterSpacing: -0.1,
117 | color: Colors.black87),
118 | ),
119 | Text(
120 | '${profile.address}',
121 | textAlign: TextAlign.center,
122 | style: TextStyle(
123 | // fontWeight: FontWeight.w600,
124 | fontSize: 12,
125 | color: Colors.black87,
126 | ),
127 | )
128 | ],
129 | ),
130 | Column(
131 | mainAxisAlignment: MainAxisAlignment.start,
132 | crossAxisAlignment: CrossAxisAlignment.start,
133 | children: [
134 | Text(
135 | 'Contact Number',
136 | textAlign: TextAlign.center,
137 | style: TextStyle(
138 | // fontFamily: AppTheme.fontName,
139 | fontWeight: FontWeight.w500,
140 | fontSize: 16,
141 | letterSpacing: -0.1,
142 | color: Colors.black87),
143 | ),
144 | Text(
145 | '${profile.contactNumber}',
146 | textAlign: TextAlign.center,
147 | style: TextStyle(
148 | // fontWeight: FontWeight.w600,
149 | fontSize: 12,
150 | color: Colors.black87,
151 | ),
152 | )
153 | ],
154 | ),
155 | ],
156 | ),
157 | ),
158 | Flexible(
159 | flex: 1,
160 | child: Container(
161 | decoration: BoxDecoration(
162 | boxShadow: [
163 | BoxShadow(
164 | color: Colors.grey.withOpacity(0.3),
165 | blurRadius: 40,
166 | ),
167 | ],
168 | ),
169 | child: SizedBox(
170 | height: 115,
171 | width: 115,
172 | child: CircleAvatar(
173 | backgroundImage: NetworkImage(profile.profilePicture)
174 | ),
175 | ),
176 | ),
177 | )
178 | ],
179 | ),
180 | );
181 | }
182 | }
183 |
184 |
--------------------------------------------------------------------------------
/lib/views/vehicle/add_vehicle_screen.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_rest_api_image_upload/controllers/vehicleController.dart';
5 | import 'package:flutter_rest_api_image_upload/widgets/loading_button.dart';
6 | import 'package:get/get.dart';
7 | import 'package:image_picker/image_picker.dart';
8 |
9 | class AddVehicleScreen extends StatefulWidget {
10 | @override
11 | _AddVehicleScreenState createState() => _AddVehicleScreenState();
12 | }
13 |
14 | class _AddVehicleScreenState extends State {
15 | final vehicleController = Get.put(VehicleController());
16 |
17 | @override
18 | void initState() {
19 | // TODO: implement initState
20 | vehicleController.clearController();
21 | super.initState();
22 | }
23 |
24 | @override
25 | Widget build(BuildContext context) {
26 | final node = FocusScope.of(context);
27 | return Scaffold(
28 | appBar: AppBar(
29 | title: Text(
30 | 'Add Vehicle'
31 | ),
32 | ),
33 | body: Container(
34 | child: SingleChildScrollView(
35 | padding: EdgeInsets.symmetric(vertical: 20, horizontal: 20),
36 | child: Form(
37 | key: vehicleController.formKey,
38 | autovalidateMode: AutovalidateMode.disabled,
39 | child: Column(
40 | children: [
41 | SizedBox(height: 40),
42 | TextFormField(
43 | keyboardType: TextInputType.name,
44 | controller: vehicleController.name,
45 | onEditingComplete: () => node.nextFocus(),
46 | validator: (String? value) {
47 | if (value!.isEmpty) {
48 | return 'this field is required';
49 | }
50 | return null;
51 | },
52 | decoration: InputDecoration(
53 | labelText: "Name",
54 | ),
55 | ),
56 | SizedBox(height: 10),
57 | TextFormField(
58 | keyboardType: TextInputType.number,
59 | controller: vehicleController.year,
60 | onEditingComplete: () => node.nextFocus(),
61 | validator: (String? value) {
62 | if (value!.isEmpty) {
63 | return 'this field is required';
64 | }
65 | return null;
66 | },
67 | decoration: InputDecoration(
68 | labelText: "Year",
69 | ),
70 | ),
71 | SizedBox(height: 10),
72 | GetBuilder(
73 | builder: (_c) => Row(
74 | mainAxisAlignment: MainAxisAlignment.spaceEvenly,
75 | children: [
76 | InkWell(
77 | child: Container(
78 | decoration: BoxDecoration(
79 | boxShadow: [
80 | BoxShadow(
81 | color: Colors.grey.withOpacity(0.3),
82 | blurRadius: 40,
83 | ),
84 | ],
85 | ),
86 | child: SizedBox(
87 | height: 115,
88 | width: 115,
89 | child: Stack(
90 | clipBehavior: Clip.none, fit: StackFit.expand,
91 | children: [
92 | Image(
93 | image : vehicleController.pickedFile1!=null
94 | ? FileImage(
95 | File(vehicleController.pickedFile1!.path),
96 | )
97 | : AssetImage('assets/images/no image.jpeg') as ImageProvider,
98 | fit: BoxFit.cover,
99 | ),
100 | ],
101 | ),
102 | ),
103 | ),
104 | onTap: (){
105 | Get.bottomSheet(
106 | Container(
107 | decoration: BoxDecoration(
108 | color: Colors.white,
109 | borderRadius: const BorderRadius.only(
110 | topLeft: Radius.circular(16.0),
111 | topRight: Radius.circular(16.0)),
112 | ),
113 | child: Wrap(
114 | alignment: WrapAlignment.end,
115 | crossAxisAlignment: WrapCrossAlignment.end,
116 | children: [
117 | ListTile(
118 | leading: Icon(Icons.camera),
119 | title: Text('Camera'),
120 | onTap: () {
121 | vehicleController.selectImage1(ImageSource.camera);
122 | },
123 | ),
124 | ListTile(
125 | leading: Icon(Icons.image),
126 | title: Text('Gallery'),
127 | onTap: () {
128 | vehicleController.selectImage1(ImageSource.gallery);
129 | },
130 | ),
131 | ],
132 | ),
133 | ),
134 | );
135 | },
136 | ),
137 | InkWell(
138 | child: Container(
139 | decoration: BoxDecoration(
140 | boxShadow: [
141 | BoxShadow(
142 | color: Colors.grey.withOpacity(0.3),
143 | blurRadius: 40,
144 | ),
145 | ],
146 | ),
147 | child: SizedBox(
148 | height: 115,
149 | width: 115,
150 | child: Stack(
151 | clipBehavior: Clip.none, fit: StackFit.expand,
152 | children: [
153 | Image(
154 | image : vehicleController.pickedFile2!=null
155 | ? FileImage(
156 | File(vehicleController.pickedFile2!.path),
157 | )
158 | : AssetImage('assets/images/no image.jpeg') as ImageProvider,
159 | fit: BoxFit.cover,
160 | ),
161 | ],
162 | ),
163 | ),
164 | ),
165 | onTap: (){
166 | Get.bottomSheet(
167 | Container(
168 | decoration: BoxDecoration(
169 | color: Colors.white,
170 | borderRadius: const BorderRadius.only(
171 | topLeft: Radius.circular(16.0),
172 | topRight: Radius.circular(16.0)),
173 | ),
174 | child: Wrap(
175 | alignment: WrapAlignment.end,
176 | crossAxisAlignment: WrapCrossAlignment.end,
177 | children: [
178 | ListTile(
179 | leading: Icon(Icons.camera),
180 | title: Text('Camera'),
181 | onTap: () {
182 | vehicleController.selectImage2(ImageSource.camera);
183 | },
184 | ),
185 | ListTile(
186 | leading: Icon(Icons.image),
187 | title: Text('Gallery'),
188 | onTap: () {
189 | vehicleController.selectImage2(ImageSource.gallery);
190 | },
191 | ),
192 | ],
193 | ),
194 | ),
195 | );
196 | },
197 | )
198 | ],
199 | ),
200 | ),
201 | SizedBox(height: 30),
202 | Obx(() {
203 | if (vehicleController.isLoading.value)
204 | return LoadingButton(
205 | onClick: () async {},
206 | color: Colors.blue,
207 | childWidget: Center(
208 | child: CircularProgressIndicator(
209 | backgroundColor: Colors.white,
210 | ),
211 | ),
212 | );
213 | else
214 | return LoadingButton(
215 | onClick: () async {
216 | vehicleController.create();
217 | },
218 | color: Colors.blue,
219 | childWidget: Center(
220 | child: Row(
221 | mainAxisAlignment:
222 | MainAxisAlignment.center,
223 | children: [
224 | Text(
225 | 'Continue',
226 | style: TextStyle(
227 | color: Colors.white,
228 | fontSize: 18,
229 | fontWeight: FontWeight.w500,
230 | ),
231 | ),
232 | ],
233 | )
234 | ),
235 | );
236 | }),
237 | SizedBox(height: 10),
238 | ],
239 | ),
240 | ),
241 | ),
242 | ),
243 | );
244 | }
245 | }
246 |
--------------------------------------------------------------------------------
/lib/views/vehicle/view_vehicle_screem.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_rest_api_image_upload/controllers/vehicleController.dart';
3 | import 'package:flutter_rest_api_image_upload/models/vehicle.dart';
4 | import 'package:get/get.dart';
5 |
6 | class ViewVehicleScreen extends StatefulWidget {
7 | @override
8 | _ViewVehicleScreenState createState() => _ViewVehicleScreenState();
9 | }
10 |
11 | class _ViewVehicleScreenState extends State {
12 | final vehicleController = Get.put(VehicleController());
13 |
14 | @override
15 | void initState() {
16 | // TODO: implement initState
17 | super.initState();
18 | WidgetsBinding.instance!.addPostFrameCallback((_) {
19 | vehicleController.fetch();
20 | });
21 | }
22 |
23 | @override
24 | Widget build(BuildContext context) {
25 | return Scaffold(
26 | body: Obx((){
27 | if(!vehicleController.isLoading.value)
28 | return ListView.builder(
29 | shrinkWrap: true,
30 | itemCount: vehicleController.vehicles.length,
31 | scrollDirection: Axis.vertical,
32 | itemBuilder: (BuildContext context, int index) {
33 | return VehicleCard(vehicle: vehicleController.vehicles[index]);
34 | },
35 | );
36 | else
37 | return Container(
38 | child: Center(
39 | child: CircularProgressIndicator(
40 | color: Colors.blueAccent,
41 | ),
42 | ),
43 | );
44 | }),
45 | );
46 | }
47 | }
48 |
49 | class VehicleCard extends StatelessWidget {
50 | final Vehicle vehicle;
51 | const VehicleCard({required this.vehicle});
52 | @override
53 | Widget build(BuildContext context) {
54 | return Container(
55 | margin: EdgeInsets.symmetric(horizontal: 20,vertical: 10),
56 | padding: EdgeInsets.all(20),
57 | decoration: BoxDecoration(
58 | color: Colors.white,
59 | borderRadius: BorderRadius.all(Radius.circular(8)),
60 | boxShadow: [
61 | BoxShadow(
62 | color: Colors.grey.withOpacity(0.2),
63 | offset: Offset(1.1, 1.1),
64 | blurRadius: 10.0),
65 | ],
66 | ),
67 | child: Column(
68 | crossAxisAlignment: CrossAxisAlignment.start,
69 | mainAxisAlignment: MainAxisAlignment.start,
70 | children: [
71 | Column(
72 | mainAxisAlignment: MainAxisAlignment.start,
73 | crossAxisAlignment: CrossAxisAlignment.start,
74 | children: [
75 | Text(
76 | 'Name',
77 | textAlign: TextAlign.center,
78 | style: TextStyle(
79 | // fontFamily: AppTheme.fontName,
80 | fontWeight: FontWeight.w500,
81 | fontSize: 16,
82 | letterSpacing: -0.1,
83 | color: Colors.black87),
84 | ),
85 | Text(
86 | '${vehicle.name}',
87 | textAlign: TextAlign.center,
88 | style: TextStyle(
89 | fontWeight: FontWeight.w600,
90 | fontSize: 28,
91 | color: Colors.black,
92 | ),
93 | )
94 | ],
95 | ),
96 | SizedBox(height: 10,),
97 | Column(
98 | mainAxisAlignment: MainAxisAlignment.start,
99 | crossAxisAlignment: CrossAxisAlignment.start,
100 | children: [
101 | Text(
102 | 'Year',
103 | textAlign: TextAlign.center,
104 | style: TextStyle(
105 | // fontFamily: AppTheme.fontName,
106 | fontWeight: FontWeight.w500,
107 | fontSize: 16,
108 | letterSpacing: -0.1,
109 | color: Colors.black87),
110 | ),
111 | Text(
112 | '${vehicle.year}',
113 | textAlign: TextAlign.center,
114 | style: TextStyle(
115 | // fontWeight: FontWeight.w600,
116 | fontSize: 12,
117 | color: Colors.black87,
118 | ),
119 | )
120 | ],
121 | ),
122 | Row(
123 | crossAxisAlignment: CrossAxisAlignment.start,
124 | mainAxisAlignment: MainAxisAlignment.spaceAround,
125 | children: [
126 | Container(
127 | decoration: BoxDecoration(
128 | boxShadow: [
129 | BoxShadow(
130 | color: Colors.grey.withOpacity(0.3),
131 | blurRadius: 40,
132 | ),
133 | ],
134 | ),
135 | child: SizedBox(
136 | height: 115,
137 | width: 115,
138 | child: Image(
139 | image: NetworkImage(vehicle.image1)
140 | ),
141 | ),
142 | ),
143 | Container(
144 | decoration: BoxDecoration(
145 | boxShadow: [
146 | BoxShadow(
147 | color: Colors.grey.withOpacity(0.3),
148 | blurRadius: 40,
149 | ),
150 | ],
151 | ),
152 | child: SizedBox(
153 | height: 115,
154 | width: 115,
155 | child: Image(
156 | image: NetworkImage(vehicle.image2),
157 | fit: BoxFit.cover,
158 | ),
159 | ),
160 | )
161 | ],
162 | ),
163 | ],
164 | )
165 | );
166 | }
167 | }
168 |
--------------------------------------------------------------------------------
/lib/widgets/loading_button.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class LoadingButton extends StatelessWidget {
4 | final Function onClick;
5 | final Widget childWidget;
6 | final Color color;
7 | const LoadingButton({required this.onClick,required this.childWidget,required this.color});
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return InkWell(
12 | onTap: ()=>onClick(),
13 | child: Ink(
14 | decoration: BoxDecoration(
15 | color: color,
16 | borderRadius: BorderRadius.circular(8),
17 | ),
18 | height: 55,
19 | child: childWidget,
20 | ),
21 | );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | async:
5 | dependency: transitive
6 | description:
7 | name: async
8 | url: "https://pub.dartlang.org"
9 | source: hosted
10 | version: "2.6.1"
11 | boolean_selector:
12 | dependency: transitive
13 | description:
14 | name: boolean_selector
15 | url: "https://pub.dartlang.org"
16 | source: hosted
17 | version: "2.1.0"
18 | characters:
19 | dependency: transitive
20 | description:
21 | name: characters
22 | url: "https://pub.dartlang.org"
23 | source: hosted
24 | version: "1.1.0"
25 | charcode:
26 | dependency: transitive
27 | description:
28 | name: charcode
29 | url: "https://pub.dartlang.org"
30 | source: hosted
31 | version: "1.2.0"
32 | clock:
33 | dependency: transitive
34 | description:
35 | name: clock
36 | url: "https://pub.dartlang.org"
37 | source: hosted
38 | version: "1.1.0"
39 | collection:
40 | dependency: transitive
41 | description:
42 | name: collection
43 | url: "https://pub.dartlang.org"
44 | source: hosted
45 | version: "1.15.0"
46 | cross_file:
47 | dependency: transitive
48 | description:
49 | name: cross_file
50 | url: "https://pub.dartlang.org"
51 | source: hosted
52 | version: "0.3.1+4"
53 | cupertino_icons:
54 | dependency: "direct main"
55 | description:
56 | name: cupertino_icons
57 | url: "https://pub.dartlang.org"
58 | source: hosted
59 | version: "1.0.3"
60 | dio:
61 | dependency: "direct main"
62 | description:
63 | name: dio
64 | url: "https://pub.dartlang.org"
65 | source: hosted
66 | version: "4.0.0"
67 | fake_async:
68 | dependency: transitive
69 | description:
70 | name: fake_async
71 | url: "https://pub.dartlang.org"
72 | source: hosted
73 | version: "1.2.0"
74 | flutter:
75 | dependency: "direct main"
76 | description: flutter
77 | source: sdk
78 | version: "0.0.0"
79 | flutter_plugin_android_lifecycle:
80 | dependency: transitive
81 | description:
82 | name: flutter_plugin_android_lifecycle
83 | url: "https://pub.dartlang.org"
84 | source: hosted
85 | version: "2.0.2"
86 | flutter_svg:
87 | dependency: "direct main"
88 | description:
89 | name: flutter_svg
90 | url: "https://pub.dartlang.org"
91 | source: hosted
92 | version: "0.22.0"
93 | flutter_test:
94 | dependency: "direct dev"
95 | description: flutter
96 | source: sdk
97 | version: "0.0.0"
98 | flutter_web_plugins:
99 | dependency: transitive
100 | description: flutter
101 | source: sdk
102 | version: "0.0.0"
103 | get:
104 | dependency: "direct main"
105 | description:
106 | name: get
107 | url: "https://pub.dartlang.org"
108 | source: hosted
109 | version: "4.3.8"
110 | http:
111 | dependency: transitive
112 | description:
113 | name: http
114 | url: "https://pub.dartlang.org"
115 | source: hosted
116 | version: "0.13.3"
117 | http_parser:
118 | dependency: transitive
119 | description:
120 | name: http_parser
121 | url: "https://pub.dartlang.org"
122 | source: hosted
123 | version: "4.0.0"
124 | image_picker:
125 | dependency: "direct main"
126 | description:
127 | name: image_picker
128 | url: "https://pub.dartlang.org"
129 | source: hosted
130 | version: "0.8.3+3"
131 | image_picker_for_web:
132 | dependency: transitive
133 | description:
134 | name: image_picker_for_web
135 | url: "https://pub.dartlang.org"
136 | source: hosted
137 | version: "2.1.3"
138 | image_picker_platform_interface:
139 | dependency: transitive
140 | description:
141 | name: image_picker_platform_interface
142 | url: "https://pub.dartlang.org"
143 | source: hosted
144 | version: "2.3.0"
145 | js:
146 | dependency: transitive
147 | description:
148 | name: js
149 | url: "https://pub.dartlang.org"
150 | source: hosted
151 | version: "0.6.3"
152 | matcher:
153 | dependency: transitive
154 | description:
155 | name: matcher
156 | url: "https://pub.dartlang.org"
157 | source: hosted
158 | version: "0.12.10"
159 | meta:
160 | dependency: transitive
161 | description:
162 | name: meta
163 | url: "https://pub.dartlang.org"
164 | source: hosted
165 | version: "1.3.0"
166 | path:
167 | dependency: transitive
168 | description:
169 | name: path
170 | url: "https://pub.dartlang.org"
171 | source: hosted
172 | version: "1.8.0"
173 | path_drawing:
174 | dependency: transitive
175 | description:
176 | name: path_drawing
177 | url: "https://pub.dartlang.org"
178 | source: hosted
179 | version: "0.5.1"
180 | path_parsing:
181 | dependency: transitive
182 | description:
183 | name: path_parsing
184 | url: "https://pub.dartlang.org"
185 | source: hosted
186 | version: "0.2.1"
187 | pedantic:
188 | dependency: transitive
189 | description:
190 | name: pedantic
191 | url: "https://pub.dartlang.org"
192 | source: hosted
193 | version: "1.11.1"
194 | petitparser:
195 | dependency: transitive
196 | description:
197 | name: petitparser
198 | url: "https://pub.dartlang.org"
199 | source: hosted
200 | version: "4.1.0"
201 | plugin_platform_interface:
202 | dependency: transitive
203 | description:
204 | name: plugin_platform_interface
205 | url: "https://pub.dartlang.org"
206 | source: hosted
207 | version: "2.0.1"
208 | sky_engine:
209 | dependency: transitive
210 | description: flutter
211 | source: sdk
212 | version: "0.0.99"
213 | source_span:
214 | dependency: transitive
215 | description:
216 | name: source_span
217 | url: "https://pub.dartlang.org"
218 | source: hosted
219 | version: "1.8.1"
220 | stack_trace:
221 | dependency: transitive
222 | description:
223 | name: stack_trace
224 | url: "https://pub.dartlang.org"
225 | source: hosted
226 | version: "1.10.0"
227 | stream_channel:
228 | dependency: transitive
229 | description:
230 | name: stream_channel
231 | url: "https://pub.dartlang.org"
232 | source: hosted
233 | version: "2.1.0"
234 | string_scanner:
235 | dependency: transitive
236 | description:
237 | name: string_scanner
238 | url: "https://pub.dartlang.org"
239 | source: hosted
240 | version: "1.1.0"
241 | term_glyph:
242 | dependency: transitive
243 | description:
244 | name: term_glyph
245 | url: "https://pub.dartlang.org"
246 | source: hosted
247 | version: "1.2.0"
248 | test_api:
249 | dependency: transitive
250 | description:
251 | name: test_api
252 | url: "https://pub.dartlang.org"
253 | source: hosted
254 | version: "0.3.0"
255 | typed_data:
256 | dependency: transitive
257 | description:
258 | name: typed_data
259 | url: "https://pub.dartlang.org"
260 | source: hosted
261 | version: "1.3.0"
262 | vector_math:
263 | dependency: transitive
264 | description:
265 | name: vector_math
266 | url: "https://pub.dartlang.org"
267 | source: hosted
268 | version: "2.1.0"
269 | xml:
270 | dependency: transitive
271 | description:
272 | name: xml
273 | url: "https://pub.dartlang.org"
274 | source: hosted
275 | version: "5.1.2"
276 | sdks:
277 | dart: ">=2.12.0 <3.0.0"
278 | flutter: ">=2.0.0"
279 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_rest_api_image_upload
2 | description: Flutter REST API Image Upload Complete Example.
3 |
4 | # The following line prevents the package from being accidentally published to
5 | # pub.dev using `pub publish`. This is preferred for private packages.
6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev
7 |
8 | # The following defines the version and build number for your application.
9 | # A version number is three numbers separated by dots, like 1.2.43
10 | # followed by an optional build number separated by a +.
11 | # Both the version and the builder number may be overridden in flutter
12 | # build by specifying --build-name and --build-number, respectively.
13 | # In Android, build-name is used as versionName while build-number used as versionCode.
14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
16 | # Read more about iOS versioning at
17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18 | version: 1.0.0+1
19 |
20 | environment:
21 | sdk: ">=2.12.0 <3.0.0"
22 |
23 | dependencies:
24 | flutter:
25 | sdk: flutter
26 |
27 |
28 | # The following adds the Cupertino Icons font to your application.
29 | # Use with the CupertinoIcons class for iOS style icons.
30 | cupertino_icons: ^1.0.2
31 |
32 | get: ^4.3.8
33 | dio: ^4.0.0
34 |
35 | flutter_svg: ^0.22.0
36 | image_picker: ^0.8.3+3
37 |
38 | dev_dependencies:
39 | flutter_test:
40 | sdk: flutter
41 |
42 | # For information on the generic Dart part of this file, see the
43 | # following page: https://dart.dev/tools/pub/pubspec
44 |
45 | # The following section is specific to Flutter.
46 | flutter:
47 |
48 | # The following line ensures that the Material Icons font is
49 | # included with your application, so that you can use the icons in
50 | # the material Icons class.
51 | uses-material-design: true
52 |
53 | # To add assets to your application, add an assets section, like this:
54 | assets:
55 | - assets/images/
56 | - assets/icons/
57 |
58 | # An image asset can refer to one or more resolution-specific "variants", see
59 | # https://flutter.dev/assets-and-images/#resolution-aware.
60 |
61 | # For details regarding adding assets from package dependencies, see
62 | # https://flutter.dev/assets-and-images/#from-packages
63 |
64 | # To add custom fonts to your application, add a fonts section here,
65 | # in this "flutter" section. Each entry in this list should have a
66 | # "family" key with the font family name, and a "fonts" key with a
67 | # list giving the asset and other descriptors for the font. For
68 | # example:
69 | # fonts:
70 | # - family: Schyler
71 | # fonts:
72 | # - asset: fonts/Schyler-Regular.ttf
73 | # - asset: fonts/Schyler-Italic.ttf
74 | # style: italic
75 | # - family: Trajan Pro
76 | # fonts:
77 | # - asset: fonts/TrajanPro.ttf
78 | # - asset: fonts/TrajanPro_Bold.ttf
79 | # weight: 700
80 | #
81 | # For details regarding fonts from package dependencies,
82 | # see https://flutter.dev/custom-fonts/#from-packages
83 |
--------------------------------------------------------------------------------
/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility that Flutter provides. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | import 'package:flutter_rest_api_image_upload/main.dart';
12 |
13 | void main() {
14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
15 | // Build our app and trigger a frame.
16 | await tester.pumpWidget(MyApp());
17 |
18 | // Verify that our counter starts at 0.
19 | expect(find.text('0'), findsOneWidget);
20 | expect(find.text('1'), findsNothing);
21 |
22 | // Tap the '+' icon and trigger a frame.
23 | await tester.tap(find.byIcon(Icons.add));
24 | await tester.pump();
25 |
26 | // Verify that our counter has incremented.
27 | expect(find.text('0'), findsNothing);
28 | expect(find.text('1'), findsOneWidget);
29 | });
30 | }
31 |
--------------------------------------------------------------------------------