├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── big_cart │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets └── images │ ├── add.svg │ ├── add_to_cart.png │ ├── address_icon.png │ ├── app_logo.png │ ├── back_arrow.png │ ├── back_arrow_black.png │ ├── banner.png │ ├── beverages.png │ ├── cart_white.png │ ├── delete_icon.png │ ├── dropdown_icon.png │ ├── edible_oil.png │ ├── email_icon.png │ ├── filter.png │ ├── filter_black.png │ ├── forward_arrow.png │ ├── fruits.png │ ├── globe_icon.png │ ├── grocery.png │ ├── heart.png │ ├── heart_filled.png │ ├── household.png │ ├── login_background.png │ ├── map_icon.png │ ├── name_icon.png │ ├── not_found_icon.png │ ├── order_success.png │ ├── password_icon.png │ ├── phone_icon.png │ ├── search_icon.png │ ├── signup_background.png │ ├── splash_background.png │ ├── subtract.svg │ ├── vegetables.png │ └── zipcode_icon.png ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── lib ├── app │ ├── api.dart │ ├── app.dart │ ├── app.router.dart │ └── locator.dart ├── constants │ ├── asset_constants.dart │ └── string_constants.dart ├── main.dart ├── models │ ├── api_responce_model.dart │ ├── carousel_item_model.dart │ ├── category_model.dart │ ├── product_model.dart │ └── user_model.dart ├── services │ ├── authentication_service.dart │ ├── carousel_service.dart │ └── cart_service.dart ├── shared │ ├── helpers.dart │ └── styles.dart ├── viewmodels │ ├── category_viewmodel.dart │ ├── checkout_viewmodel.dart │ ├── home_viewmodel.dart │ ├── login_viewmodel.dart │ ├── shopping_cart_viewmodel.dart │ ├── signup_viewmodel.dart │ └── splash_viewmodel.dart ├── views │ ├── category │ │ ├── category_view.dart │ │ └── product_category_grid_list.dart │ ├── checkout │ │ ├── checkout_form.dart │ │ ├── checkout_view.dart │ │ └── validation_message.dart │ ├── home │ │ ├── banner_carousel.dart │ │ ├── category_containers.dart │ │ ├── custom_home_drawer.dart │ │ ├── floating_cart_button.dart │ │ ├── home_view.dart │ │ ├── logout_loading_screen.dart │ │ ├── product_grid_list.dart │ │ ├── search_bar.dart │ │ └── title_with_arrow_button.dart │ ├── login │ │ ├── login_form.dart │ │ └── login_view.dart │ ├── order_success │ │ └── order_success_view.dart │ ├── shopping_cart │ │ ├── cart_item_list.dart │ │ ├── cost_with_main_button.dart │ │ ├── shopping_cart_view.dart │ │ └── title_with_cost.dart │ ├── signup │ │ ├── signup_form.dart │ │ └── signup_view.dart │ └── splash │ │ ├── background.dart │ │ ├── foreground.dart │ │ └── splash_view.dart └── widgets │ └── dumb │ ├── app_main_button.dart │ ├── authentication_field.dart │ ├── authentication_layout.dart │ ├── customized_app_bar.dart │ ├── loading_indicator.dart │ ├── page_error_indicator.dart │ └── product_card.dart ├── pubspec.lock ├── pubspec.yaml ├── test └── widget_test.dart ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── index.html └── manifest.json └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 5f105a6ca7a5ac7b8bc9b241f4c2d86f4188cf5c 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Big Cart 2 | ## An Ecommerce app to buy groceries 3 | 4 | - Framework: Flutter 5 | - Architecture: MVVM 6 | - Backend: Api 7 | - State Management: Stacked 8 | 9 | ## Features 10 | 11 | - User can Login/Register into the app. 12 | - Browse all the items available and add them to cart. 13 | - Fill the Order form and place Order. 14 | - Incase Usser logs into the app from another device he will have to force logout from the previous device and relogin because the token will expire. 15 | 16 | ## ScreenShots: 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /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 flutter.compileSdkVersion 30 | 31 | compileOptions { 32 | sourceCompatibility JavaVersion.VERSION_1_8 33 | targetCompatibility JavaVersion.VERSION_1_8 34 | } 35 | 36 | kotlinOptions { 37 | jvmTarget = '1.8' 38 | } 39 | 40 | sourceSets { 41 | main.java.srcDirs += 'src/main/kotlin' 42 | } 43 | 44 | defaultConfig { 45 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 46 | applicationId "com.example.big_cart" 47 | minSdkVersion flutter.minSdkVersion 48 | targetSdkVersion flutter.targetSdkVersion 49 | versionCode flutterVersionCode.toInteger() 50 | versionName flutterVersionName 51 | } 52 | 53 | buildTypes { 54 | release { 55 | // TODO: Add your own signing config for the release build. 56 | // Signing with the debug keys for now, so `flutter run --release` works. 57 | signingConfig signingConfigs.debug 58 | } 59 | } 60 | } 61 | 62 | flutter { 63 | source '../..' 64 | } 65 | 66 | dependencies { 67 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 68 | } 69 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 16 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/big_cart/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.big_cart 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:4.1.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip 7 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /assets/images/add.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /assets/images/add_to_cart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/add_to_cart.png -------------------------------------------------------------------------------- /assets/images/address_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/address_icon.png -------------------------------------------------------------------------------- /assets/images/app_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/app_logo.png -------------------------------------------------------------------------------- /assets/images/back_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/back_arrow.png -------------------------------------------------------------------------------- /assets/images/back_arrow_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/back_arrow_black.png -------------------------------------------------------------------------------- /assets/images/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/banner.png -------------------------------------------------------------------------------- /assets/images/beverages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/beverages.png -------------------------------------------------------------------------------- /assets/images/cart_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/cart_white.png -------------------------------------------------------------------------------- /assets/images/delete_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/delete_icon.png -------------------------------------------------------------------------------- /assets/images/dropdown_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/dropdown_icon.png -------------------------------------------------------------------------------- /assets/images/edible_oil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/edible_oil.png -------------------------------------------------------------------------------- /assets/images/email_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/email_icon.png -------------------------------------------------------------------------------- /assets/images/filter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/filter.png -------------------------------------------------------------------------------- /assets/images/filter_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/filter_black.png -------------------------------------------------------------------------------- /assets/images/forward_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/forward_arrow.png -------------------------------------------------------------------------------- /assets/images/fruits.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/fruits.png -------------------------------------------------------------------------------- /assets/images/globe_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/globe_icon.png -------------------------------------------------------------------------------- /assets/images/grocery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/grocery.png -------------------------------------------------------------------------------- /assets/images/heart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/heart.png -------------------------------------------------------------------------------- /assets/images/heart_filled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/heart_filled.png -------------------------------------------------------------------------------- /assets/images/household.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/household.png -------------------------------------------------------------------------------- /assets/images/login_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/login_background.png -------------------------------------------------------------------------------- /assets/images/map_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/map_icon.png -------------------------------------------------------------------------------- /assets/images/name_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/name_icon.png -------------------------------------------------------------------------------- /assets/images/not_found_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/not_found_icon.png -------------------------------------------------------------------------------- /assets/images/order_success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/order_success.png -------------------------------------------------------------------------------- /assets/images/password_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/password_icon.png -------------------------------------------------------------------------------- /assets/images/phone_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/phone_icon.png -------------------------------------------------------------------------------- /assets/images/search_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/search_icon.png -------------------------------------------------------------------------------- /assets/images/signup_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/signup_background.png -------------------------------------------------------------------------------- /assets/images/splash_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/splash_background.png -------------------------------------------------------------------------------- /assets/images/subtract.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /assets/images/vegetables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/vegetables.png -------------------------------------------------------------------------------- /assets/images/zipcode_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/assets/images/zipcode_icon.png -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 9.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/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/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/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/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/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/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/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/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/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/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/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/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/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/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/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/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/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/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/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/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/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/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/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/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/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/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/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/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/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/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Big Cart 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | big_cart 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/app/api.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:big_cart/models/api_responce_model.dart'; 3 | import 'package:big_cart/models/category_model.dart'; 4 | import 'package:big_cart/models/product_model.dart'; 5 | import '../models/user_model.dart'; 6 | import 'package:http/http.dart' as http; 7 | 8 | class Api { 9 | static const String _baseUrl = 'http://ishaqhassan.com:2000'; 10 | 11 | static Future signupUser( 12 | String email, 13 | String phone, 14 | String password, 15 | ) async { 16 | var signupUrl = Uri.parse(_baseUrl + '/user'); 17 | try { 18 | http.Response responce = await http.post( 19 | signupUrl, 20 | body: { 21 | "email": email, 22 | "phone": phone, 23 | "password": password, 24 | }, 25 | ); 26 | Map json = jsonDecode(responce.body); 27 | User user = 28 | ApiResponce.fromJson(json, User.fromJson(json['data'])).data!; 29 | return user; 30 | } catch (e) { 31 | throw (e.toString()); 32 | } 33 | } 34 | 35 | static Future loginUser( 36 | String email, 37 | String password, 38 | ) async { 39 | var signinUrl = Uri.parse(_baseUrl + '/user/signin'); 40 | try { 41 | http.Response responce = await http.post( 42 | signinUrl, 43 | body: { 44 | "email": email, 45 | "password": password, 46 | }, 47 | ); 48 | Map json = jsonDecode(responce.body); 49 | User user = 50 | ApiResponce.fromJson(json, User.fromJson(json['data'])).data!; 51 | return user; 52 | } catch (e) { 53 | throw (e.toString()); 54 | } 55 | } 56 | 57 | static Future logoutUser( 58 | String? accessToken, 59 | ) async { 60 | var signoutUrl = Uri.parse(_baseUrl + '/user/signout'); 61 | try { 62 | http.Response responce = await http.get( 63 | signoutUrl, 64 | headers: {"Authorization": "Bearer ${accessToken.toString()}"}, 65 | ); 66 | Map json = jsonDecode(responce.body); 67 | User user = 68 | ApiResponce.fromJson(json, User.fromJson(json['data'])).data!; 69 | return user; 70 | } catch (e) { 71 | throw (e.toString()); 72 | } 73 | } 74 | 75 | static Future> getCategories(String? accessToken) async { 76 | var categoryUrl = Uri.parse(_baseUrl + '/category'); 77 | try { 78 | http.Response responce = await http.get(categoryUrl, 79 | headers: {"Authorization": "Bearer ${accessToken.toString()}"}); 80 | List json = jsonDecode(responce.body)["data"]; 81 | List categories = 82 | json.map((object) => Category.fromJson(object)).toList(); 83 | return categories; 84 | } catch (e) { 85 | throw (e.toString()); 86 | } 87 | } 88 | 89 | static Future> getProducts(String? accessToken) async { 90 | var productUrl = Uri.parse(_baseUrl + '/product'); 91 | try { 92 | http.Response responce = await http.get(productUrl, 93 | headers: {"Authorization": "Bearer ${accessToken.toString()}"}); 94 | List json = jsonDecode(responce.body)["data"]; 95 | List products = 96 | json.map((object) => Product.fromJson(object)).toList(); 97 | return products; 98 | } catch (e) { 99 | throw (e.toString()); 100 | } 101 | } 102 | 103 | static Future> getProductsByCategory( 104 | String? accessToken, int categoryId) async { 105 | var productUrl = Uri.parse(_baseUrl + '/product/${categoryId.toString()}'); 106 | try { 107 | http.Response responce = await http.get(productUrl, 108 | headers: {"Authorization": "Bearer ${accessToken.toString()}"}); 109 | List json = jsonDecode(responce.body)["data"]; 110 | List products = 111 | json.map((object) => Product.fromJson(object)).toList(); 112 | return products; 113 | } catch (e) { 114 | throw (e.toString()); 115 | } 116 | } 117 | 118 | static Future> getProductsByTitle( 119 | String? accessToken, String text) async { 120 | var productUrl = 121 | Uri.parse(_baseUrl + '/product/search?q=${text.toString()}'); 122 | try { 123 | http.Response responce = await http.get(productUrl, 124 | headers: {"Authorization": "Bearer ${accessToken.toString()}"}); 125 | List json = jsonDecode(responce.body)["data"]; 126 | List products = 127 | json.map((object) => Product.fromJson(object)).toList(); 128 | return products; 129 | } catch (e) { 130 | throw (e.toString()); 131 | } 132 | } 133 | 134 | static Future placeOrder( 135 | String? accessToken, 136 | String name, 137 | String email, 138 | String phno, 139 | String address, 140 | String zip, 141 | String city, 142 | String country, 143 | List> items) async { 144 | var orderUrl = Uri.parse(_baseUrl + '/order'); 145 | try { 146 | http.Response responce = await http.post( 147 | orderUrl, 148 | headers: { 149 | "Authorization": "Bearer ${accessToken.toString()}", 150 | "Content-Type": "application/json" 151 | }, 152 | body: jsonEncode({ 153 | "name": name, 154 | "email": email, 155 | "phoneNumber": phno, 156 | "address": address, 157 | "zip": zip, 158 | "city": city, 159 | "country": country, 160 | "items": items, 161 | }), 162 | ); 163 | Map json = jsonDecode(responce.body)["data"]; 164 | int id = json["id"]; 165 | return id; 166 | } catch (e) { 167 | throw (e.toString()); 168 | } 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /lib/app/app.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/views/login/login_view.dart'; 2 | import 'package:big_cart/views/splash/splash_view.dart'; 3 | import 'package:stacked/stacked_annotations.dart'; 4 | import '../views/category/category_view.dart'; 5 | import '../views/checkout/checkout_view.dart'; 6 | import '../views/home/home_view.dart'; 7 | import '../views/order_success/order_success_view.dart'; 8 | import '../views/shopping_cart/shopping_cart_view.dart'; 9 | import '../views/signup/signup_view.dart'; 10 | 11 | @StackedApp( 12 | routes: [ 13 | MaterialRoute(page: SplashView, initial: true), 14 | MaterialRoute(page: LoginView), 15 | MaterialRoute(page: SignupView), 16 | MaterialRoute(page: HomeView), 17 | MaterialRoute(page: CategoryView), 18 | MaterialRoute(page: ShoppingCartView), 19 | MaterialRoute(page: CheckoutView), 20 | MaterialRoute(page: OrderSuccessView), 21 | ], 22 | ) 23 | class AppSetup {} 24 | -------------------------------------------------------------------------------- /lib/app/app.router.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | // ************************************************************************** 4 | // StackedRouterGenerator 5 | // ************************************************************************** 6 | 7 | // ignore_for_file: public_member_api_docs 8 | 9 | import 'package:flutter/material.dart'; 10 | import 'package:stacked/stacked.dart'; 11 | import 'package:stacked/stacked_annotations.dart'; 12 | 13 | import '../views/category/category_view.dart'; 14 | import '../views/checkout/checkout_view.dart'; 15 | import '../views/home/home_view.dart'; 16 | import '../views/login/login_view.dart'; 17 | import '../views/order_success/order_success_view.dart'; 18 | import '../views/shopping_cart/shopping_cart_view.dart'; 19 | import '../views/signup/signup_view.dart'; 20 | import '../views/splash/splash_view.dart'; 21 | 22 | class Routes { 23 | static const String splashView = '/'; 24 | static const String loginView = '/login-view'; 25 | static const String signupView = '/signup-view'; 26 | static const String homeView = '/home-view'; 27 | static const String categoryView = '/category-view'; 28 | static const String shoppingCartView = '/shopping-cart-view'; 29 | static const String checkoutView = '/checkout-view'; 30 | static const String orderSuccessView = '/order-success-view'; 31 | static const all = { 32 | splashView, 33 | loginView, 34 | signupView, 35 | homeView, 36 | categoryView, 37 | shoppingCartView, 38 | checkoutView, 39 | orderSuccessView, 40 | }; 41 | } 42 | 43 | class StackedRouter extends RouterBase { 44 | @override 45 | List get routes => _routes; 46 | final _routes = [ 47 | RouteDef(Routes.splashView, page: SplashView), 48 | RouteDef(Routes.loginView, page: LoginView), 49 | RouteDef(Routes.signupView, page: SignupView), 50 | RouteDef(Routes.homeView, page: HomeView), 51 | RouteDef(Routes.categoryView, page: CategoryView), 52 | RouteDef(Routes.shoppingCartView, page: ShoppingCartView), 53 | RouteDef(Routes.checkoutView, page: CheckoutView), 54 | RouteDef(Routes.orderSuccessView, page: OrderSuccessView), 55 | ]; 56 | @override 57 | Map get pagesMap => _pagesMap; 58 | final _pagesMap = { 59 | SplashView: (data) { 60 | return MaterialPageRoute( 61 | builder: (context) => const SplashView(), 62 | settings: data, 63 | ); 64 | }, 65 | LoginView: (data) { 66 | return MaterialPageRoute( 67 | builder: (context) => const LoginView(), 68 | settings: data, 69 | ); 70 | }, 71 | SignupView: (data) { 72 | return MaterialPageRoute( 73 | builder: (context) => const SignupView(), 74 | settings: data, 75 | ); 76 | }, 77 | HomeView: (data) { 78 | return MaterialPageRoute( 79 | builder: (context) => const HomeView(), 80 | settings: data, 81 | ); 82 | }, 83 | CategoryView: (data) { 84 | var args = data.getArgs(nullOk: false); 85 | return MaterialPageRoute( 86 | builder: (context) => CategoryView( 87 | key: args.key, 88 | id: args.id, 89 | title: args.title, 90 | ), 91 | settings: data, 92 | ); 93 | }, 94 | ShoppingCartView: (data) { 95 | return MaterialPageRoute( 96 | builder: (context) => const ShoppingCartView(), 97 | settings: data, 98 | ); 99 | }, 100 | CheckoutView: (data) { 101 | return MaterialPageRoute( 102 | builder: (context) => const CheckoutView(), 103 | settings: data, 104 | ); 105 | }, 106 | OrderSuccessView: (data) { 107 | var args = data.getArgs(nullOk: false); 108 | return MaterialPageRoute( 109 | builder: (context) => OrderSuccessView( 110 | key: args.key, 111 | id: args.id, 112 | ), 113 | settings: data, 114 | ); 115 | }, 116 | }; 117 | } 118 | 119 | /// ************************************************************************ 120 | /// Arguments holder classes 121 | /// ************************************************************************* 122 | 123 | /// CategoryView arguments holder class 124 | class CategoryViewArguments { 125 | final Key? key; 126 | final int id; 127 | final String title; 128 | CategoryViewArguments({this.key, required this.id, required this.title}); 129 | } 130 | 131 | /// OrderSuccessView arguments holder class 132 | class OrderSuccessViewArguments { 133 | final Key? key; 134 | final int id; 135 | OrderSuccessViewArguments({this.key, required this.id}); 136 | } 137 | -------------------------------------------------------------------------------- /lib/app/locator.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/services/authentication_service.dart'; 2 | import 'package:big_cart/services/carousel_service.dart'; 3 | import 'package:big_cart/services/cart_service.dart'; 4 | import 'package:get_it/get_it.dart'; 5 | import 'package:stacked_services/stacked_services.dart'; 6 | 7 | final locator = GetIt.instance; 8 | 9 | void setupLocator() { 10 | locator.registerLazySingleton(() => NavigationService()); 11 | locator.registerLazySingleton(() => CarouselService()); 12 | locator.registerLazySingleton(() => AuthenticationService()); 13 | locator.registerLazySingleton(() => CartService()); 14 | } 15 | -------------------------------------------------------------------------------- /lib/constants/asset_constants.dart: -------------------------------------------------------------------------------- 1 | class AssetConstants { 2 | // Png Assets 3 | static String splashScreenBackground = 'assets/images/splash_background.png'; 4 | static String appLogo = 'assets/images/app_logo.png'; 5 | static String loginBackground = 'assets/images/login_background.png'; 6 | static String backArrow = 'assets/images/back_arrow.png'; 7 | static String emailIcon = 'assets/images/email_icon.png'; 8 | static String passwordIcon = 'assets/images/password_icon.png'; 9 | static String signupBackground = 'assets/images/signup_background.png'; 10 | static String searchIcon = 'assets/images/search_icon.png'; 11 | static String filterIcon = 'assets/images/filter.png'; 12 | static String bannerImage = 'assets/images/banner.png'; 13 | static String forwardArrow = 'assets/images/forward_arrow.png'; 14 | static String backArrowBlack = 'assets/images/back_arrow_black.png'; 15 | static String filterBlack = 'assets/images/filter_black.png'; 16 | static String nameIcon = 'assets/images/name_icon.png'; 17 | static String phoneIcon = 'assets/images/phone_icon.png'; 18 | static String addressIcon = 'assets/images/address_icon.png'; 19 | static String zipcodeIcon = 'assets/images/zipcode_icon.png'; 20 | static String cityIcon = 'assets/images/map_icon.png'; 21 | static String countryIcon = 'assets/images/globe_icon.png'; 22 | static String vegetablesIcon = 'assets/images/vegetables.png'; 23 | static String fruitsIcon = 'assets/images/fruits.png'; 24 | static String beveragesIcon = 'assets/images/beverages.png'; 25 | static String groceryIcon = 'assets/images/grocery.png'; 26 | static String edibleOilIcon = 'assets/images/edible_oil.png'; 27 | static String householdIcon = 'assets/images/household.png'; 28 | static String errorIcon = 'assets/images/not_found_icon.png'; 29 | static String addToCartIcon = 'assets/images/add_to_cart.png'; 30 | static String favoriteUnselected = 'assets/images/heart.png'; 31 | static String favoriteSelected = 'assets/images/heart_filled.png'; 32 | static String dropdownIcon = 'assets/images/dropdown_icon.png'; 33 | static String cartIconWhite = 'assets/images/cart_white.png'; 34 | static String deleteIcon = 'assets/images/delete_icon.png'; 35 | static String orderSuccessIcon = 'assets/images/order_success.png'; 36 | 37 | // Svg Assets 38 | static String addIcon = 'assets/images/add.svg'; 39 | static String subtractIcon = 'assets/images/subtract.svg'; 40 | } 41 | -------------------------------------------------------------------------------- /lib/constants/string_constants.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/lib/constants/string_constants.dart -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/app/app.router.dart'; 2 | import 'package:big_cart/app/locator.dart'; 3 | import 'package:big_cart/constants/asset_constants.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:stacked_services/stacked_services.dart'; 6 | 7 | void main() { 8 | setupLocator(); 9 | runApp(const MyApp()); 10 | } 11 | 12 | class MyApp extends StatelessWidget { 13 | const MyApp({Key? key}) : super(key: key); 14 | 15 | // This widget is the root of your application. 16 | @override 17 | Widget build(BuildContext context) { 18 | precacheImage(AssetImage(AssetConstants.splashScreenBackground), context); 19 | return MaterialApp( 20 | title: 'Big Cart', 21 | theme: ThemeData(), 22 | debugShowCheckedModeBanner: false, 23 | // home: CheckoutView(), 24 | navigatorKey: StackedService.navigatorKey, 25 | onGenerateRoute: StackedRouter().onGenerateRoute, 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/models/api_responce_model.dart: -------------------------------------------------------------------------------- 1 | abstract class ApiDataModel { 2 | Map toJson(); 3 | } 4 | 5 | class ApiResponce { 6 | String? message; 7 | int? statusCode; 8 | T? data; 9 | 10 | ApiResponce({ 11 | required this.message, 12 | required this.statusCode, 13 | required this.data, 14 | }); 15 | 16 | ApiResponce.fromJson(Map json, T data) { 17 | message = json['message']; 18 | statusCode = json['statusCode']; 19 | this.data = data; 20 | } 21 | 22 | Map toJson() { 23 | return { 24 | "message": message, 25 | "statusCode": statusCode, 26 | "data": data?.toJson(), 27 | }; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/models/carousel_item_model.dart: -------------------------------------------------------------------------------- 1 | class CarouselItem { 2 | final String text; 3 | final String imagePath; 4 | 5 | CarouselItem({ 6 | required this.text, 7 | required this.imagePath, 8 | }); 9 | } 10 | -------------------------------------------------------------------------------- /lib/models/category_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/models/api_responce_model.dart'; 2 | 3 | class Category extends ApiDataModel { 4 | int? id; 5 | String? title; 6 | String? icon; 7 | String? color; 8 | 9 | Category({this.id, this.title, this.icon, this.color}); 10 | 11 | Category.fromJson(Map json) { 12 | id = json['id']; 13 | title = json['title']; 14 | icon = json['icon']; 15 | color = json['color']; 16 | } 17 | 18 | Map toJson() { 19 | final Map data = new Map(); 20 | data['id'] = this.id; 21 | data['title'] = this.title; 22 | data['icon'] = this.icon; 23 | data['color'] = this.color; 24 | return data; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/models/product_model.dart: -------------------------------------------------------------------------------- 1 | class Product { 2 | int? id; 3 | int? catId; 4 | String? title; 5 | String? unit; 6 | int? stockAvailable; 7 | String? image; 8 | String? color; 9 | double? price; 10 | int? qty; 11 | 12 | Product( 13 | {this.id, 14 | this.catId, 15 | this.title, 16 | this.unit, 17 | this.stockAvailable, 18 | this.image, 19 | this.color, 20 | this.price, 21 | this.qty}); 22 | 23 | Product.fromJson(Map json) { 24 | id = json['id']; 25 | catId = json['catId']; 26 | title = json['title']; 27 | unit = json['unit']; 28 | stockAvailable = json['stockAvailable']; 29 | image = json['image']; 30 | color = json['color']; 31 | price = json['price']; 32 | qty = json['qty']; 33 | } 34 | 35 | Map toJson() { 36 | final Map data = new Map(); 37 | data['id'] = this.id; 38 | data['catId'] = this.catId; 39 | data['title'] = this.title; 40 | data['unit'] = this.unit; 41 | data['stockAvailable'] = this.stockAvailable; 42 | data['image'] = this.image; 43 | data['color'] = this.color; 44 | data['price'] = this.price; 45 | data['qty'] = this.qty; 46 | return data; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/models/user_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/models/api_responce_model.dart'; 2 | 3 | class User implements ApiDataModel { 4 | int? id; 5 | String? email; 6 | String? phone; 7 | String? password; 8 | String? accessToken; 9 | 10 | User({this.id, this.email, this.phone, this.password, this.accessToken}); 11 | 12 | User.fromJson(Map json) { 13 | id = json['id']; 14 | email = json['email']; 15 | phone = json['phone']; 16 | password = json['password']; 17 | accessToken = json['accessToken']; 18 | } 19 | 20 | Map toJson() { 21 | final Map data = new Map(); 22 | data['id'] = this.id; 23 | data['email'] = this.email; 24 | data['phone'] = this.phone; 25 | data['password'] = this.password; 26 | data['accessToken'] = this.accessToken; 27 | return data; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/services/authentication_service.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:big_cart/models/user_model.dart'; 3 | import 'package:injectable/injectable.dart'; 4 | import 'package:shared_preferences/shared_preferences.dart'; 5 | import '../app/api.dart'; 6 | 7 | @lazySingleton 8 | class AuthenticationService { 9 | String? get authToken => _user?.accessToken; 10 | String? get email => _user?.email; 11 | 12 | User? _user; 13 | 14 | Future loadUser() async { 15 | final pref = await SharedPreferences.getInstance(); 16 | try { 17 | _user = User.fromJson(jsonDecode(pref.getString('user') ?? '')); 18 | } catch (e) { 19 | return; 20 | } 21 | } 22 | 23 | Future resetUser() async { 24 | final pref = await SharedPreferences.getInstance(); 25 | pref.clear(); 26 | _user = null; 27 | } 28 | 29 | Future _saveUser() async { 30 | final pref = await SharedPreferences.getInstance(); 31 | await pref.setString('user', jsonEncode(_user?.toJson())); 32 | } 33 | 34 | Future login({ 35 | required String email, 36 | required String password, 37 | required bool shouldRemember, 38 | }) async { 39 | _user = null; 40 | try { 41 | _user = await Api.loginUser(email, password); 42 | if (shouldRemember == true) { 43 | await _saveUser(); 44 | } 45 | } catch (e) { 46 | throw (e.toString()); 47 | } 48 | } 49 | 50 | Future signup({ 51 | required String email, 52 | required String password, 53 | required String phone, 54 | }) async { 55 | _user = null; 56 | try { 57 | _user = await Api.signupUser(email, phone, password); 58 | } catch (e) { 59 | throw (e.toString()); 60 | } 61 | } 62 | 63 | Future logout() async { 64 | try { 65 | _user = await Api.logoutUser( 66 | _user?.accessToken, 67 | ); 68 | await resetUser(); 69 | } catch (e) { 70 | throw (e.toString()); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /lib/services/carousel_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/models/carousel_item_model.dart'; 2 | import 'package:injectable/injectable.dart'; 3 | import '../constants/asset_constants.dart'; 4 | 5 | @lazySingleton 6 | class CarouselService { 7 | List getCarouselList() { 8 | List carouselList = []; 9 | carouselList.add(CarouselItem( 10 | text: '20% off on your\nfirst purchase', 11 | imagePath: AssetConstants.bannerImage)); 12 | carouselList.add(CarouselItem( 13 | text: '20% off on your\nfirst purchase', 14 | imagePath: AssetConstants.bannerImage)); 15 | carouselList.add(CarouselItem( 16 | text: '20% off on your\nfirst purchase', 17 | imagePath: AssetConstants.bannerImage)); 18 | carouselList.add(CarouselItem( 19 | text: '20% off on your\nfirst purchase', 20 | imagePath: AssetConstants.bannerImage)); 21 | return carouselList; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/services/cart_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/models/product_model.dart'; 2 | import 'package:injectable/injectable.dart'; 3 | 4 | @lazySingleton 5 | class CartService { 6 | List _cart = []; 7 | List get cart => _cart; 8 | 9 | List _favorites = []; 10 | List get favorites => _favorites; 11 | 12 | void addProduct(Product product) { 13 | int index = _cart.indexWhere((element) => element.id == product.id); 14 | if (index == -1) { 15 | product.qty = 1; 16 | _cart.add(product); 17 | } else { 18 | _cart[index].qty = (_cart[index].qty ?? 0) + 1; 19 | } 20 | } 21 | 22 | void removeProduct(Product product) { 23 | int index = _cart.indexWhere((element) => element.id == product.id); 24 | if (index != -1) { 25 | if (_cart[index].qty == 1) { 26 | deleteProduct(_cart[index]); 27 | } else { 28 | _cart[index].qty = (_cart[index].qty ?? 2) - 1; 29 | } 30 | } 31 | } 32 | 33 | void deleteProduct(Product product) { 34 | int index = _cart.indexWhere((element) => element.id == product.id); 35 | if (index != -1) { 36 | _cart.removeAt(index); 37 | } 38 | } 39 | 40 | void clearCart() { 41 | _cart = []; 42 | } 43 | 44 | int getQuantityFromProduct(Product product) { 45 | int index = _cart.indexWhere((element) => element.id == product.id); 46 | if (index != -1) { 47 | return _cart[index].qty!; 48 | } else { 49 | return 0; 50 | } 51 | } 52 | 53 | void addOrRemoveFavorites(Product product) { 54 | int index = _favorites.indexWhere((element) => element.id == product.id); 55 | if (index == -1) { 56 | _favorites.add(product); 57 | } else { 58 | _favorites.removeAt(index); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/shared/helpers.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | const SizedBox verticalSpaceMini = SizedBox(height: 5); 4 | const SizedBox verticalSpaceSmall = SizedBox(height: 11); 5 | const SizedBox verticalSpaceMedium = SizedBox(height: 17); 6 | const SizedBox verticalSpaceRegular = SizedBox(height: 21); 7 | const SizedBox verticalSpaceLarge = SizedBox(height: 25); 8 | 9 | double screenWidth(BuildContext context, {double percentage = 1}) => 10 | MediaQuery.of(context).size.width * percentage; 11 | double screenHeight(BuildContext context, {double percentage = 1}) => 12 | MediaQuery.of(context).size.height * percentage; 13 | double statusBarHeight(BuildContext context) => 14 | MediaQuery.of(context).padding.top; 15 | -------------------------------------------------------------------------------- /lib/shared/styles.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/constants/asset_constants.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:google_fonts/google_fonts.dart'; 4 | 5 | // App Colors 6 | const Color appGreenColor = Color(0xFF6CC51D); 7 | const Color appGreyColor = Color(0xFF868889); 8 | const Color appWhiteColor = Color(0xFFF4F5F9); 9 | const Color appBlueColor = Color(0xFF407EC7); 10 | const Color appGreenSecondary = Color(0xFFAEDC81); 11 | const Color appGreySecondary = Color(0xFFEBEBEB); 12 | const Color appGreyDark = Color(0xFFB1B1B1); 13 | const Color appRedColor = Color(0xFFEF574B); 14 | 15 | // App TextStyles 16 | TextStyle heading1 = GoogleFonts.poppins( 17 | fontSize: 20, 18 | fontWeight: FontWeight.w700, 19 | letterSpacing: 20 * (30.5 / 100), 20 | color: appGreenColor, 21 | ); 22 | 23 | TextStyle heading2 = GoogleFonts.poppins( 24 | fontSize: 20, 25 | fontWeight: FontWeight.w600, 26 | letterSpacing: 20 * (30.5 / 100), 27 | color: appGreenColor, 28 | ); 29 | 30 | TextStyle heading3 = GoogleFonts.poppins( 31 | fontSize: 15, 32 | fontWeight: FontWeight.w500, 33 | letterSpacing: 15 * (20 / 100), 34 | color: appGreyColor, 35 | ); 36 | 37 | TextStyle heading4 = GoogleFonts.poppins( 38 | fontSize: 30, 39 | fontWeight: FontWeight.w700, 40 | letterSpacing: 30 * (3 / 100), 41 | color: Colors.black, 42 | ); 43 | 44 | TextStyle heading5 = GoogleFonts.poppins( 45 | fontSize: 25, 46 | fontWeight: FontWeight.w600, 47 | letterSpacing: 25 * (3 / 100), 48 | color: Colors.black, 49 | ); 50 | 51 | TextStyle heading6 = GoogleFonts.poppins( 52 | fontSize: 18, 53 | fontWeight: FontWeight.w500, 54 | letterSpacing: 18 * (3 / 100), 55 | color: Colors.white, 56 | ); 57 | 58 | TextStyle heading7 = GoogleFonts.poppins( 59 | fontSize: 15, 60 | fontWeight: FontWeight.w600, 61 | color: Colors.white, 62 | ); 63 | 64 | TextStyle paragraph1 = GoogleFonts.poppins( 65 | fontSize: 15, 66 | fontWeight: FontWeight.w500, 67 | letterSpacing: 15 * (3 / 100), 68 | color: appGreyColor, 69 | ); 70 | 71 | TextStyle paragraph2 = GoogleFonts.poppins( 72 | fontSize: 15, 73 | fontWeight: FontWeight.w400, 74 | letterSpacing: 15 * (3 / 100), 75 | color: appGreyColor, 76 | ); 77 | 78 | TextStyle paragraph3 = GoogleFonts.poppins( 79 | fontSize: 15, 80 | fontWeight: FontWeight.w300, 81 | letterSpacing: 15 * (3 / 100), 82 | color: appGreyColor, 83 | ); 84 | 85 | TextStyle paragraph4 = GoogleFonts.poppins( 86 | fontSize: 15, 87 | fontWeight: FontWeight.w500, 88 | color: appGreyColor, 89 | ); 90 | 91 | TextStyle paragraph5 = GoogleFonts.poppins( 92 | fontSize: 18, 93 | fontWeight: FontWeight.w600, 94 | color: Colors.black, 95 | ); 96 | 97 | TextStyle paragraph6 = GoogleFonts.poppins( 98 | fontSize: 12, 99 | fontWeight: FontWeight.w500, 100 | color: appGreyColor, 101 | ); 102 | 103 | TextStyle paragraph7 = GoogleFonts.poppins( 104 | fontSize: 10, 105 | fontWeight: FontWeight.w500, 106 | color: appGreyColor, 107 | ); 108 | 109 | TextStyle paragraph8 = GoogleFonts.poppins( 110 | fontSize: 16, 111 | fontWeight: FontWeight.w400, 112 | color: appGreyDark, 113 | ); 114 | 115 | TextStyle paragraph9 = GoogleFonts.poppins( 116 | fontSize: 16, 117 | fontWeight: FontWeight.w700, 118 | color: appGreyDark, 119 | ); 120 | 121 | Color getCategoryColorFromId(int id) { 122 | switch (id) { 123 | case 1: 124 | return const Color(0xFFE6F2EA); 125 | case 2: 126 | return const Color(0xFFFFE9E5); 127 | case 3: 128 | return const Color(0xFFFFF6E3); 129 | case 4: 130 | return const Color(0xFFF3EFFA); 131 | case 5: 132 | return const Color(0xFFDCF4F5); 133 | case 6: 134 | return const Color(0xFFFFE8F2); 135 | default: 136 | return const Color(0xFFFFFFFF); 137 | } 138 | } 139 | 140 | String getCategoryIconFromId(int id) { 141 | switch (id) { 142 | case 1: 143 | return AssetConstants.vegetablesIcon; 144 | case 2: 145 | return AssetConstants.fruitsIcon; 146 | case 3: 147 | return AssetConstants.beveragesIcon; 148 | case 4: 149 | return AssetConstants.groceryIcon; 150 | case 5: 151 | return AssetConstants.edibleOilIcon; 152 | case 6: 153 | return AssetConstants.householdIcon; 154 | default: 155 | return AssetConstants.errorIcon; 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /lib/viewmodels/category_viewmodel.dart: -------------------------------------------------------------------------------- 1 | import 'package:stacked/stacked.dart'; 2 | import '../app/api.dart'; 3 | import '../app/locator.dart'; 4 | import '../models/product_model.dart'; 5 | import '../services/authentication_service.dart'; 6 | import '../services/cart_service.dart'; 7 | 8 | class CategoryViewModel extends BaseViewModel { 9 | final _auth = locator(); 10 | final _cartService = locator(); 11 | 12 | List get cart => _cartService.cart; 13 | List get favorites => _cartService.favorites; 14 | 15 | bool _isLoading = true; 16 | bool get isLoading => _isLoading; 17 | 18 | bool _hasError = false; 19 | bool get hasError => _hasError; 20 | 21 | List products = []; 22 | 23 | int productQuantity(Product product) { 24 | return _cartService.getQuantityFromProduct(product); 25 | } 26 | 27 | void addToCart(Product product) { 28 | _cartService.addProduct(product); 29 | notifyListeners(); 30 | } 31 | 32 | void removeFromCart(Product product) { 33 | _cartService.removeProduct(product); 34 | notifyListeners(); 35 | } 36 | 37 | void addOrRemoveFavorites(Product product) { 38 | _cartService.addOrRemoveFavorites(product); 39 | notifyListeners(); 40 | } 41 | 42 | bool isFavorited(Product product) { 43 | int index = favorites.indexWhere((element) => element.id == product.id); 44 | if (index == -1) { 45 | return false; 46 | } else { 47 | return true; 48 | } 49 | } 50 | 51 | void onModelReady(int categoryId) async { 52 | _isLoading = true; 53 | _hasError = false; 54 | notifyListeners(); 55 | products = []; 56 | try { 57 | products = await Api.getProductsByCategory(_auth.authToken, categoryId); 58 | _isLoading = false; 59 | } catch (e) { 60 | _hasError = true; 61 | } 62 | notifyListeners(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /lib/viewmodels/home_viewmodel.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/app/api.dart'; 2 | import 'package:big_cart/app/app.router.dart'; 3 | import 'package:big_cart/app/locator.dart'; 4 | import 'package:big_cart/models/category_model.dart'; 5 | import 'package:big_cart/models/product_model.dart'; 6 | import 'package:big_cart/services/authentication_service.dart'; 7 | import 'package:big_cart/services/carousel_service.dart'; 8 | import 'package:big_cart/services/cart_service.dart'; 9 | import 'package:stacked/stacked.dart'; 10 | import 'package:stacked_services/stacked_services.dart'; 11 | 12 | import '../models/carousel_item_model.dart'; 13 | 14 | class HomeViewModel extends BaseViewModel { 15 | final _carouselService = locator(); 16 | final _auth = locator(); 17 | final _cartService = locator(); 18 | final _navigator = locator(); 19 | 20 | List get cart => _cartService.cart; 21 | List get favorites => _cartService.favorites; 22 | String? get email => _auth.email; 23 | 24 | bool _isLoading = true; 25 | bool get isLoading => _isLoading; 26 | 27 | bool _hasError = false; 28 | bool get hasError => _hasError; 29 | 30 | List carouselList = []; 31 | List categories = []; 32 | List products = []; 33 | 34 | int productQuantity(Product product) { 35 | return _cartService.getQuantityFromProduct(product); 36 | } 37 | 38 | void addToCart(Product product) { 39 | _cartService.addProduct(product); 40 | notifyListeners(); 41 | } 42 | 43 | void removeFromCart(Product product) { 44 | _cartService.removeProduct(product); 45 | notifyListeners(); 46 | } 47 | 48 | void addOrRemoveFavorites(Product product) { 49 | _cartService.addOrRemoveFavorites(product); 50 | notifyListeners(); 51 | } 52 | 53 | bool isFavorited(Product product) { 54 | int index = favorites.indexWhere((element) => element.id == product.id); 55 | if (index == -1) { 56 | return false; 57 | } else { 58 | return true; 59 | } 60 | } 61 | 62 | String logoutLoadingText = 'Logging out'; 63 | bool logoutAnimationActive = false; 64 | 65 | void logoutAnimator() async { 66 | int counter = 1; 67 | while (true) { 68 | if (logoutAnimationActive == false) { 69 | break; 70 | } else { 71 | int multiplier = counter % 3; 72 | counter += 1; 73 | logoutLoadingText = 'Logging out' + ('.' * multiplier); 74 | notifyListeners(); 75 | await Future.delayed(const Duration(milliseconds: 300)); 76 | } 77 | } 78 | } 79 | 80 | void logoutUser() async { 81 | logoutAnimationActive = true; 82 | notifyListeners(); 83 | logoutAnimator(); 84 | await Future.delayed(const Duration(seconds: 1)); 85 | try { 86 | await _auth.logout(); 87 | logoutAnimationActive = false; 88 | _navigator.replaceWith(Routes.loginView); 89 | } catch (e) { 90 | await _auth.resetUser(); 91 | logoutAnimationActive = false; 92 | _navigator.replaceWith(Routes.loginView); 93 | } 94 | logoutAnimationActive = false; 95 | notifyListeners(); 96 | } 97 | 98 | String _searchBarText = ''; 99 | set searchBarText(String value) { 100 | _searchBarText = value; 101 | } 102 | 103 | bool onlyProducts = false; 104 | 105 | void onModelReady() async { 106 | _isLoading = true; 107 | _hasError = false; 108 | notifyListeners(); 109 | carouselList = _carouselService.getCarouselList(); 110 | categories = []; 111 | products = []; 112 | try { 113 | if (onlyProducts) { 114 | products = 115 | await Api.getProductsByTitle(_auth.authToken, _searchBarText); 116 | _isLoading = false; 117 | } else { 118 | categories = await Api.getCategories(_auth.authToken); 119 | products = await Api.getProducts(_auth.authToken); 120 | _isLoading = false; 121 | } 122 | } catch (e) { 123 | _hasError = true; 124 | } 125 | notifyListeners(); 126 | } 127 | 128 | void navigateToCategoryPage(int? id, String? title) { 129 | _navigator 130 | .navigateTo(Routes.categoryView, 131 | arguments: CategoryViewArguments( 132 | id: id ?? 0, title: title ?? 'Not Found'))! 133 | .then((value) { 134 | notifyListeners(); 135 | }); 136 | } 137 | 138 | void navigateToCartPage() { 139 | _navigator.navigateTo(Routes.shoppingCartView)!.then((value) { 140 | notifyListeners(); 141 | }); 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /lib/viewmodels/login_viewmodel.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/app/app.router.dart'; 2 | import 'package:big_cart/app/locator.dart'; 3 | import 'package:big_cart/services/authentication_service.dart'; 4 | import 'package:big_cart/shared/styles.dart'; 5 | import 'package:big_cart/views/login/login_form.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:stacked/stacked.dart'; 8 | import 'package:stacked_services/stacked_services.dart'; 9 | 10 | class LoginViewModel extends FormViewModel { 11 | final _auth = locator(); 12 | final _navigator = locator(); 13 | 14 | Color _fieldTextColor = appGreyColor; 15 | Color get fieldTextColor => _fieldTextColor; 16 | set fieldTextColor(Color color) { 17 | _fieldPasswordColor = appGreyColor; 18 | _fieldTextColor = color; 19 | notifyListeners(); 20 | } 21 | 22 | Color _fieldPasswordColor = appGreyColor; 23 | Color get fieldPasswordColor => _fieldPasswordColor; 24 | set fieldPasswordColor(Color color) { 25 | _fieldPasswordColor = color; 26 | _fieldTextColor = appGreyColor; 27 | notifyListeners(); 28 | } 29 | 30 | bool _isObscure = true; 31 | bool get isObscure => _isObscure; 32 | set isObscure(bool value) { 33 | _isObscure = value; 34 | notifyListeners(); 35 | } 36 | 37 | bool _shouldRemember = false; 38 | bool get shouldRemember => _shouldRemember; 39 | set shouldRemember(bool value) { 40 | _shouldRemember = value; 41 | notifyListeners(); 42 | } 43 | 44 | bool _emailHasError = false; 45 | bool get emailHasError => _emailHasError; 46 | set emailHasError(bool value) { 47 | _emailHasError = value; 48 | notifyListeners(); 49 | } 50 | 51 | bool _passwordHasError = false; 52 | bool get passwordHasError => _passwordHasError; 53 | set passwordHasError(bool value) { 54 | _passwordHasError = value; 55 | notifyListeners(); 56 | } 57 | 58 | bool isLoading = false; 59 | 60 | void validateForm() async { 61 | isLoading = true; 62 | notifyListeners(); 63 | emailHasError = false; 64 | passwordHasError = false; 65 | String email = formValueMap[EmailValueKey]; 66 | String password = formValueMap[PasswordValueKey]; 67 | bool passwordContainsNumber = false; 68 | passwordContainsNumber = password.contains(RegExp(r'[0-9]')); 69 | 70 | if (!email.contains('@')) { 71 | setValidationMessage('Please enter a valid email'); 72 | emailHasError = true; 73 | } else if (password.length < 8) { 74 | setValidationMessage('Incorrect Password'); 75 | passwordHasError = true; 76 | } else if (!passwordContainsNumber) { 77 | setValidationMessage('Incorrect Password'); 78 | passwordHasError = true; 79 | } else { 80 | try { 81 | await _auth.login( 82 | email: email, password: password, shouldRemember: _shouldRemember); 83 | _navigator.replaceWith(Routes.homeView); 84 | } catch (e) { 85 | setValidationMessage('Invalid Credentials'); 86 | } 87 | } 88 | isLoading = false; 89 | notifyListeners(); 90 | } 91 | 92 | void navigateToSignupPage() { 93 | _navigator.replaceWith(Routes.signupView); 94 | } 95 | 96 | @override 97 | void setFormStatus() {} 98 | } 99 | -------------------------------------------------------------------------------- /lib/viewmodels/shopping_cart_viewmodel.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/app/app.router.dart'; 2 | import 'package:big_cart/models/product_model.dart'; 3 | import 'package:big_cart/services/cart_service.dart'; 4 | import 'package:stacked/stacked.dart'; 5 | import 'package:stacked_services/stacked_services.dart'; 6 | 7 | import '../app/locator.dart'; 8 | 9 | class ShoppingCartViewModel extends BaseViewModel { 10 | final _cartService = locator(); 11 | final _navigator = locator(); 12 | 13 | List get cart => _cartService.cart; 14 | 15 | double get totalCost => shippingCharges + subTotal; 16 | 17 | double _shippingCharges = 1.6; 18 | double get shippingCharges => _shippingCharges; 19 | 20 | double get subTotal { 21 | double total = 0.0; 22 | try { 23 | for (Product item in cart) { 24 | total += (item.price! * item.qty!); 25 | } 26 | return total; 27 | } catch (e) { 28 | return 0.0; 29 | } 30 | } 31 | 32 | int productQuantity(Product product) { 33 | return _cartService.getQuantityFromProduct(product); 34 | } 35 | 36 | void addToCart(Product product) { 37 | _cartService.addProduct(product); 38 | notifyListeners(); 39 | } 40 | 41 | void removeFromCart(Product product) { 42 | _cartService.removeProduct(product); 43 | notifyListeners(); 44 | } 45 | 46 | void deleteFromCart(Product product) { 47 | _cartService.deleteProduct(product); 48 | notifyListeners(); 49 | } 50 | 51 | void moveToCheckout() { 52 | _navigator.navigateTo(Routes.checkoutView); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/viewmodels/signup_viewmodel.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/services/authentication_service.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:stacked/stacked.dart'; 4 | import 'package:stacked_services/stacked_services.dart'; 5 | 6 | import '../app/app.router.dart'; 7 | import '../app/locator.dart'; 8 | import '../shared/styles.dart'; 9 | import '../views/login/login_form.dart'; 10 | 11 | class SignupViewModel extends FormViewModel { 12 | final _auth = locator(); 13 | final _navigator = locator(); 14 | 15 | Color _fieldTextColor = appGreyColor; 16 | Color get fieldTextColor => _fieldTextColor; 17 | set fieldTextColor(Color color) { 18 | _fieldPhoneColor = appGreyColor; 19 | _fieldPasswordColor = appGreyColor; 20 | _fieldTextColor = color; 21 | notifyListeners(); 22 | } 23 | 24 | Color _fieldPhoneColor = appGreyColor; 25 | Color get fieldPhoneColor => _fieldPhoneColor; 26 | set fieldPhoneColor(Color color) { 27 | _fieldPhoneColor = color; 28 | _fieldPasswordColor = appGreyColor; 29 | _fieldTextColor = appGreyColor; 30 | notifyListeners(); 31 | } 32 | 33 | Color _fieldPasswordColor = appGreyColor; 34 | Color get fieldPasswordColor => _fieldPasswordColor; 35 | set fieldPasswordColor(Color color) { 36 | _fieldPasswordColor = color; 37 | _fieldTextColor = appGreyColor; 38 | _fieldPhoneColor = appGreyColor; 39 | notifyListeners(); 40 | } 41 | 42 | bool _isObscure = true; 43 | bool get isObscure => _isObscure; 44 | set isObscure(bool value) { 45 | _isObscure = value; 46 | notifyListeners(); 47 | } 48 | 49 | bool _phoneHasError = false; 50 | bool get phoneHasError => _phoneHasError; 51 | set phoneHasError(bool value) { 52 | _phoneHasError = value; 53 | notifyListeners(); 54 | } 55 | 56 | bool _emailHasError = false; 57 | bool get emailHasError => _emailHasError; 58 | set emailHasError(bool value) { 59 | _emailHasError = value; 60 | notifyListeners(); 61 | } 62 | 63 | bool _passwordHasError = false; 64 | bool get passwordHasError => _passwordHasError; 65 | set passwordHasError(bool value) { 66 | _passwordHasError = value; 67 | notifyListeners(); 68 | } 69 | 70 | bool isLoading = false; 71 | 72 | void validateForm() async { 73 | isLoading = true; 74 | notifyListeners(); 75 | emailHasError = false; 76 | passwordHasError = false; 77 | phoneHasError = false; 78 | String email = formValueMap[EmailValueKey]; 79 | String password = formValueMap[PasswordValueKey]; 80 | String phone = formValueMap[PhoneValueKey]; 81 | bool passwordContainsNumber = false; 82 | passwordContainsNumber = password.contains(RegExp(r'[0-9]')); 83 | 84 | if (!email.contains('@')) { 85 | setValidationMessage('Please enter a valid email'); 86 | emailHasError = true; 87 | } else if (phone.length < 10) { 88 | setValidationMessage('Enter a valid phone number'); 89 | phoneHasError = true; 90 | } else if (password.length < 8) { 91 | setValidationMessage('Password must be atleast 8 characters long'); 92 | passwordHasError = true; 93 | } else if (!passwordContainsNumber) { 94 | setValidationMessage('Password must contain a number'); 95 | passwordHasError = true; 96 | } else { 97 | try { 98 | await _auth.signup(email: email, password: password, phone: phone); 99 | _navigator.replaceWith(Routes.homeView); 100 | } catch (e) { 101 | setValidationMessage('Something went wrong'); 102 | } 103 | } 104 | isLoading = false; 105 | notifyListeners(); 106 | } 107 | 108 | void navigateToLoginPage() { 109 | _navigator.replaceWith(Routes.loginView); 110 | } 111 | 112 | @override 113 | void setFormStatus() { 114 | // TODO: implement setFormStatus 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /lib/viewmodels/splash_viewmodel.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/app/app.router.dart'; 2 | import 'package:big_cart/app/locator.dart'; 3 | import 'package:big_cart/services/authentication_service.dart'; 4 | import 'package:stacked/stacked.dart'; 5 | import 'package:stacked_services/stacked_services.dart'; 6 | 7 | class SplashViewModel extends BaseViewModel { 8 | final _auth = locator(); 9 | final _navigator = locator(); 10 | 11 | void initializeApp() async { 12 | await _auth.loadUser(); 13 | await Future.delayed( 14 | const Duration(milliseconds: 2000), 15 | ); 16 | if (_auth.authToken == null) { 17 | _navigator.replaceWith(Routes.loginView); 18 | } else { 19 | _navigator.replaceWith(Routes.homeView); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/views/category/category_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/constants/asset_constants.dart'; 2 | import 'package:big_cart/shared/styles.dart'; 3 | import 'package:big_cart/viewmodels/category_viewmodel.dart'; 4 | import 'package:big_cart/views/category/product_category_grid_list.dart'; 5 | import 'package:big_cart/widgets/dumb/customized_app_bar.dart'; 6 | import 'package:big_cart/widgets/dumb/loading_indicator.dart'; 7 | import 'package:big_cart/widgets/dumb/page_error_indicator.dart'; 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter/services.dart'; 10 | import 'package:stacked/stacked.dart'; 11 | 12 | class CategoryView extends StatelessWidget { 13 | final int id; 14 | final String title; 15 | 16 | const CategoryView({Key? key, required this.id, required this.title}) 17 | : super(key: key); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | SystemChrome.setSystemUIOverlayStyle( 22 | const SystemUiOverlayStyle( 23 | statusBarColor: Colors.transparent, 24 | statusBarIconBrightness: Brightness.dark), 25 | ); 26 | return ViewModelBuilder.reactive( 27 | onModelReady: (viewModel) => viewModel.onModelReady(id), 28 | viewModelBuilder: () => CategoryViewModel(), 29 | builder: (context, model, child) => Scaffold( 30 | backgroundColor: appWhiteColor, 31 | body: Column( 32 | children: [ 33 | CustomizedAppBar( 34 | title: title, 35 | leading: AssetConstants.backArrowBlack, 36 | leadingOnTap: () { 37 | Navigator.of(context).pop(); 38 | }, 39 | trailing: AssetConstants.filterBlack, 40 | trailingOnTap: () {}, 41 | ), 42 | const SizedBox(height: 13), 43 | Expanded( 44 | child: model.hasError 45 | ? const PageErrorIndicator() 46 | : model.isLoading 47 | ? const LoadingIndicator() 48 | : model.products.isEmpty 49 | ? Align( 50 | alignment: Alignment.topCenter, 51 | child: Padding( 52 | padding: const EdgeInsets.only(top: 13), 53 | child: Text( 54 | 'No products found', 55 | style: paragraph1, 56 | ), 57 | ), 58 | ) 59 | : const ProductCategoryGridList(), 60 | ), 61 | ], 62 | ), 63 | ), 64 | ); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/views/category/product_category_grid_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/viewmodels/category_viewmodel.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:stacked/stacked.dart'; 4 | import '../../shared/helpers.dart'; 5 | import '../../widgets/dumb/product_card.dart'; 6 | 7 | class ProductCategoryGridList extends ViewModelWidget { 8 | const ProductCategoryGridList({ 9 | Key? key, 10 | }) : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context, CategoryViewModel viewModel) { 14 | return GridView.builder( 15 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( 16 | crossAxisCount: screenWidth(context) > screenHeight(context) ? 4 : 2, 17 | childAspectRatio: 181 / 234, 18 | crossAxisSpacing: 18, 19 | mainAxisSpacing: 20), 20 | padding: const EdgeInsets.only(left: 17, right: 17, bottom: 17, top: 13), 21 | itemCount: viewModel.products.length, 22 | itemBuilder: (context, index) => ProductCard( 23 | shadeColor: viewModel.products[index].color, 24 | image: viewModel.products[index].image, 25 | price: viewModel.products[index].price, 26 | title: viewModel.products[index].title, 27 | unit: viewModel.products[index].unit, 28 | qtyInCart: viewModel.productQuantity(viewModel.products[index]), 29 | onMinusTap: () => viewModel.removeFromCart(viewModel.products[index]), 30 | onPlusTap: () => viewModel.addToCart(viewModel.products[index]), 31 | onFavoriteButtonTap: () => 32 | viewModel.addOrRemoveFavorites(viewModel.products[index]), 33 | favoriteToggle: viewModel.isFavorited(viewModel.products[index]), 34 | ), 35 | shrinkWrap: true, 36 | primary: false, 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/views/checkout/checkout_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/constants/asset_constants.dart'; 2 | import 'package:big_cart/shared/styles.dart'; 3 | import 'package:big_cart/viewmodels/checkout_viewmodel.dart'; 4 | import 'package:big_cart/widgets/dumb/app_main_button.dart'; 5 | import 'package:big_cart/widgets/dumb/loading_indicator.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:flutter/services.dart'; 8 | import 'package:stacked/stacked.dart'; 9 | import '../../widgets/dumb/customized_app_bar.dart'; 10 | import 'checkout_form.dart'; 11 | 12 | class CheckoutView extends StatelessWidget { 13 | const CheckoutView({ 14 | Key? key, 15 | }) : super(key: key); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | SystemChrome.setSystemUIOverlayStyle( 20 | const SystemUiOverlayStyle( 21 | statusBarColor: Colors.transparent, 22 | statusBarIconBrightness: Brightness.dark), 23 | ); 24 | return ViewModelBuilder.reactive( 25 | viewModelBuilder: () => CheckoutViewModel(), 26 | builder: (context, model, child) => GestureDetector( 27 | onTap: () => FocusManager.instance.primaryFocus?.unfocus(), 28 | child: Scaffold( 29 | backgroundColor: appWhiteColor, 30 | body: Column( 31 | children: [ 32 | CustomizedAppBar( 33 | title: 'Checkout', 34 | leading: AssetConstants.backArrowBlack, 35 | leadingOnTap: () { 36 | Navigator.of(context).pop(); 37 | }, 38 | ), 39 | const SizedBox(height: 13), 40 | Expanded( 41 | child: model.isLoading 42 | ? const LoadingIndicator() 43 | : const CheckoutForm(), 44 | ), 45 | const SizedBox(height: 13), 46 | AppMainButton( 47 | onTap: () { 48 | FocusScope.of(context).unfocus(); 49 | if (!model.isLoading) { 50 | model.validateForm(); 51 | } 52 | }, 53 | text: 'Next'), 54 | const SizedBox(height: 36), 55 | ], 56 | ), 57 | ), 58 | ), 59 | ); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/views/checkout/validation_message.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../../shared/styles.dart'; 4 | 5 | class ValidationMessage extends StatelessWidget { 6 | bool hasError; 7 | String? errorMessage; 8 | ValidationMessage({ 9 | Key? key, 10 | required this.hasError, 11 | required this.errorMessage, 12 | }) : super(key: key); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return AnimatedOpacity( 17 | duration: Duration(milliseconds: hasError == false ? 100 : 500), 18 | opacity: hasError == false ? 0.0 : 1.0, 19 | child: AnimatedContainer( 20 | duration: const Duration(milliseconds: 300), 21 | margin: const EdgeInsets.only( 22 | left: 19, 23 | bottom: 5, 24 | top: 1, 25 | ), 26 | alignment: Alignment.topLeft, 27 | height: hasError == false ? 0 : 19, 28 | child: Stack( 29 | fit: StackFit.expand, 30 | children: [ 31 | Positioned( 32 | left: 0, 33 | bottom: 0, 34 | child: SizedBox( 35 | height: 19, 36 | child: FittedBox( 37 | fit: BoxFit.contain, 38 | child: Text( 39 | errorMessage ?? ' ', 40 | style: paragraph6.copyWith(color: Colors.red), 41 | ), 42 | ), 43 | ), 44 | ), 45 | ], 46 | ), 47 | ), 48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/views/home/banner_carousel.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/models/carousel_item_model.dart'; 2 | import 'package:carousel_slider/carousel_slider.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | import '../../shared/helpers.dart'; 6 | import '../../shared/styles.dart'; 7 | 8 | class BannerCarousel extends StatefulWidget { 9 | List items; 10 | 11 | BannerCarousel({ 12 | Key? key, 13 | required this.items, 14 | }) : super(key: key); 15 | 16 | @override 17 | State createState() => _BannerCarouselState(); 18 | } 19 | 20 | class _BannerCarouselState extends State { 21 | int pageIndex = 0; 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | double bannerWidth = screenWidth(context) - 34; 26 | double bannerHeight = bannerWidth * (283 / 380); 27 | 28 | return Align( 29 | alignment: Alignment.topCenter, 30 | child: Stack( 31 | children: [ 32 | CarouselSlider.builder( 33 | itemCount: widget.items.length, 34 | itemBuilder: (context, index, pageIndex) => Container( 35 | margin: const EdgeInsets.only(bottom: 20), 36 | alignment: Alignment.bottomLeft, 37 | width: bannerWidth, 38 | height: bannerHeight, 39 | decoration: BoxDecoration( 40 | image: DecorationImage( 41 | image: AssetImage(widget.items[index].imagePath), 42 | fit: BoxFit.cover, 43 | ), 44 | ), 45 | child: Padding( 46 | padding: EdgeInsets.only( 47 | left: bannerWidth * (44 / 380) + 48 | (screenWidth(context) > screenHeight(context) ? 40 : 0), 49 | bottom: screenWidth(context) > screenHeight(context) 50 | ? 40 51 | : bannerHeight * (78 / 283), 52 | ), 53 | child: Text( 54 | widget.items[index].text, 55 | style: paragraph5, 56 | ), 57 | ), 58 | ), 59 | options: CarouselOptions( 60 | initialPage: 0, 61 | height: screenWidth(context) > screenHeight(context) 62 | ? 150 63 | : (bannerHeight + 20), 64 | viewportFraction: 1, 65 | autoPlay: true, 66 | onPageChanged: (index, reason) { 67 | setState(() { 68 | pageIndex = index; 69 | }); 70 | }, 71 | ), 72 | ), 73 | Positioned( 74 | bottom: screenWidth(context) > screenHeight(context) 75 | ? 40 76 | : bannerHeight * (50 / 303), 77 | left: 33, 78 | child: Row( 79 | mainAxisSize: MainAxisSize.min, 80 | children: [ 81 | ...List.generate( 82 | widget.items.length, 83 | (index) => AnimatedContainer( 84 | margin: const EdgeInsets.only(right: 6), 85 | duration: const Duration(milliseconds: 400), 86 | width: index == pageIndex ? 24 : 6, 87 | height: 6, 88 | decoration: BoxDecoration( 89 | color: index == pageIndex ? appGreenColor : Colors.white, 90 | shape: BoxShape.rectangle, 91 | borderRadius: BorderRadius.circular(100), 92 | ), 93 | ), 94 | ), 95 | ], 96 | ), 97 | ), 98 | ], 99 | ), 100 | ); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /lib/views/home/category_containers.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:stacked/stacked.dart'; 3 | import '../../shared/styles.dart'; 4 | import '../../viewmodels/home_viewmodel.dart'; 5 | 6 | class CategoryContainers extends ViewModelWidget { 7 | const CategoryContainers({ 8 | Key? key, 9 | }) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context, HomeViewModel viewModel) { 13 | return Center( 14 | child: SingleChildScrollView( 15 | physics: const BouncingScrollPhysics(), 16 | scrollDirection: Axis.horizontal, 17 | child: Row( 18 | children: [ 19 | ...[const SizedBox(width: 10)], 20 | ...List.generate( 21 | viewModel.categories.length, 22 | (index) => GestureDetector( 23 | onTap: () => viewModel.navigateToCategoryPage( 24 | viewModel.categories[index].id, 25 | viewModel.categories[index].title), 26 | child: Stack( 27 | alignment: Alignment.center, 28 | children: [ 29 | Container( 30 | padding: const EdgeInsets.symmetric(vertical: 13), 31 | margin: const EdgeInsets.only( 32 | left: 10, 33 | top: 17, 34 | bottom: 29, 35 | right: 10, 36 | ), 37 | width: 52, 38 | height: 52, 39 | decoration: BoxDecoration( 40 | shape: BoxShape.circle, 41 | color: getCategoryColorFromId( 42 | viewModel.categories[index].id ?? 0), 43 | ), 44 | child: Image.asset( 45 | getCategoryIconFromId( 46 | viewModel.categories[index].id ?? 0), 47 | ), 48 | ), 49 | Positioned( 50 | bottom: 3, 51 | child: Text( 52 | viewModel.categories[index].title ?? '', 53 | style: paragraph7, 54 | ), 55 | ), 56 | ], 57 | ), 58 | ), 59 | ), 60 | ...[const SizedBox(width: 10)], 61 | ], 62 | ), 63 | ), 64 | ); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/views/home/custom_home_drawer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:stacked/stacked.dart'; 3 | import '../../shared/styles.dart'; 4 | import '../../viewmodels/home_viewmodel.dart'; 5 | 6 | class CustomHomeDrawer extends ViewModelWidget { 7 | const CustomHomeDrawer({ 8 | Key? key, 9 | }) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context, HomeViewModel viewModel) { 13 | return Drawer( 14 | child: Column( 15 | children: [ 16 | Container( 17 | height: 200, 18 | width: double.infinity, 19 | color: appGreyColor, 20 | child: Column( 21 | mainAxisAlignment: MainAxisAlignment.end, 22 | children: [ 23 | Container( 24 | margin: const EdgeInsets.only(bottom: 8), 25 | width: 80, 26 | height: 80, 27 | decoration: BoxDecoration( 28 | shape: BoxShape.circle, 29 | border: Border.all( 30 | width: 4, 31 | color: appGreySecondary, 32 | ), 33 | ), 34 | child: const Icon( 35 | Icons.person, 36 | color: appGreySecondary, 37 | size: 50, 38 | ), 39 | ), 40 | Text( 41 | viewModel.email ?? '', 42 | style: paragraph1.copyWith(color: appGreySecondary), 43 | ), 44 | const SizedBox(height: 17), 45 | ], 46 | ), 47 | ), 48 | Padding( 49 | padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 15), 50 | child: Row( 51 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 52 | children: [ 53 | Text( 54 | 'Balance', 55 | style: heading7.copyWith(color: appGreyColor), 56 | ), 57 | Padding( 58 | padding: const EdgeInsets.only(bottom: 1), 59 | child: Text( 60 | 'Rs.3566', 61 | style: heading7.copyWith(color: appGreyColor), 62 | ), 63 | ) 64 | ], 65 | ), 66 | ), 67 | Container( 68 | margin: const EdgeInsets.only(bottom: 10), 69 | width: double.infinity, 70 | height: 1, 71 | color: appGreyColor, 72 | ), 73 | ListTile( 74 | onTap: () {}, 75 | leading: const Icon( 76 | Icons.notes, 77 | color: appGreyColor, 78 | ), 79 | title: Text( 80 | 'My Orders', 81 | style: heading7.copyWith(color: appGreyColor), 82 | ), 83 | ), 84 | ListTile( 85 | onTap: () {}, 86 | leading: const Icon( 87 | Icons.credit_card, 88 | color: appGreyColor, 89 | ), 90 | title: Text( 91 | 'Credit Cards', 92 | style: heading7.copyWith(color: appGreyColor), 93 | ), 94 | ), 95 | ListTile( 96 | onTap: () {}, 97 | leading: const Icon( 98 | Icons.card_giftcard, 99 | color: appGreyColor, 100 | ), 101 | title: Text( 102 | 'Reward Shop', 103 | style: heading7.copyWith(color: appGreyColor), 104 | ), 105 | ), 106 | ListTile( 107 | onTap: () {}, 108 | leading: const Icon( 109 | Icons.favorite, 110 | color: appGreyColor, 111 | ), 112 | title: Text( 113 | 'Favorites', 114 | style: heading7.copyWith(color: appGreyColor), 115 | ), 116 | ), 117 | ListTile( 118 | onTap: () { 119 | Navigator.of(context).pop(); 120 | FocusManager.instance.primaryFocus?.unfocus(); 121 | viewModel.logoutUser(); 122 | }, 123 | leading: const Padding( 124 | padding: EdgeInsets.only(left: 2), 125 | child: Icon( 126 | Icons.logout, 127 | color: appGreyColor, 128 | ), 129 | ), 130 | title: Text( 131 | 'Logout', 132 | style: heading7.copyWith(color: appGreyColor), 133 | ), 134 | ), 135 | ], 136 | ), 137 | ); 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /lib/views/home/floating_cart_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:stacked/stacked.dart'; 3 | import '../../constants/asset_constants.dart'; 4 | import '../../shared/styles.dart'; 5 | import '../../viewmodels/home_viewmodel.dart'; 6 | 7 | class FloatingCartButton extends ViewModelWidget { 8 | const FloatingCartButton({ 9 | Key? key, 10 | }) : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context, HomeViewModel viewModel) { 14 | return Align( 15 | alignment: Alignment.bottomRight, 16 | child: GestureDetector( 17 | onTap: () => viewModel.navigateToCartPage(), 18 | child: Container( 19 | margin: const EdgeInsets.only(bottom: 8, right: 2), 20 | alignment: Alignment.center, 21 | width: 68, 22 | height: 68, 23 | decoration: BoxDecoration( 24 | color: appGreenColor, 25 | shape: BoxShape.circle, 26 | boxShadow: [ 27 | BoxShadow( 28 | offset: const Offset(0, 4), 29 | blurRadius: 4, 30 | color: appGreenColor.withOpacity(0.26), 31 | ), 32 | ], 33 | ), 34 | child: Image.asset( 35 | AssetConstants.cartIconWhite, 36 | width: 21, 37 | ), 38 | ), 39 | ), 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/views/home/home_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/shared/styles.dart'; 2 | import 'package:big_cart/viewmodels/home_viewmodel.dart'; 3 | import 'package:big_cart/views/home/product_grid_list.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/services.dart'; 6 | import 'package:stacked/stacked.dart'; 7 | import '../../widgets/dumb/loading_indicator.dart'; 8 | import '../../widgets/dumb/page_error_indicator.dart'; 9 | import 'banner_carousel.dart'; 10 | import 'category_containers.dart'; 11 | import 'custom_home_drawer.dart'; 12 | import 'floating_cart_button.dart'; 13 | import 'logout_loading_screen.dart'; 14 | import 'search_bar.dart'; 15 | import 'title_with_arrow_button.dart'; 16 | 17 | class HomeView extends StatelessWidget { 18 | const HomeView({Key? key}) : super(key: key); 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | WidgetsBinding.instance?.addPostFrameCallback((timeStamp) { 23 | SystemChrome.setSystemUIOverlayStyle( 24 | const SystemUiOverlayStyle( 25 | statusBarColor: Colors.transparent, 26 | statusBarIconBrightness: Brightness.dark), 27 | ); 28 | }); 29 | return ViewModelBuilder.reactive( 30 | viewModelBuilder: () => HomeViewModel(), 31 | onModelReady: (viewModel) => viewModel.onModelReady(), 32 | builder: (context, model, child) => WillPopScope( 33 | onWillPop: () async { 34 | if (model.onlyProducts) { 35 | model.onlyProducts = false; 36 | model.onModelReady(); 37 | FocusManager.instance.primaryFocus?.unfocus(); 38 | return false; 39 | } else { 40 | return true; 41 | } 42 | }, 43 | child: GestureDetector( 44 | onTap: () => FocusManager.instance.primaryFocus?.unfocus(), 45 | child: Stack( 46 | children: [ 47 | Scaffold( 48 | floatingActionButton: const FloatingCartButton(), 49 | drawer: const CustomHomeDrawer(), 50 | body: Column( 51 | children: [ 52 | const SearchBar(), 53 | Expanded( 54 | child: model.hasError 55 | ? const PageErrorIndicator() 56 | : model.isLoading 57 | ? const LoadingIndicator() 58 | : ListView( 59 | padding: EdgeInsets.zero, 60 | children: [ 61 | if (!model.onlyProducts) ...[ 62 | BannerCarousel(items: model.carouselList), 63 | const TitleWithArrowButton( 64 | title: 'Categories', 65 | ), 66 | const CategoryContainers(), 67 | const SizedBox(height: 29), 68 | const TitleWithArrowButton( 69 | title: 'Featured Products') 70 | ], 71 | if (model.onlyProducts && 72 | model.products.isEmpty) 73 | Align( 74 | alignment: Alignment.center, 75 | child: Padding( 76 | padding: 77 | const EdgeInsets.only(top: 13), 78 | child: Text( 79 | 'No products found', 80 | style: paragraph1, 81 | ), 82 | ), 83 | ), 84 | const ProductGridList(), 85 | ], 86 | ), 87 | ), 88 | ], 89 | ), 90 | ), 91 | const LogoutLoadingScreen(), 92 | ], 93 | ), 94 | ), 95 | ), 96 | ); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /lib/views/home/logout_loading_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:stacked/stacked.dart'; 3 | import '../../shared/styles.dart'; 4 | import '../../viewmodels/home_viewmodel.dart'; 5 | 6 | class LogoutLoadingScreen extends ViewModelWidget { 7 | const LogoutLoadingScreen({ 8 | Key? key, 9 | }) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context, HomeViewModel viewModel) { 13 | return Positioned.fill( 14 | child: IgnorePointer( 15 | ignoring: !viewModel.logoutAnimationActive, 16 | child: AnimatedOpacity( 17 | duration: const Duration(milliseconds: 200), 18 | opacity: viewModel.logoutAnimationActive ? 1 : 0, 19 | child: Container( 20 | alignment: Alignment.center, 21 | color: Colors.black.withOpacity(0.7), 22 | child: Material( 23 | type: MaterialType.transparency, 24 | child: Text( 25 | viewModel.logoutLoadingText, 26 | style: heading7, 27 | ), 28 | ), 29 | ), 30 | ), 31 | ), 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/views/home/product_grid_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:stacked/stacked.dart'; 3 | 4 | import '../../shared/helpers.dart'; 5 | import '../../viewmodels/home_viewmodel.dart'; 6 | import '../../widgets/dumb/product_card.dart'; 7 | 8 | class ProductGridList extends ViewModelWidget { 9 | const ProductGridList({ 10 | Key? key, 11 | }) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context, HomeViewModel viewModel) { 15 | return GridView.builder( 16 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( 17 | crossAxisCount: screenWidth(context) > screenHeight(context) ? 4 : 2, 18 | childAspectRatio: 181 / 234, 19 | crossAxisSpacing: 18, 20 | mainAxisSpacing: 20), 21 | padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 20), 22 | itemCount: viewModel.products.length, 23 | itemBuilder: (context, index) => ProductCard( 24 | shadeColor: viewModel.products[index].color, 25 | image: viewModel.products[index].image, 26 | price: viewModel.products[index].price, 27 | title: viewModel.products[index].title, 28 | unit: viewModel.products[index].unit, 29 | qtyInCart: viewModel.productQuantity(viewModel.products[index]), 30 | onMinusTap: () => viewModel.removeFromCart(viewModel.products[index]), 31 | onPlusTap: () => viewModel.addToCart(viewModel.products[index]), 32 | onFavoriteButtonTap: () => 33 | viewModel.addOrRemoveFavorites(viewModel.products[index]), 34 | favoriteToggle: viewModel.isFavorited(viewModel.products[index]), 35 | ), 36 | shrinkWrap: true, 37 | primary: false, 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/views/home/search_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_hooks/flutter_hooks.dart'; 3 | import 'package:stacked_hooks/stacked_hooks.dart'; 4 | import '../../constants/asset_constants.dart'; 5 | import '../../shared/styles.dart'; 6 | import '../../viewmodels/home_viewmodel.dart'; 7 | 8 | class SearchBar extends HookViewModelWidget { 9 | const SearchBar({ 10 | Key? key, 11 | }) : super(key: key); 12 | 13 | @override 14 | Widget buildViewModelWidget(BuildContext context, HomeViewModel viewModel) { 15 | final TextEditingController controller = useTextEditingController(); 16 | if (!viewModel.onlyProducts) { 17 | controller.text = ''; 18 | } 19 | 20 | return Container( 21 | margin: const EdgeInsets.only(top: 51, left: 17, right: 17, bottom: 10), 22 | alignment: Alignment.center, 23 | height: 50, 24 | decoration: BoxDecoration( 25 | color: appWhiteColor, 26 | borderRadius: BorderRadius.circular(5), 27 | ), 28 | child: TextField( 29 | controller: controller, 30 | style: paragraph4, 31 | textInputAction: TextInputAction.search, 32 | maxLines: 1, 33 | textAlignVertical: TextAlignVertical.center, 34 | onChanged: (text) => viewModel.searchBarText = text, 35 | onSubmitted: (text) { 36 | viewModel.onlyProducts = true; 37 | viewModel.onModelReady(); 38 | }, 39 | cursorColor: appGreyColor, 40 | decoration: InputDecoration( 41 | isCollapsed: true, 42 | border: InputBorder.none, 43 | label: const Padding( 44 | padding: EdgeInsets.only(top: 3), 45 | child: Text('Search keywords...'), 46 | ), 47 | labelStyle: paragraph4, 48 | floatingLabelBehavior: FloatingLabelBehavior.never, 49 | prefixIcon: Padding( 50 | padding: const EdgeInsetsDirectional.only(start: 4), 51 | child: Container( 52 | width: 48, 53 | alignment: Alignment.center, 54 | child: Image.asset( 55 | AssetConstants.searchIcon, 56 | width: 20, 57 | height: 20, 58 | ), 59 | ), 60 | ), 61 | suffixIcon: Padding( 62 | padding: const EdgeInsets.only(right: 3), 63 | child: Container( 64 | width: 49, 65 | alignment: Alignment.center, 66 | child: Image.asset( 67 | AssetConstants.filterIcon, 68 | width: 19, 69 | height: 17, 70 | ), 71 | ), 72 | ), 73 | ), 74 | ), 75 | ); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /lib/views/home/title_with_arrow_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../../constants/asset_constants.dart'; 3 | import '../../shared/styles.dart'; 4 | 5 | class TitleWithArrowButton extends StatelessWidget { 6 | final String title; 7 | 8 | const TitleWithArrowButton({Key? key, required this.title}) : super(key: key); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return Padding( 13 | padding: const EdgeInsets.symmetric(horizontal: 16), 14 | child: Row( 15 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 16 | children: [ 17 | Text( 18 | title, 19 | style: paragraph5, 20 | ), 21 | Container( 22 | width: 40, 23 | height: 18, 24 | decoration: BoxDecoration( 25 | image: DecorationImage( 26 | image: AssetImage(AssetConstants.forwardArrow), 27 | alignment: Alignment.centerRight, 28 | fit: BoxFit.contain, 29 | ), 30 | ), 31 | ) 32 | ], 33 | ), 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/views/login/login_form.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/gestures.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_hooks/flutter_hooks.dart'; 4 | import 'package:flutter_switch/flutter_switch.dart'; 5 | import 'package:stacked_hooks/stacked_hooks.dart'; 6 | import '../../constants/asset_constants.dart'; 7 | import '../../shared/helpers.dart'; 8 | import '../../shared/styles.dart'; 9 | import '../../viewmodels/login_viewmodel.dart'; 10 | import '../../widgets/dumb/app_main_button.dart'; 11 | import '../../widgets/dumb/authentication_field.dart'; 12 | 13 | const String EmailValueKey = 'email'; 14 | const String PasswordValueKey = 'password'; 15 | const String PhoneValueKey = 'phone'; 16 | 17 | class LoginForm extends HookViewModelWidget { 18 | const LoginForm({Key? key}) : super(key: key, reactive: true); 19 | 20 | @override 21 | Widget buildViewModelWidget(BuildContext context, LoginViewModel viewModel) { 22 | final email = useTextEditingController(); 23 | final emailFocus = useFocusNode(); 24 | final password = useTextEditingController(); 25 | final passwordFocus = useFocusNode(); 26 | 27 | void _fireFormChanged(LoginViewModel model) => model 28 | .setData({EmailValueKey: email.text, PasswordValueKey: password.text}); 29 | 30 | return Form( 31 | child: Column( 32 | crossAxisAlignment: CrossAxisAlignment.start, 33 | children: [ 34 | Padding( 35 | padding: const EdgeInsets.only(left: 16, top: 30), 36 | child: Text( 37 | 'Welcome back !', 38 | style: heading5, 39 | ), 40 | ), 41 | Padding( 42 | padding: const EdgeInsets.only(left: 16, top: 2), 43 | child: Text( 44 | 'Sign in to your account', 45 | style: paragraph2, 46 | ), 47 | ), 48 | const SizedBox(height: 26), 49 | 50 | // Email Field 51 | AuthenticationField( 52 | controller: email, 53 | focusNode: emailFocus, 54 | hasError: viewModel.emailHasError, 55 | onChanged: (text) { 56 | _fireFormChanged(viewModel); 57 | viewModel.emailHasError = false; 58 | }, 59 | onSubmit: (text) { 60 | FocusScope.of(context).requestFocus(passwordFocus); 61 | viewModel.fieldPasswordColor = Colors.black; 62 | }, 63 | textColor: viewModel.fieldTextColor, 64 | onTap: () => viewModel.fieldTextColor = Colors.black, 65 | onEditingComplete: () => viewModel.fieldTextColor = appGreyColor, 66 | label: 'Email', 67 | prefixIconPath: AssetConstants.emailIcon, 68 | ), 69 | verticalSpaceMini, 70 | 71 | // Password Field 72 | AuthenticationField( 73 | controller: password, 74 | focusNode: passwordFocus, 75 | hasError: viewModel.passwordHasError, 76 | onChanged: (text) { 77 | _fireFormChanged(viewModel); 78 | viewModel.passwordHasError = false; 79 | }, 80 | onSubmit: (text) { 81 | FocusScope.of(context).unfocus(); 82 | }, 83 | textColor: viewModel.fieldPasswordColor, 84 | onTap: () => viewModel.fieldPasswordColor = Colors.black, 85 | onEditingComplete: () { 86 | viewModel.fieldPasswordColor = appGreyColor; 87 | FocusScope.of(context).unfocus(); 88 | }, 89 | obscureText: viewModel.isObscure, 90 | label: 'Password', 91 | prefixIconPath: AssetConstants.passwordIcon, 92 | suffixIcon: Padding( 93 | padding: const EdgeInsets.only(left: 5, right: 10), 94 | child: IconButton( 95 | onPressed: () => viewModel.isObscure = !viewModel.isObscure, 96 | icon: Icon( 97 | viewModel.isObscure ? Icons.visibility : Icons.visibility_off, 98 | color: appGreyColor, 99 | ), 100 | ), 101 | ), 102 | ), 103 | 104 | // Error Message 105 | if (viewModel.showValidationMessage) ...[ 106 | verticalSpaceMini, 107 | Padding( 108 | padding: const EdgeInsets.symmetric(horizontal: 18), 109 | child: Align( 110 | alignment: Alignment.center, 111 | child: Text( 112 | viewModel.validationMessage.toString(), 113 | textAlign: TextAlign.center, 114 | style: paragraph6.copyWith(color: Colors.red, fontSize: 15), 115 | ), 116 | ), 117 | ), 118 | ], 119 | 120 | verticalSpaceRegular, 121 | Padding( 122 | padding: const EdgeInsets.symmetric(horizontal: 26), 123 | child: Row( 124 | mainAxisSize: MainAxisSize.max, 125 | children: [ 126 | FlutterSwitch( 127 | padding: 0, 128 | width: 28.57, 129 | height: 16, 130 | toggleSize: 13, 131 | switchBorder: Border.all(width: 1.5, color: appGreyColor), 132 | toggleBorder: Border.all(width: 1.5, color: appWhiteColor), 133 | inactiveColor: appGreyColor, 134 | value: viewModel.shouldRemember, 135 | onToggle: (val) => viewModel.shouldRemember = val, 136 | ), 137 | const SizedBox(width: 9.43), 138 | Text( 139 | 'Remember me', 140 | style: paragraph1, 141 | ), 142 | const Spacer(), 143 | Text('Forgot Password', 144 | style: paragraph1.copyWith(color: appBlueColor)), 145 | ], 146 | ), 147 | ), 148 | verticalSpaceMedium, 149 | 150 | // Form Button 151 | AppMainButton( 152 | text: 'Login', 153 | isLoading: viewModel.isLoading, 154 | onTap: () { 155 | FocusScope.of(context).unfocus(); 156 | viewModel.validateForm(); 157 | }, 158 | ), 159 | const SizedBox(height: 20), 160 | 161 | // Footer Text 162 | Align( 163 | alignment: Alignment.topCenter, 164 | child: RichText( 165 | text: TextSpan( 166 | text: 'Don\'t have an account ? ', 167 | style: paragraph3, 168 | children: [ 169 | TextSpan( 170 | text: 'Sign up', 171 | style: paragraph1.copyWith(color: Colors.black), 172 | recognizer: TapGestureRecognizer() 173 | ..onTap = () { 174 | viewModel.navigateToSignupPage(); 175 | }, 176 | ), 177 | ], 178 | )), 179 | ), 180 | const SizedBox(height: 45), 181 | ], 182 | ), 183 | ); 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /lib/views/login/login_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/constants/asset_constants.dart'; 2 | import 'package:big_cart/shared/styles.dart'; 3 | import 'package:big_cart/viewmodels/login_viewmodel.dart'; 4 | import 'package:big_cart/widgets/dumb/authentication_layout.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter/services.dart'; 7 | import 'package:stacked/stacked.dart'; 8 | import 'login_form.dart'; 9 | 10 | class LoginView extends StatelessWidget { 11 | const LoginView({Key? key}) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | SystemChrome.setSystemUIOverlayStyle( 16 | const SystemUiOverlayStyle( 17 | statusBarColor: Colors.transparent, 18 | statusBarIconBrightness: Brightness.light), 19 | ); 20 | return ViewModelBuilder.reactive( 21 | viewModelBuilder: () => LoginViewModel(), 22 | builder: (context, model, child) => AuthenticationLayout( 23 | image: AssetConstants.loginBackground, 24 | form: const LoginForm(), 25 | minHeight: 453, 26 | onBackButtonPressed: () {}, 27 | isDisabled: model.isLoading, 28 | onScreenTap: () { 29 | FocusManager.instance.primaryFocus?.unfocus(); 30 | model.fieldTextColor = appGreyColor; 31 | model.fieldPasswordColor = appGreyColor; 32 | }, 33 | ), 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/views/order_success/order_success_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/app/app.router.dart'; 2 | import 'package:big_cart/constants/asset_constants.dart'; 3 | import 'package:big_cart/shared/helpers.dart'; 4 | import 'package:big_cart/shared/styles.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter/services.dart'; 7 | import 'package:stacked_services/stacked_services.dart'; 8 | 9 | import '../../app/locator.dart'; 10 | import '../../widgets/dumb/app_main_button.dart'; 11 | 12 | class OrderSuccessView extends StatelessWidget { 13 | int id; 14 | OrderSuccessView({Key? key, required this.id}) : super(key: key); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | SystemChrome.setSystemUIOverlayStyle( 19 | const SystemUiOverlayStyle( 20 | statusBarColor: Colors.transparent, 21 | statusBarIconBrightness: Brightness.dark), 22 | ); 23 | return WillPopScope( 24 | onWillPop: () async { 25 | locator().clearStackAndShow(Routes.homeView); 26 | return false; 27 | }, 28 | child: Scaffold( 29 | backgroundColor: Colors.white, 30 | body: Column( 31 | children: [ 32 | Expanded( 33 | child: Column( 34 | mainAxisAlignment: MainAxisAlignment.center, 35 | children: [ 36 | Image.asset( 37 | AssetConstants.orderSuccessIcon, 38 | width: (screenWidth(context) * (227 / 414)), 39 | ), 40 | const SizedBox(height: 45), 41 | Text( 42 | 'Congrats', 43 | style: heading5.copyWith(fontSize: 24), 44 | ), 45 | const SizedBox(height: 8), 46 | Align( 47 | alignment: Alignment.center, 48 | child: RichText( 49 | textAlign: TextAlign.center, 50 | text: TextSpan( 51 | text: 'Your Order ', 52 | style: paragraph8, 53 | children: [ 54 | TextSpan( 55 | text: '#' + id.toString().padLeft(5, '0'), 56 | style: paragraph9), 57 | TextSpan( 58 | text: ' is\nSuccessfuly Received', 59 | style: paragraph8) 60 | ]), 61 | ), 62 | ) 63 | ], 64 | ), 65 | ), 66 | SizedBox( 67 | height: screenHeight( 68 | context, 69 | percentage: (90 / 896), 70 | ), 71 | ), 72 | AppMainButton( 73 | onTap: () { 74 | locator() 75 | .clearStackAndShow(Routes.homeView); 76 | }, 77 | text: 'Go to home'), 78 | const SizedBox(height: 36), 79 | ], 80 | ), 81 | ), 82 | ); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /lib/views/shopping_cart/cart_item_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_slidable/flutter_slidable.dart'; 3 | import 'package:flutter_svg/flutter_svg.dart'; 4 | import 'package:stacked/stacked.dart'; 5 | import '../../constants/asset_constants.dart'; 6 | import '../../shared/helpers.dart'; 7 | import '../../shared/styles.dart'; 8 | import '../../viewmodels/shopping_cart_viewmodel.dart'; 9 | 10 | class CartItemList extends ViewModelWidget { 11 | const CartItemList({Key? key}) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context, ShoppingCartViewModel viewModel) { 15 | return ListView( 16 | padding: EdgeInsets.zero, 17 | children: [ 18 | const SizedBox(height: 2), 19 | ...List.generate( 20 | viewModel.cart.length, 21 | (index) => Slidable( 22 | endActionPane: ActionPane( 23 | extentRatio: 0.22, 24 | motion: const ScrollMotion(), 25 | children: [ 26 | GestureDetector( 27 | onTap: () => 28 | viewModel.deleteFromCart(viewModel.cart[index]), 29 | child: Container( 30 | margin: const EdgeInsets.only(top: 11), 31 | width: (screenWidth(context) * 0.22) - 17, 32 | alignment: Alignment.center, 33 | color: appRedColor, 34 | child: Image.asset( 35 | AssetConstants.deleteIcon, 36 | height: 28, 37 | ), 38 | ), 39 | ) 40 | ]), 41 | child: Container( 42 | height: 100, 43 | padding: const EdgeInsets.only(right: 7), 44 | margin: const EdgeInsets.only( 45 | left: 17, 46 | right: 17, 47 | top: 11, 48 | ), 49 | color: Colors.white, 50 | child: Row( 51 | children: [ 52 | Container( 53 | width: 104, 54 | padding: const EdgeInsets.only(top: 15, bottom: 8), 55 | color: Colors.transparent, 56 | child: Stack( 57 | fit: StackFit.expand, 58 | children: [ 59 | Container( 60 | margin: const EdgeInsets.only(bottom: 18), 61 | child: FittedBox( 62 | child: Container( 63 | height: 10, 64 | width: 10, 65 | decoration: BoxDecoration( 66 | color: Color( 67 | int.parse( 68 | '0xFF' + 69 | viewModel.cart[index].color 70 | .toString() 71 | .substring(1), 72 | ), 73 | ).withOpacity(0.3), 74 | shape: BoxShape.circle, 75 | ), 76 | ), 77 | ), 78 | ), 79 | Container( 80 | margin: const EdgeInsets.only(bottom: 8, top: 15), 81 | child: FittedBox( 82 | child: Image.network( 83 | viewModel.cart[index].image ?? 84 | AssetConstants.errorIcon)), 85 | ) 86 | ], 87 | ), 88 | ), 89 | Column( 90 | crossAxisAlignment: CrossAxisAlignment.start, 91 | mainAxisAlignment: MainAxisAlignment.center, 92 | children: [ 93 | const SizedBox(height: 2), 94 | Text( 95 | '\$' + 96 | (viewModel.cart[index].price ?? 0) 97 | .toString() 98 | .padRight(4, '0') + 99 | ' x ' + 100 | (viewModel.cart[index].qty ?? 0).toString(), 101 | style: paragraph6.copyWith(color: appGreenColor), 102 | ), 103 | Text( 104 | viewModel.cart[index].title ?? '', 105 | style: heading7.copyWith(color: Colors.black), 106 | ), 107 | Text( 108 | viewModel.cart[index].unit ?? '', 109 | style: paragraph6, 110 | ), 111 | ], 112 | ), 113 | const Spacer(), 114 | SizedBox( 115 | width: 41, 116 | child: Padding( 117 | padding: const EdgeInsets.only(top: 3), 118 | child: Column( 119 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 120 | children: [ 121 | GestureDetector( 122 | onTap: () { 123 | viewModel.addToCart(viewModel.cart[index]); 124 | }, 125 | child: Container( 126 | color: Colors.transparent, 127 | height: 31, 128 | alignment: Alignment.center, 129 | child: SvgPicture.asset( 130 | AssetConstants.addIcon, 131 | width: 13.5, 132 | ), 133 | ), 134 | ), 135 | Text( 136 | viewModel 137 | .productQuantity(viewModel.cart[index]) 138 | .toString(), 139 | style: paragraph4, 140 | ), 141 | GestureDetector( 142 | onTap: () { 143 | viewModel.removeFromCart(viewModel.cart[index]); 144 | }, 145 | child: Container( 146 | color: Colors.transparent, 147 | height: 31, 148 | alignment: Alignment.center, 149 | child: SvgPicture.asset( 150 | AssetConstants.subtractIcon, 151 | width: 13.5, 152 | ), 153 | ), 154 | ), 155 | ], 156 | ), 157 | ), 158 | ) 159 | ], 160 | ), 161 | ), 162 | ), 163 | ), 164 | const SizedBox(height: 13), 165 | ], 166 | ); 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /lib/views/shopping_cart/cost_with_main_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:stacked/stacked.dart'; 3 | import '../../shared/styles.dart'; 4 | import '../../viewmodels/shopping_cart_viewmodel.dart'; 5 | import '../../widgets/dumb/app_main_button.dart'; 6 | import 'title_with_cost.dart'; 7 | 8 | class CostWithMainButton extends ViewModelWidget { 9 | const CostWithMainButton({ 10 | Key? key, 11 | }) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context, ShoppingCartViewModel viewModel) { 15 | return Container( 16 | margin: const EdgeInsets.only(top: 13), 17 | constraints: const BoxConstraints(minHeight: 100), 18 | color: Colors.white, 19 | child: Column( 20 | mainAxisAlignment: MainAxisAlignment.end, 21 | children: [ 22 | const SizedBox(height: 22), 23 | TitleWithCost( 24 | title: 'Subtotal', 25 | cost: viewModel.subTotal, 26 | style: paragraph6, 27 | ), 28 | const SizedBox(height: 7), 29 | TitleWithCost( 30 | title: 'Shipping charges', 31 | cost: viewModel.shippingCharges, 32 | style: paragraph6, 33 | ), 34 | const SizedBox(height: 10), 35 | Container( 36 | margin: const EdgeInsets.symmetric(horizontal: 17, vertical: 10), 37 | height: 1, 38 | color: appGreySecondary, 39 | ), 40 | TitleWithCost( 41 | title: 'Total', 42 | cost: viewModel.totalCost, 43 | style: paragraph5, 44 | ), 45 | const SizedBox(height: 16), 46 | AppMainButton( 47 | onTap: () { 48 | viewModel.moveToCheckout(); 49 | }, 50 | text: 'Checkout'), 51 | const SizedBox(height: 36), 52 | ], 53 | ), 54 | ); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /lib/views/shopping_cart/shopping_cart_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/constants/asset_constants.dart'; 2 | import 'package:big_cart/shared/styles.dart'; 3 | import 'package:big_cart/viewmodels/shopping_cart_viewmodel.dart'; 4 | import 'package:big_cart/widgets/dumb/customized_app_bar.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter/services.dart'; 7 | import 'package:stacked/stacked.dart'; 8 | import 'cart_item_list.dart'; 9 | import 'cost_with_main_button.dart'; 10 | 11 | class ShoppingCartView extends StatelessWidget { 12 | const ShoppingCartView({Key? key}) : super(key: key); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | SystemChrome.setSystemUIOverlayStyle( 17 | const SystemUiOverlayStyle( 18 | statusBarColor: Colors.transparent, 19 | statusBarIconBrightness: Brightness.dark), 20 | ); 21 | return ViewModelBuilder.nonReactive( 22 | viewModelBuilder: () => ShoppingCartViewModel(), 23 | builder: (context, model, child) => Scaffold( 24 | backgroundColor: appWhiteColor, 25 | body: Column( 26 | children: [ 27 | CustomizedAppBar( 28 | title: 'Shopping Cart', 29 | leading: AssetConstants.backArrowBlack, 30 | leadingOnTap: () { 31 | Navigator.of(context).pop(); 32 | }, 33 | ), 34 | const SizedBox(height: 13), 35 | const Expanded( 36 | child: CartItemList(), 37 | ), 38 | const CostWithMainButton(), 39 | ], 40 | ), 41 | ), 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/views/shopping_cart/title_with_cost.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class TitleWithCost extends StatelessWidget { 4 | final String title; 5 | final double cost; 6 | final TextStyle style; 7 | 8 | const TitleWithCost({ 9 | Key? key, 10 | required this.title, 11 | required this.cost, 12 | required this.style, 13 | }) : super(key: key); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Padding( 18 | padding: const EdgeInsets.symmetric(horizontal: 17), 19 | child: Row( 20 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 21 | children: [ 22 | Text( 23 | title, 24 | style: style, 25 | ), 26 | Text( 27 | '\$' + cost.toStringAsFixed(1), 28 | style: style, 29 | ), 30 | ], 31 | ), 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/views/signup/signup_form.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/gestures.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_hooks/flutter_hooks.dart'; 4 | import 'package:stacked_hooks/stacked_hooks.dart'; 5 | import '../../constants/asset_constants.dart'; 6 | import '../../shared/helpers.dart'; 7 | import '../../shared/styles.dart'; 8 | import '../../viewmodels/signup_viewmodel.dart'; 9 | import '../../widgets/dumb/app_main_button.dart'; 10 | import '../../widgets/dumb/authentication_field.dart'; 11 | import '../login/login_form.dart'; 12 | 13 | class SignupForm extends HookViewModelWidget { 14 | const SignupForm({Key? key}) : super(key: key); 15 | 16 | @override 17 | Widget buildViewModelWidget(BuildContext context, SignupViewModel viewModel) { 18 | final email = useTextEditingController(); 19 | final emailFocus = useFocusNode(); 20 | final password = useTextEditingController(); 21 | final passwordFocus = useFocusNode(); 22 | final phone = useTextEditingController(); 23 | final phoneFocus = useFocusNode(); 24 | 25 | void _fireFormChanged(SignupViewModel model) => model.setData({ 26 | EmailValueKey: email.text, 27 | PasswordValueKey: password.text, 28 | PhoneValueKey: phone.text, 29 | }); 30 | 31 | return Form( 32 | child: Column( 33 | crossAxisAlignment: CrossAxisAlignment.start, 34 | children: [ 35 | Padding( 36 | padding: const EdgeInsets.only(left: 16, top: 30), 37 | child: Text( 38 | 'Create account', 39 | style: heading5, 40 | ), 41 | ), 42 | Padding( 43 | padding: const EdgeInsets.only(left: 16, top: 2), 44 | child: Text( 45 | 'Quickly create account', 46 | style: paragraph2, 47 | ), 48 | ), 49 | const SizedBox(height: 26), 50 | 51 | // Email Field 52 | AuthenticationField( 53 | controller: email, 54 | focusNode: emailFocus, 55 | hasError: viewModel.emailHasError, 56 | onChanged: (text) { 57 | _fireFormChanged(viewModel); 58 | viewModel.emailHasError = false; 59 | }, 60 | onSubmit: (text) { 61 | FocusScope.of(context).requestFocus(phoneFocus); 62 | viewModel.fieldPhoneColor = Colors.black; 63 | }, 64 | textColor: viewModel.fieldTextColor, 65 | onTap: () => viewModel.fieldTextColor = Colors.black, 66 | onEditingComplete: () => viewModel.fieldTextColor = appGreyColor, 67 | label: 'Email', 68 | prefixIconPath: AssetConstants.emailIcon, 69 | ), 70 | verticalSpaceMini, 71 | 72 | // Phone Field 73 | AuthenticationField( 74 | controller: phone, 75 | focusNode: phoneFocus, 76 | hasError: viewModel.phoneHasError, 77 | onChanged: (text) { 78 | _fireFormChanged(viewModel); 79 | viewModel.phoneHasError = false; 80 | }, 81 | onSubmit: (text) { 82 | FocusScope.of(context).requestFocus(passwordFocus); 83 | viewModel.fieldPasswordColor = Colors.black; 84 | }, 85 | textColor: viewModel.fieldPhoneColor, 86 | onTap: () => viewModel.fieldPhoneColor = Colors.black, 87 | onEditingComplete: () => viewModel.fieldPhoneColor = appGreyColor, 88 | label: 'Phone', 89 | prefixIconPath: AssetConstants.phoneIcon, 90 | ), 91 | verticalSpaceMini, 92 | 93 | // Password Field 94 | AuthenticationField( 95 | controller: password, 96 | focusNode: passwordFocus, 97 | hasError: viewModel.passwordHasError, 98 | onChanged: (text) { 99 | _fireFormChanged(viewModel); 100 | viewModel.passwordHasError = false; 101 | }, 102 | onSubmit: (text) { 103 | FocusScope.of(context).unfocus(); 104 | }, 105 | textColor: viewModel.fieldPasswordColor, 106 | onTap: () => viewModel.fieldPasswordColor = Colors.black, 107 | onEditingComplete: () { 108 | viewModel.fieldPasswordColor = appGreyColor; 109 | FocusScope.of(context).unfocus(); 110 | }, 111 | obscureText: viewModel.isObscure, 112 | label: 'Password', 113 | prefixIconPath: AssetConstants.passwordIcon, 114 | suffixIcon: Padding( 115 | padding: const EdgeInsets.only(left: 5, right: 10), 116 | child: IconButton( 117 | onPressed: () => viewModel.isObscure = !viewModel.isObscure, 118 | icon: Icon( 119 | viewModel.isObscure ? Icons.visibility : Icons.visibility_off, 120 | color: appGreyColor, 121 | ), 122 | ), 123 | ), 124 | ), 125 | if (viewModel.showValidationMessage) ...[ 126 | verticalSpaceMini, 127 | Padding( 128 | padding: const EdgeInsets.symmetric(horizontal: 18), 129 | child: Align( 130 | alignment: Alignment.center, 131 | child: Text( 132 | viewModel.validationMessage.toString(), 133 | textAlign: TextAlign.center, 134 | style: paragraph6.copyWith(color: Colors.red, fontSize: 15), 135 | ), 136 | ), 137 | ), 138 | ], 139 | 140 | verticalSpaceMedium, 141 | 142 | // Form Button 143 | AppMainButton( 144 | text: 'SignUp', 145 | isLoading: viewModel.isLoading, 146 | onTap: () { 147 | FocusScope.of(context).unfocus(); 148 | viewModel.validateForm(); 149 | }, 150 | ), 151 | const SizedBox(height: 20), 152 | 153 | // Footer Text 154 | Align( 155 | alignment: Alignment.topCenter, 156 | child: RichText( 157 | text: TextSpan( 158 | text: 'Already have an account ? ', 159 | style: paragraph3, 160 | children: [ 161 | TextSpan( 162 | text: 'Login', 163 | style: paragraph1.copyWith(color: Colors.black), 164 | recognizer: TapGestureRecognizer() 165 | ..onTap = () { 166 | viewModel.navigateToLoginPage(); 167 | }, 168 | ), 169 | ], 170 | ), 171 | ), 172 | ), 173 | const SizedBox(height: 45), 174 | ], 175 | ), 176 | ); 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /lib/views/signup/signup_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/constants/asset_constants.dart'; 2 | import 'package:big_cart/viewmodels/signup_viewmodel.dart'; 3 | import 'package:big_cart/views/signup/signup_form.dart'; 4 | import 'package:big_cart/widgets/dumb/authentication_layout.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:stacked/stacked.dart'; 7 | import '../../shared/styles.dart'; 8 | 9 | class SignupView extends StatelessWidget { 10 | const SignupView({Key? key}) : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return ViewModelBuilder.reactive( 15 | viewModelBuilder: () => SignupViewModel(), 16 | builder: (context, model, child) => AuthenticationLayout( 17 | form: const SignupForm(), 18 | minHeight: 473, 19 | isDisabled: model.isLoading, 20 | onBackButtonPressed: () { 21 | Navigator.of(context).pop(); 22 | }, 23 | image: AssetConstants.signupBackground, 24 | onScreenTap: () { 25 | FocusManager.instance.primaryFocus?.unfocus(); 26 | model.fieldTextColor = appGreyColor; 27 | model.fieldPasswordColor = appGreyColor; 28 | model.fieldPhoneColor = appGreyColor; 29 | }, 30 | ), 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/views/splash/background.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../../constants/asset_constants.dart'; 3 | 4 | class Background extends StatelessWidget { 5 | const Background({ 6 | Key? key, 7 | }) : super(key: key); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Container( 12 | decoration: BoxDecoration( 13 | image: DecorationImage( 14 | image: AssetImage(AssetConstants.splashScreenBackground), 15 | fit: BoxFit.cover), 16 | ), 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/views/splash/foreground.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../../constants/asset_constants.dart'; 3 | import '../../shared/styles.dart'; 4 | 5 | class Foreground extends StatelessWidget { 6 | const Foreground({ 7 | Key? key, 8 | }) : super(key: key); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return Column( 13 | children: [ 14 | const SizedBox(height: 96), 15 | Text( 16 | 'Welcome to', 17 | style: heading4, 18 | ), 19 | const SizedBox(height: 1), 20 | Image.asset( 21 | AssetConstants.appLogo, 22 | width: 127, 23 | height: 50, 24 | ), 25 | const SizedBox(height: 17), 26 | Padding( 27 | padding: const EdgeInsets.symmetric(horizontal: 47), 28 | child: Text( 29 | 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy', 30 | style: paragraph1, 31 | textAlign: TextAlign.center, 32 | ), 33 | ), 34 | const Spacer(), 35 | Text( 36 | 'POWERED BY', 37 | style: heading3, 38 | ), 39 | const SizedBox(height: 6), 40 | RichText( 41 | text: TextSpan( 42 | text: 'TECH', 43 | style: heading2, 44 | children: [ 45 | TextSpan(text: ' IDARA', style: heading1), 46 | ], 47 | ), 48 | ), 49 | const SizedBox(height: 31), 50 | ], 51 | ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lib/views/splash/splash_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:big_cart/viewmodels/splash_viewmodel.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter/services.dart'; 4 | import 'package:flutter_hooks/flutter_hooks.dart'; 5 | import 'package:stacked/stacked.dart'; 6 | 7 | import 'background.dart'; 8 | import 'foreground.dart'; 9 | 10 | class SplashView extends HookWidget { 11 | const SplashView({Key? key}) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | final controller = useAnimationController( 16 | duration: const Duration(milliseconds: 500), 17 | ); 18 | final animation = Tween(begin: 0.0, end: 1.0).animate(controller); 19 | controller.forward(); 20 | 21 | SystemChrome.setSystemUIOverlayStyle( 22 | const SystemUiOverlayStyle( 23 | statusBarColor: Colors.transparent, 24 | statusBarIconBrightness: Brightness.dark), 25 | ); 26 | 27 | return ViewModelBuilder.reactive( 28 | viewModelBuilder: () => SplashViewModel(), 29 | onModelReady: (viewModel) => viewModel.initializeApp(), 30 | builder: (context, model, child) => Scaffold( 31 | body: FadeTransition( 32 | opacity: animation, 33 | child: Stack( 34 | alignment: Alignment.center, 35 | children: const [ 36 | Background(), 37 | Foreground(), 38 | ], 39 | ), 40 | ), 41 | ), 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/widgets/dumb/app_main_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../../shared/styles.dart'; 3 | 4 | class AppMainButton extends StatelessWidget { 5 | final String text; 6 | final VoidCallback onTap; 7 | final bool? isLoading; 8 | 9 | const AppMainButton({ 10 | Key? key, 11 | required this.onTap, 12 | required this.text, 13 | this.isLoading, 14 | }) : super(key: key); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return GestureDetector( 19 | onTap: onTap, 20 | child: Container( 21 | margin: const EdgeInsets.symmetric(horizontal: 17), 22 | alignment: Alignment.center, 23 | height: 60, 24 | decoration: BoxDecoration( 25 | gradient: const LinearGradient( 26 | begin: Alignment.centerLeft, 27 | end: Alignment.centerRight, 28 | colors: [ 29 | appGreenSecondary, 30 | appGreenColor, 31 | ], 32 | ), 33 | borderRadius: BorderRadius.circular(5), 34 | boxShadow: [ 35 | BoxShadow( 36 | color: appGreenColor.withOpacity(0.25), 37 | offset: const Offset(0, 10), 38 | blurRadius: 9, 39 | ), 40 | ], 41 | ), 42 | child: isLoading == true 43 | ? const Padding( 44 | padding: EdgeInsets.symmetric(vertical: 15), 45 | child: FittedBox( 46 | child: CircularProgressIndicator( 47 | color: Colors.white, 48 | ), 49 | ), 50 | ) 51 | : Text( 52 | text, 53 | style: heading7, 54 | ), 55 | ), 56 | ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/widgets/dumb/authentication_field.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../../shared/styles.dart'; 4 | 5 | class AuthenticationField extends StatelessWidget { 6 | AuthenticationField({ 7 | Key? key, 8 | required this.controller, 9 | required this.focusNode, 10 | required this.onChanged, 11 | required this.onSubmit, 12 | required this.textColor, 13 | required this.onTap, 14 | required this.onEditingComplete, 15 | required this.label, 16 | required this.prefixIconPath, 17 | this.prefixIcon, 18 | this.suffixIcon, 19 | this.obscureText = false, 20 | this.textSize, 21 | this.hasError, 22 | }) : super(key: key); 23 | 24 | final TextEditingController controller; 25 | final FocusNode focusNode; 26 | Function(String)? onChanged; 27 | Function(String)? onSubmit; 28 | VoidCallback onTap; 29 | VoidCallback onEditingComplete; 30 | Color textColor; 31 | String label; 32 | String prefixIconPath; 33 | Widget? prefixIcon; 34 | Widget? suffixIcon; 35 | bool obscureText; 36 | double? textSize; 37 | bool? hasError; 38 | 39 | @override 40 | Widget build(BuildContext context) { 41 | return AnimatedContainer( 42 | duration: Duration(milliseconds: hasError == true ? 300 : 200), 43 | alignment: Alignment.center, 44 | height: 62, 45 | margin: const EdgeInsets.symmetric(horizontal: 15), 46 | decoration: BoxDecoration( 47 | color: Colors.white, 48 | borderRadius: BorderRadius.circular(5), 49 | border: Border.all( 50 | width: 2, 51 | color: hasError == true ? Colors.red : Colors.transparent, 52 | ), 53 | ), 54 | child: TextFormField( 55 | style: heading3.copyWith( 56 | letterSpacing: 15 * (3 / 100), 57 | color: textColor, 58 | fontSize: textSize), 59 | controller: controller, 60 | focusNode: focusNode, 61 | textInputAction: TextInputAction.done, 62 | maxLines: 1, 63 | textAlignVertical: TextAlignVertical.center, 64 | onChanged: onChanged, 65 | onFieldSubmitted: onSubmit, 66 | onTap: onTap, 67 | onEditingComplete: onEditingComplete, 68 | obscureText: obscureText, 69 | obscuringCharacter: '•', 70 | decoration: InputDecoration( 71 | isCollapsed: true, 72 | border: InputBorder.none, 73 | label: Text(label), 74 | labelStyle: heading3.copyWith(letterSpacing: 15 * (3 / 100)), 75 | floatingLabelBehavior: FloatingLabelBehavior.never, 76 | prefixIcon: prefixIcon ?? 77 | Padding( 78 | padding: const EdgeInsets.only(left: 28, right: 21), 79 | child: SizedBox( 80 | height: 25, 81 | width: 25, 82 | child: FittedBox( 83 | child: ImageIcon( 84 | AssetImage(prefixIconPath), 85 | color: appGreyColor, 86 | ), 87 | ), 88 | ), 89 | ), 90 | suffixIcon: suffixIcon), 91 | ), 92 | ); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /lib/widgets/dumb/authentication_layout.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | import '../../constants/asset_constants.dart'; 4 | import '../../shared/helpers.dart'; 5 | import '../../shared/styles.dart'; 6 | 7 | class AuthenticationLayout extends StatelessWidget { 8 | final Widget form; 9 | final VoidCallback onBackButtonPressed; 10 | final String image; 11 | final VoidCallback? onScreenTap; 12 | final double minHeight; 13 | bool? isDisabled; 14 | 15 | AuthenticationLayout( 16 | {required this.form, 17 | required this.onBackButtonPressed, 18 | required this.image, 19 | required this.minHeight, 20 | this.onScreenTap, 21 | this.isDisabled, 22 | Key? key}) 23 | : super(key: key); 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | SystemChrome.setSystemUIOverlayStyle( 28 | const SystemUiOverlayStyle( 29 | statusBarColor: Colors.transparent, 30 | statusBarIconBrightness: Brightness.light), 31 | ); 32 | 33 | double formContainerHeight = 34 | screenHeight(context, percentage: (minHeight / 896)) < minHeight 35 | ? minHeight 36 | : screenHeight(context, percentage: (minHeight / 896)); 37 | 38 | return GestureDetector( 39 | onTap: onScreenTap, 40 | child: Scaffold( 41 | body: SingleChildScrollView( 42 | child: SizedBox( 43 | height: screenHeight(context), 44 | width: screenWidth(context), 45 | child: Stack( 46 | alignment: Alignment.center, 47 | children: [ 48 | Container( 49 | decoration: BoxDecoration( 50 | image: DecorationImage( 51 | image: AssetImage(image), fit: BoxFit.cover), 52 | ), 53 | ), 54 | Positioned( 55 | top: 0, 56 | left: 0, 57 | right: 0, 58 | child: Container( 59 | height: 131, 60 | decoration: BoxDecoration( 61 | gradient: LinearGradient( 62 | begin: Alignment.topCenter, 63 | end: Alignment.bottomCenter, 64 | stops: const [0.0, 1.0], 65 | colors: [ 66 | Colors.black.withOpacity(1), 67 | Colors.black.withOpacity(0), 68 | ], 69 | ), 70 | ), 71 | ), 72 | ), 73 | Positioned( 74 | top: 63, 75 | child: Text( 76 | 'Welcome', 77 | style: heading6, 78 | ), 79 | ), 80 | Positioned( 81 | top: 53, 82 | left: 1, 83 | child: IconButton( 84 | onPressed: onBackButtonPressed, 85 | icon: ImageIcon( 86 | AssetImage(AssetConstants.backArrow), 87 | ), 88 | iconSize: 22, 89 | color: Colors.white, 90 | ), 91 | ), 92 | Positioned( 93 | left: 0, 94 | right: 0, 95 | bottom: 0, 96 | child: Stack( 97 | fit: StackFit.loose, 98 | children: [ 99 | Container( 100 | constraints: 101 | BoxConstraints(minHeight: formContainerHeight), 102 | decoration: const BoxDecoration( 103 | color: appWhiteColor, 104 | borderRadius: BorderRadius.vertical( 105 | top: Radius.circular(10), 106 | ), 107 | ), 108 | child: form, 109 | ), 110 | if (isDisabled == true) 111 | Positioned.fill( 112 | child: Container( 113 | color: Colors.transparent, 114 | ), 115 | ), 116 | ], 117 | ), 118 | ), 119 | ], 120 | ), 121 | ), 122 | ), 123 | ), 124 | ); 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /lib/widgets/dumb/customized_app_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../../shared/styles.dart'; 4 | 5 | class CustomizedAppBar extends StatelessWidget { 6 | const CustomizedAppBar({ 7 | Key? key, 8 | required this.title, 9 | this.leading, 10 | this.leadingOnTap, 11 | this.trailing, 12 | this.trailingOnTap, 13 | }) : super(key: key); 14 | 15 | final String title; 16 | final String? leading; 17 | final VoidCallback? leadingOnTap; 18 | final String? trailing; 19 | final VoidCallback? trailingOnTap; 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | return Container( 24 | height: 118, 25 | color: Colors.white, 26 | child: Stack( 27 | alignment: Alignment.center, 28 | fit: StackFit.expand, 29 | children: [ 30 | Positioned( 31 | bottom: 29, 32 | child: Text( 33 | title, 34 | style: heading6.copyWith(color: Colors.black), 35 | ), 36 | ), 37 | if (leading != null) 38 | Positioned( 39 | left: 0, 40 | bottom: 29, 41 | child: GestureDetector( 42 | onTap: leadingOnTap, 43 | child: Container( 44 | height: 26, 45 | width: 40, 46 | alignment: Alignment.center, 47 | color: Colors.transparent, 48 | padding: const EdgeInsets.only(left: 17), 49 | child: Image.asset( 50 | leading!, 51 | width: 23, 52 | fit: BoxFit.contain, 53 | ), 54 | ), 55 | ), 56 | ), 57 | if (trailing != null) 58 | Positioned( 59 | right: 0, 60 | bottom: 29, 61 | child: GestureDetector( 62 | onTap: trailingOnTap, 63 | child: Container( 64 | height: 26, 65 | width: 40, 66 | alignment: Alignment.centerRight, 67 | padding: const EdgeInsets.only(right: 17.41), 68 | child: Image.asset( 69 | trailing!, 70 | width: 18.59, 71 | fit: BoxFit.contain, 72 | ), 73 | ), 74 | ), 75 | ), 76 | ], 77 | ), 78 | ); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/widgets/dumb/loading_indicator.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_spinkit/flutter_spinkit.dart'; 3 | import '../../shared/styles.dart'; 4 | 5 | class LoadingIndicator extends StatelessWidget { 6 | const LoadingIndicator({ 7 | Key? key, 8 | }) : super(key: key); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return Container( 13 | margin: const EdgeInsets.only(bottom: 80), 14 | alignment: Alignment.center, 15 | child: const SpinKitSpinningLines( 16 | size: 100, 17 | color: appGreyColor, 18 | lineWidth: 3, 19 | duration: Duration(milliseconds: 1500), 20 | ), 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/widgets/dumb/page_error_indicator.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../../constants/asset_constants.dart'; 3 | import '../../shared/styles.dart'; 4 | 5 | class PageErrorIndicator extends StatelessWidget { 6 | const PageErrorIndicator({ 7 | Key? key, 8 | }) : super(key: key); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return Container( 13 | margin: const EdgeInsets.only(bottom: 80, left: 40, right: 40), 14 | alignment: Alignment.center, 15 | child: Column( 16 | mainAxisSize: MainAxisSize.min, 17 | children: [ 18 | SizedBox( 19 | width: 120, 20 | height: 120, 21 | child: FittedBox( 22 | child: Image.asset( 23 | AssetConstants.errorIcon, 24 | ), 25 | ), 26 | ), 27 | const SizedBox(height: 10), 28 | Text( 29 | 'Oops! Something went wrong', 30 | textAlign: TextAlign.center, 31 | style: heading5.copyWith(color: appGreyColor), 32 | ) 33 | ], 34 | ), 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: big_cart 2 | description: A new Flutter project. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.0.0+1 19 | 20 | environment: 21 | sdk: ">=2.16.0 <3.0.0" 22 | 23 | # Dependencies specify other packages that your package needs in order to work. 24 | # To automatically upgrade your package dependencies to the latest versions 25 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 26 | # dependencies can be manually updated by changing the version numbers below to 27 | # the latest version available on pub.dev. To see which dependencies have newer 28 | # versions available, run `flutter pub outdated`. 29 | dependencies: 30 | flutter: 31 | sdk: flutter 32 | 33 | stacked: ^2.3.0 34 | stacked_services: ^0.8.17 35 | stacked_hooks: ^0.2.2 36 | injectable: ^1.5.3 37 | get_it: ^7.2.0 38 | flutter_hooks: ^0.18.3 39 | google_fonts: ^2.3.1 40 | flutter_switch: ^0.3.2 41 | carousel_slider: ^4.0.0 42 | http: ^0.13.4 43 | shared_preferences: ^2.0.13 44 | flutter_spinkit: ^5.1.0 45 | flutter_svg: ^1.0.3 46 | flutter_slidable: ^1.2.0 47 | 48 | 49 | # The following adds the Cupertino Icons font to your application. 50 | # Use with the CupertinoIcons class for iOS style icons. 51 | cupertino_icons: ^1.0.2 52 | 53 | dev_dependencies: 54 | flutter_test: 55 | sdk: flutter 56 | 57 | stacked_generator: ^0.6.2 58 | build_runner: ^2.1.10 59 | 60 | # The "flutter_lints" package below contains a set of recommended lints to 61 | # encourage good coding practices. The lint set provided by the package is 62 | # activated in the `analysis_options.yaml` file located at the root of your 63 | # package. See that file for information about deactivating specific lint 64 | # rules and activating additional ones. 65 | flutter_lints: ^1.0.0 66 | 67 | # For information on the generic Dart part of this file, see the 68 | # following page: https://dart.dev/tools/pub/pubspec 69 | 70 | # The following section is specific to Flutter. 71 | flutter: 72 | 73 | # The following line ensures that the Material Icons font is 74 | # included with your application, so that you can use the icons in 75 | # the material Icons class. 76 | uses-material-design: true 77 | 78 | # To add assets to your application, add an assets section, like this: 79 | assets: 80 | - assets/images/ 81 | 82 | # An image asset can refer to one or more resolution-specific "variants", see 83 | # https://flutter.dev/assets-and-images/#resolution-aware. 84 | 85 | # For details regarding adding assets from package dependencies, see 86 | # https://flutter.dev/assets-and-images/#from-packages 87 | 88 | # To add custom fonts to your application, add a fonts section here, 89 | # in this "flutter" section. Each entry in this list should have a 90 | # "family" key with the font family name, and a "fonts" key with a 91 | # list giving the asset and other descriptors for the font. For 92 | # example: 93 | # fonts: 94 | # - family: Schyler 95 | # fonts: 96 | # - asset: fonts/Schyler-Regular.ttf 97 | # - asset: fonts/Schyler-Italic.ttf 98 | # style: italic 99 | # - family: Trajan Pro 100 | # fonts: 101 | # - asset: fonts/TrajanPro.ttf 102 | # - asset: fonts/TrajanPro_Bold.ttf 103 | # weight: 700 104 | # 105 | # For details regarding fonts from package dependencies, 106 | # see https://flutter.dev/custom-fonts/#from-packages 107 | -------------------------------------------------------------------------------- /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:big_cart/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(const 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 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | big_cart 33 | 34 | 35 | 36 | 39 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "big_cart", 3 | "short_name": "big_cart", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(big_cart LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "big_cart") 5 | 6 | cmake_policy(SET CMP0063 NEW) 7 | 8 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 9 | 10 | # Configure build options. 11 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 12 | if(IS_MULTICONFIG) 13 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 14 | CACHE STRING "" FORCE) 15 | else() 16 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 17 | set(CMAKE_BUILD_TYPE "Debug" CACHE 18 | STRING "Flutter build mode" FORCE) 19 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 20 | "Debug" "Profile" "Release") 21 | endif() 22 | endif() 23 | 24 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 25 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 26 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 27 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 28 | 29 | # Use Unicode for all projects. 30 | add_definitions(-DUNICODE -D_UNICODE) 31 | 32 | # Compilation settings that should be applied to most targets. 33 | function(APPLY_STANDARD_SETTINGS TARGET) 34 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 35 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 36 | target_compile_options(${TARGET} PRIVATE /EHsc) 37 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 38 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 39 | endfunction() 40 | 41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 42 | 43 | # Flutter library and tool build rules. 44 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 45 | 46 | # Application build 47 | add_subdirectory("runner") 48 | 49 | # Generated plugin build rules, which manage building the plugins and adding 50 | # them to the application. 51 | include(flutter/generated_plugins.cmake) 52 | 53 | 54 | # === Installation === 55 | # Support files are copied into place next to the executable, so that it can 56 | # run in place. This is done instead of making a separate bundle (as on Linux) 57 | # so that building and running from within Visual Studio will work. 58 | set(BUILD_BUNDLE_DIR "$") 59 | # Make the "install" step default, as it's required to run. 60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 63 | endif() 64 | 65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 67 | 68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 69 | COMPONENT Runtime) 70 | 71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 72 | COMPONENT Runtime) 73 | 74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 75 | COMPONENT Runtime) 76 | 77 | if(PLUGIN_BUNDLED_LIBRARIES) 78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 80 | COMPONENT Runtime) 81 | endif() 82 | 83 | # Fully re-copy the assets directory on each build to avoid having stale files 84 | # from a previous install. 85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 86 | install(CODE " 87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 88 | " COMPONENT Runtime) 89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 91 | 92 | # Install the AOT library on non-Debug builds only. 93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 94 | CONFIGURATIONS Profile;Release 95 | COMPONENT Runtime) 96 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | 3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 4 | 5 | # Configuration provided via flutter tool. 6 | include(${EPHEMERAL_DIR}/generated_config.cmake) 7 | 8 | # TODO: Move the rest of this into files in ephemeral. See 9 | # https://github.com/flutter/flutter/issues/57146. 10 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 11 | 12 | # === Flutter Library === 13 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 14 | 15 | # Published to parent scope for install step. 16 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 17 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 18 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 19 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 20 | 21 | list(APPEND FLUTTER_LIBRARY_HEADERS 22 | "flutter_export.h" 23 | "flutter_windows.h" 24 | "flutter_messenger.h" 25 | "flutter_plugin_registrar.h" 26 | "flutter_texture_registrar.h" 27 | ) 28 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 29 | add_library(flutter INTERFACE) 30 | target_include_directories(flutter INTERFACE 31 | "${EPHEMERAL_DIR}" 32 | ) 33 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 34 | add_dependencies(flutter flutter_assemble) 35 | 36 | # === Wrapper === 37 | list(APPEND CPP_WRAPPER_SOURCES_CORE 38 | "core_implementations.cc" 39 | "standard_codec.cc" 40 | ) 41 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 42 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 43 | "plugin_registrar.cc" 44 | ) 45 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 46 | list(APPEND CPP_WRAPPER_SOURCES_APP 47 | "flutter_engine.cc" 48 | "flutter_view_controller.cc" 49 | ) 50 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 51 | 52 | # Wrapper sources needed for a plugin. 53 | add_library(flutter_wrapper_plugin STATIC 54 | ${CPP_WRAPPER_SOURCES_CORE} 55 | ${CPP_WRAPPER_SOURCES_PLUGIN} 56 | ) 57 | apply_standard_settings(flutter_wrapper_plugin) 58 | set_target_properties(flutter_wrapper_plugin PROPERTIES 59 | POSITION_INDEPENDENT_CODE ON) 60 | set_target_properties(flutter_wrapper_plugin PROPERTIES 61 | CXX_VISIBILITY_PRESET hidden) 62 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 63 | target_include_directories(flutter_wrapper_plugin PUBLIC 64 | "${WRAPPER_ROOT}/include" 65 | ) 66 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 67 | 68 | # Wrapper sources needed for the runner. 69 | add_library(flutter_wrapper_app STATIC 70 | ${CPP_WRAPPER_SOURCES_CORE} 71 | ${CPP_WRAPPER_SOURCES_APP} 72 | ) 73 | apply_standard_settings(flutter_wrapper_app) 74 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 75 | target_include_directories(flutter_wrapper_app PUBLIC 76 | "${WRAPPER_ROOT}/include" 77 | ) 78 | add_dependencies(flutter_wrapper_app flutter_assemble) 79 | 80 | # === Flutter tool backend === 81 | # _phony_ is a non-existent file to force this command to run every time, 82 | # since currently there's no way to get a full input/output list from the 83 | # flutter tool. 84 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 85 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 86 | add_custom_command( 87 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 88 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 89 | ${CPP_WRAPPER_SOURCES_APP} 90 | ${PHONY_OUTPUT} 91 | COMMAND ${CMAKE_COMMAND} -E env 92 | ${FLUTTER_TOOL_ENVIRONMENT} 93 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 94 | windows-x64 $ 95 | VERBATIM 96 | ) 97 | add_custom_target(flutter_assemble DEPENDS 98 | "${FLUTTER_LIBRARY}" 99 | ${FLUTTER_LIBRARY_HEADERS} 100 | ${CPP_WRAPPER_SOURCES_CORE} 101 | ${CPP_WRAPPER_SOURCES_PLUGIN} 102 | ${CPP_WRAPPER_SOURCES_APP} 103 | ) 104 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | set(PLUGIN_BUNDLED_LIBRARIES) 9 | 10 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 11 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 12 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 13 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 14 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 15 | endforeach(plugin) 16 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | add_executable(${BINARY_NAME} WIN32 5 | "flutter_window.cpp" 6 | "main.cpp" 7 | "utils.cpp" 8 | "win32_window.cpp" 9 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 10 | "Runner.rc" 11 | "runner.exe.manifest" 12 | ) 13 | apply_standard_settings(${BINARY_NAME}) 14 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 15 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 16 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 17 | add_dependencies(${BINARY_NAME} flutter_assemble) 18 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #ifdef FLUTTER_BUILD_NUMBER 64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0 67 | #endif 68 | 69 | #ifdef FLUTTER_BUILD_NAME 70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "big_cart" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "big_cart" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "big_cart.exe" "\0" 98 | VALUE "ProductName", "big_cart" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"big_cart", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohsinraza-fdev/BigCart-Flutter/040cebe4aa70ff5dd0acb0e48c1a3ef740a9815e/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | if (target_length == 0) { 52 | return std::string(); 53 | } 54 | std::string utf8_string; 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | --------------------------------------------------------------------------------