├── .flutter-plugins ├── .idea ├── codeStyles │ └── Project.xml ├── encodings.xml └── misc.xml ├── .metadata ├── .packages ├── README.md ├── Screenshots ├── E-Commerce_1.jpg ├── E-Commerce_2.jpg ├── E-Commerce_3.jpg ├── E-Commerce_4.jpg ├── E-Commerce_5.jpg ├── E-Commerce_6.jpg ├── E-Commerce_7.jpg ├── E-Commerce_8.jpg ├── buymecoffee.png ├── facebook.png ├── flutter-ecommerce.json ├── instagram.png ├── linkedin.png ├── stackoverflow.png └── twitter.png ├── android ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── io │ │ │ │ └── flutter │ │ │ │ └── plugins │ │ │ │ └── GeneratedPluginRegistrant.java │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── toastguyz │ │ │ │ └── flutter_ecommerce │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── 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 │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── assets ├── blog_placeholder.jpg ├── fonts │ ├── Anton-Regular.ttf │ ├── Lato-Bold.ttf │ ├── Lato-Regular.ttf │ ├── WorkSans-Bold.ttf │ ├── WorkSans-Light.ttf │ ├── WorkSans-Medium.ttf │ ├── WorkSans-Regular.ttf │ └── WorkSans-SemiBold.ttf ├── image_four.jpg ├── image_one.jpg ├── image_three.jpeg ├── image_two.jpg └── images │ └── product-placeholder.png ├── flutter-ecommerce.json ├── ios ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ ├── Generated.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ └── contents.xcworkspacedata └── 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 │ ├── GeneratedPluginRegistrant.h │ ├── GeneratedPluginRegistrant.m │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── lib ├── constants.dart ├── helpers │ └── custom_route.dart ├── main.dart ├── models │ └── http_exception.dart ├── providers │ ├── auth.dart │ ├── cart.dart │ ├── orders.dart │ ├── product.dart │ └── products.dart ├── screens │ ├── auth_screen.dart │ ├── cart_screen.dart │ ├── edit_product_screen.dart │ ├── orders_screen.dart │ ├── product_detail_screen.dart │ ├── products_overview_screen.dart │ ├── splash_screen.dart │ └── user_products_screen.dart └── widgets │ ├── app_drawer.dart │ ├── badge.dart │ ├── cart_item.dart │ ├── order_item.dart │ ├── product_item.dart │ ├── products_grid.dart │ └── user_product_item.dart ├── pubspec.lock ├── pubspec.yaml └── test └── widget_test.dart /.flutter-plugins: -------------------------------------------------------------------------------- 1 | shared_preferences=D:\\Program_Files\\FlutterSDK\\flutter_windows_v1.9.1+hotfix.2-stable\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\shared_preferences-0.5.3+4\\ 2 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | xmlns:android 14 | 15 | ^$ 16 | 17 | 18 | 19 |
20 |
21 | 22 | 23 | 24 | xmlns:.* 25 | 26 | ^$ 27 | 28 | 29 | BY_NAME 30 | 31 |
32 |
33 | 34 | 35 | 36 | .*:id 37 | 38 | http://schemas.android.com/apk/res/android 39 | 40 | 41 | 42 |
43 |
44 | 45 | 46 | 47 | .*:name 48 | 49 | http://schemas.android.com/apk/res/android 50 | 51 | 52 | 53 |
54 |
55 | 56 | 57 | 58 | name 59 | 60 | ^$ 61 | 62 | 63 | 64 |
65 |
66 | 67 | 68 | 69 | style 70 | 71 | ^$ 72 | 73 | 74 | 75 |
76 |
77 | 78 | 79 | 80 | .* 81 | 82 | ^$ 83 | 84 | 85 | BY_NAME 86 | 87 |
88 |
89 | 90 | 91 | 92 | .* 93 | 94 | http://schemas.android.com/apk/res/android 95 | 96 | 97 | ANDROID_ATTRIBUTE_ORDER 98 | 99 |
100 |
101 | 102 | 103 | 104 | .* 105 | 106 | .* 107 | 108 | 109 | BY_NAME 110 | 111 |
112 |
113 |
114 |
115 |
116 |
-------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.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: 20e59316b8b8474554b38493b8ca888794b0234a 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /.packages: -------------------------------------------------------------------------------- 1 | # Generated by pub on 2019-09-30 00:11:50.198325. 2 | async:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.3.0/lib/ 3 | boolean_selector:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.5/lib/ 4 | charcode:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib/ 5 | collection:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11/lib/ 6 | cupertino_icons:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.2/lib/ 7 | flutter:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/packages/flutter/lib/ 8 | flutter_test:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/packages/flutter_test/lib/ 9 | http:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+2/lib/ 10 | http_parser:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.3/lib/ 11 | intl:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/ 12 | matcher:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.5/lib/ 13 | meta:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.1.7/lib/ 14 | path:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.6.4/lib/ 15 | pedantic:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/pedantic-1.8.0+1/lib/ 16 | provider:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.1.0/lib/ 17 | quiver:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/quiver-2.0.5/lib/ 18 | shared_preferences:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.3+4/lib/ 19 | sky_engine:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/bin/cache/pkg/sky_engine/lib/ 20 | source_span:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.5.5/lib/ 21 | stack_trace:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib/ 22 | stream_channel:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.0.0/lib/ 23 | string_scanner:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.5/lib/ 24 | term_glyph:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib/ 25 | test_api:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.5/lib/ 26 | typed_data:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib/ 27 | vector_math:file:///D:/Program_Files/FlutterSDK/flutter_windows_v1.9.1+hotfix.2-stable/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.0.8/lib/ 28 | flutter_ecommerce:lib/ 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flutter E-Commerce 2 | 3 | > A flutter application for beautiful E-commerce UI App with provider pattern. 4 | 5 | Main Features Used : 6 | - Beautiful UI Design 7 | - Firebase Database 8 | - Firebase Authentication 9 | - Data Fetching From Network 10 | - ImagePicker 11 | - Provider Package 12 | - Future Builder 13 | 14 | ## Screenshots 15 | 16 | | 1 | 2| 17 | |------|-------| 18 | ||| 19 | 20 | | 3 | 4| 21 | |------|-------| 22 | ||| 23 | 24 | | 5 | 6| 25 | |------|-------| 26 | ||| 27 | 28 | | 7 | 8| 29 | |------|-------| 30 | ||| 31 | 32 | Don't forget to star :star2: the repo if you like our work.:heart::blue_heart::yellow_heart::purple_heart::green_heart: 33 | 34 | ## Website :link: 35 | 36 | > [Toastguyz](www.toastguyz.com) - A programming tutorials website 37 | 38 | ## Support on social media :thumbsup: 39 | 40 | >Follow us on our social media profiles to support us. 41 | 42 | - [Youtube Channel](https://www.youtube.com/toastguyz) 43 | - [Facebook Page](https://www.facebook.com/toastguyz) 44 | - [Twitter Account](https://www.twitter.com/toastguyz) 45 | - [Instagram Account](https://www.instagram.com/toastguyz) 46 | 47 | ## Code Developer 48 | 49 | >### Jay Patel :fire: 50 | >Enthusiastic Android & Flutter App Developer. 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | ## ☕ Donate 59 | 60 | > [Paypal](https://www.paypal.me/toastguyz) 61 | 62 | 63 | ./Screenshots/buymecoffee.png 64 | 65 | 66 | Thanks for reaching out to us. :100: 67 | 68 | # Getting Started 69 | 70 | > 1. Create your flutter application project. 71 | > 2. [Set up with firebase](https://firebase.google.com/docs) 72 | > 3. Create Realtime Database with Test Rules and import the attached json file(flutter-ecommerce.json) in Screenshots folder to your flutter project. 73 | > 4. To run your project, enable Authentication for email in [firebase console](https://console.firebase.google.com/). 74 | > 5. Also, setup firebase storage in your firebase console. 75 | > 6. Add your Firebase Web API Key and Firebase Database Path in **constants.dart** file. 76 | 77 | RealTime Database Rules : 78 | { 79 | "rules": { 80 | ".read": true, 81 | ".write": true 82 | } 83 | } 84 | 85 | Now, you're ready to rock the floor:guitar: -------------------------------------------------------------------------------- /Screenshots/E-Commerce_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/Screenshots/E-Commerce_1.jpg -------------------------------------------------------------------------------- /Screenshots/E-Commerce_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/Screenshots/E-Commerce_2.jpg -------------------------------------------------------------------------------- /Screenshots/E-Commerce_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/Screenshots/E-Commerce_3.jpg -------------------------------------------------------------------------------- /Screenshots/E-Commerce_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/Screenshots/E-Commerce_4.jpg -------------------------------------------------------------------------------- /Screenshots/E-Commerce_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/Screenshots/E-Commerce_5.jpg -------------------------------------------------------------------------------- /Screenshots/E-Commerce_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/Screenshots/E-Commerce_6.jpg -------------------------------------------------------------------------------- /Screenshots/E-Commerce_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/Screenshots/E-Commerce_7.jpg -------------------------------------------------------------------------------- /Screenshots/E-Commerce_8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/Screenshots/E-Commerce_8.jpg -------------------------------------------------------------------------------- /Screenshots/buymecoffee.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/Screenshots/buymecoffee.png -------------------------------------------------------------------------------- /Screenshots/facebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/Screenshots/facebook.png -------------------------------------------------------------------------------- /Screenshots/flutter-ecommerce.json: -------------------------------------------------------------------------------- 1 | { 2 | "products" : { 3 | "-LpqSHzHiTpJi1iQkIJq" : { 4 | "creatorId" : "xXMtsSC4kJd5m5RVxJhQiNamyFH2", 5 | "description" : "Cool Red T- Shirt", 6 | "imageUrl" : "https://cdn.pixabay.com/photo/2016/10/02/22/17/red-t-shirt-1710578_1280.jpg", 7 | "price" : 100.0, 8 | "title" : "Red T - Shirt" 9 | }, 10 | "-LpqSHzHiTpJi1iQkIMf" : { 11 | "creatorId" : "xXMtsSC4kJd5m5RVxJhQiNamyFH2", 12 | "description" : "Prepare any meal you want.", 13 | "imageUrl" : "https://upload.wikimedia.org/wikipedia/commons/thumb/1/14/Cast-Iron-Pan.jpg/1024px-Cast-Iron-Pan.jpg", 14 | "price" : 99.99, 15 | "title" : "A Pan" 16 | }, 17 | "-LpqSHzHiTpJi1iQkINP" : { 18 | "creatorId" : "xXMtsSC4kJd5m5RVxJhQiNamyFH2", 19 | "description" : "Warm and cozy - exactly what you need for the winter.", 20 | "imageUrl" : "https://live.staticflickr.com/4043/4438260868_cc79b3369d_z.jpg", 21 | "price" : 50.0, 22 | "title" : "Yellow Scarf" 23 | }, 24 | "-LpqSHzHiTpJi1iQkITM" : { 25 | "creatorId" : "xXMtsSC4kJd5m5RVxJhQiNamyFH2", 26 | "description" : "A nice pair of trousers.", 27 | "imageUrl" : "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e8/Trousers%2C_dress_%28AM_1960.022-8%29.jpg/512px-Trousers%2C_dress_%28AM_1960.022-8%29.jpg", 28 | "price" : 250.0, 29 | "title" : "Trousers" 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Screenshots/instagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/Screenshots/instagram.png -------------------------------------------------------------------------------- /Screenshots/linkedin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/Screenshots/linkedin.png -------------------------------------------------------------------------------- /Screenshots/stackoverflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/Screenshots/stackoverflow.png -------------------------------------------------------------------------------- /Screenshots/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/Screenshots/twitter.png -------------------------------------------------------------------------------- /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 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.toastguyz.flutter_ecommerce" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'androidx.test:runner:1.1.1' 66 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 67 | } 68 | apply plugin: 'com.google.gms.google-services' -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java: -------------------------------------------------------------------------------- 1 | package io.flutter.plugins; 2 | 3 | import io.flutter.plugin.common.PluginRegistry; 4 | import io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin; 5 | 6 | /** 7 | * Generated file. Do not edit. 8 | */ 9 | public final class GeneratedPluginRegistrant { 10 | public static void registerWith(PluginRegistry registry) { 11 | if (alreadyRegisteredWith(registry)) { 12 | return; 13 | } 14 | SharedPreferencesPlugin.registerWith(registry.registrarFor("io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin")); 15 | } 16 | 17 | private static boolean alreadyRegisteredWith(PluginRegistry registry) { 18 | final String key = GeneratedPluginRegistrant.class.getCanonicalName(); 19 | if (registry.hasPlugin(key)) { 20 | return true; 21 | } 22 | registry.registrarFor(key); 23 | return false; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/toastguyz/flutter_ecommerce/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.toastguyz.flutter_ecommerce 2 | 3 | import android.os.Bundle 4 | 5 | import io.flutter.app.FlutterActivity 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | GeneratedPluginRegistrant.registerWith(this) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /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/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.21' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.3.0' 10 | classpath 'com.google.gms:google-services:4.2.0' 11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | google() 18 | jcenter() 19 | } 20 | } 21 | 22 | rootProject.buildDir = '../build' 23 | subprojects { 24 | project.buildDir = "${rootProject.buildDir}/${project.name}" 25 | } 26 | subprojects { 27 | project.evaluationDependsOn(':app') 28 | } 29 | 30 | task clean(type: Delete) { 31 | delete rootProject.buildDir 32 | } 33 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /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-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /assets/blog_placeholder.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/assets/blog_placeholder.jpg -------------------------------------------------------------------------------- /assets/fonts/Anton-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/assets/fonts/Anton-Regular.ttf -------------------------------------------------------------------------------- /assets/fonts/Lato-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/assets/fonts/Lato-Bold.ttf -------------------------------------------------------------------------------- /assets/fonts/Lato-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/assets/fonts/Lato-Regular.ttf -------------------------------------------------------------------------------- /assets/fonts/WorkSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/assets/fonts/WorkSans-Bold.ttf -------------------------------------------------------------------------------- /assets/fonts/WorkSans-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/assets/fonts/WorkSans-Light.ttf -------------------------------------------------------------------------------- /assets/fonts/WorkSans-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/assets/fonts/WorkSans-Medium.ttf -------------------------------------------------------------------------------- /assets/fonts/WorkSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/assets/fonts/WorkSans-Regular.ttf -------------------------------------------------------------------------------- /assets/fonts/WorkSans-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/assets/fonts/WorkSans-SemiBold.ttf -------------------------------------------------------------------------------- /assets/image_four.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/assets/image_four.jpg -------------------------------------------------------------------------------- /assets/image_one.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/assets/image_one.jpg -------------------------------------------------------------------------------- /assets/image_three.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/assets/image_three.jpeg -------------------------------------------------------------------------------- /assets/image_two.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/assets/image_two.jpg -------------------------------------------------------------------------------- /assets/images/product-placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/assets/images/product-placeholder.png -------------------------------------------------------------------------------- /flutter-ecommerce.json: -------------------------------------------------------------------------------- 1 | { 2 | "products" : { 3 | "-LpqSHzHiTpJi1iQkIJq" : { 4 | "creatorId" : "xXMtsSC4kJd5m5RVxJhQiNamyFH2", 5 | "description" : "Cool Red T- Shirt", 6 | "imageUrl" : "https://cdn.pixabay.com/photo/2016/10/02/22/17/red-t-shirt-1710578_1280.jpg", 7 | "price" : 100.0, 8 | "title" : "Red T - Shirt" 9 | }, 10 | "-LpqSHzHiTpJi1iQkIMf" : { 11 | "creatorId" : "xXMtsSC4kJd5m5RVxJhQiNamyFH2", 12 | "description" : "Prepare any meal you want.", 13 | "imageUrl" : "https://upload.wikimedia.org/wikipedia/commons/thumb/1/14/Cast-Iron-Pan.jpg/1024px-Cast-Iron-Pan.jpg", 14 | "price" : 99.99, 15 | "title" : "A Pan" 16 | }, 17 | "-LpqSHzHiTpJi1iQkINP" : { 18 | "creatorId" : "xXMtsSC4kJd5m5RVxJhQiNamyFH2", 19 | "description" : "Warm and cozy - exactly what you need for the winter.", 20 | "imageUrl" : "https://live.staticflickr.com/4043/4438260868_cc79b3369d_z.jpg", 21 | "price" : 50.0, 22 | "title" : "Yellow Scarf" 23 | }, 24 | "-LpqSHzHiTpJi1iQkITM" : { 25 | "creatorId" : "xXMtsSC4kJd5m5RVxJhQiNamyFH2", 26 | "description" : "A nice pair of trousers.", 27 | "imageUrl" : "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e8/Trousers%2C_dress_%28AM_1960.022-8%29.jpg/512px-Trousers%2C_dress_%28AM_1960.022-8%29.jpg", 28 | "price" : 250.0, 29 | "title" : "Trousers" 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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/Generated.xcconfig: -------------------------------------------------------------------------------- 1 | // This is a generated file; do not edit or check into version control. 2 | FLUTTER_ROOT=D:\Program_Files\FlutterSDK\flutter_windows_v1.7.8+hotfix.4-stable\flutter 3 | FLUTTER_APPLICATION_PATH=G:\Flutter\GitProjects\flutter_ecommerce\flutter_ecommerce 4 | FLUTTER_TARGET=lib/main.dart 5 | FLUTTER_BUILD_DIR=build 6 | SYMROOT=${SOURCE_ROOT}/../build\ios 7 | FLUTTER_FRAMEWORK_DIR=D:\Program_Files\FlutterSDK\flutter_windows_v1.7.8+hotfix.4-stable\flutter\bin\cache\artifacts\engine\ios 8 | FLUTTER_BUILD_NAME=1.0.0 9 | FLUTTER_BUILD_NUMBER=1 10 | -------------------------------------------------------------------------------- /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 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 18 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 19 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 20 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXCopyFilesBuildPhase section */ 24 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 25 | isa = PBXCopyFilesBuildPhase; 26 | buildActionMask = 2147483647; 27 | dstPath = ""; 28 | dstSubfolderSpec = 10; 29 | files = ( 30 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 31 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 32 | ); 33 | name = "Embed Frameworks"; 34 | runOnlyForDeploymentPostprocessing = 0; 35 | }; 36 | /* End PBXCopyFilesBuildPhase section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 40 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 41 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 42 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 43 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 44 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 45 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 46 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 47 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 48 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 49 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 51 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 52 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 53 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 62 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | /* End PBXFrameworksBuildPhase section */ 67 | 68 | /* Begin PBXGroup section */ 69 | 9740EEB11CF90186004384FC /* Flutter */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 3B80C3931E831B6300D905FE /* App.framework */, 73 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 74 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 75 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 76 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 77 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 78 | ); 79 | name = Flutter; 80 | sourceTree = ""; 81 | }; 82 | 97C146E51CF9000F007C117D = { 83 | isa = PBXGroup; 84 | children = ( 85 | 9740EEB11CF90186004384FC /* Flutter */, 86 | 97C146F01CF9000F007C117D /* Runner */, 87 | 97C146EF1CF9000F007C117D /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | 97C146EF1CF9000F007C117D /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 97C146EE1CF9000F007C117D /* Runner.app */, 95 | ); 96 | name = Products; 97 | sourceTree = ""; 98 | }; 99 | 97C146F01CF9000F007C117D /* Runner */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 103 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 104 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 105 | 97C147021CF9000F007C117D /* Info.plist */, 106 | 97C146F11CF9000F007C117D /* Supporting Files */, 107 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 108 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 109 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 110 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 111 | ); 112 | path = Runner; 113 | sourceTree = ""; 114 | }; 115 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | ); 119 | name = "Supporting Files"; 120 | sourceTree = ""; 121 | }; 122 | /* End PBXGroup section */ 123 | 124 | /* Begin PBXNativeTarget section */ 125 | 97C146ED1CF9000F007C117D /* Runner */ = { 126 | isa = PBXNativeTarget; 127 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 128 | buildPhases = ( 129 | 9740EEB61CF901F6004384FC /* Run Script */, 130 | 97C146EA1CF9000F007C117D /* Sources */, 131 | 97C146EB1CF9000F007C117D /* Frameworks */, 132 | 97C146EC1CF9000F007C117D /* Resources */, 133 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 134 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 135 | ); 136 | buildRules = ( 137 | ); 138 | dependencies = ( 139 | ); 140 | name = Runner; 141 | productName = Runner; 142 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 143 | productType = "com.apple.product-type.application"; 144 | }; 145 | /* End PBXNativeTarget section */ 146 | 147 | /* Begin PBXProject section */ 148 | 97C146E61CF9000F007C117D /* Project object */ = { 149 | isa = PBXProject; 150 | attributes = { 151 | LastUpgradeCheck = 1020; 152 | ORGANIZATIONNAME = "The Chromium Authors"; 153 | TargetAttributes = { 154 | 97C146ED1CF9000F007C117D = { 155 | CreatedOnToolsVersion = 7.3.1; 156 | LastSwiftMigration = 0910; 157 | }; 158 | }; 159 | }; 160 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 161 | compatibilityVersion = "Xcode 3.2"; 162 | developmentRegion = en; 163 | hasScannedForEncodings = 0; 164 | knownRegions = ( 165 | en, 166 | Base, 167 | ); 168 | mainGroup = 97C146E51CF9000F007C117D; 169 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 170 | projectDirPath = ""; 171 | projectRoot = ""; 172 | targets = ( 173 | 97C146ED1CF9000F007C117D /* Runner */, 174 | ); 175 | }; 176 | /* End PBXProject section */ 177 | 178 | /* Begin PBXResourcesBuildPhase section */ 179 | 97C146EC1CF9000F007C117D /* Resources */ = { 180 | isa = PBXResourcesBuildPhase; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 184 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 185 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 186 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 187 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 188 | ); 189 | runOnlyForDeploymentPostprocessing = 0; 190 | }; 191 | /* End PBXResourcesBuildPhase section */ 192 | 193 | /* Begin PBXShellScriptBuildPhase section */ 194 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 195 | isa = PBXShellScriptBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | ); 199 | inputPaths = ( 200 | ); 201 | name = "Thin Binary"; 202 | outputPaths = ( 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | shellPath = /bin/sh; 206 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 207 | }; 208 | 9740EEB61CF901F6004384FC /* Run Script */ = { 209 | isa = PBXShellScriptBuildPhase; 210 | buildActionMask = 2147483647; 211 | files = ( 212 | ); 213 | inputPaths = ( 214 | ); 215 | name = "Run Script"; 216 | outputPaths = ( 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | shellPath = /bin/sh; 220 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 221 | }; 222 | /* End PBXShellScriptBuildPhase section */ 223 | 224 | /* Begin PBXSourcesBuildPhase section */ 225 | 97C146EA1CF9000F007C117D /* Sources */ = { 226 | isa = PBXSourcesBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 230 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | /* End PBXSourcesBuildPhase section */ 235 | 236 | /* Begin PBXVariantGroup section */ 237 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 238 | isa = PBXVariantGroup; 239 | children = ( 240 | 97C146FB1CF9000F007C117D /* Base */, 241 | ); 242 | name = Main.storyboard; 243 | sourceTree = ""; 244 | }; 245 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 246 | isa = PBXVariantGroup; 247 | children = ( 248 | 97C147001CF9000F007C117D /* Base */, 249 | ); 250 | name = LaunchScreen.storyboard; 251 | sourceTree = ""; 252 | }; 253 | /* End PBXVariantGroup section */ 254 | 255 | /* Begin XCBuildConfiguration section */ 256 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 257 | isa = XCBuildConfiguration; 258 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 259 | buildSettings = { 260 | ALWAYS_SEARCH_USER_PATHS = NO; 261 | CLANG_ANALYZER_NONNULL = YES; 262 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 263 | CLANG_CXX_LIBRARY = "libc++"; 264 | CLANG_ENABLE_MODULES = YES; 265 | CLANG_ENABLE_OBJC_ARC = YES; 266 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 267 | CLANG_WARN_BOOL_CONVERSION = YES; 268 | CLANG_WARN_COMMA = YES; 269 | CLANG_WARN_CONSTANT_CONVERSION = YES; 270 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 271 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 272 | CLANG_WARN_EMPTY_BODY = YES; 273 | CLANG_WARN_ENUM_CONVERSION = YES; 274 | CLANG_WARN_INFINITE_RECURSION = YES; 275 | CLANG_WARN_INT_CONVERSION = YES; 276 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 277 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 278 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 279 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 280 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 281 | CLANG_WARN_STRICT_PROTOTYPES = YES; 282 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 283 | CLANG_WARN_UNREACHABLE_CODE = YES; 284 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 285 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 286 | COPY_PHASE_STRIP = NO; 287 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 288 | ENABLE_NS_ASSERTIONS = NO; 289 | ENABLE_STRICT_OBJC_MSGSEND = YES; 290 | GCC_C_LANGUAGE_STANDARD = gnu99; 291 | GCC_NO_COMMON_BLOCKS = YES; 292 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 293 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 294 | GCC_WARN_UNDECLARED_SELECTOR = YES; 295 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 296 | GCC_WARN_UNUSED_FUNCTION = YES; 297 | GCC_WARN_UNUSED_VARIABLE = YES; 298 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 299 | MTL_ENABLE_DEBUG_INFO = NO; 300 | SDKROOT = iphoneos; 301 | TARGETED_DEVICE_FAMILY = "1,2"; 302 | VALIDATE_PRODUCT = YES; 303 | }; 304 | name = Profile; 305 | }; 306 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 307 | isa = XCBuildConfiguration; 308 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 309 | buildSettings = { 310 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 311 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 312 | DEVELOPMENT_TEAM = S8QB4VV633; 313 | ENABLE_BITCODE = NO; 314 | FRAMEWORK_SEARCH_PATHS = ( 315 | "$(inherited)", 316 | "$(PROJECT_DIR)/Flutter", 317 | ); 318 | INFOPLIST_FILE = Runner/Info.plist; 319 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 320 | LIBRARY_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | "$(PROJECT_DIR)/Flutter", 323 | ); 324 | PRODUCT_BUNDLE_IDENTIFIER = com.toastguyz.flutterEcommerce; 325 | PRODUCT_NAME = "$(TARGET_NAME)"; 326 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 327 | SWIFT_VERSION = 4.0; 328 | VERSIONING_SYSTEM = "apple-generic"; 329 | }; 330 | name = Profile; 331 | }; 332 | 97C147031CF9000F007C117D /* Debug */ = { 333 | isa = XCBuildConfiguration; 334 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 335 | buildSettings = { 336 | ALWAYS_SEARCH_USER_PATHS = NO; 337 | CLANG_ANALYZER_NONNULL = YES; 338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 339 | CLANG_CXX_LIBRARY = "libc++"; 340 | CLANG_ENABLE_MODULES = YES; 341 | CLANG_ENABLE_OBJC_ARC = YES; 342 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 343 | CLANG_WARN_BOOL_CONVERSION = YES; 344 | CLANG_WARN_COMMA = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 347 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 348 | CLANG_WARN_EMPTY_BODY = YES; 349 | CLANG_WARN_ENUM_CONVERSION = YES; 350 | CLANG_WARN_INFINITE_RECURSION = YES; 351 | CLANG_WARN_INT_CONVERSION = YES; 352 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 353 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 354 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 355 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 356 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 357 | CLANG_WARN_STRICT_PROTOTYPES = YES; 358 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 359 | CLANG_WARN_UNREACHABLE_CODE = YES; 360 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 361 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 362 | COPY_PHASE_STRIP = NO; 363 | DEBUG_INFORMATION_FORMAT = dwarf; 364 | ENABLE_STRICT_OBJC_MSGSEND = YES; 365 | ENABLE_TESTABILITY = YES; 366 | GCC_C_LANGUAGE_STANDARD = gnu99; 367 | GCC_DYNAMIC_NO_PIC = NO; 368 | GCC_NO_COMMON_BLOCKS = YES; 369 | GCC_OPTIMIZATION_LEVEL = 0; 370 | GCC_PREPROCESSOR_DEFINITIONS = ( 371 | "DEBUG=1", 372 | "$(inherited)", 373 | ); 374 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 375 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 376 | GCC_WARN_UNDECLARED_SELECTOR = YES; 377 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 378 | GCC_WARN_UNUSED_FUNCTION = YES; 379 | GCC_WARN_UNUSED_VARIABLE = YES; 380 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 381 | MTL_ENABLE_DEBUG_INFO = YES; 382 | ONLY_ACTIVE_ARCH = YES; 383 | SDKROOT = iphoneos; 384 | TARGETED_DEVICE_FAMILY = "1,2"; 385 | }; 386 | name = Debug; 387 | }; 388 | 97C147041CF9000F007C117D /* Release */ = { 389 | isa = XCBuildConfiguration; 390 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 391 | buildSettings = { 392 | ALWAYS_SEARCH_USER_PATHS = NO; 393 | CLANG_ANALYZER_NONNULL = YES; 394 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 395 | CLANG_CXX_LIBRARY = "libc++"; 396 | CLANG_ENABLE_MODULES = YES; 397 | CLANG_ENABLE_OBJC_ARC = YES; 398 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 399 | CLANG_WARN_BOOL_CONVERSION = YES; 400 | CLANG_WARN_COMMA = YES; 401 | CLANG_WARN_CONSTANT_CONVERSION = YES; 402 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 403 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 404 | CLANG_WARN_EMPTY_BODY = YES; 405 | CLANG_WARN_ENUM_CONVERSION = YES; 406 | CLANG_WARN_INFINITE_RECURSION = YES; 407 | CLANG_WARN_INT_CONVERSION = YES; 408 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 409 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 410 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 412 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 413 | CLANG_WARN_STRICT_PROTOTYPES = YES; 414 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 415 | CLANG_WARN_UNREACHABLE_CODE = YES; 416 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 417 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 418 | COPY_PHASE_STRIP = NO; 419 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 420 | ENABLE_NS_ASSERTIONS = NO; 421 | ENABLE_STRICT_OBJC_MSGSEND = YES; 422 | GCC_C_LANGUAGE_STANDARD = gnu99; 423 | GCC_NO_COMMON_BLOCKS = YES; 424 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 425 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 426 | GCC_WARN_UNDECLARED_SELECTOR = YES; 427 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 428 | GCC_WARN_UNUSED_FUNCTION = YES; 429 | GCC_WARN_UNUSED_VARIABLE = YES; 430 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 431 | MTL_ENABLE_DEBUG_INFO = NO; 432 | SDKROOT = iphoneos; 433 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 434 | TARGETED_DEVICE_FAMILY = "1,2"; 435 | VALIDATE_PRODUCT = YES; 436 | }; 437 | name = Release; 438 | }; 439 | 97C147061CF9000F007C117D /* Debug */ = { 440 | isa = XCBuildConfiguration; 441 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 442 | buildSettings = { 443 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 444 | CLANG_ENABLE_MODULES = YES; 445 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 446 | ENABLE_BITCODE = NO; 447 | FRAMEWORK_SEARCH_PATHS = ( 448 | "$(inherited)", 449 | "$(PROJECT_DIR)/Flutter", 450 | ); 451 | INFOPLIST_FILE = Runner/Info.plist; 452 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 453 | LIBRARY_SEARCH_PATHS = ( 454 | "$(inherited)", 455 | "$(PROJECT_DIR)/Flutter", 456 | ); 457 | PRODUCT_BUNDLE_IDENTIFIER = com.toastguyz.flutterEcommerce; 458 | PRODUCT_NAME = "$(TARGET_NAME)"; 459 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 460 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 461 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 462 | SWIFT_VERSION = 4.0; 463 | VERSIONING_SYSTEM = "apple-generic"; 464 | }; 465 | name = Debug; 466 | }; 467 | 97C147071CF9000F007C117D /* Release */ = { 468 | isa = XCBuildConfiguration; 469 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 470 | buildSettings = { 471 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 472 | CLANG_ENABLE_MODULES = YES; 473 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 474 | ENABLE_BITCODE = NO; 475 | FRAMEWORK_SEARCH_PATHS = ( 476 | "$(inherited)", 477 | "$(PROJECT_DIR)/Flutter", 478 | ); 479 | INFOPLIST_FILE = Runner/Info.plist; 480 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 481 | LIBRARY_SEARCH_PATHS = ( 482 | "$(inherited)", 483 | "$(PROJECT_DIR)/Flutter", 484 | ); 485 | PRODUCT_BUNDLE_IDENTIFIER = com.toastguyz.flutterEcommerce; 486 | PRODUCT_NAME = "$(TARGET_NAME)"; 487 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 488 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 489 | SWIFT_VERSION = 4.0; 490 | VERSIONING_SYSTEM = "apple-generic"; 491 | }; 492 | name = Release; 493 | }; 494 | /* End XCBuildConfiguration section */ 495 | 496 | /* Begin XCConfigurationList section */ 497 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 498 | isa = XCConfigurationList; 499 | buildConfigurations = ( 500 | 97C147031CF9000F007C117D /* Debug */, 501 | 97C147041CF9000F007C117D /* Release */, 502 | 249021D3217E4FDB00AE95B9 /* Profile */, 503 | ); 504 | defaultConfigurationIsVisible = 0; 505 | defaultConfigurationName = Release; 506 | }; 507 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 508 | isa = XCConfigurationList; 509 | buildConfigurations = ( 510 | 97C147061CF9000F007C117D /* Debug */, 511 | 97C147071CF9000F007C117D /* Release */, 512 | 249021D4217E4FDB00AE95B9 /* Profile */, 513 | ); 514 | defaultConfigurationIsVisible = 0; 515 | defaultConfigurationName = Release; 516 | }; 517 | /* End XCConfigurationList section */ 518 | 519 | }; 520 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 521 | } 522 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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/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: [UIApplicationLaunchOptionsKey: 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/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/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/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/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/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/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/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/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/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/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/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/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/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/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/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/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/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/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/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/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/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/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/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/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/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/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/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/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/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/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/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toastguyz/flutter-ecommerce/6493756005c53a0c6c3a8a6042c90167bd91ff79/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/GeneratedPluginRegistrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #ifndef GeneratedPluginRegistrant_h 6 | #define GeneratedPluginRegistrant_h 7 | 8 | #import 9 | 10 | @interface GeneratedPluginRegistrant : NSObject 11 | + (void)registerWithRegistry:(NSObject*)registry; 12 | @end 13 | 14 | #endif /* GeneratedPluginRegistrant_h */ 15 | -------------------------------------------------------------------------------- /ios/Runner/GeneratedPluginRegistrant.m: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #import "GeneratedPluginRegistrant.h" 6 | #import 7 | 8 | @implementation GeneratedPluginRegistrant 9 | 10 | + (void)registerWithRegistry:(NSObject*)registry { 11 | [FLTSharedPreferencesPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTSharedPreferencesPlugin"]]; 12 | } 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /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_ecommerce 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" -------------------------------------------------------------------------------- /lib/constants.dart: -------------------------------------------------------------------------------- 1 | const String YOUR_WEB_API_KEY="YOUR_KEY"; 2 | const String YOUR_FIREBASE_DATABASE_PATH="YOUR_FIREBASE_DATABASE_PATH"; -------------------------------------------------------------------------------- /lib/helpers/custom_route.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/src/material/page_transitions_theme.dart'; 3 | 4 | class CustomRoute extends MaterialPageRoute{ 5 | 6 | CustomRoute({WidgetBuilder builder,RouteSettings settings}):super(builder:builder,settings:settings); 7 | 8 | @override 9 | Widget buildTransitions(BuildContext context, Animation animation, Animation secondaryAnimation, Widget child) { 10 | if(settings.isInitialRoute){ 11 | return child; 12 | } 13 | 14 | return FadeTransition(opacity: animation,child: child,); 15 | // return super.buildTransitions(context, animation, secondaryAnimation, child); 16 | } 17 | } 18 | 19 | class CustomPageTransitionsBuilder extends PageTransitionsBuilder{ 20 | @override 21 | Widget buildTransitions(PageRoute pageRoute,BuildContext context, Animation animation, Animation secondaryAnimation, Widget child) { 22 | if(pageRoute.settings.isInitialRoute){ 23 | return child; 24 | } 25 | 26 | return FadeTransition(opacity: animation,child: child,); 27 | } 28 | } -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_ecommerce/helpers/custom_route.dart'; 3 | import 'package:flutter_ecommerce/providers/auth.dart'; 4 | import 'package:flutter_ecommerce/providers/cart.dart'; 5 | import 'package:flutter_ecommerce/providers/orders.dart'; 6 | import 'package:flutter_ecommerce/providers/products.dart'; 7 | import 'package:flutter_ecommerce/screens/auth_screen.dart'; 8 | import 'package:flutter_ecommerce/screens/cart_screen.dart'; 9 | import 'package:flutter_ecommerce/screens/edit_product_screen.dart'; 10 | import 'package:flutter_ecommerce/screens/orders_screen.dart'; 11 | import 'package:flutter_ecommerce/screens/splash_screen.dart'; 12 | import 'package:flutter_ecommerce/screens/user_products_screen.dart'; 13 | import 'package:provider/provider.dart'; 14 | 15 | import './screens/products_overview_screen.dart'; 16 | import './screens/product_detail_screen.dart'; 17 | 18 | void main() => runApp(MyApp()); 19 | 20 | class MyApp extends StatelessWidget { 21 | @override 22 | Widget build(BuildContext context) { 23 | // return ChangeNotifierProvider( 24 | // builder: (BuildContext context) => Products(), 25 | return MultiProvider( 26 | providers: [ 27 | ChangeNotifierProvider.value( 28 | value: Auth(), 29 | ), 30 | ChangeNotifierProxyProvider( 31 | builder: (context, auth, previousProducts) => Products( 32 | auth.token, 33 | auth.userId, 34 | previousProducts == null ? [] : previousProducts.items), 35 | ), 36 | ChangeNotifierProxyProvider( 37 | builder: (context, auth, previousOrders) => Orders(auth.token, 38 | auth.userId, previousOrders == null ? [] : previousOrders.orders), 39 | ), 40 | ChangeNotifierProvider.value( 41 | value: Cart(), 42 | ), 43 | ], 44 | child: Consumer( 45 | builder: (BuildContext context, Auth auth, Widget child) { 46 | return MaterialApp( 47 | debugShowCheckedModeBanner: false, 48 | title: 'E-Store', 49 | theme: ThemeData( 50 | primarySwatch: Colors.green, 51 | accentColor: Colors.redAccent, 52 | fontFamily: 'Lato', 53 | pageTransitionsTheme: PageTransitionsTheme(builders: { 54 | TargetPlatform.android: CustomPageTransitionsBuilder(), 55 | TargetPlatform.iOS: CustomPageTransitionsBuilder(), 56 | }), 57 | ), 58 | home: auth.isAuth 59 | ? ProductsOverviewScreen() 60 | : FutureBuilder( 61 | future: auth.tryAutoLogin(), 62 | builder: (BuildContext context, AsyncSnapshot snapshot) => 63 | snapshot.connectionState == ConnectionState.waiting 64 | ? SplashScreen() 65 | : AuthScreen(), 66 | ), 67 | routes: { 68 | ProductDetailScreen.routeName: (ctx) => ProductDetailScreen(), 69 | CartScreen.routeName: (ctx) => CartScreen(), 70 | OrdersScreen.routeName: (ctx) => OrdersScreen(), 71 | UserProductsScreen.routeName: (ctx) => UserProductsScreen(), 72 | EditProductScreen.routeName: (ctx) => EditProductScreen(), 73 | }); 74 | }, 75 | ), 76 | ); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /lib/models/http_exception.dart: -------------------------------------------------------------------------------- 1 | class HttpException implements Exception { 2 | final String message; 3 | 4 | HttpException(this.message); 5 | 6 | @override 7 | String toString() { 8 | return message; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /lib/providers/auth.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_ecommerce/constants.dart'; 6 | import 'package:flutter_ecommerce/models/http_exception.dart'; 7 | import 'package:http/http.dart' as http; 8 | import 'package:shared_preferences/shared_preferences.dart'; 9 | 10 | class Auth with ChangeNotifier { 11 | String _token; 12 | DateTime _expiryDate; 13 | String _userId; 14 | Timer _authTimer; 15 | 16 | bool get isAuth { 17 | return _token != null; 18 | } 19 | 20 | String get token { 21 | if (_expiryDate != null && 22 | _expiryDate.isAfter(DateTime.now()) && 23 | _token != null) { 24 | return _token; 25 | } 26 | 27 | return null; 28 | } 29 | 30 | String get userId { 31 | return _userId; 32 | } 33 | 34 | /*Future _authenticate(String email, String password, String url) async { 35 | try { 36 | final response = await http.post(url, 37 | body: json.encode({ 38 | "email": email, 39 | "password": password, 40 | "returnSecureToken": true, 41 | })); 42 | 43 | final responseData = json.decode(response.body); 44 | if (responseData["error"] != null) { 45 | throw HttpException(responseData["error"]["message"]); 46 | } 47 | 48 | _token = responseData["idToken"]; 49 | _userId = responseData["localId"]; 50 | _expiryDate = DateTime.now() 51 | .add(Duration(seconds: int.parse(responseData["expiresIn"]))); 52 | 53 | _autoLogout(); 54 | notifyListeners(); 55 | 56 | final prefs = await SharedPreferences.getInstance(); 57 | final userData = json.encode( 58 | {"token": _token, "userId": _userId, "expiryDate": DateTime.now().toIso8601String}); 59 | prefs.setString("userData", userData); 60 | } catch (error) { 61 | throw error; 62 | } 63 | }*/ 64 | 65 | /*Future signUp(String email, String password) async { 66 | const url = 67 | "https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=${YOUR_KEY}"; 68 | 69 | return _authenticate(email, password, url); 70 | } 71 | 72 | Future login(String email, String password) async { 73 | const url = 74 | "https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=${YOUR_KEY}"; 75 | 76 | return _authenticate(email, password, url); 77 | }*/ 78 | 79 | Future signUp(String email, String password) async { 80 | const urlSegment = "accounts:signUp"; 81 | 82 | return _authenticate(email, password, urlSegment); 83 | } 84 | 85 | Future login(String email, String password) async { 86 | const urlSegment = "accounts:signInWithPassword"; 87 | 88 | return _authenticate(email, password, urlSegment); 89 | } 90 | 91 | Future _authenticate( 92 | String email, String password, String urlSegment) async { 93 | final url = 94 | 'https://identitytoolkit.googleapis.com/v1/$urlSegment?key=${YOUR_WEB_API_KEY}'; 95 | try { 96 | final response = await http.post( 97 | url, 98 | body: json.encode( 99 | { 100 | 'email': email, 101 | 'password': password, 102 | 'returnSecureToken': true, 103 | }, 104 | ), 105 | ); 106 | final responseData = json.decode(response.body); 107 | if (responseData['error'] != null) { 108 | throw HttpException(responseData['error']['message']); 109 | } 110 | _token = responseData['idToken']; 111 | _userId = responseData['localId']; 112 | _expiryDate = DateTime.now().add( 113 | Duration( 114 | seconds: int.parse( 115 | responseData['expiresIn'], 116 | ), 117 | ), 118 | ); 119 | _autoLogout(); 120 | notifyListeners(); 121 | final prefs = await SharedPreferences.getInstance(); 122 | final userData = json.encode( 123 | { 124 | 'token': _token, 125 | 'userId': _userId, 126 | 'expiryDate': _expiryDate.toIso8601String(), 127 | }, 128 | ); 129 | prefs.setString('userData', userData); 130 | } catch (error) { 131 | throw error; 132 | } 133 | } 134 | 135 | Future tryAutoLogin() async { 136 | final prefs = await SharedPreferences.getInstance(); 137 | 138 | if (!prefs.containsKey("userData")) { 139 | return false; 140 | } 141 | 142 | final extractedUserData = 143 | json.decode(prefs.getString("userData")) as Map; 144 | final expiryDate = DateTime.parse(extractedUserData["expiryDate"]); 145 | 146 | if (expiryDate.isBefore(DateTime.now())) { 147 | return false; 148 | } 149 | 150 | if (expiryDate.isBefore(DateTime.now())) { 151 | return false; 152 | } 153 | 154 | _token = extractedUserData["token"]; 155 | _userId = extractedUserData["userId"]; 156 | _expiryDate = expiryDate; 157 | notifyListeners(); 158 | _autoLogout(); 159 | 160 | return true; 161 | } 162 | 163 | Future logOut() async { 164 | _token = null; 165 | _userId = null; 166 | _expiryDate = null; 167 | if (_authTimer != null) { 168 | _authTimer.cancel(); 169 | _authTimer = null; 170 | } 171 | notifyListeners(); 172 | 173 | final prefs = await SharedPreferences.getInstance(); 174 | prefs.remove("userData"); 175 | } 176 | 177 | void _autoLogout() { 178 | if (_authTimer != null) { 179 | _authTimer.cancel(); 180 | } 181 | final timeToExpiry = _expiryDate.difference(DateTime.now()).inSeconds; 182 | _authTimer = Timer(Duration(seconds: timeToExpiry), () { 183 | logOut(); 184 | }); 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /lib/providers/cart.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class CartItem { 4 | final String Id; 5 | final String title; 6 | final int quanity; 7 | final double price; 8 | 9 | CartItem( 10 | {@required this.Id, 11 | @required this.title, 12 | @required this.quanity, 13 | @required this.price}); 14 | } 15 | 16 | class Cart with ChangeNotifier { 17 | Map _items = {}; 18 | 19 | Map get items { 20 | return {..._items}; 21 | } 22 | 23 | int get itemCount { 24 | return _items.length; 25 | } 26 | 27 | double get totalAmount { 28 | var total = 0.0; 29 | 30 | _items.forEach((key, cartItem) { 31 | total += cartItem.quanity * cartItem.price; 32 | }); 33 | 34 | return total; 35 | } 36 | 37 | void addItem(String productId, String title, double price) { 38 | if (_items.containsKey(productId)) { 39 | // change quantity... 40 | _items.update( 41 | productId, 42 | (existingCardItem) => CartItem( 43 | Id: existingCardItem.Id, 44 | title: existingCardItem.title, 45 | price: existingCardItem.price, 46 | quanity: existingCardItem.quanity + 1)); 47 | } else { 48 | _items.putIfAbsent( 49 | productId, 50 | () => CartItem( 51 | Id: DateTime.now().toString(), 52 | title: title, 53 | price: price, 54 | quanity: 1)); 55 | } 56 | notifyListeners(); 57 | } 58 | 59 | void removeItem(String productId) { 60 | _items.remove(productId); 61 | notifyListeners(); 62 | } 63 | 64 | void removeSingleItem(String productId) { 65 | if (!_items.containsKey(productId)) { 66 | return; 67 | } 68 | 69 | if (_items[productId].quanity > 1) { 70 | // reduce quantity... 71 | 72 | _items.update( 73 | productId, 74 | (existingCardItem) => CartItem( 75 | Id: existingCardItem.Id, 76 | title: existingCardItem.title, 77 | price: existingCardItem.price, 78 | quanity: existingCardItem.quanity - 1)); 79 | } else { 80 | _items.remove(productId); 81 | } 82 | 83 | notifyListeners(); 84 | } 85 | 86 | void clear() { 87 | _items = {}; 88 | notifyListeners(); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /lib/providers/orders.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_ecommerce/constants.dart'; 5 | import 'package:flutter_ecommerce/providers/cart.dart'; 6 | import 'package:http/http.dart' as http; 7 | 8 | class OrderItem { 9 | final String id; 10 | final double amount; 11 | final List products; 12 | final DateTime dateTime; 13 | 14 | OrderItem( 15 | {@required this.id, 16 | @required this.amount, 17 | @required this.products, 18 | @required this.dateTime}); 19 | } 20 | 21 | class Orders with ChangeNotifier { 22 | List _orders = []; 23 | 24 | final String authToken; 25 | final String userId; 26 | Orders(this.authToken,this.userId,this._orders); 27 | 28 | List get orders { 29 | return [..._orders]; 30 | } 31 | 32 | Future addOrder(List cartProducts, double total) async { 33 | final url = "${YOUR_FIREBASE_DATABASE_PATH}/$userId.json?auth=$authToken"; 34 | final timeStamp = DateTime.now(); 35 | 36 | var response = await http.post(url, 37 | body: json.encode({ 38 | "amount": total, 39 | "dateTime": timeStamp.toIso8601String(), 40 | "products": cartProducts 41 | .map((cartProduct) => { 42 | "id": cartProduct.Id, 43 | "title": cartProduct.title, 44 | "quanity": cartProduct.quanity, 45 | "price": cartProduct.price, 46 | }) 47 | .toList(), 48 | })); 49 | 50 | _orders.insert( 51 | 0, 52 | OrderItem( 53 | id: json.decode(response.body)["name"], 54 | amount: total, 55 | products: cartProducts, 56 | dateTime: timeStamp, 57 | )); 58 | notifyListeners(); 59 | } 60 | 61 | Future fetchAndSetOrders() async { 62 | final url = "${YOUR_FIREBASE_DATABASE_PATH}/orders/$userId.json?auth=$authToken"; 63 | final response = await http.get(url); 64 | print(json.decode(response.body)); 65 | 66 | final extractedData = json.decode(response.body) as Map; 67 | if (extractedData == null) { 68 | return; 69 | } 70 | 71 | final List loadedOrders = []; 72 | extractedData.forEach((orderId, orderData) { 73 | loadedOrders.add(OrderItem( 74 | id: orderId, 75 | amount: orderData["amount"], 76 | dateTime: DateTime.parse(orderData["dateTime"]), 77 | products: (orderData["products"] as List) 78 | .map((item) => CartItem( 79 | Id: item["id"], 80 | title: item["title"], 81 | quanity: item["quanity"], 82 | price: item["price"])) 83 | .toList(), 84 | )); 85 | }); 86 | 87 | _orders = loadedOrders; 88 | notifyListeners(); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /lib/providers/product.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/foundation.dart'; 4 | import 'package:flutter_ecommerce/constants.dart'; 5 | import 'package:http/http.dart' as http; 6 | 7 | class Product with ChangeNotifier { 8 | final String id; 9 | final String title; 10 | final String description; 11 | final double price; 12 | final String imageUrl; 13 | bool isFavorite; 14 | 15 | Product({ 16 | @required this.id, 17 | @required this.title, 18 | @required this.description, 19 | @required this.price, 20 | @required this.imageUrl, 21 | this.isFavorite = false, 22 | }); 23 | 24 | void toggleFavouriteStatus(String authToken, String userId) async { 25 | final oldStatus = isFavorite; 26 | 27 | isFavorite = !isFavorite; 28 | notifyListeners(); 29 | 30 | final url = "${YOUR_FIREBASE_DATABASE_PATH}/userFavourites/$userId/$id.json?auth=$authToken"; 31 | try { 32 | /*final response = await http.patch(url, 33 | body: json.encode({ 34 | "isFavorite": isFavorite, 35 | }));*/ 36 | 37 | final response = await http.put(url, 38 | body: json.encode({ 39 | isFavorite, 40 | })); 41 | 42 | print("hello"); 43 | if (response.statusCode >= 400) { 44 | print("hello1"); 45 | _setFavValue(oldStatus); 46 | } 47 | } catch (error) { 48 | print("hello2"); 49 | print("error : ${error.toString()}"); 50 | _setFavValue(oldStatus); 51 | } 52 | } 53 | 54 | void _setFavValue(bool oldStatus) { 55 | isFavorite = oldStatus; 56 | notifyListeners(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/providers/products.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_ecommerce/constants.dart'; 5 | import 'package:flutter_ecommerce/models/http_exception.dart'; 6 | import 'package:flutter_ecommerce/providers/product.dart'; 7 | import 'package:http/http.dart' as http; 8 | 9 | class Products with ChangeNotifier { 10 | List _items = []; 11 | 12 | final String authToken; 13 | final String userId; 14 | 15 | Products(this.authToken, this.userId, this._items); 16 | 17 | List get items { 18 | return [..._items]; 19 | } 20 | 21 | List get favouriteItems { 22 | return _items.where((prodItem) => prodItem.isFavorite).toList(); 23 | } 24 | 25 | Product findById(String productId) { 26 | return _items.firstWhere((prod) => prod.id == productId); 27 | } 28 | 29 | /*Future addProduct(Product product) { 30 | const url = "${YOUR_FIREBASE_DATABASE_PATH}/products.json"; 31 | http 32 | .post(url, 33 | body: json.encode({ 34 | "title": product.title, 35 | "price": product.price, 36 | "imageUrl": product.imageUrl, 37 | "description": product.description, 38 | "isFavorite": product.isFavorite, 39 | })) 40 | .then((response) { 41 | _items.add(Product( 42 | id: json.decode(response.body)["name"], 43 | title: product.title, 44 | price: product.price, 45 | imageUrl: product.imageUrl, 46 | description: product.description)); 47 | notifyListeners(); 48 | }).catchError((onError) { 49 | print("onError : ${onError}"); 50 | throw onError; 51 | }); 52 | }*/ 53 | 54 | Future addProduct(Product product) async { 55 | final url = 56 | "${YOUR_FIREBASE_DATABASE_PATH}/products.json?auth=$authToken"; 57 | 58 | try { 59 | var response = await http.post(url, 60 | body: json.encode({ 61 | "title": product.title, 62 | "price": product.price, 63 | "imageUrl": product.imageUrl, 64 | "description": product.description, 65 | "creatorId": userId, 66 | })); 67 | 68 | _items.add(Product( 69 | id: json.decode(response.body)["name"], 70 | title: product.title, 71 | price: product.price, 72 | imageUrl: product.imageUrl, 73 | description: product.description)); 74 | notifyListeners(); 75 | } catch (error) { 76 | print(error); 77 | throw error; 78 | } 79 | } 80 | 81 | Future fetchAndSetProducts([bool filterByUser = false]) async { 82 | var url; 83 | if (filterByUser) { 84 | url = 85 | '${YOUR_FIREBASE_DATABASE_PATH}/products.json?auth=$authToken&orderBy="creatorId"&equalTo="$userId"'; 86 | } else { 87 | url = 88 | '${YOUR_FIREBASE_DATABASE_PATH}/products.json?auth=$authToken'; 89 | } 90 | 91 | try { 92 | final response = await http.get(url); 93 | 94 | final extractedData = json.decode(response.body) as Map; 95 | if (extractedData == null) { 96 | return; 97 | } 98 | 99 | final favUrl = 100 | "${YOUR_FIREBASE_DATABASE_PATH}/userFavourites/$userId.json?auth=$authToken"; 101 | final favResponse = await http.get(favUrl); 102 | final favData = json.decode(favResponse.body); 103 | 104 | List loadedProducts = []; 105 | extractedData.forEach((prodId, prodData) { 106 | loadedProducts.add(Product( 107 | id: prodId, 108 | title: prodData["title"], 109 | description: prodData["description"], 110 | price: prodData["price"], 111 | imageUrl: prodData["imageUrl"], 112 | isFavorite: favData == null ? false : favData[prodId] ?? false, 113 | )); 114 | }); 115 | _items = loadedProducts; 116 | notifyListeners(); 117 | } catch (error) { 118 | throw error; 119 | } 120 | } 121 | 122 | Future updateProduct(String id, Product newProduct) async { 123 | final prodIndex = _items.indexWhere((prod) => prod.id == id); 124 | if (prodIndex >= 0) { 125 | final url = 126 | "${YOUR_FIREBASE_DATABASE_PATH}/products/$id.json?auth=$authToken"; 127 | await http.patch(url, 128 | body: json.encode({ 129 | "title": newProduct.title, 130 | "description": newProduct.description, 131 | "price": newProduct.price, 132 | "imageUrl": newProduct.imageUrl, 133 | })); 134 | 135 | _items[prodIndex] = newProduct; 136 | notifyListeners(); 137 | } else { 138 | print("Failure !!!"); 139 | } 140 | } 141 | 142 | /*void deleteProduct(String productId) { 143 | final url = 144 | "${YOUR_FIREBASE_DATABASE_PATH}/products/$productId.json"; 145 | 146 | final existingProductIndex = 147 | _items.indexWhere((prod) => prod.id == productId); 148 | var existingProduct = _items[existingProductIndex]; 149 | 150 | _items.removeAt(existingProductIndex); 151 | notifyListeners(); 152 | 153 | http.delete(url).then((response) { 154 | if(response.statusCode>=400){ 155 | throw HttpException("Failed to delete product!!"); 156 | } 157 | existingProduct = null; 158 | }).catchError((error) { 159 | print("Error : ${error}"); 160 | 161 | _items.insert(existingProductIndex, existingProduct); 162 | notifyListeners(); 163 | }); 164 | }*/ 165 | 166 | Future deleteProduct(String productId) async { 167 | final url = 168 | "${YOUR_FIREBASE_DATABASE_PATH}/products/$productId.json?auth=$authToken"; 169 | 170 | final existingProductIndex = 171 | _items.indexWhere((prod) => prod.id == productId); 172 | var existingProduct = _items[existingProductIndex]; 173 | 174 | _items.removeAt(existingProductIndex); 175 | notifyListeners(); 176 | 177 | final response = await http.delete(url); 178 | if (response.statusCode >= 400) { 179 | _items.insert(existingProductIndex, existingProduct); 180 | notifyListeners(); 181 | 182 | throw HttpException("Failed to delete product!!"); 183 | } 184 | existingProduct = null; 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /lib/screens/auth_screen.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:provider/provider.dart'; 5 | 6 | import '../providers/auth.dart'; 7 | import '../models/http_exception.dart'; 8 | 9 | enum AuthMode { Signup, Login } 10 | 11 | class AuthScreen extends StatelessWidget { 12 | static const routeName = '/auth'; 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | final deviceSize = MediaQuery.of(context).size; 17 | // final transformConfig = Matrix4.rotationZ(-8 * pi / 180); 18 | // transformConfig.translate(-10.0); 19 | return Scaffold( 20 | // resizeToAvoidBottomInset: false, 21 | body: Stack( 22 | children: [ 23 | Container( 24 | decoration: BoxDecoration( 25 | gradient: LinearGradient( 26 | colors: [ 27 | /*Color.fromRGBO(215, 117, 255, 1).withOpacity(0.5), 28 | Color.fromRGBO(255, 188, 117, 1).withOpacity(0.9),*/ 29 | Color(0xff283c86), 30 | Color(0xff45a247), 31 | ], 32 | begin: Alignment.topLeft, 33 | end: Alignment.bottomRight, 34 | stops: [0, 1], 35 | ), 36 | ), 37 | ), 38 | SingleChildScrollView( 39 | child: Container( 40 | height: deviceSize.height, 41 | width: deviceSize.width, 42 | child: Column( 43 | mainAxisAlignment: MainAxisAlignment.center, 44 | crossAxisAlignment: CrossAxisAlignment.center, 45 | children: [ 46 | Flexible( 47 | child: Container( 48 | margin: EdgeInsets.only(bottom: 20.0), 49 | padding: 50 | EdgeInsets.symmetric(vertical: 8.0, horizontal: 94.0), 51 | transform: Matrix4.rotationZ(-8 * pi / 180) 52 | ..translate(-10.0), 53 | // ..translate(-10.0), 54 | decoration: BoxDecoration( 55 | borderRadius: BorderRadius.circular(20), 56 | color: Colors.lightGreen.shade800, 57 | boxShadow: [ 58 | BoxShadow( 59 | blurRadius: 8, 60 | color: Colors.black26, 61 | offset: Offset(0, 2), 62 | ) 63 | ], 64 | ), 65 | child: Text( 66 | 'MyShop', 67 | style: TextStyle( 68 | color: Theme.of(context).accentTextTheme.title.color, 69 | fontSize: 50, 70 | fontFamily: 'Anton', 71 | fontWeight: FontWeight.normal, 72 | ), 73 | ), 74 | ), 75 | ), 76 | Flexible( 77 | flex: deviceSize.width > 600 ? 2 : 1, 78 | child: AuthCard(), 79 | ), 80 | ], 81 | ), 82 | ), 83 | ), 84 | ], 85 | ), 86 | ); 87 | } 88 | } 89 | 90 | class AuthCard extends StatefulWidget { 91 | const AuthCard({ 92 | Key key, 93 | }) : super(key: key); 94 | 95 | @override 96 | _AuthCardState createState() => _AuthCardState(); 97 | } 98 | 99 | class _AuthCardState extends State 100 | with SingleTickerProviderStateMixin { 101 | final GlobalKey _formKey = GlobalKey(); 102 | AuthMode _authMode = AuthMode.Login; 103 | Map _authData = { 104 | 'email': '', 105 | 'password': '', 106 | }; 107 | var _isLoading = false; 108 | final _passwordController = TextEditingController(); 109 | AnimationController _controller; 110 | Animation _slideAnimation; 111 | Animation _opacityAnimation; 112 | 113 | @override 114 | void initState() { 115 | super.initState(); 116 | _controller = AnimationController( 117 | vsync: this, 118 | duration: Duration( 119 | milliseconds: 300, 120 | ), 121 | ); 122 | _slideAnimation = Tween( 123 | begin: Offset(0, -1.5), 124 | end: Offset(0, 0), 125 | ).animate( 126 | CurvedAnimation( 127 | parent: _controller, 128 | curve: Curves.fastOutSlowIn, 129 | ), 130 | ); 131 | _opacityAnimation = Tween(begin: 0.0, end: 1.0).animate( 132 | CurvedAnimation( 133 | parent: _controller, 134 | curve: Curves.easeIn, 135 | ), 136 | ); 137 | // _heightAnimation.addListener(() => setState(() {})); 138 | } 139 | 140 | @override 141 | void dispose() { 142 | super.dispose(); 143 | _controller.dispose(); 144 | } 145 | 146 | void _showErrorDialog(String message) { 147 | showDialog( 148 | context: context, 149 | builder: (ctx) => AlertDialog( 150 | title: Text('An Error Occurred!'), 151 | content: Text(message), 152 | actions: [ 153 | FlatButton( 154 | child: Text('Okay'), 155 | onPressed: () { 156 | Navigator.of(ctx).pop(); 157 | }, 158 | ) 159 | ], 160 | ), 161 | ); 162 | } 163 | 164 | Future _submit() async { 165 | if (!_formKey.currentState.validate()) { 166 | // Invalid! 167 | return; 168 | } 169 | _formKey.currentState.save(); 170 | setState(() { 171 | _isLoading = true; 172 | }); 173 | try { 174 | if (_authMode == AuthMode.Login) { 175 | // Log user in 176 | await Provider.of(context, listen: false).login( 177 | _authData['email'], 178 | _authData['password'], 179 | ); 180 | } else { 181 | // Sign user up 182 | await Provider.of(context, listen: false).signUp( 183 | _authData['email'], 184 | _authData['password'], 185 | ); 186 | } 187 | } on HttpException catch (error) { 188 | var errorMessage = 'Authentication failed'; 189 | if (error.toString().contains('EMAIL_EXISTS')) { 190 | errorMessage = 'This email address is already in use.'; 191 | } else if (error.toString().contains('INVALID_EMAIL')) { 192 | errorMessage = 'This is not a valid email address'; 193 | } else if (error.toString().contains('WEAK_PASSWORD')) { 194 | errorMessage = 'This password is too weak.'; 195 | } else if (error.toString().contains('EMAIL_NOT_FOUND')) { 196 | errorMessage = 'Could not find a user with that email.'; 197 | } else if (error.toString().contains('INVALID_PASSWORD')) { 198 | errorMessage = 'Invalid password.'; 199 | } 200 | _showErrorDialog(errorMessage); 201 | } catch (error) { 202 | const errorMessage = 203 | 'Could not authenticate you. Please try again later.'; 204 | _showErrorDialog(errorMessage); 205 | } 206 | 207 | setState(() { 208 | _isLoading = false; 209 | }); 210 | } 211 | 212 | void _switchAuthMode() { 213 | if (_authMode == AuthMode.Login) { 214 | setState(() { 215 | _authMode = AuthMode.Signup; 216 | }); 217 | _controller.forward(); 218 | } else { 219 | setState(() { 220 | _authMode = AuthMode.Login; 221 | }); 222 | _controller.reverse(); 223 | } 224 | } 225 | 226 | @override 227 | Widget build(BuildContext context) { 228 | final deviceSize = MediaQuery.of(context).size; 229 | return Card( 230 | shape: RoundedRectangleBorder( 231 | borderRadius: BorderRadius.circular(10.0), 232 | ), 233 | elevation: 8.0, 234 | child: AnimatedContainer( 235 | duration: Duration(milliseconds: 300), 236 | curve: Curves.easeIn, 237 | height: _authMode == AuthMode.Signup ? 320 : 260, 238 | // height: _heightAnimation.value.height, 239 | constraints: 240 | BoxConstraints(minHeight: _authMode == AuthMode.Signup ? 320 : 260), 241 | width: deviceSize.width * 0.75, 242 | padding: EdgeInsets.all(16.0), 243 | child: Form( 244 | key: _formKey, 245 | child: SingleChildScrollView( 246 | child: Column( 247 | children: [ 248 | TextFormField( 249 | decoration: InputDecoration(labelText: 'E-Mail'), 250 | keyboardType: TextInputType.emailAddress, 251 | validator: (value) { 252 | if (value.isEmpty || !value.contains('@')) { 253 | return 'Invalid email!'; 254 | } 255 | }, 256 | onSaved: (value) { 257 | _authData['email'] = value; 258 | }, 259 | ), 260 | TextFormField( 261 | decoration: InputDecoration(labelText: 'Password'), 262 | obscureText: true, 263 | controller: _passwordController, 264 | validator: (value) { 265 | if (value.isEmpty || value.length < 5) { 266 | return 'Password is too short!'; 267 | } 268 | }, 269 | onSaved: (value) { 270 | _authData['password'] = value; 271 | }, 272 | ), 273 | AnimatedContainer( 274 | constraints: BoxConstraints( 275 | minHeight: _authMode == AuthMode.Signup ? 60 : 0, 276 | maxHeight: _authMode == AuthMode.Signup ? 120 : 0, 277 | ), 278 | duration: Duration(milliseconds: 300), 279 | curve: Curves.easeIn, 280 | child: FadeTransition( 281 | opacity: _opacityAnimation, 282 | child: SlideTransition( 283 | position: _slideAnimation, 284 | child: TextFormField( 285 | enabled: _authMode == AuthMode.Signup, 286 | decoration: 287 | InputDecoration(labelText: 'Confirm Password'), 288 | obscureText: true, 289 | validator: _authMode == AuthMode.Signup 290 | ? (value) { 291 | if (value != _passwordController.text) { 292 | return 'Passwords do not match!'; 293 | } 294 | } 295 | : null, 296 | ), 297 | ), 298 | ), 299 | ), 300 | SizedBox( 301 | height: 20, 302 | ), 303 | if (_isLoading) 304 | CircularProgressIndicator() 305 | else 306 | RaisedButton( 307 | child: 308 | Text(_authMode == AuthMode.Login ? 'LOGIN' : 'SIGN UP'), 309 | onPressed: _submit, 310 | shape: RoundedRectangleBorder( 311 | borderRadius: BorderRadius.circular(30), 312 | ), 313 | padding: 314 | EdgeInsets.symmetric(horizontal: 30.0, vertical: 8.0), 315 | color: Theme.of(context).primaryColor, 316 | textColor: Theme.of(context).primaryTextTheme.button.color, 317 | ), 318 | FlatButton( 319 | child: Text( 320 | '${_authMode == AuthMode.Login ? 'SIGNUP' : 'LOGIN'} INSTEAD'), 321 | onPressed: _switchAuthMode, 322 | padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 4), 323 | materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, 324 | textColor: Theme.of(context).primaryColor, 325 | ), 326 | ], 327 | ), 328 | ), 329 | ), 330 | ), 331 | ); 332 | } 333 | } 334 | -------------------------------------------------------------------------------- /lib/screens/cart_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_ecommerce/providers/cart.dart' show Cart; 3 | import 'package:flutter_ecommerce/providers/orders.dart'; 4 | import 'package:provider/provider.dart'; 5 | import 'package:flutter_ecommerce/widgets/cart_item.dart'; 6 | 7 | class CartScreen extends StatelessWidget { 8 | static const routeName = "/cart"; 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | var cart = Provider.of(context); 13 | 14 | return Scaffold( 15 | appBar: AppBar( 16 | title: Text("Your Cart"), 17 | ), 18 | body: Column( 19 | children: [ 20 | Card( 21 | margin: EdgeInsets.all(15.0), 22 | child: Padding( 23 | padding: const EdgeInsets.all(8.0), 24 | child: Row( 25 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 26 | children: [ 27 | Text( 28 | "Total", 29 | style: TextStyle(fontSize: 20.0), 30 | ), 31 | Spacer(), 32 | Chip( 33 | label: Text( 34 | "\$${cart.totalAmount.toStringAsFixed(2)}", 35 | style: TextStyle( 36 | color: 37 | Theme.of(context).primaryTextTheme.title.color), 38 | ), 39 | backgroundColor: Theme.of(context).primaryColor, 40 | ), 41 | OrderButton(cart), 42 | ], 43 | ), 44 | ), 45 | ), 46 | SizedBox( 47 | height: 10.0, 48 | ), 49 | Expanded( 50 | child: ListView.builder( 51 | itemCount: cart.itemCount, 52 | itemBuilder: (BuildContext context, int index) { 53 | return CartItem( 54 | cart.items.values.toList()[index].Id, 55 | cart.items.keys.toList()[index], 56 | cart.items.values.toList()[index].price, 57 | cart.items.values.toList()[index].quanity, 58 | cart.items.values.toList()[index].title); 59 | }, 60 | ), 61 | ), 62 | ], 63 | ), 64 | ); 65 | } 66 | } 67 | 68 | class OrderButton extends StatefulWidget { 69 | final Cart cart; 70 | 71 | OrderButton(this.cart); 72 | 73 | @override 74 | _OrderButtonState createState() => _OrderButtonState(); 75 | } 76 | 77 | class _OrderButtonState extends State { 78 | var _isLoading = false; 79 | 80 | @override 81 | Widget build(BuildContext context) { 82 | return FlatButton( 83 | child: _isLoading ? CircularProgressIndicator() : Text("ORDER NOW"), 84 | textColor: Theme.of(context).primaryColor, 85 | onPressed: widget.cart.totalAmount <= 0 || _isLoading 86 | ? null 87 | : () async { 88 | setState(() { 89 | _isLoading = true; 90 | }); 91 | await Provider.of(context, listen: false).addOrder(widget.cart.items.values.toList(), widget.cart.totalAmount); 92 | widget.cart.clear(); 93 | 94 | setState(() { 95 | _isLoading = false; 96 | }); 97 | }, 98 | ); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /lib/screens/edit_product_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_ecommerce/providers/product.dart'; 3 | import 'package:flutter_ecommerce/providers/products.dart'; 4 | import 'package:provider/provider.dart'; 5 | 6 | class EditProductScreen extends StatefulWidget { 7 | static const routeName = "/edit-product"; 8 | 9 | @override 10 | _EditProductScreenState createState() => _EditProductScreenState(); 11 | } 12 | 13 | class _EditProductScreenState extends State { 14 | var _priceFocusNode = FocusNode(); 15 | var _descriptionFocusNode = FocusNode(); 16 | var _imageUrlFocusNode = FocusNode(); 17 | final _imageUrlController = TextEditingController(); 18 | final _form = GlobalKey(); 19 | var _editedProduct = Product( 20 | id: null, 21 | title: "", 22 | price: 0, 23 | description: "", 24 | imageUrl: "", 25 | ); 26 | var _initValues = { 27 | "title": "", 28 | "price": "", 29 | "imageUrl": "", 30 | "description": "", 31 | }; 32 | var _isInit = true; 33 | var _isLoading = false; 34 | 35 | void _updateImageUrl() { 36 | if (!_imageUrlFocusNode.hasFocus) { 37 | if ((!_imageUrlController.text.startsWith("http") && 38 | !_imageUrlController.text.startsWith("https")) || 39 | (!_imageUrlController.text.endsWith(".png") && 40 | !_imageUrlController.text.endsWith(".jpg") && 41 | !_imageUrlController.text.endsWith(".jpeg") && 42 | !_imageUrlController.text.endsWith(".webp"))) { 43 | return; 44 | } 45 | 46 | setState(() {}); 47 | } 48 | } 49 | 50 | /*void _saveForm() { 51 | final isValid = _form.currentState.validate(); 52 | if (!isValid) { 53 | return; 54 | } 55 | _form.currentState.save(); 56 | 57 | setState(() { 58 | _isLoading = true; 59 | }); 60 | if (_editedProduct.id != null) { 61 | Provider.of(context, listen: false) 62 | .updateProduct(_editedProduct.id, _editedProduct); 63 | 64 | setState(() { 65 | _isLoading = false; 66 | }); 67 | Navigator.of(context).pop(); 68 | } else { 69 | Provider.of(context, listen: false) 70 | .addProduct(_editedProduct) 71 | .catchError((onError) { 72 | showDialog( 73 | context: context, 74 | builder: (context) { 75 | return AlertDialog( 76 | title: Text("Error !!"), 77 | content: 78 | Text("Something went wrong due to : ${onError.toString()}"), 79 | actions: [ 80 | FlatButton( 81 | child: Text("Okay"), 82 | onPressed: () { 83 | Navigator.of(context).pop(); 84 | }, 85 | ), 86 | ], 87 | ); 88 | }); 89 | }).then((_) { 90 | setState(() { 91 | _isLoading = false; 92 | }); 93 | Navigator.of(context).pop(); 94 | }); 95 | } 96 | }*/ 97 | 98 | Future _saveForm() async { 99 | final isValid = _form.currentState.validate(); 100 | if (!isValid) { 101 | return; 102 | } 103 | _form.currentState.save(); 104 | 105 | setState(() { 106 | _isLoading = true; 107 | }); 108 | 109 | if (_editedProduct.id != null) { 110 | await Provider.of(context, listen: false) 111 | .updateProduct(_editedProduct.id, _editedProduct); 112 | } else { 113 | try { 114 | await Provider.of(context, listen: false) 115 | .addProduct(_editedProduct); 116 | } catch (error) { 117 | await showDialog( 118 | context: context, 119 | builder: (context) { 120 | return AlertDialog( 121 | title: Text("Error !!"), 122 | content: 123 | Text("Something went wrong due to : ${error.toString()}"), 124 | actions: [ 125 | FlatButton( 126 | child: Text("Okay"), 127 | onPressed: () { 128 | Navigator.of(context).pop(); 129 | }, 130 | ), 131 | ], 132 | ); 133 | }); 134 | } 135 | /*finally { 136 | setState(() { 137 | _isLoading = false; 138 | }); 139 | Navigator.of(context).pop(); 140 | }*/ 141 | } 142 | 143 | setState(() { 144 | _isLoading = false; 145 | }); 146 | Navigator.of(context).pop(); 147 | } 148 | 149 | @override 150 | void didChangeDependencies() { 151 | if (_isInit) { 152 | final productId = ModalRoute.of(context).settings.arguments as String; 153 | if (productId != null) { 154 | _editedProduct = 155 | Provider.of(context, listen: false).findById(productId); 156 | _initValues = { 157 | "title": _editedProduct.title, 158 | "price": _editedProduct.price.toString(), 159 | "imageUrl": "", 160 | "description": _editedProduct.description, 161 | }; 162 | _imageUrlController.text = _editedProduct.imageUrl; 163 | } 164 | _isInit = false; 165 | } 166 | super.didChangeDependencies(); 167 | } 168 | 169 | @override 170 | void initState() { 171 | _imageUrlFocusNode.addListener(_updateImageUrl); 172 | super.initState(); 173 | } 174 | 175 | @override 176 | void dispose() { 177 | super.dispose(); 178 | _imageUrlFocusNode.removeListener(_updateImageUrl); 179 | _priceFocusNode.dispose(); 180 | _descriptionFocusNode.dispose(); 181 | _imageUrlController.dispose(); 182 | _imageUrlFocusNode.dispose(); 183 | } 184 | 185 | @override 186 | Widget build(BuildContext context) { 187 | return Scaffold( 188 | appBar: AppBar( 189 | title: Text("Edit Product"), 190 | actions: [ 191 | IconButton( 192 | icon: Icon(Icons.done), 193 | onPressed: () { 194 | _saveForm(); 195 | }, 196 | ), 197 | ], 198 | ), 199 | body: _isLoading 200 | ? Center( 201 | child: CircularProgressIndicator(), 202 | ) 203 | : Padding( 204 | padding: const EdgeInsets.all(15.0), 205 | child: Form( 206 | key: _form, 207 | child: ListView( 208 | children: [ 209 | TextFormField( 210 | initialValue: _initValues["title"], 211 | decoration: InputDecoration(labelText: "Title"), 212 | textInputAction: TextInputAction.next, 213 | onFieldSubmitted: (_) { 214 | FocusScope.of(context).requestFocus(_priceFocusNode); 215 | }, 216 | validator: (value) { 217 | if (value.isEmpty) { 218 | return "Title is required!"; 219 | } 220 | }, 221 | onSaved: (value) { 222 | _editedProduct = Product( 223 | id: _editedProduct.id, 224 | isFavorite: _editedProduct.isFavorite, 225 | title: value, 226 | price: _editedProduct.price, 227 | imageUrl: _editedProduct.imageUrl, 228 | description: _editedProduct.description, 229 | ); 230 | }, 231 | ), 232 | TextFormField( 233 | initialValue: _initValues["price"], 234 | focusNode: _priceFocusNode, 235 | decoration: InputDecoration(labelText: "Price"), 236 | textInputAction: TextInputAction.next, 237 | keyboardType: TextInputType.number, 238 | onFieldSubmitted: (_) { 239 | FocusScope.of(context) 240 | .requestFocus(_descriptionFocusNode); 241 | }, 242 | validator: (value) { 243 | if (value.isEmpty) { 244 | return "Price is required!"; 245 | } 246 | if (double.tryParse(value) == null) { 247 | return "Please enter valid price!"; 248 | } 249 | if (double.parse(value) <= 0) { 250 | return "Please enter price greater than 0!"; 251 | } 252 | }, 253 | onSaved: (value) { 254 | _editedProduct = Product( 255 | id: _editedProduct.id, 256 | isFavorite: _editedProduct.isFavorite, 257 | title: _editedProduct.title, 258 | price: double.parse(value), 259 | imageUrl: _editedProduct.imageUrl, 260 | description: _editedProduct.description, 261 | ); 262 | }, 263 | ), 264 | TextFormField( 265 | initialValue: _initValues["description"], 266 | focusNode: _descriptionFocusNode, 267 | decoration: InputDecoration(labelText: "Description"), 268 | maxLines: 3, 269 | keyboardType: TextInputType.multiline, 270 | validator: (value) { 271 | if (value.isEmpty) { 272 | return "Description is required!"; 273 | } 274 | if (value.length <= 10) { 275 | return "Description should be at least 10 characters long!"; 276 | } 277 | }, 278 | onSaved: (value) { 279 | _editedProduct = Product( 280 | id: _editedProduct.id, 281 | isFavorite: _editedProduct.isFavorite, 282 | title: _editedProduct.title, 283 | price: _editedProduct.price, 284 | imageUrl: _editedProduct.imageUrl, 285 | description: value, 286 | ); 287 | }, 288 | ), 289 | Row( 290 | crossAxisAlignment: CrossAxisAlignment.end, 291 | children: [ 292 | Container( 293 | width: 100.0, 294 | height: 100.0, 295 | margin: EdgeInsets.only(top: 10.0, right: 10.0), 296 | decoration: BoxDecoration( 297 | border: Border.all(width: 1.0, color: Colors.grey), 298 | ), 299 | child: _imageUrlController.text.isEmpty 300 | ? Center( 301 | child: Text("Enter URL"), 302 | ) 303 | : FittedBox( 304 | child: Image.network( 305 | _imageUrlController.text, 306 | fit: BoxFit.cover, 307 | ), 308 | ), 309 | ), 310 | Expanded( 311 | child: TextFormField( 312 | controller: _imageUrlController, 313 | decoration: InputDecoration(labelText: "Image URL"), 314 | textInputAction: TextInputAction.done, 315 | keyboardType: TextInputType.url, 316 | focusNode: _imageUrlFocusNode, 317 | onFieldSubmitted: (_) { 318 | _saveForm(); 319 | }, 320 | validator: (value) { 321 | if (value.isEmpty) { 322 | return "Image URL is required!"; 323 | } 324 | if (!value.startsWith("http") && 325 | !value.startsWith("https")) { 326 | return "Please enter a valid Image URL"; 327 | } 328 | if (!value.endsWith(".png") && 329 | !value.endsWith(".jpg") && 330 | !value.endsWith(".jpeg") && 331 | !value.endsWith(".webp")) { 332 | return "Please enter a valid Image URL"; 333 | } 334 | }, 335 | onSaved: (value) { 336 | _editedProduct = Product( 337 | id: _editedProduct.id, 338 | isFavorite: _editedProduct.isFavorite, 339 | title: _editedProduct.title, 340 | price: _editedProduct.price, 341 | imageUrl: value, 342 | description: _editedProduct.description, 343 | ); 344 | }, 345 | ), 346 | ), 347 | ], 348 | ), 349 | ], 350 | ), 351 | ), 352 | ), 353 | ); 354 | } 355 | } 356 | -------------------------------------------------------------------------------- /lib/screens/orders_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_ecommerce/providers/orders.dart' show Orders; 3 | import 'package:flutter_ecommerce/widgets/app_drawer.dart'; 4 | import 'package:provider/provider.dart'; 5 | import 'package:flutter_ecommerce/widgets/order_item.dart'; 6 | 7 | class OrdersScreen extends StatelessWidget { 8 | static const routeName = "/orders"; 9 | 10 | // var _isLoading = false; 11 | 12 | // @override 13 | // void initState() { 14 | // Method-1 15 | 16 | /*Future.delayed(Duration.zero).then((_) async { 17 | setState(() { 18 | _isLoading = true; 19 | }); 20 | await Provider.of(context, listen: false).fetchAndSetOrders(); 21 | setState(() { 22 | _isLoading = false; 23 | }); 24 | });*/ 25 | 26 | // Method-2 27 | 28 | /*_isLoading = true; 29 | 30 | // WILL WORK ONLY DUE TO "listen:false" attribute of provider 31 | Provider.of(context, listen: false).fetchAndSetOrders().then((_) { 32 | setState(() { 33 | _isLoading = false; 34 | }); 35 | });*/ 36 | 37 | // super.initState(); 38 | // } 39 | 40 | @override 41 | Widget build(BuildContext context) { 42 | return Scaffold( 43 | appBar: AppBar( 44 | title: Text("Your Orders"), 45 | ), 46 | drawer: AppDrawer(), 47 | /*body: _isLoading 48 | ? Center( 49 | child: CircularProgressIndicator(), 50 | ) 51 | : ListView.builder( 52 | itemCount: orderData.orders.length, 53 | itemBuilder: (BuildContext context, int index) { 54 | return OrderItem(orderData.orders[index]); 55 | }, 56 | ),*/ 57 | body: FutureBuilder( 58 | future: Provider.of(context, listen: false).fetchAndSetOrders(), 59 | builder: (BuildContext context, AsyncSnapshot snapshot) { 60 | if (snapshot.connectionState == ConnectionState.waiting) { 61 | return Center( 62 | child: CircularProgressIndicator(), 63 | ); 64 | } else { 65 | if (snapshot.error != null) { 66 | return Center( 67 | child: Text("An error occured!!"), 68 | ); 69 | } else { 70 | return Consumer( 71 | builder: 72 | (BuildContext context, Orders orderData, Widget child) { 73 | if (orderData.orders != null) { 74 | if (orderData.orders.length > 0) { 75 | return ListView.builder( 76 | itemCount: orderData.orders.length, 77 | itemBuilder: (BuildContext context, int index) { 78 | return OrderItem(orderData.orders[index]); 79 | }, 80 | ); 81 | } else { 82 | return Center( 83 | child: Text( 84 | "No Data Found!!", 85 | style: TextStyle( 86 | fontSize: 20.0, fontWeight: FontWeight.w500), 87 | ), 88 | ); 89 | } 90 | } else { 91 | return Center( 92 | child: Text( 93 | "No Data Found!!", 94 | style: TextStyle( 95 | fontSize: 20.0, fontWeight: FontWeight.w500), 96 | ), 97 | ); 98 | } 99 | }, 100 | ); 101 | } 102 | } 103 | }, 104 | ), 105 | ); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /lib/screens/product_detail_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_ecommerce/providers/products.dart'; 3 | import 'package:provider/provider.dart'; 4 | 5 | class ProductDetailScreen extends StatelessWidget { 6 | static const routeName = '/product-detail'; 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | final productId = 11 | ModalRoute.of(context).settings.arguments as String; // is the id! 12 | final loadedProduct = 13 | Provider.of(context, listen: false).findById(productId); 14 | 15 | return Scaffold( 16 | /*appBar: AppBar( 17 | title: Text(loadedProduct.title), 18 | ),*/ 19 | body: CustomScrollView( 20 | slivers: [ 21 | SliverAppBar( 22 | expandedHeight: 300, 23 | pinned: true, 24 | flexibleSpace: FlexibleSpaceBar( 25 | title: Text(loadedProduct.title), 26 | background: Hero( 27 | tag: loadedProduct.id, 28 | child: Image.network( 29 | loadedProduct.imageUrl, 30 | fit: BoxFit.cover, 31 | ), 32 | ), 33 | ), 34 | ), 35 | SliverList( 36 | delegate: SliverChildListDelegate([ 37 | SizedBox( 38 | height: 10.0, 39 | ), 40 | Text( 41 | "\$${loadedProduct.price}", 42 | textAlign: TextAlign.center, 43 | style: TextStyle(color: Colors.grey, fontSize: 20.0), 44 | ), 45 | SizedBox( 46 | height: 10.0, 47 | ), 48 | Container( 49 | padding: EdgeInsets.symmetric(horizontal: 10.0), 50 | width: double.infinity, 51 | child: Text( 52 | loadedProduct.description, 53 | textAlign: TextAlign.center, 54 | softWrap: true, 55 | ), 56 | ), 57 | SizedBox( 58 | height: 1000.0, 59 | ), 60 | ]), 61 | ), 62 | ], 63 | ), 64 | ); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/screens/products_overview_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_ecommerce/providers/cart.dart'; 3 | import 'package:flutter_ecommerce/providers/products.dart'; 4 | import 'package:flutter_ecommerce/screens/cart_screen.dart'; 5 | import 'package:flutter_ecommerce/widgets/app_drawer.dart'; 6 | import 'package:flutter_ecommerce/widgets/badge.dart'; 7 | import 'package:flutter_ecommerce/widgets/products_grid.dart'; 8 | import 'package:provider/provider.dart'; 9 | 10 | enum FilterOptions { Favourites, All } 11 | 12 | class ProductsOverviewScreen extends StatefulWidget { 13 | @override 14 | _ProductsOverviewScreenState createState() => _ProductsOverviewScreenState(); 15 | } 16 | 17 | class _ProductsOverviewScreenState extends State { 18 | var _showOnlyFavourites = false; 19 | var _isInit = true; 20 | var _isLoading = false; 21 | 22 | @override 23 | void initState() { 24 | // WON'T WORK 25 | // Provider.of(context).fetchAndSetProducts(); 26 | 27 | // WILL WORK 28 | // Provider.of(context,listen: false).fetchAndSetProducts(); 29 | 30 | // WILL WORK 31 | // Future.delayed(Duration.zero).then((_){ 32 | // Provider.of(context).fetchAndSetProducts(); 33 | // }); 34 | 35 | super.initState(); 36 | } 37 | 38 | @override 39 | void didChangeDependencies() { 40 | if (_isInit) { 41 | setState(() { 42 | _isLoading = true; 43 | }); 44 | 45 | Provider.of(context).fetchAndSetProducts().then((_) { 46 | setState(() { 47 | _isLoading = false; 48 | }); 49 | }); 50 | } 51 | _isInit = false; 52 | super.didChangeDependencies(); 53 | } 54 | 55 | @override 56 | Widget build(BuildContext context) { 57 | return Scaffold( 58 | appBar: AppBar( 59 | title: Text('MyShop'), 60 | actions: [ 61 | PopupMenuButton( 62 | onSelected: (FilterOptions selectedValue) { 63 | setState(() { 64 | if (FilterOptions.Favourites == selectedValue) { 65 | _showOnlyFavourites = true; 66 | } else { 67 | _showOnlyFavourites = false; 68 | } 69 | }); 70 | }, 71 | icon: Icon(Icons.more_vert), 72 | itemBuilder: (BuildContext context) { 73 | return [ 74 | PopupMenuItem( 75 | child: Text("Only Favourites"), 76 | value: FilterOptions.Favourites, 77 | ), 78 | PopupMenuItem( 79 | child: Text("Select All"), 80 | value: FilterOptions.All, 81 | ), 82 | ]; 83 | }, 84 | ), 85 | Consumer( 86 | builder: (BuildContext context, Cart cart, Widget widget) { 87 | return Badge( 88 | child: widget, 89 | value: cart.itemCount.toString(), 90 | ); 91 | }, 92 | child: IconButton( 93 | icon: Icon(Icons.shopping_cart), 94 | onPressed: () { 95 | Navigator.of(context).pushNamed(CartScreen.routeName); 96 | }), 97 | ), 98 | ], 99 | ), 100 | drawer: AppDrawer(), 101 | body: _isLoading 102 | ? Center( 103 | child: CircularProgressIndicator(), 104 | ) 105 | : ProductsGrid(_showOnlyFavourites), 106 | ); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /lib/screens/splash_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class SplashScreen extends StatelessWidget { 4 | @override 5 | Widget build(BuildContext context) { 6 | return Scaffold( 7 | body: Center( 8 | child: Text("Loading..."), 9 | ), 10 | ); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /lib/screens/user_products_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_ecommerce/providers/products.dart'; 3 | import 'package:flutter_ecommerce/screens/edit_product_screen.dart'; 4 | import 'package:flutter_ecommerce/widgets/app_drawer.dart'; 5 | import 'package:flutter_ecommerce/widgets/user_product_item.dart'; 6 | import 'package:provider/provider.dart'; 7 | 8 | class UserProductsScreen extends StatelessWidget { 9 | static const routeName = "/user-products"; 10 | 11 | Future refreshProducts(BuildContext context) async { 12 | await Provider.of(context, listen: false) 13 | .fetchAndSetProducts(true); 14 | } 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return Scaffold( 19 | appBar: AppBar( 20 | title: const Text("Manage Products"), 21 | actions: [ 22 | IconButton( 23 | icon: const Icon(Icons.add), 24 | onPressed: () { 25 | Navigator.of(context).pushNamed(EditProductScreen.routeName); 26 | }, 27 | ) 28 | ], 29 | ), 30 | drawer: AppDrawer(), 31 | body: FutureBuilder( 32 | future: refreshProducts(context), 33 | builder: (BuildContext context, AsyncSnapshot snapshot) { 34 | if (snapshot.connectionState == ConnectionState.waiting) { 35 | return Center( 36 | child: CircularProgressIndicator(), 37 | ); 38 | } else { 39 | return RefreshIndicator( 40 | onRefresh: () => refreshProducts(context), 41 | child: Consumer( 42 | builder: (BuildContext context, Products productsData, Widget child) { 43 | return Padding( 44 | padding: EdgeInsets.all(8.0), 45 | child: ListView.builder( 46 | itemCount: productsData.items.length, 47 | itemBuilder: (BuildContext context, int index) { 48 | return Column( 49 | children: [ 50 | UserProductItem( 51 | productsData.items[index].id, 52 | productsData.items[index].title, 53 | productsData.items[index].imageUrl), 54 | Divider(), 55 | ], 56 | ); 57 | }, 58 | ), 59 | ); 60 | }, 61 | ), 62 | ); 63 | } 64 | }, 65 | ), 66 | ); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /lib/widgets/app_drawer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_ecommerce/helpers/custom_route.dart'; 3 | import 'package:flutter_ecommerce/providers/auth.dart'; 4 | import 'package:flutter_ecommerce/screens/orders_screen.dart'; 5 | import 'package:flutter_ecommerce/screens/user_products_screen.dart'; 6 | import 'package:provider/provider.dart'; 7 | 8 | class AppDrawer extends StatelessWidget { 9 | @override 10 | Widget build(BuildContext context) { 11 | return Drawer( 12 | child: Column( 13 | children: [ 14 | AppBar( 15 | title: Text("Hello Friend!"), 16 | automaticallyImplyLeading: false, 17 | ), 18 | Divider(), 19 | ListTile( 20 | leading: Icon(Icons.shop), 21 | title: Text("Shop"), 22 | onTap: () { 23 | Navigator.of(context).pushReplacementNamed("/"); 24 | }, 25 | ), 26 | Divider(), 27 | ListTile( 28 | leading: Icon(Icons.shop), 29 | title: Text("Orders"), 30 | onTap: () { 31 | /*Navigator.of(context) 32 | .pushReplacementNamed(OrdersScreen.routeName);*/ 33 | Navigator.of(context).pushReplacement( 34 | CustomRoute(builder: (context) => OrdersScreen())); 35 | }, 36 | ), 37 | Divider(), 38 | ListTile( 39 | leading: Icon(Icons.edit), 40 | title: Text("Manage Products"), 41 | onTap: () { 42 | Navigator.of(context) 43 | .pushReplacementNamed(UserProductsScreen.routeName); 44 | }, 45 | ), 46 | Divider(), 47 | ListTile( 48 | leading: Icon(Icons.exit_to_app), 49 | title: Text("Logout"), 50 | onTap: () { 51 | Navigator.of(context).pop(); 52 | Navigator.of(context).pushReplacementNamed("/"); 53 | Provider.of(context, listen: false).logOut(); 54 | }, 55 | ), 56 | ], 57 | ), 58 | ); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /lib/widgets/badge.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Badge extends StatelessWidget { 4 | const Badge({ 5 | Key key, 6 | @required this.child, 7 | @required this.value, 8 | this.color, 9 | }) : super(key: key); 10 | 11 | final Widget child; 12 | final String value; 13 | final Color color; 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Stack( 18 | alignment: Alignment.center, 19 | children: [ 20 | child, 21 | Positioned( 22 | right: 8, 23 | top: 8, 24 | child: Container( 25 | padding: EdgeInsets.all(2.0), 26 | // color: Theme.of(context).accentColor, 27 | decoration: BoxDecoration( 28 | borderRadius: BorderRadius.circular(10.0), 29 | color: color != null ? color : Theme.of(context).accentColor, 30 | ), 31 | constraints: BoxConstraints( 32 | minWidth: 16, 33 | minHeight: 16, 34 | ), 35 | child: Text( 36 | value, 37 | textAlign: TextAlign.center, 38 | style: TextStyle( 39 | fontSize: 10, 40 | ), 41 | ), 42 | ), 43 | ) 44 | ], 45 | ); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/widgets/cart_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_ecommerce/providers/cart.dart'; 3 | import 'package:provider/provider.dart'; 4 | 5 | class CartItem extends StatelessWidget { 6 | final String id; 7 | final String productId; 8 | final double price; 9 | final int quantity; 10 | final String title; 11 | 12 | CartItem(this.id, this.productId, this.price, this.quantity, this.title); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return Dismissible( 17 | key: ValueKey(id), 18 | direction: DismissDirection.endToStart, 19 | onDismissed: (direction) { 20 | Provider.of(context, listen: false).removeItem(productId); 21 | }, 22 | confirmDismiss: (direction) { 23 | return showDialog( 24 | context: context, 25 | builder: (context) { 26 | return AlertDialog( 27 | title: Text("Are you sure ?"), 28 | content: Text("Do you want to remove the item from the cart?"), 29 | actions: [ 30 | FlatButton(child: Text("No"),onPressed: (){ 31 | Navigator.of(context).pop(false); 32 | },), 33 | FlatButton(child: Text("Yes"),onPressed: (){ 34 | Navigator.of(context).pop(true); 35 | },), 36 | ], 37 | ); 38 | }); 39 | }, 40 | background: Container( 41 | color: Theme.of(context).errorColor, 42 | child: Icon( 43 | Icons.delete, 44 | color: Colors.white, 45 | size: 40.0, 46 | ), 47 | alignment: Alignment.centerRight, 48 | padding: EdgeInsets.only(right: 20.0), 49 | margin: EdgeInsets.symmetric(horizontal: 15.0, vertical: 5.0), 50 | ), 51 | child: Card( 52 | margin: EdgeInsets.symmetric(horizontal: 15.0, vertical: 5.0), 53 | child: Padding( 54 | padding: EdgeInsets.all(8.0), 55 | child: ListTile( 56 | leading: CircleAvatar( 57 | child: Padding( 58 | padding: const EdgeInsets.all(5.0), 59 | child: FittedBox(child: Text("\$${price}")), 60 | ), 61 | ), 62 | title: Text(title), 63 | subtitle: Text("Total : \$${price * quantity}"), 64 | trailing: Text("x ${quantity}"), 65 | ), 66 | ), 67 | ), 68 | ); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /lib/widgets/order_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_ecommerce/providers/orders.dart' as ord; 3 | import 'package:intl/intl.dart'; 4 | import 'dart:math'; 5 | 6 | class OrderItem extends StatefulWidget { 7 | final ord.OrderItem order; 8 | 9 | OrderItem(this.order); 10 | 11 | @override 12 | _OrderItemState createState() => _OrderItemState(); 13 | } 14 | 15 | class _OrderItemState extends State { 16 | var _expanded = false; 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return AnimatedContainer( 21 | duration: Duration(milliseconds: 300), 22 | height: 23 | _expanded ? min(widget.order.products.length * 20.0 + 110, 200) : 95, 24 | child: Card( 25 | margin: EdgeInsets.all(10.0), 26 | child: Column( 27 | children: [ 28 | ListTile( 29 | title: Text("\$${widget.order.amount}"), 30 | subtitle: Text( 31 | DateFormat("dd MM yyyy hh:mm").format(widget.order.dateTime)), 32 | trailing: IconButton( 33 | icon: Icon(_expanded ? Icons.expand_less : Icons.expand_more), 34 | onPressed: () { 35 | setState(() { 36 | _expanded = !_expanded; 37 | }); 38 | }), 39 | ), 40 | if (_expanded) 41 | Divider( 42 | height: 2.0, 43 | color: Colors.grey, 44 | ), 45 | AnimatedContainer( 46 | duration: Duration(milliseconds: 300), 47 | padding: EdgeInsets.symmetric(horizontal: 15.0, vertical: 5.0), 48 | height: _expanded 49 | ? min(widget.order.products.length * 20.0 + 10, 100) 50 | : 0, 51 | child: ListView( 52 | children: widget.order.products 53 | .map((prod) => Row( 54 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 55 | children: [ 56 | Text( 57 | prod.title, 58 | style: TextStyle( 59 | fontSize: 18.0, fontWeight: FontWeight.bold), 60 | ), 61 | Text( 62 | "\$${prod.price} x ${prod.quanity}", 63 | style: TextStyle( 64 | fontSize: 15.0, color: Colors.grey[700]), 65 | ), 66 | ], 67 | )) 68 | .toList(), 69 | ), 70 | ), 71 | ], 72 | ), 73 | ), 74 | ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /lib/widgets/product_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_ecommerce/providers/auth.dart'; 3 | import 'package:flutter_ecommerce/providers/cart.dart'; 4 | import 'package:flutter_ecommerce/providers/product.dart'; 5 | 6 | import '../screens/product_detail_screen.dart'; 7 | import 'package:provider/provider.dart'; 8 | 9 | class ProductItem extends StatelessWidget { 10 | @override 11 | Widget build(BuildContext context) { 12 | final product = Provider.of(context, listen: false); 13 | final cart = Provider.of(context, listen: false); 14 | final authData = Provider.of(context, listen: false); 15 | 16 | return ClipRRect( 17 | borderRadius: BorderRadius.circular(10), 18 | child: GridTile( 19 | child: GestureDetector( 20 | onTap: () { 21 | Navigator.of(context).pushNamed( 22 | ProductDetailScreen.routeName, 23 | arguments: product.id, 24 | ); 25 | }, 26 | child: Hero( 27 | tag: product.id, 28 | child: FadeInImage( 29 | fit: BoxFit.cover, 30 | placeholder: AssetImage("assets/images/product-placeholder.png"), 31 | image: NetworkImage( 32 | product.imageUrl, 33 | ), 34 | ), 35 | ), 36 | ), 37 | footer: GridTileBar( 38 | backgroundColor: Colors.black87, 39 | leading: Consumer( 40 | builder: (BuildContext context, Product product, Widget child) { 41 | return IconButton( 42 | icon: Icon(product.isFavorite 43 | ? Icons.favorite 44 | : Icons.favorite_border), 45 | color: Theme.of(context).accentColor, 46 | onPressed: () { 47 | product.toggleFavouriteStatus(authData.token, authData.userId); 48 | }, 49 | ); 50 | }, 51 | ), 52 | title: Text( 53 | product.title, 54 | textAlign: TextAlign.center, 55 | ), 56 | trailing: IconButton( 57 | icon: Icon( 58 | Icons.shopping_cart, 59 | ), 60 | onPressed: () { 61 | cart.addItem(product.id, product.title, product.price); 62 | Scaffold.of(context).hideCurrentSnackBar(); 63 | Scaffold.of(context).showSnackBar( 64 | SnackBar( 65 | content: Text("Item added to cart !"), 66 | action: SnackBarAction( 67 | label: "UNDO", 68 | onPressed: () { 69 | cart.removeSingleItem(product.id); 70 | }), 71 | duration: Duration(seconds: 2), 72 | ), 73 | ); 74 | }, 75 | color: Theme.of(context).accentColor, 76 | ), 77 | ), 78 | ), 79 | ); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/widgets/products_grid.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_ecommerce/providers/products.dart'; 3 | import 'package:flutter_ecommerce/widgets/product_item.dart'; 4 | import 'package:provider/provider.dart'; 5 | 6 | class ProductsGrid extends StatelessWidget { 7 | final bool showFavs; 8 | 9 | ProductsGrid(this.showFavs); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | final productsData = Provider.of(context); 14 | final products = 15 | showFavs ? productsData.favouriteItems : productsData.items; 16 | 17 | return GridView.builder( 18 | padding: const EdgeInsets.all(10.0), 19 | itemCount: products.length, 20 | itemBuilder: (context, index) => ChangeNotifierProvider.value( 21 | // builder: (BuildContext context) => products[index], 22 | value: products[index], 23 | child: ProductItem(), 24 | ), 25 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( 26 | crossAxisCount: 2, 27 | childAspectRatio: 3 / 2, 28 | crossAxisSpacing: 10, 29 | mainAxisSpacing: 10, 30 | ), 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/widgets/user_product_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_ecommerce/providers/products.dart'; 3 | import 'package:flutter_ecommerce/screens/edit_product_screen.dart'; 4 | import 'package:provider/provider.dart'; 5 | 6 | class UserProductItem extends StatelessWidget { 7 | final String title; 8 | final String imageUrl; 9 | final String id; 10 | 11 | UserProductItem(this.id, this.title, this.imageUrl); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | final _scaffold = Scaffold.of(context); 16 | return ListTile( 17 | title: Text(this.title), 18 | leading: CircleAvatar( 19 | backgroundImage: NetworkImage(imageUrl), 20 | ), 21 | trailing: Row( 22 | mainAxisSize: MainAxisSize.min, 23 | children: [ 24 | IconButton( 25 | icon: Icon(Icons.edit), 26 | onPressed: () { 27 | Navigator.of(context).pushNamed(EditProductScreen.routeName, arguments: this.id); 28 | }, 29 | color: Theme.of(context).primaryColor, 30 | ), 31 | IconButton( 32 | icon: Icon(Icons.delete), 33 | /*onPressed: (){ 34 | Provider.of(context, listen: false).deleteProduct(this.id); 35 | },*/ 36 | onPressed: () async { 37 | try { 38 | await Provider.of(context, listen: false).deleteProduct(this.id); 39 | } catch (error) { 40 | _scaffold.showSnackBar(SnackBar(content: Text(error.toString()))); 41 | } 42 | }, 43 | color: Theme.of(context).errorColor, 44 | ), 45 | ], 46 | ), 47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /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.3.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.0.5" 18 | charcode: 19 | dependency: transitive 20 | description: 21 | name: charcode 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.1.2" 25 | collection: 26 | dependency: transitive 27 | description: 28 | name: collection 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.14.11" 32 | cupertino_icons: 33 | dependency: "direct main" 34 | description: 35 | name: cupertino_icons 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "0.1.2" 39 | flutter: 40 | dependency: "direct main" 41 | description: flutter 42 | source: sdk 43 | version: "0.0.0" 44 | flutter_test: 45 | dependency: "direct dev" 46 | description: flutter 47 | source: sdk 48 | version: "0.0.0" 49 | http: 50 | dependency: "direct main" 51 | description: 52 | name: http 53 | url: "https://pub.dartlang.org" 54 | source: hosted 55 | version: "0.12.0+2" 56 | http_parser: 57 | dependency: transitive 58 | description: 59 | name: http_parser 60 | url: "https://pub.dartlang.org" 61 | source: hosted 62 | version: "3.1.3" 63 | intl: 64 | dependency: "direct main" 65 | description: 66 | name: intl 67 | url: "https://pub.dartlang.org" 68 | source: hosted 69 | version: "0.16.0" 70 | matcher: 71 | dependency: transitive 72 | description: 73 | name: matcher 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "0.12.5" 77 | meta: 78 | dependency: transitive 79 | description: 80 | name: meta 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "1.1.7" 84 | path: 85 | dependency: transitive 86 | description: 87 | name: path 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.6.4" 91 | pedantic: 92 | dependency: transitive 93 | description: 94 | name: pedantic 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "1.8.0+1" 98 | provider: 99 | dependency: "direct main" 100 | description: 101 | name: provider 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "3.1.0" 105 | quiver: 106 | dependency: transitive 107 | description: 108 | name: quiver 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "2.0.5" 112 | shared_preferences: 113 | dependency: "direct main" 114 | description: 115 | name: shared_preferences 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "0.5.3+4" 119 | sky_engine: 120 | dependency: transitive 121 | description: flutter 122 | source: sdk 123 | version: "0.0.99" 124 | source_span: 125 | dependency: transitive 126 | description: 127 | name: source_span 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.5.5" 131 | stack_trace: 132 | dependency: transitive 133 | description: 134 | name: stack_trace 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.9.3" 138 | stream_channel: 139 | dependency: transitive 140 | description: 141 | name: stream_channel 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "2.0.0" 145 | string_scanner: 146 | dependency: transitive 147 | description: 148 | name: string_scanner 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.0.5" 152 | term_glyph: 153 | dependency: transitive 154 | description: 155 | name: term_glyph 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "1.1.0" 159 | test_api: 160 | dependency: transitive 161 | description: 162 | name: test_api 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "0.2.5" 166 | typed_data: 167 | dependency: transitive 168 | description: 169 | name: typed_data 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "1.1.6" 173 | vector_math: 174 | dependency: transitive 175 | description: 176 | name: vector_math 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "2.0.8" 180 | sdks: 181 | dart: ">=2.2.2 <3.0.0" 182 | flutter: ">=1.5.0 <2.0.0" 183 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_ecommerce 2 | description: A new Flutter application. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # In Android, build-name is used as versionName while build-number used as versionCode. 10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 12 | # Read more about iOS versioning at 13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 14 | version: 1.0.0+1 15 | 16 | environment: 17 | sdk: ">=2.1.0 <3.0.0" 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | 23 | # The following adds the Cupertino Icons font to your application. 24 | # Use with the CupertinoIcons class for iOS style icons. 25 | cupertino_icons: ^0.1.2 26 | provider: ^3.1.0 27 | intl: ^0.16.0 28 | http: ^0.12.0+2 29 | shared_preferences: ^0.5.3+4 30 | 31 | dev_dependencies: 32 | flutter_test: 33 | sdk: flutter 34 | 35 | # For information on the generic Dart part of this file, see the 36 | # following page: https://dart.dev/tools/pub/pubspec 37 | 38 | # The following section is specific to Flutter. 39 | flutter: 40 | 41 | # The following line ensures that the Material Icons font is 42 | # included with your application, so that you can use the icons in 43 | # the material Icons class. 44 | uses-material-design: true 45 | 46 | # To add assets to your application, add an assets section, like this: 47 | # assets: 48 | # - images/a_dot_burr.jpeg 49 | # - images/a_dot_ham.jpeg 50 | 51 | assets: 52 | - assets/ 53 | 54 | # An image asset can refer to one or more resolution-specific "variants", see 55 | # https://flutter.dev/assets-and-images/#resolution-aware. 56 | 57 | # For details regarding adding assets from package dependencies, see 58 | # https://flutter.dev/assets-and-images/#from-packages 59 | 60 | # To add custom fonts to your application, add a fonts section here, 61 | # in this "flutter" section. Each entry in this list should have a 62 | # "family" key with the font family name, and a "fonts" key with a 63 | # list giving the asset and other descriptors for the font. For 64 | 65 | fonts: 66 | - family: WorkSans 67 | fonts: 68 | - asset: assets/fonts/WorkSans-Regular.ttf 69 | - asset: assets/fonts/WorkSans-Bold.ttf 70 | weight: 700 71 | - family: Anton 72 | fonts: 73 | - asset: assets/fonts/Anton-Regular.ttf 74 | 75 | # example: 76 | # fonts: 77 | # - family: Schyler 78 | # fonts: 79 | # - asset: fonts/Schyler-Regular.ttf 80 | # - asset: fonts/Schyler-Italic.ttf 81 | # style: italic 82 | # - family: Trajan Pro 83 | # fonts: 84 | # - asset: fonts/TrajanPro.ttf 85 | # - asset: fonts/TrajanPro_Bold.ttf 86 | # weight: 700 87 | # 88 | # For details regarding fonts from package dependencies, 89 | # see https://flutter.dev/custom-fonts/#from-packages 90 | -------------------------------------------------------------------------------- /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_ecommerce/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 | --------------------------------------------------------------------------------