Repository: mailmaul/sinaruecommerce
Branch: master
Commit: c92f0df9db45
Files: 62
Total size: 110.6 KB
Directory structure:
gitextract_cuq0ykq3/
├── .gitignore
├── .metadata
├── .vscode/
│ └── launch.json
├── README.md
├── analysis_options.yaml
├── android/
│ ├── .gitignore
│ ├── app/
│ │ ├── build.gradle
│ │ ├── google-services.json
│ │ └── src/
│ │ ├── debug/
│ │ │ └── AndroidManifest.xml
│ │ ├── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin/
│ │ │ │ └── com/
│ │ │ │ └── example/
│ │ │ │ └── sinaruecommerce/
│ │ │ │ └── MainActivity.kt
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ └── launch_background.xml
│ │ │ ├── drawable-v21/
│ │ │ │ └── launch_background.xml
│ │ │ ├── values/
│ │ │ │ └── styles.xml
│ │ │ └── values-night/
│ │ │ └── styles.xml
│ │ └── profile/
│ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle/
│ │ └── wrapper/
│ │ └── gradle-wrapper.properties
│ ├── gradle.properties
│ └── settings.gradle
├── ios/
│ ├── .gitignore
│ ├── Flutter/
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Runner/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── LaunchImage.imageset/
│ │ │ ├── Contents.json
│ │ │ └── README.md
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── Runner-Bridging-Header.h
│ ├── 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
├── lib/
│ ├── auth.dart
│ ├── colors/
│ │ └── colors.dart
│ ├── controller/
│ │ ├── cart_controller.dart
│ │ └── product_controller.dart
│ ├── homepage.dart
│ ├── main.dart
│ ├── payment/
│ │ └── payment.dart
│ ├── products/
│ │ ├── cart_products.dart
│ │ ├── cart_screen.dart
│ │ ├── cart_total.dart
│ │ ├── catalog_products.dart
│ │ ├── catalog_screen.dart
│ │ ├── product_model.dart
│ │ └── product_overview.dart
│ ├── services/
│ │ └── firestore_db.dart
│ ├── utils.dart
│ └── widget/
│ ├── login_widget.dart
│ └── signUp_widget.dart
├── pubspec.yaml
├── test/
│ └── widget_test.dart
└── web/
├── index.html
└── manifest.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
# Web related
lib/generated_plugin_registrant.dart
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
================================================
FILE: .metadata
================================================
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: fc7015e35aac7ab785e7ae15a47db5c9e669ec7f
channel: beta
project_type: app
================================================
FILE: .vscode/launch.json
================================================
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "sinaruecommerce",
"request": "launch",
"type": "dart"
},
{
"name": "sinaruecommerce (profile mode)",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
}
]
}
================================================
FILE: README.md
================================================
# sinaruecommerce
A new Flutter project.
## Getting Started
The purpose of this application is to expedite the buying and selling process and make it easier to record every transaction so that the store owner can control the stock of goods and be able to make the right decision regarding the procurement process in the form of an E-Commerce Application
================================================
FILE: analysis_options.yaml
================================================
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
================================================
FILE: android/.gitignore
================================================
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
================================================
FILE: android/app/build.gradle
================================================
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 30
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.sinaruecommerce"
minSdkVersion 19
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation platform('com.google.firebase:firebase-bom:29.0.4')
implementation 'com.android.support:multidex:1.0.3'
}
================================================
FILE: android/app/google-services.json
================================================
{
"project_info": {
"project_number": "491104141997",
"project_id": "sutamaapp",
"storage_bucket": "sutamaapp.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:491104141997:android:c4bf135d295026686dfc24",
"android_client_info": {
"package_name": "com.example.sinaruecommerce"
}
},
"oauth_client": [
{
"client_id": "491104141997-20sas9se13pp9k87p3s9kg5avppion9h.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.example.sinaruecommerce",
"certificate_hash": "2e07e510595134ec23110601ec87822884d2b04b"
}
},
{
"client_id": "491104141997-vkdj383ng13hluvi9cdkl20a5dflva9n.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDCwEEhXEnNKqBaBsspG7rdDQpe4tuvWKc"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "491104141997-vkdj383ng13hluvi9cdkl20a5dflva9n.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
================================================
FILE: android/app/src/debug/AndroidManifest.xml
================================================
================================================
FILE: android/app/src/main/AndroidManifest.xml
================================================
================================================
FILE: android/app/src/main/kotlin/com/example/sinaruecommerce/MainActivity.kt
================================================
package com.example.sinaruecommerce
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
================================================
FILE: android/app/src/main/res/drawable/launch_background.xml
================================================
================================================
FILE: android/app/src/main/res/drawable-v21/launch_background.xml
================================================
================================================
FILE: android/app/src/main/res/values/styles.xml
================================================
================================================
FILE: android/app/src/main/res/values-night/styles.xml
================================================
================================================
FILE: android/app/src/profile/AndroidManifest.xml
================================================
================================================
FILE: android/build.gradle
================================================
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
================================================
FILE: android/gradle/wrapper/gradle-wrapper.properties
================================================
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
================================================
FILE: android/gradle.properties
================================================
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
================================================
FILE: android/settings.gradle
================================================
include ':app'
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
================================================
FILE: ios/.gitignore
================================================
**/dgph
*.mode1v3
*.mode2v3
*.moved-aside
*.pbxuser
*.perspectivev3
**/*sync/
.sconsign.dblite
.tags*
**/.vagrant/
**/DerivedData/
Icon?
**/Pods/
**/.symlinks/
profile
xcuserdata
**/.generated/
Flutter/App.framework
Flutter/Flutter.framework
Flutter/Flutter.podspec
Flutter/Generated.xcconfig
Flutter/ephemeral/
Flutter/app.flx
Flutter/app.zip
Flutter/flutter_assets/
Flutter/flutter_export_environment.sh
ServiceDefinitions.json
Runner/GeneratedPluginRegistrant.*
# Exceptions to above rules.
!default.mode1v3
!default.mode2v3
!default.pbxuser
!default.perspectivev3
================================================
FILE: ios/Flutter/AppFrameworkInfo.plist
================================================
CFBundleDevelopmentRegion
en
CFBundleExecutable
App
CFBundleIdentifier
io.flutter.flutter.app
CFBundleInfoDictionaryVersion
6.0
CFBundleName
App
CFBundlePackageType
FMWK
CFBundleShortVersionString
1.0
CFBundleSignature
????
CFBundleVersion
1.0
MinimumOSVersion
9.0
================================================
FILE: ios/Flutter/Debug.xcconfig
================================================
#include "Generated.xcconfig"
================================================
FILE: ios/Flutter/Release.xcconfig
================================================
#include "Generated.xcconfig"
================================================
FILE: ios/Runner/AppDelegate.swift
================================================
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
================================================
FILE: ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
================================================
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
================================================
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
================================================
# Launch Screen Assets
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
================================================
FILE: ios/Runner/Base.lproj/LaunchScreen.storyboard
================================================
================================================
FILE: ios/Runner/Base.lproj/Main.storyboard
================================================
================================================
FILE: ios/Runner/Info.plist
================================================
CFBundleDevelopmentRegion
$(DEVELOPMENT_LANGUAGE)
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIdentifier
$(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
sinaruecommerce
CFBundlePackageType
APPL
CFBundleShortVersionString
$(FLUTTER_BUILD_NAME)
CFBundleSignature
????
CFBundleVersion
$(FLUTTER_BUILD_NUMBER)
LSRequiresIPhoneOS
UILaunchStoryboardName
LaunchScreen
UIMainStoryboardFile
Main
UISupportedInterfaceOrientations
UIInterfaceOrientationPortrait
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
UISupportedInterfaceOrientations~ipad
UIInterfaceOrientationPortrait
UIInterfaceOrientationPortraitUpsideDown
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
UIViewControllerBasedStatusBarAppearance
================================================
FILE: ios/Runner/Runner-Bridging-Header.h
================================================
#import "GeneratedPluginRegistrant.h"
================================================
FILE: ios/Runner.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
9740EEB31CF90195004384FC /* Generated.xcconfig */,
);
name = Flutter;
sourceTree = "";
};
97C146E51CF9000F007C117D = {
isa = PBXGroup;
children = (
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
);
sourceTree = "";
};
97C146EF1CF9000F007C117D /* Products */ = {
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
);
name = Products;
sourceTree = "";
};
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C147021CF9000F007C117D /* Info.plist */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
);
path = Runner;
sourceTree = "";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
97C146ED1CF9000F007C117D /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
);
buildRules = (
);
dependencies = (
);
name = Runner;
productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 1100;
};
};
};
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
97C146EC1CF9000F007C117D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
97C146EA1CF9000F007C117D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C146FB1CF9000F007C117D /* Base */,
);
name = Main.storyboard;
sourceTree = "";
};
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C147001CF9000F007C117D /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
249021D3217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Profile;
};
249021D4217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.sinaruecommerce;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Profile;
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
97C147061CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.sinaruecommerce;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
};
97C147071CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.sinaruecommerce;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147031CF9000F007C117D /* Debug */,
97C147041CF9000F007C117D /* Release */,
249021D3217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147061CF9000F007C117D /* Debug */,
97C147071CF9000F007C117D /* Release */,
249021D4217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}
================================================
FILE: ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
================================================
================================================
FILE: ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
================================================
IDEDidComputeMac32BitWarning
================================================
FILE: ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
================================================
PreviewsEnabled
================================================
FILE: ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
================================================
================================================
FILE: ios/Runner.xcworkspace/contents.xcworkspacedata
================================================
================================================
FILE: ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
================================================
IDEDidComputeMac32BitWarning
================================================
FILE: ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
================================================
PreviewsEnabled
================================================
FILE: lib/auth.dart
================================================
import 'package:sinaruecommerce/widget/signup_widget.dart';
import './widget/login_widget.dart';
import 'package:flutter/material.dart';
class AuthPage extends StatefulWidget {
@override
_AuthPageState createState() => _AuthPageState();
}
class _AuthPageState extends State {
bool isLogin = true;
@override
Widget build(BuildContext context) => isLogin
? LoginWidget(onClickedSignUp: toggle)
: SignUpWidget(onClickedSignIn: toggle);
void toggle() => setState(() => isLogin = !isLogin);
}
================================================
FILE: lib/colors/colors.dart
================================================
import 'package:flutter/material.dart';
Color primaryColor = Color(0xffff7643);
Color scaffoldBackgroundColor = Color(0xffcbcbcb);
Color textColor = Colors.black87;
================================================
FILE: lib/controller/cart_controller.dart
================================================
import 'package:get/get.dart';
import 'package:sinaruecommerce/products/product_model.dart';
class CartController extends GetxController {
var _products = {}.obs;
void addProduct(Product product) {
if (_products.containsKey(product)) {
_products[product] += 1;
} else {
_products[product] = 1;
}
Get.snackbar(
"Product Added",
"You have added the ${product.name} to the cart",
snackPosition: SnackPosition.BOTTOM,
duration: Duration(seconds: 2),
);
}
void removeProduct(Product product) {
if (_products.containsKey(product) && _products[product] == 1) {
_products.removeWhere((key, value) => key == product);
} else {
_products[product] -= 1;
}
Get.snackbar(
"Product Removed",
"You have removed the ${product.name} to the cart",
snackPosition: SnackPosition.BOTTOM,
duration: Duration(seconds: 2),
);
}
get products => _products;
get productSubtotal => _products.entries
.map((product) => product.key.price * product.value)
.toList();
get total => _products.entries
.map((product) => product.key.price * product.value)
.toList()
.reduce((value, element) => value + element)
.toStringAsFixed(2);
}
================================================
FILE: lib/controller/product_controller.dart
================================================
import 'package:get/get.dart';
import 'package:sinaruecommerce/products/product_model.dart';
import 'package:sinaruecommerce/services/firestore_db.dart';
class ProductController extends GetxController {
final products = [].obs;
@override
void onInit() {
products.bindStream(FirestoreDB().getAllProducts());
super.onInit();
}
}
================================================
FILE: lib/homepage.dart
================================================
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sinaruecommerce/colors/colors.dart';
import 'package:sinaruecommerce/products/catalog_screen.dart';
import 'package:sinaruecommerce/products/product_overview.dart';
import 'controller/cart_controller.dart';
import 'controller/product_controller.dart';
class HomePage extends StatefulWidget {
final productController = Get.put(ProductController());
final Stream products =
FirebaseFirestore.instance.collection('products').snapshots();
@override
State createState() => _HomePageState();
}
class _HomePageState extends State {
@override
bool homeColor = true;
bool cartColor = false;
bool aboutColor = false;
bool contactusColor = false;
Widget product1() {
final cartController = Get.put(CartController());
final ProductController productController = Get.find();
return Container(
margin: EdgeInsets.only(right: 10),
height: 235,
width: 165,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => ProductOverview(
productImage: ("assets/images/mcb1.png"),
productName: ("MCB Schneider 60A"),
productPrice: (55000),
productStok: (78),
),
),
);
},
child: Container(
height: 150,
padding: EdgeInsets.all(5),
width: double.infinity,
child: Image(
image: AssetImage("assets/images/mcb1.png"),
),
),
),
Expanded(
flex: 2,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"MCB Schneider 60A",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
Text(
'Rp. 55.000',
style: TextStyle(
color: Colors.grey,
),
),
SizedBox(
height: 5,
),
],
),
),
),
Row(
children: [
Expanded(
child: Container(
height: 30,
width: 50,
child: Text(
"Stock :",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
),
SizedBox(
width: 5,
),
Expanded(
child: Container(
height: 30,
width: 50,
child: Text(
'78 Pcs',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
),
],
),
],
),
);
}
Widget product2() {
final cartController = Get.put(CartController());
final ProductController productController = Get.find();
final int index;
return Container(
margin: EdgeInsets.only(right: 10),
height: 235,
width: 165,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
// Navigator.of(context).push(
// MaterialPageRoute(
// builder: (context) => ProductOverview(
// productImage: (_products[0]["productImage"]),
// productName: (_products[0]["productName"]),
// productPrice: (_products[0]["productPrice"]),
// productStok: (_products[0]["productStok"]),
// ),
// ),
// );
},
child: Container(
height: 150,
padding: EdgeInsets.all(5),
width: double.infinity,
child: Image(
image: AssetImage("assets/images/mcb2.png"),
),
),
),
Expanded(
flex: 2,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"BARDI Wall Socket",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
Text(
'Rp. 190.000',
style: TextStyle(
color: Colors.grey,
),
),
SizedBox(
height: 5,
),
],
),
),
),
Row(
children: [
Expanded(
child: Container(
height: 30,
width: 50,
child: Text(
"Stock :",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
),
SizedBox(
width: 5,
),
Expanded(
child: Container(
height: 30,
width: 50,
child: Text(
'30 Pcs',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
),
],
),
],
),
);
}
Widget product3() {
final cartController = Get.put(CartController());
final ProductController productController = Get.find();
final int index;
return Container(
margin: EdgeInsets.only(right: 10),
height: 235,
width: 165,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
// Navigator.of(context).push(
// MaterialPageRoute(
// builder: (context) => ProductOverview(
// productImage: (_products[0]["productImage"]),
// productName: (_products[0]["productName"]),
// productPrice: (_products[0]["productPrice"]),
// productStok: (_products[0]["productStok"]),
// ),
// ),
// );
},
child: Container(
height: 150,
padding: EdgeInsets.all(5),
width: double.infinity,
child: Image(
image: AssetImage("assets/images/mcb3.png"),
),
),
),
Expanded(
flex: 2,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"BARDI Sakelar Socket",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
Text(
'Rp. 80.000',
style: TextStyle(
color: Colors.grey,
),
),
SizedBox(
height: 5,
),
],
),
),
),
Row(
children: [
Expanded(
child: Container(
height: 30,
width: 50,
child: Text(
"Stock :",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
),
SizedBox(
width: 5,
),
Expanded(
child: Container(
height: 30,
width: 50,
child: Text(
'22 Pcs',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
),
],
),
],
),
);
}
Widget product4() {
final cartController = Get.put(CartController());
final ProductController productController = Get.find();
final int index;
return Container(
margin: EdgeInsets.only(right: 10),
height: 235,
width: 165,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
// Navigator.of(context).push(
// MaterialPageRoute(
// builder: (context) => ProductOverview(
// productImage: (_products[0]["productImage"]),
// productName: (_products[0]["productName"]),
// productPrice: (_products[0]["productPrice"]),
// productStok: (_products[0]["productStok"]),
// ),
// ),
// );
},
child: Container(
height: 150,
padding: EdgeInsets.all(5),
width: double.infinity,
child: Image(
image: AssetImage("assets/images/mcb4.png"),
),
),
),
Expanded(
flex: 2,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Hannoch LED 3W",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
Text(
'Rp. 35.000',
style: TextStyle(
color: Colors.grey,
),
),
SizedBox(
height: 5,
),
],
),
),
),
Row(
children: [
Expanded(
child: Container(
height: 30,
width: 50,
child: Text(
"Stock :",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
),
SizedBox(
width: 5,
),
Expanded(
child: Container(
height: 30,
width: 50,
child: Text(
'150 Pcs',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
),
],
),
],
),
);
}
Widget product5() {
final cartController = Get.put(CartController());
final ProductController productController = Get.find();
final int index;
return Container(
margin: EdgeInsets.only(right: 10),
height: 235,
width: 165,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
// Navigator.of(context).push(
// MaterialPageRoute(
// builder: (context) => ProductOverview(
// productImage: (_products[0]["productImage"]),
// productName: (_products[0]["productName"]),
// productPrice: (_products[0]["productPrice"]),
// productStok: (_products[0]["productStok"]),
// ),
// ),
// );
},
child: Container(
height: 150,
padding: EdgeInsets.all(5),
width: double.infinity,
child: Image(
image: AssetImage("assets/images/mcb5.png"),
),
),
),
Expanded(
flex: 2,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"BARDI Smart LED",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
Text(
'Rp. 120.000',
style: TextStyle(
color: Colors.grey,
),
),
SizedBox(
height: 5,
),
],
),
),
),
Row(
children: [
Expanded(
child: Container(
height: 30,
width: 50,
child: Text(
"Stock :",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
),
SizedBox(
width: 5,
),
Expanded(
child: Container(
height: 30,
width: 50,
child: Text(
'50',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
),
],
),
],
),
);
}
Widget product6() {
final cartController = Get.put(CartController());
final ProductController productController = Get.find();
final int index;
return Container(
margin: EdgeInsets.only(right: 10),
height: 235,
width: 165,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
// Navigator.of(context).push(
// MaterialPageRoute(
// builder: (context) => ProductOverview(
// productImage: (_products[0]["productImage"]),
// productName: (_products[0]["productName"]),
// productPrice: (_products[0]["productPrice"]),
// productStok: (_products[0]["productStok"]),
// ),
// ),
// );
},
child: Container(
height: 150,
padding: EdgeInsets.all(5),
width: double.infinity,
child: Image(
image: AssetImage("assets/images/cable1.png"),
),
),
),
Expanded(
flex: 2,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Kabel NYA 1,5 100M",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
Text(
'Rp. 175.000',
style: TextStyle(
color: Colors.grey,
),
),
SizedBox(
height: 5,
),
],
),
),
),
Row(
children: [
Expanded(
child: Container(
height: 30,
width: 50,
child: Text(
"Stock :",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
),
SizedBox(
width: 5,
),
Expanded(
child: Container(
height: 30,
width: 50,
child: Text(
'50 Pcs',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
),
],
),
],
),
);
}
Widget build(BuildContext context) {
final user = FirebaseAuth.instance.currentUser!;
return Scaffold(
backgroundColor: Color(0xffcbcbcb),
drawer: Drawer(
child: Container(
color: Colors.white,
child: ListView(
children: [
DrawerHeader(
child: Row(
children: [
CircleAvatar(
backgroundColor: Colors.white54,
radius: 43,
child: CircleAvatar(
radius: 40,
backgroundColor: primaryColor,
),
),
SizedBox(
width: 20,
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Welcome"),
SizedBox(
child: Text(
"${user.email}",
style: TextStyle(
fontSize: 15, fontWeight: FontWeight.bold),
),
height: 20,
),
],
),
],
),
),
ListTile(
selected: homeColor,
leading: Icon(Icons.home_outlined),
title: Text("Home"),
onTap: () {
setState(() {
homeColor = true;
contactusColor = false;
cartColor = false;
aboutColor = false;
});
},
),
ListTile(
leading: Icon(Icons.shop),
title: Text("Catalog Product"),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => CatalogScreen(),
),
);
},
),
ListTile(
leading: Icon(Icons.shopping_cart),
title: Text("My Cart"),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => CatalogScreen(),
),
);
},
),
ListTile(
leading: Icon(Icons.phone_outlined),
title: Text("ContactUs"),
),
ListTile(
leading: Icon(Icons.logout_outlined),
title: Text("Logout"),
onTap: () => FirebaseAuth.instance.signOut()),
],
),
),
),
appBar: AppBar(
backgroundColor: primaryColor,
title: Text("Homepage"),
actions: [
CircleAvatar(
radius: 20,
backgroundColor: Colors.white,
child: IconButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => CatalogScreen(),
),
);
},
icon: Icon(
Icons.shopping_cart_outlined,
size: 17,
color: Colors.black,
)),
),
],
),
body: Padding(
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
child: ListView(
children: [
Container(
height: 150,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage('assets/images/banner1.png'),
),
color: Colors.red,
borderRadius: BorderRadius.circular(10),
),
child: Row(
children: [
Expanded(
flex: 2,
child: Container(
child: Column(
children: [
Padding(
padding:
const EdgeInsets.only(right: 250, bottom: 10),
child: Container(
height: 50,
width: 100,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(50),
bottomLeft: Radius.circular(50),
),
),
child: Image(
image: AssetImage(
'assets/images/logo.png',
),
),
),
),
Text(
'30% Off',
style: TextStyle(
fontSize: 40,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
Padding(
padding: const EdgeInsets.only(left: 10),
child: Text(
'On all Lamps product',
style: TextStyle(
color: Colors.white,
),
),
),
],
),
),
),
Expanded(
child: Container(),
),
],
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Feature Product'),
Text(
'View All',
style: TextStyle(
color: Colors.grey,
),
),
],
),
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
product1(),
product2(),
product3(),
],
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('New Product'),
Text(
'View All',
style: TextStyle(
color: Colors.grey,
),
),
],
),
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
product4(),
product5(),
product6(),
],
),
),
],
),
),
);
}
}
================================================
FILE: lib/main.dart
================================================
import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:get/get.dart';
import 'package:sinaruecommerce/auth.dart';
import 'package:sinaruecommerce/homepage.dart';
import 'package:sinaruecommerce/products/catalog_screen.dart';
import 'package:sinaruecommerce/utils.dart';
import 'package:firebase_core/firebase_core.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: FirebaseOptions(
apiKey: "AIzaSyDCwEEhXEnNKqBaBsspG7rdDQpe4tuvWKc",
appId: "1:491104141997:android:c4bf135d295026686dfc24",
messagingSenderId: "491104141997",
projectId: "sutamaapp",
),
);
runApp(MyApp());
}
final navigatorKey = GlobalKey();
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return GetMaterialApp(
scaffoldMessengerKey: Utils.messengerKey,
navigatorKey: navigatorKey,
debugShowCheckedModeBanner: false,
home: MainPage(),
);
}
}
class MainPage extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
body: StreamBuilder(
stream: FirebaseAuth.instance.authStateChanges(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return HomePage();
} else {
return AuthPage();
}
},
),
);
}
================================================
FILE: lib/payment/payment.dart
================================================
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:razorpay_flutter/razorpay_flutter.dart';
import 'package:sinaruecommerce/colors/colors.dart';
import 'package:sinaruecommerce/controller/cart_controller.dart';
import 'package:sinaruecommerce/products/cart_products.dart';
import 'package:sinaruecommerce/products/cart_total.dart';
class PaymentScreen extends StatefulWidget {
const PaymentScreen({Key? key}) : super(key: key);
@override
_PaymentScreenState createState() => _PaymentScreenState();
}
class _PaymentScreenState extends State {
var _razorpay = Razorpay();
final CartController controller = Get.find();
@override
void initState() {
// TODO: implement initState
_razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, _handlePaymentSuccess);
_razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, _handlePaymentError);
_razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET, _handleExternalWallet);
super.initState();
}
void _handlePaymentSuccess(PaymentSuccessResponse response) {
// Do something when payment succeeds
print("Payment Done");
}
void _handlePaymentError(PaymentFailureResponse response) {
// Do something when payment fails
print("Payment Fail");
}
void _handleExternalWallet(ExternalWalletResponse response) {
// Do something when an external wallet is selected
}
@override
Widget build(BuildContext context) {
var size = MediaQuery.of(context).size;
return Scaffold(
appBar: const CupertinoNavigationBar(
middle: Text("Payment"),
),
body: Container(
height: size.height,
width: size.width,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
CartProducts(),
CartTotal(),
CupertinoButton(
color: primaryColor,
child: Text(
"Pay Amount",
),
onPressed: () {
//Payment
var options = {
'key': 'rzp_test_gGzZvykNuGnFR0',
'amount': (double.parse(controller.total) * 100)
.toDouble(), //in the smallest currency sub-unit.
'name': 'Sinar Utama Payment',
'currency': 'IDR',
'description': 'Lamandau - Kalimantan Tengah',
'timeout': 300, // in seconds
'prefill': {
'contact': '081545035513',
'email': '112201805918@mhs.dinus.ac.id'
}
};
_razorpay.open(options);
})
],
),
),
);
}
@override
void dispose() {
_razorpay.clear(); // Removes all listeners
// TODO: implement dispose
super.dispose();
}
}
================================================
FILE: lib/products/cart_products.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sinaruecommerce/controller/cart_controller.dart';
import 'package:sinaruecommerce/products/product_model.dart';
class CartProducts extends StatelessWidget {
final CartController controller = Get.find();
CartProducts({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Obx(
() => SizedBox(
height: 600,
child: ListView.builder(
itemCount: controller.products.length,
itemBuilder: (BuildContext context, int index) {
return CartProductCard(
controller: controller,
quantity: controller.products.values.toList()[index],
product: controller.products.keys.toList()[index],
index: index,
);
}),
),
);
}
}
class CartProductCard extends StatelessWidget {
final CartController? controller;
final Product? product;
final int? quantity;
final int? index;
const CartProductCard({
Key? key,
required this.controller,
required this.product,
required this.quantity,
required this.index,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CircleAvatar(
radius: 40,
backgroundImage: NetworkImage(product!.imageUrl),
),
SizedBox(
width: 20,
),
Expanded(
child: Text(product!.name),
),
IconButton(
onPressed: () {
controller!.removeProduct(product!);
},
icon: Icon(Icons.remove_circle),
),
Text('$quantity'),
IconButton(
onPressed: () {
controller!.addProduct(product!);
},
icon: Icon(Icons.add_circle),
),
],
),
);
}
}
================================================
FILE: lib/products/cart_screen.dart
================================================
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sinaruecommerce/colors/colors.dart';
import 'package:sinaruecommerce/payment/payment.dart';
import 'package:sinaruecommerce/products/cart_products.dart';
import 'package:sinaruecommerce/products/cart_total.dart';
import 'package:sinaruecommerce/products/catalog_screen.dart';
class CartScreen extends StatelessWidget {
CartScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: CupertinoNavigationBar(
middle: Text("My Cart"),
backgroundColor: primaryColor,
),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
CartProducts(),
CartTotal(),
CupertinoButton(
color: primaryColor,
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => PaymentScreen(),
),
);
},
child: Text("Checkout"),
),
],
),
);
}
}
================================================
FILE: lib/products/cart_total.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sinaruecommerce/controller/cart_controller.dart';
class CartTotal extends StatelessWidget {
final CartController controller = Get.find();
CartTotal({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Obx(
() => Container(
padding: EdgeInsets.symmetric(horizontal: 75),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Total",
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
Text(
"Rp. ${controller.total}",
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
)
],
),
),
);
}
}
================================================
FILE: lib/products/catalog_products.dart
================================================
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sinaruecommerce/controller/cart_controller.dart';
import 'package:sinaruecommerce/controller/product_controller.dart';
class CatalogProducts extends StatelessWidget {
final productController = Get.put(ProductController());
final Stream products =
FirebaseFirestore.instance.collection('products').snapshots();
CatalogProducts({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Obx(
() => Flexible(
child: ListView.builder(
itemCount: productController.products.length,
itemBuilder: (BuildContext context, int index) {
return CatalogProductCard(index: index);
},
),
),
);
}
}
class CatalogProductCard extends StatelessWidget {
final cartController = Get.put(CartController());
final ProductController productController = Get.find();
final int index;
CatalogProductCard({
Key? key,
required this.index,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CircleAvatar(
radius: 40,
backgroundImage:
NetworkImage(productController.products[index].imageUrl),
),
SizedBox(
width: 20,
),
Expanded(
child: Text(
productController.products[index].name,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
),
),
Expanded(
child: Text('Rp. ${productController.products[index].price}'),
),
Expanded(
child: Text('Stok : ${productController.products[index].stock}'),
),
IconButton(
onPressed: () {
cartController.addProduct(productController.products[index]);
},
icon: Icon(Icons.add_circle),
)
],
),
);
}
}
================================================
FILE: lib/products/catalog_screen.dart
================================================
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sinaruecommerce/colors/colors.dart';
import 'package:sinaruecommerce/products/cart_screen.dart';
import 'package:sinaruecommerce/products/catalog_products.dart';
class CatalogScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: CupertinoNavigationBar(
backgroundColor: primaryColor,
middle: Text("Catalog"),
),
body: SafeArea(
child: Column(
children: [
CatalogProducts(),
Padding(
padding: const EdgeInsets.symmetric(vertical: 50),
child: CupertinoButton(
color: primaryColor,
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => CartScreen(),
),
);
},
child: Text("Go To Cart"),
),
)
],
),
),
);
}
}
================================================
FILE: lib/products/product_model.dart
================================================
import 'package:cloud_firestore/cloud_firestore.dart';
class Product {
final String name;
final int price;
final String imageUrl;
final int stock;
const Product({
required this.name,
required this.price,
required this.imageUrl,
required this.stock,
});
static Product fromSnapshot(DocumentSnapshot snap) {
Product product = Product(
name: snap['name'],
price: snap['price'],
imageUrl: snap['imageUrl'],
stock: snap['stock']);
return product;
}
// static const List products = [
// Product(
// name: "Lampu",
// price: 15000,
// imageUrl:
// "https://www.jualbuy.com/uploads/product_image/variant_image/2021-01-15/1610689116-images_(1).jpeg",
// stock: 15),
// Product(
// name: "MCB",
// price: 20000,
// imageUrl:
// "https://n2.sdlcdn.com/imgs/h/5/j/Schneider-MCB-One-Pole-2-SDL295309435-1-b3f0b.jpg",
// stock: 15),
// Product(
// name: "Kabel",
// price: 25000,
// imageUrl:
// "https://ecs7.tokopedia.net/img/cache/700/product-1/2020/7/3/12574622/12574622_8fe05ff7-cac6-4de3-92e8-e686352bb28d_400_400",
// stock: 15),
// ];
}
================================================
FILE: lib/products/product_overview.dart
================================================
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sinaruecommerce/products/cart_screen.dart';
import 'package:sinaruecommerce/products/catalog_screen.dart';
import '../colors/colors.dart';
class ProductOverview extends StatefulWidget {
final String? productImage;
final String? productName;
final int? productPrice;
final int? productStok;
final Function? onTap;
ProductOverview(
{this.productImage,
this.productName,
this.productPrice,
this.productStok,
this.onTap});
@override
_ProductOverviewState createState() => _ProductOverviewState();
}
class _ProductOverviewState extends State {
Widget bottomNavigatorBar({
Color? iconColor,
Color? backgroundColor,
Color? color,
String? title,
IconData? iconData,
}) {
return Expanded(
child: Container(
padding: EdgeInsets.all(20),
color: backgroundColor,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
iconData,
size: 17,
color: iconColor,
),
SizedBox(
width: 5,
),
Text(
title!,
style: TextStyle(color: Colors.black),
),
],
),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 50),
child: CupertinoButton(
color: primaryColor,
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => CatalogScreen(),
),
);
},
child: Text("Go To Catalog"),
),
),
],
),
appBar: AppBar(
iconTheme: IconThemeData(color: textColor),
backgroundColor: primaryColor,
title: Text(
"Product Overview",
style: TextStyle(color: textColor),
),
),
body: Column(
children: [
Expanded(
child: Container(
width: double.infinity,
child: Column(
children: [
ListTile(
title: Text(widget.productName!),
subtitle: Text("Rp. " + widget.productPrice.toString()),
),
Container(
height: 250,
padding: EdgeInsets.all(40),
child: Image.asset(widget.productImage!),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 20),
width: double.infinity,
child: Text(
"Description :",
textAlign: TextAlign.start,
style: TextStyle(
color: textColor,
fontWeight: FontWeight.w600,
fontSize: 20),
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 5),
width: double.infinity,
child: Text(
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
textAlign: TextAlign.start,
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
width: double.infinity,
child: Text(
"Stock " + widget.productStok.toString(),
textAlign: TextAlign.start,
style: TextStyle(
color: textColor,
fontWeight: FontWeight.w600,
fontSize: 15),
),
),
],
),
),
)
],
),
);
}
}
================================================
FILE: lib/services/firestore_db.dart
================================================
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:sinaruecommerce/products/product_model.dart';
class FirestoreDB {
final FirebaseFirestore _firebaseFirestore = FirebaseFirestore.instance;
Stream> getAllProducts() {
return _firebaseFirestore
.collection('products')
.snapshots()
.map((snapshot) {
return snapshot.docs.map((doc) => Product.fromSnapshot(doc)).toList();
});
}
}
================================================
FILE: lib/utils.dart
================================================
import 'package:flutter/material.dart';
class Utils {
static final messengerKey = GlobalKey();
static showSnackBar(String? text) {
if (text == null) return;
final snackBar = SnackBar(content: Text(text), backgroundColor: Colors.red);
messengerKey.currentState!
..removeCurrentSnackBar()
..showSnackBar(snackBar);
}
}
================================================
FILE: lib/widget/login_widget.dart
================================================
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:sinaruecommerce/main.dart';
import 'package:sinaruecommerce/utils.dart';
class LoginWidget extends StatefulWidget {
final VoidCallback? onClickedSignUp;
const LoginWidget({Key? key, this.onClickedSignUp}) : super(key: key);
@override
_LoginWidgetState createState() => _LoginWidgetState();
}
class _LoginWidgetState extends State {
final emailController = TextEditingController();
final passwordController = TextEditingController();
@override
void dispose() {
emailController.dispose();
passwordController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) => SingleChildScrollView(
padding: EdgeInsets.all(50),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: 300,
height: 300,
child: Image.asset("assets/images/logo.png"),
),
SizedBox(height: 40),
TextFormField(
controller: emailController,
cursorColor: Colors.white,
textInputAction: TextInputAction.next,
decoration: InputDecoration(labelText: "Email"),
autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (value) => value != null && value.length < 6
? "Enter min. 6 characters"
: null,
obscureText: false,
),
SizedBox(height: 40),
TextFormField(
controller: passwordController,
cursorColor: Colors.white,
textInputAction: TextInputAction.next,
decoration: InputDecoration(labelText: "Password"),
autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (value) => value != null && value.length < 6
? "Enter min. 6 characters"
: null,
obscureText: true,
),
SizedBox(height: 20),
ElevatedButton.icon(
onPressed: signIn,
icon: Icon(Icons.lock_open),
label: Text(
"Sign In",
style: TextStyle(fontSize: 24),
),
),
SizedBox(height: 20),
RichText(
text: TextSpan(
style: TextStyle(color: Colors.black45, fontSize: 15),
text: "No Account? ",
children: [
TextSpan(
recognizer: TapGestureRecognizer()
..onTap = widget.onClickedSignUp,
text: "Sign Up",
style: TextStyle(
decoration: TextDecoration.underline,
color: Colors.black))
]))
],
),
);
Future signIn() async {
showDialog(
context: context,
builder: (context) => Center(
child: CircularProgressIndicator(),
),
);
try {
await FirebaseAuth.instance.signInWithEmailAndPassword(
email: emailController.text.trim(),
password: passwordController.text.trim(),
);
} on FirebaseAuthException catch (e) {
print(e);
Utils.showSnackBar(e.message);
}
navigatorKey.currentState!.popUntil((route) => route.isFirst);
}
}
================================================
FILE: lib/widget/signUp_widget.dart
================================================
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:sinaruecommerce/main.dart';
import 'package:email_validator/email_validator.dart';
import 'package:sinaruecommerce/utils.dart';
class SignUpWidget extends StatefulWidget {
final VoidCallback? onClickedSignIn;
const SignUpWidget({Key? key, this.onClickedSignIn}) : super(key: key);
@override
_LoginWidgetState createState() => _LoginWidgetState();
}
class _LoginWidgetState extends State {
final formKey = GlobalKey();
final emailController = TextEditingController();
final passwordController = TextEditingController();
@override
void dispose() {
emailController.dispose();
passwordController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) => SingleChildScrollView(
padding: EdgeInsets.all(36),
child: Form(
key: formKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 300,
height: 300,
child: Image.asset("assets/images/logo.png"),
),
SizedBox(height: 40),
TextFormField(
controller: emailController,
cursorColor: Colors.white,
textInputAction: TextInputAction.next,
decoration: InputDecoration(labelText: "Email"),
autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (email) =>
email != null && !EmailValidator.validate(email)
? "Enter a valid email"
: null,
obscureText: false,
),
SizedBox(height: 40),
TextFormField(
controller: passwordController,
cursorColor: Colors.white,
textInputAction: TextInputAction.next,
decoration: InputDecoration(labelText: "Password"),
autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (value) => value != null && value.length < 6
? "Enter min. 6 characters"
: null,
obscureText: true,
),
SizedBox(height: 20),
ElevatedButton.icon(
onPressed: signUp,
icon: Icon(Icons.lock_open),
label: Text(
"Sign Up",
style: TextStyle(fontSize: 24),
),
),
SizedBox(height: 20),
RichText(
text: TextSpan(
style: TextStyle(color: Colors.black45, fontSize: 15),
text: "Already have an Account? ",
children: [
TextSpan(
recognizer: TapGestureRecognizer()
..onTap = widget.onClickedSignIn,
text: "Sign In",
style: TextStyle(
decoration: TextDecoration.underline,
color: Colors.black))
]))
],
),
),
);
Future signUp() async {
final isValid = formKey.currentState!.validate();
if (!isValid) return;
showDialog(
context: context,
builder: (context) => Center(
child: CircularProgressIndicator(),
),
);
try {
await FirebaseAuth.instance.createUserWithEmailAndPassword(
email: emailController.text.trim(),
password: passwordController.text.trim(),
);
} on FirebaseAuthException catch (e) {
print(e);
Utils.showSnackBar(e.message);
}
navigatorKey.currentState!.popUntil((route) => route.isFirst);
}
}
================================================
FILE: pubspec.yaml
================================================
name: sinaruecommerce
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.15.0-178.1.beta <3.0.0"
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
firebase_core: ^1.11.0
firebase_auth: ^3.3.5
email_validator: ^2.0.1
get: ^4.6.1
cloud_firestore: ^3.1.6
razorpay_flutter: ^1.2.9
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^1.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
uses-material-design: true
assets:
- assets/
- assets/images/
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
================================================
FILE: test/widget_test.dart
================================================
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:sinaruecommerce/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
================================================
FILE: web/index.html
================================================
sinaruecommerce
================================================
FILE: web/manifest.json
================================================
{
"name": "sinaruecommerce",
"short_name": "sinaruecommerce",
"start_url": ".",
"display": "standalone",
"background_color": "#0175C2",
"theme_color": "#0175C2",
"description": "A new Flutter project.",
"orientation": "portrait-primary",
"prefer_related_applications": false,
"icons": [
{
"src": "icons/Icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icons/Icon-512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "icons/Icon-maskable-192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "icons/Icon-maskable-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
]
}