├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── Runner-Bridging-Header.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── 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-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ └── project.pbxproj ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── WorkspaceSettings.xcsettings │ │ └── IDEWorkspaceChecks.plist └── .gitignore ├── android ├── gradle.properties ├── app │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── 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 │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable-v21 │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── values │ │ │ │ │ └── styles.xml │ │ │ │ └── values-night │ │ │ │ │ └── styles.xml │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── flutter_db │ │ │ │ │ └── MainActivity.java │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle └── build.gradle ├── res └── flowersonsea.jpg ├── .metadata ├── README.md ├── .gitignore ├── lib ├── main.dart ├── shared_widgets │ ├── clay.dart │ ├── buttons.dart │ └── form_text_field.dart ├── models │ └── model_user.dart ├── widgets │ ├── seller_shop.dart │ ├── login.dart │ ├── seller_account.dart │ ├── buyer_account.dart │ └── register.dart └── database │ └── app_database.dart ├── test └── widget_test.dart ├── pubspec.yaml └── pubspec.lock /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /res/flowersonsea.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/res/flowersonsea.jpg -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/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/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/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/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/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/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/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/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/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/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/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/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/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/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/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/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/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/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/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/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/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/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/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/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/example/flutter_db/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.flutter_db; 2 | 3 | import io.flutter.embedding.android.FlutterActivity; 4 | 5 | public class MainActivity extends FlutterActivity { 6 | } 7 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beautybird/Flutter-with-Postgresql-using-Models-class/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /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.9.1-all.zip 7 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: f4abaa0735eba4dfd8f33f73363911d63931fe03 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flutter & Postgresql 2 | 3 | A Project to create a Postgresql Database for a Flutter App . 4 | Also create a DB connection between the App the database using Postgres API from pub.dev 5 | 6 | 7 | video 1 : https://youtu.be/8Qitb_OLicQ 8 | 9 | video 2 : https://youtu.be/48p65nNR8Bs 10 | 11 | video 3 : https://youtu.be/WFe1kZhvUIw 12 | 13 | video 4 : https://youtu.be/vgLYhKiPbVE 14 | 15 | video 5 : https://youtu.be/pro4uT7D5aw 16 | 17 | video 6 : https://youtu.be/xcolBOOJGfc -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:4.2.0' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | project.evaluationDependsOn(':app') 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/ephemeral/ 22 | Flutter/app.flx 23 | Flutter/app.zip 24 | Flutter/flutter_assets/ 25 | Flutter/flutter_export_environment.sh 26 | ServiceDefinitions.json 27 | Runner/GeneratedPluginRegistrant.* 28 | 29 | # Exceptions to above rules. 30 | !default.mode1v3 31 | !default.mode2v3 32 | !default.pbxuser 33 | !default.perspectivev3 34 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_db/widgets/buyer_account.dart'; 3 | import 'package:flutter_db/widgets/login.dart'; 4 | import 'package:flutter_db/widgets/register.dart'; 5 | import 'package:flutter_db/widgets/seller_account.dart'; 6 | import 'package:flutter_db/widgets/seller_shop.dart'; 7 | 8 | void main() { 9 | runApp(MyApp()); 10 | } 11 | class MyApp extends StatelessWidget { 12 | const MyApp({Key? key}) : super(key: key); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return MyAppDesign(); 17 | } 18 | } 19 | 20 | class MyAppDesign extends StatelessWidget { 21 | const MyAppDesign({Key? key}) : super(key: key); 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return MaterialApp( 26 | initialRoute: '/login', 27 | routes: { 28 | '/login':(context)=> Login(), 29 | "/register":(context)=> Register(), 30 | "/buyerAccount":(context)=> BuyerAccount(), 31 | "/sellerAccount":(context)=> SellerAccount(), 32 | '/sellerShop':(context)=> SellerShop(), 33 | }, 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:flutter_db/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /lib/shared_widgets/clay.dart: -------------------------------------------------------------------------------- 1 | import 'package:clay_containers/clay_containers.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class ClayContainerDesign extends StatelessWidget { 5 | var containerColor; 6 | double? borderRadius; 7 | BorderRadius? customBorderRadius; 8 | CurveType? curveType; 9 | double? height; 10 | String? textDetails; 11 | double? clayTextSize; 12 | Color? clayTextColor; 13 | Color? clayTextColorText; 14 | 15 | ClayContainerDesign( 16 | {this.containerColor, 17 | this.borderRadius, 18 | this.customBorderRadius, 19 | this.curveType, 20 | this.height, 21 | this.textDetails, 22 | this.clayTextSize, 23 | this.clayTextColor, 24 | this.clayTextColorText}); 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | return ClayContainer( 29 | color: containerColor, 30 | borderRadius: borderRadius, 31 | customBorderRadius: customBorderRadius, 32 | curveType: curveType, 33 | height: height, 34 | child: Padding( 35 | padding: EdgeInsets.all(10), 36 | child: ClayText( 37 | textDetails ?? '', 38 | emboss: true, 39 | size: clayTextSize, 40 | depth: 60, 41 | style: TextStyle( 42 | fontStyle: FontStyle.italic, 43 | letterSpacing: 1.0, 44 | ), 45 | color: clayTextColor, 46 | textColor: clayTextColorText, 47 | ), 48 | ), 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/shared_widgets/buttons.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | 4 | class StandardElevatedButton extends StatelessWidget { 5 | const StandardElevatedButton({Key? key, this.style, this.child, this.onPressed}): super(key: key); 6 | final ButtonStyle? style ; 7 | final Widget? child; 8 | final Function()? onPressed ; 9 | 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return ElevatedButton( 14 | onPressed: onPressed, 15 | onLongPress: () {}, 16 | style: ButtonStyle( 17 | textStyle: MaterialStateProperty.resolveWith((states) { 18 | if (states.contains(MaterialState.hovered)) { 19 | return TextStyle(); 20 | } 21 | return TextStyle(); 22 | }), 23 | foregroundColor: MaterialStateProperty.resolveWith((states) { 24 | if (states.contains(MaterialState.pressed)) { 25 | return Theme.of(context).colorScheme.primary.withOpacity(0.5); 26 | } 27 | return Colors.white; 28 | }), 29 | ), 30 | focusNode: FocusNode(), 31 | clipBehavior: Clip.hardEdge, 32 | child: child, 33 | ); 34 | } 35 | } 36 | 37 | class UserAccountImageButton extends StatelessWidget { 38 | final Function()? onPressed; 39 | final Widget? icon; 40 | //final IconData buttonIcon; 41 | 42 | const UserAccountImageButton({this.icon,this.onPressed}) ; 43 | 44 | @override 45 | Widget build(BuildContext context) { 46 | return ElevatedButton(onPressed: onPressed, child: icon ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_db 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 30 29 | 30 | defaultConfig { 31 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 32 | applicationId "com.example.flutter_db" 33 | minSdkVersion 24 34 | targetSdkVersion 30 35 | versionCode flutterVersionCode.toInteger() 36 | versionName flutterVersionName 37 | } 38 | 39 | buildTypes { 40 | release { 41 | // TODO: Add your own signing config for the release build. 42 | // Signing with the debug keys for now, so `flutter run --release` works. 43 | signingConfig signingConfigs.debug 44 | } 45 | } 46 | } 47 | 48 | flutter { 49 | source '../..' 50 | } 51 | -------------------------------------------------------------------------------- /lib/models/model_user.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_db/database/app_database.dart'; 2 | 3 | class ModelsUsers { 4 | // Register Model Section 5 | String futureSeller = ''; 6 | Future registerNewSeller( 7 | String email, String password, String mobile) async { 8 | futureSeller = await AppDatabase().registerSeller(email, password, mobile); 9 | 10 | return futureSeller; 11 | } 12 | 13 | String futureBuyer = ''; 14 | Future registerNewBuyer( 15 | String buyerEmail, String password, String fName, String lName) async { 16 | futureBuyer = 17 | await AppDatabase().registerBuyer(buyerEmail, password, fName, lName); 18 | return futureBuyer; 19 | } 20 | 21 | /// Login Model Section 22 | String loginFuture = ''; 23 | Future userLoginModel(String email, String password) async { 24 | loginFuture = await AppDatabase().loginUser(email, password); 25 | return loginFuture; 26 | } 27 | 28 | //Update Model Section 29 | String futureUpdateBuyer = ''; 30 | Future updateBuyerDetails( 31 | int ssnFieldValue, String mobileFieldValue) async { 32 | futureUpdateBuyer = 33 | await AppDatabase().updateBuyerData(ssnFieldValue, mobileFieldValue); 34 | 35 | return futureUpdateBuyer; 36 | } 37 | 38 | String sellerUpdateFuture = ''; 39 | Future updateSellerDetails(String companyFieldValue, 40 | String fNameFieldValue, String logoValue) async { 41 | sellerUpdateFuture = await AppDatabase().updateSellerData( 42 | companyFieldValue, fNameFieldValue, logoValue); 43 | 44 | return sellerUpdateFuture; 45 | } 46 | 47 | // Fetch Seller Data 48 | 49 | List sellerDataFuture = []; 50 | Future> fetchSellerData(String emailValue) async{ 51 | sellerDataFuture = await AppDatabase().fetchSellerData(emailValue); 52 | return sellerDataFuture ; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 13 | 17 | 21 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_db 2 | description: A new Flutter project. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.0.0+1 19 | 20 | environment: 21 | sdk: ">=2.12.0 <3.0.0" 22 | 23 | dependencies: 24 | flutter: 25 | sdk: flutter 26 | dio: ^4.0.0 27 | http: ^0.13.3 28 | html: ^0.15.0 29 | #database 30 | postgres: ^2.3.2 31 | #Clay containers 32 | clay_containers: ^0.3.2 33 | #Hashing 34 | password_dart: ^2.0.1 35 | #image picker 36 | image_picker: ^0.8.2 37 | #image 38 | image: ^3.0.2 39 | 40 | 41 | # The following adds the Cupertino Icons font to your application. 42 | # Use with the CupertinoIcons class for iOS style icons. 43 | cupertino_icons: ^1.0.2 44 | 45 | dev_dependencies: 46 | flutter_test: 47 | sdk: flutter 48 | 49 | # For information on the generic Dart part of this file, see the 50 | # following page: https://dart.dev/tools/pub/pubspec 51 | 52 | # The following section is specific to Flutter. 53 | flutter: 54 | 55 | # The following line ensures that the Material Icons font is 56 | # included with your application, so that you can use the icons in 57 | # the material Icons class. 58 | uses-material-design: true 59 | 60 | # To add assets to your application, add an assets section, like this: 61 | # assets: 62 | # - images/a_dot_burr.jpeg 63 | # - images/a_dot_ham.jpeg 64 | 65 | # An image asset can refer to one or more resolution-specific "variants", see 66 | # https://flutter.dev/assets-and-images/#resolution-aware. 67 | 68 | # For details regarding adding assets from package dependencies, see 69 | # https://flutter.dev/assets-and-images/#from-packages 70 | 71 | # To add custom fonts to your application, add a fonts section here, 72 | # in this "flutter" section. Each entry in this list should have a 73 | # "family" key with the font family name, and a "fonts" key with a 74 | # list giving the asset and other descriptors for the font. For 75 | # example: 76 | # fonts: 77 | # - family: Schyler 78 | # fonts: 79 | # - asset: fonts/Schyler-Regular.ttf 80 | # - asset: fonts/Schyler-Italic.ttf 81 | # style: italic 82 | # - family: Trajan Pro 83 | # fonts: 84 | # - asset: fonts/TrajanPro.ttf 85 | # - asset: fonts/TrajanPro_Bold.ttf 86 | # weight: 700 87 | # 88 | # For details regarding fonts from package dependencies, 89 | # see https://flutter.dev/custom-fonts/#from-packages 90 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /lib/shared_widgets/form_text_field.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class FormTextFieldStandard extends StatelessWidget { 4 | FormTextFieldStandard( 5 | {Key? key, 6 | this.controller, 7 | this.textInputType, 8 | this.textInputAction, 9 | this.fontSize, 10 | this.fontWeight, 11 | this.fontColor, 12 | this.icon, 13 | this.onTap, 14 | this.onChanged, 15 | this.onFieldSubmitted, 16 | this.onEditingComplete, 17 | this.tooltip, 18 | this.onPressed, 19 | this.validate, 20 | this.formTextFieldLabel, 21 | this.maxLines,}) 22 | : super(key: key); 23 | 24 | final TextEditingController? controller; 25 | final TextInputType? textInputType; 26 | final TextInputAction? textInputAction; 27 | final double? fontSize; 28 | final FontWeight? fontWeight; 29 | final Color? fontColor; 30 | final IconData? icon; 31 | 32 | final Function()? onTap; 33 | final Function(String)? onChanged; 34 | final Function(String)? onFieldSubmitted; 35 | final Function()? onEditingComplete; 36 | final String? tooltip; 37 | final Function()? onPressed; 38 | RegExp? regExp = new RegExp(r'^[a-zA-Z0-9_]+( [a-zA-Z0-9_]+)*$'); 39 | Iterable? matches; 40 | final String? Function(String?)? validate; 41 | 42 | final String? formTextFieldLabel; 43 | final int? maxLines; 44 | 45 | List obsecureListValues=[]; 46 | List? getObsecureValue() { 47 | obsecureListValues.add(true); 48 | obsecureListValues.add(false); 49 | return obsecureListValues; 50 | } 51 | 52 | @override 53 | Widget build(BuildContext context) { 54 | return TextFormField( 55 | controller: controller, 56 | initialValue: null, 57 | focusNode: FocusNode(), 58 | decoration: InputDecoration( 59 | labelText: formTextFieldLabel, 60 | labelStyle: TextStyle( 61 | color: Colors.black, fontSize: 19.0, fontStyle: FontStyle.italic), 62 | //hintText: 'Type Your Password', 63 | //hintStyle: TextStyle(color: Colors.black87,fontSize: 16.0), 64 | prefixIcon: Icon( 65 | icon, 66 | color: Colors.teal, 67 | ), 68 | /*suffixIcon: IconButton( 69 | icon: Icon(Icons.text_fields), 70 | iconSize: 35.0, 71 | color: Colors.black, 72 | tooltip: tooltip, 73 | alignment: Alignment.centerRight, 74 | onPressed: onPressed, 75 | ),*/ 76 | border: OutlineInputBorder( 77 | borderSide: BorderSide( 78 | color: Colors.green, 79 | width: 1.0, 80 | style: BorderStyle.solid, 81 | ), 82 | borderRadius: BorderRadius.all(Radius.circular(10.0)), 83 | gapPadding: 4.0, 84 | ), 85 | focusedBorder: UnderlineInputBorder( 86 | borderSide: BorderSide( 87 | color: Colors.orangeAccent, 88 | width: 1.0, 89 | style: BorderStyle.solid, 90 | ), 91 | ), 92 | errorStyle: TextStyle(color: Colors.black), 93 | errorBorder: OutlineInputBorder( 94 | borderSide: BorderSide( 95 | color: Colors.red, width: 1.0, style: BorderStyle.solid), 96 | ), 97 | ), 98 | keyboardType: textInputType, 99 | textCapitalization: TextCapitalization.none, 100 | textInputAction: textInputAction, 101 | style: TextStyle( 102 | fontSize: fontSize, 103 | fontWeight: fontWeight, 104 | color: fontColor, 105 | fontStyle: FontStyle.italic, 106 | ), 107 | strutStyle: StrutStyle(), 108 | textAlign: TextAlign.start, 109 | textAlignVertical: TextAlignVertical.center, 110 | autocorrect: true, 111 | enableSuggestions: true, 112 | maxLines: maxLines, 113 | validator: validate, 114 | /*(val)=> !val.contains(pattern) || val.isEmpty? 'Invalid Charachters': null,*/ 115 | //onSaved: (val)=> _text = val , 116 | toolbarOptions: 117 | ToolbarOptions(copy: true, cut: true, paste: true, selectAll: true), 118 | autofocus: false, 119 | onChanged: onChanged, 120 | onEditingComplete: onEditingComplete, 121 | onFieldSubmitted: onFieldSubmitted, 122 | onTap: onTap, 123 | ); 124 | } 125 | } 126 | class FormTextFieldStandardObsecured extends StatelessWidget { 127 | FormTextFieldStandardObsecured( 128 | {Key? key, 129 | this.controller, 130 | this.textInputType, 131 | this.textInputAction, 132 | this.fontSize, 133 | this.fontWeight, 134 | this.fontColor, 135 | this.icon, 136 | this.onTap, 137 | this.onChanged, 138 | this.onFieldSubmitted, 139 | this.onEditingComplete, 140 | this.tooltip, 141 | this.onPressed, 142 | this.validate, 143 | this.formTextFieldLabel, 144 | this.maxLines, 145 | }) 146 | : super(key: key); 147 | 148 | final TextEditingController? controller; 149 | final TextInputType? textInputType; 150 | final TextInputAction? textInputAction; 151 | final double? fontSize; 152 | final FontWeight? fontWeight; 153 | final Color? fontColor; 154 | final IconData? icon; 155 | 156 | final Function()? onTap; 157 | final Function(String)? onChanged; 158 | final Function(String)? onFieldSubmitted; 159 | final Function()? onEditingComplete; 160 | final String? tooltip; 161 | final Function()? onPressed; 162 | RegExp? regExp = new RegExp(r'^[a-zA-Z0-9_]+( [a-zA-Z0-9_]+)*$'); 163 | Iterable? matches; 164 | final String? Function(String?)? validate; 165 | 166 | final String? formTextFieldLabel; 167 | final int? maxLines; 168 | 169 | List obsecureListValues=[]; 170 | List? getObsecureValue() { 171 | obsecureListValues.add(true); 172 | obsecureListValues.add(false); 173 | return obsecureListValues; 174 | } 175 | 176 | @override 177 | Widget build(BuildContext context) { 178 | return TextFormField( 179 | controller: controller, 180 | initialValue: null, 181 | focusNode: FocusNode(), 182 | decoration: InputDecoration( 183 | labelText: formTextFieldLabel, 184 | labelStyle: TextStyle( 185 | color: Colors.black, fontSize: 19.0, fontStyle: FontStyle.italic), 186 | //hintText: 'Type Your Password', 187 | //hintStyle: TextStyle(color: Colors.black87,fontSize: 16.0), 188 | prefixIcon: Icon( 189 | icon, 190 | color: Colors.teal, 191 | ), 192 | /*suffixIcon: IconButton( 193 | icon: Icon(Icons.text_fields), 194 | iconSize: 35.0, 195 | color: Colors.black, 196 | tooltip: tooltip, 197 | alignment: Alignment.centerRight, 198 | onPressed: onPressed, 199 | ),*/ 200 | border: OutlineInputBorder( 201 | borderSide: BorderSide( 202 | color: Colors.green, 203 | width: 1.0, 204 | style: BorderStyle.solid, 205 | ), 206 | borderRadius: BorderRadius.all(Radius.circular(10.0)), 207 | gapPadding: 4.0, 208 | ), 209 | focusedBorder: UnderlineInputBorder( 210 | borderSide: BorderSide( 211 | color: Colors.orangeAccent, 212 | width: 1.0, 213 | style: BorderStyle.solid, 214 | ), 215 | ), 216 | errorStyle: TextStyle(color: Colors.black), 217 | errorBorder: OutlineInputBorder( 218 | borderSide: BorderSide( 219 | color: Colors.red, width: 1.0, style: BorderStyle.solid), 220 | ), 221 | ), 222 | keyboardType: textInputType, 223 | textCapitalization: TextCapitalization.none, 224 | textInputAction: textInputAction, 225 | style: TextStyle( 226 | fontSize: fontSize, 227 | fontWeight: fontWeight, 228 | color: fontColor, 229 | fontStyle: FontStyle.italic, 230 | ), 231 | strutStyle: StrutStyle(), 232 | textAlign: TextAlign.start, 233 | textAlignVertical: TextAlignVertical.center, 234 | autocorrect: true, 235 | enableSuggestions: true, 236 | maxLines: maxLines, 237 | validator: validate, 238 | /*(val)=> !val.contains(pattern) || val.isEmpty? 'Invalid Charachters': null,*/ 239 | //onSaved: (val)=> _text = val , 240 | toolbarOptions: 241 | ToolbarOptions(copy: true, cut: true, paste: true, selectAll: true), 242 | autofocus: false, 243 | onChanged: onChanged, 244 | onEditingComplete: onEditingComplete, 245 | onFieldSubmitted: onFieldSubmitted, 246 | onTap: onTap, 247 | obscureText: true, 248 | ); 249 | } 250 | } 251 | -------------------------------------------------------------------------------- /lib/widgets/seller_shop.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | import 'dart:typed_data'; 4 | 5 | import 'package:clay_containers/clay_containers.dart'; 6 | import 'package:flutter/cupertino.dart'; 7 | import 'package:flutter/material.dart'; 8 | import 'package:flutter_db/models/model_user.dart'; 9 | import 'package:flutter_db/shared_widgets/buttons.dart'; 10 | import 'package:flutter_db/shared_widgets/clay.dart'; 11 | import 'package:flutter_db/shared_widgets/form_text_field.dart'; 12 | 13 | class SellerShop extends StatelessWidget { 14 | const SellerShop({Key? key}) : super(key: key); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return Scaffold( 19 | appBar: AppBar( 20 | title: Text('Seller Shop'), 21 | ), 22 | body: Center( 23 | child: SellerShopView(), 24 | ), 25 | ); 26 | } 27 | } 28 | 29 | class SellerShopView extends StatefulWidget { 30 | const SellerShopView({Key? key}) : super(key: key); 31 | 32 | @override 33 | _SellerShopViewState createState() => _SellerShopViewState(); 34 | } 35 | 36 | class _SellerShopViewState extends State { 37 | final _fetchDataGlobalKey = GlobalKey(); 38 | 39 | String? companyName; 40 | String? email; 41 | String? fName; 42 | String? mobile; 43 | String avatar = ''; 44 | 45 | final _emailController = TextEditingController(); 46 | 47 | String _emailTextValue = ''; 48 | String _getEmailText() { 49 | _emailTextValue = ((_emailController.text).isEmpty != true || 50 | (_emailController.text).length > 0 51 | ? _emailController.text 52 | : ''); 53 | return _emailTextValue; 54 | } 55 | 56 | @override 57 | void initState() { 58 | // TODO: implement initState 59 | super.initState(); 60 | _emailController.addListener(() { 61 | _getEmailText(); 62 | }); 63 | } 64 | 65 | @override 66 | void dispose() { 67 | // TODO: implement dispose 68 | _emailController.dispose(); 69 | super.dispose(); 70 | } 71 | 72 | @override 73 | Widget build(BuildContext context) { 74 | return ListView( 75 | scrollDirection: Axis.vertical, 76 | controller: ScrollController(), 77 | shrinkWrap: true, 78 | children: [ 79 | Form( 80 | key: _fetchDataGlobalKey, 81 | child: Column( 82 | mainAxisAlignment: MainAxisAlignment.center, 83 | crossAxisAlignment: CrossAxisAlignment.center, 84 | mainAxisSize: MainAxisSize.min, 85 | children: [ 86 | Flexible( 87 | flex: 1, 88 | fit: FlexFit.loose, 89 | child: FormTextFieldStandard( 90 | textInputType: TextInputType.emailAddress, 91 | controller: _emailController, 92 | icon: Icons.email_outlined, 93 | fontSize: 20.0, 94 | ), 95 | ), 96 | SizedBox( 97 | height: 10.0, 98 | ), 99 | Flexible( 100 | flex: 1, 101 | fit: FlexFit.loose, 102 | child: StandardElevatedButton( 103 | style: ButtonStyle(), 104 | child: Text( 105 | "Show Details", 106 | style: TextStyle( 107 | fontSize: 17.0, 108 | fontStyle: FontStyle.italic, 109 | fontWeight: FontWeight.bold, 110 | letterSpacing: 2.0, 111 | ), 112 | ), 113 | onPressed: () { 114 | ModelsUsers() 115 | .fetchSellerData(_emailTextValue) 116 | .then((fetchedDataFuture) { 117 | // If we receive data from DB 118 | String companyNameStr = 119 | fetchedDataFuture.elementAt(0).toString(); 120 | String emailStr = 121 | fetchedDataFuture.elementAt(1).toString(); 122 | String fNameStr = 123 | fetchedDataFuture.elementAt(2).toString(); 124 | String mobileStr = 125 | fetchedDataFuture.elementAt(3).toString(); 126 | String avatarStr = fetchedDataFuture.elementAt(4); 127 | Timer(Duration(seconds: 2), () { 128 | setState(() { 129 | //Important we give time to fetch data from DB 130 | // Then we set new state for the page 131 | companyName = companyNameStr; 132 | email = emailStr; 133 | fName = fNameStr; 134 | mobile = mobileStr; 135 | avatar = avatarStr; 136 | }); 137 | }); 138 | }); 139 | }, 140 | ), 141 | ), 142 | SizedBox( 143 | height: 10.0, 144 | ), 145 | Flexible( 146 | flex: 1, 147 | fit: FlexFit.loose, 148 | child: ClayContainerDesign( 149 | containerColor: Colors.grey[300], 150 | borderRadius: 10, 151 | customBorderRadius: BorderRadius.all(Radius.circular(20.0)), 152 | curveType: CurveType.convex, 153 | height: 40.0, 154 | textDetails: companyName, 155 | clayTextSize: 20.0, 156 | clayTextColor: Colors.white, 157 | clayTextColorText: Colors.black, 158 | ), 159 | ), 160 | SizedBox( 161 | height: 10, 162 | ), 163 | Flexible( 164 | flex: 1, 165 | fit: FlexFit.loose, 166 | child: ClayContainerDesign( 167 | containerColor: Colors.grey[300], 168 | borderRadius: 10, 169 | customBorderRadius: BorderRadius.all(Radius.circular(20.0)), 170 | curveType: CurveType.convex, 171 | height: 40.0, 172 | textDetails: email, 173 | clayTextSize: 20.0, 174 | clayTextColor: Colors.white, 175 | clayTextColorText: Colors.black, 176 | ), 177 | ), 178 | SizedBox( 179 | height: 10, 180 | ), 181 | Flexible( 182 | flex: 1, 183 | fit: FlexFit.loose, 184 | child: ClayContainerDesign( 185 | containerColor: Colors.grey[300], 186 | borderRadius: 10, 187 | customBorderRadius: BorderRadius.all(Radius.circular(20.0)), 188 | curveType: CurveType.convex, 189 | height: 40.0, 190 | textDetails: fName, 191 | clayTextSize: 20.0, 192 | clayTextColor: Colors.white, 193 | clayTextColorText: Colors.black, 194 | ), 195 | ), 196 | SizedBox( 197 | height: 10, 198 | ), 199 | Flexible( 200 | flex: 1, 201 | fit: FlexFit.loose, 202 | child: ClayContainerDesign( 203 | containerColor: Colors.grey[300], 204 | borderRadius: 10, 205 | customBorderRadius: BorderRadius.all(Radius.circular(20.0)), 206 | curveType: CurveType.convex, 207 | height: 40.0, 208 | textDetails: mobile, 209 | clayTextSize: 20.0, 210 | clayTextColor: Colors.white, 211 | clayTextColorText: Colors.black, 212 | ), 213 | ), 214 | SizedBox( 215 | height: 10.0, 216 | ), 217 | Flexible( 218 | flex: 1, 219 | fit: FlexFit.loose, 220 | child: Image.memory( 221 | Base64Decoder().convert(avatar), 222 | width: 200.0, 223 | height: 170.0, 224 | ), 225 | ), 226 | ], 227 | ), 228 | ), 229 | ]); 230 | } 231 | } 232 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "3.1.2" 11 | async: 12 | dependency: transitive 13 | description: 14 | name: async 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.6.1" 18 | boolean_selector: 19 | dependency: transitive 20 | description: 21 | name: boolean_selector 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.1.0" 25 | buffer: 26 | dependency: transitive 27 | description: 28 | name: buffer 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.1.1" 32 | characters: 33 | dependency: transitive 34 | description: 35 | name: characters 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.0" 39 | charcode: 40 | dependency: transitive 41 | description: 42 | name: charcode 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.2.0" 46 | clay_containers: 47 | dependency: "direct main" 48 | description: 49 | name: clay_containers 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "0.3.2" 53 | clock: 54 | dependency: transitive 55 | description: 56 | name: clock 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "1.1.0" 60 | collection: 61 | dependency: transitive 62 | description: 63 | name: collection 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.15.0" 67 | convert: 68 | dependency: transitive 69 | description: 70 | name: convert 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "3.0.1" 74 | cross_file: 75 | dependency: transitive 76 | description: 77 | name: cross_file 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "0.3.1+4" 81 | crypto: 82 | dependency: transitive 83 | description: 84 | name: crypto 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "3.0.1" 88 | csslib: 89 | dependency: transitive 90 | description: 91 | name: csslib 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "0.17.0" 95 | cupertino_icons: 96 | dependency: "direct main" 97 | description: 98 | name: cupertino_icons 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "1.0.3" 102 | dio: 103 | dependency: "direct main" 104 | description: 105 | name: dio 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "4.0.0" 109 | fake_async: 110 | dependency: transitive 111 | description: 112 | name: fake_async 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "1.2.0" 116 | flutter: 117 | dependency: "direct main" 118 | description: flutter 119 | source: sdk 120 | version: "0.0.0" 121 | flutter_plugin_android_lifecycle: 122 | dependency: transitive 123 | description: 124 | name: flutter_plugin_android_lifecycle 125 | url: "https://pub.dartlang.org" 126 | source: hosted 127 | version: "2.0.2" 128 | flutter_test: 129 | dependency: "direct dev" 130 | description: flutter 131 | source: sdk 132 | version: "0.0.0" 133 | flutter_web_plugins: 134 | dependency: transitive 135 | description: flutter 136 | source: sdk 137 | version: "0.0.0" 138 | html: 139 | dependency: "direct main" 140 | description: 141 | name: html 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "0.15.0" 145 | http: 146 | dependency: "direct main" 147 | description: 148 | name: http 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "0.13.3" 152 | http_parser: 153 | dependency: transitive 154 | description: 155 | name: http_parser 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "4.0.0" 159 | image: 160 | dependency: "direct main" 161 | description: 162 | name: image 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "3.0.2" 166 | image_picker: 167 | dependency: "direct main" 168 | description: 169 | name: image_picker 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "0.8.4" 173 | image_picker_for_web: 174 | dependency: transitive 175 | description: 176 | name: image_picker_for_web 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "2.1.3" 180 | image_picker_platform_interface: 181 | dependency: transitive 182 | description: 183 | name: image_picker_platform_interface 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "2.3.0" 187 | js: 188 | dependency: transitive 189 | description: 190 | name: js 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "0.6.3" 194 | matcher: 195 | dependency: transitive 196 | description: 197 | name: matcher 198 | url: "https://pub.dartlang.org" 199 | source: hosted 200 | version: "0.12.10" 201 | meta: 202 | dependency: transitive 203 | description: 204 | name: meta 205 | url: "https://pub.dartlang.org" 206 | source: hosted 207 | version: "1.3.0" 208 | password_dart: 209 | dependency: "direct main" 210 | description: 211 | name: password_dart 212 | url: "https://pub.dartlang.org" 213 | source: hosted 214 | version: "2.0.1" 215 | path: 216 | dependency: transitive 217 | description: 218 | name: path 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "1.8.0" 222 | pedantic: 223 | dependency: transitive 224 | description: 225 | name: pedantic 226 | url: "https://pub.dartlang.org" 227 | source: hosted 228 | version: "1.11.1" 229 | petitparser: 230 | dependency: transitive 231 | description: 232 | name: petitparser 233 | url: "https://pub.dartlang.org" 234 | source: hosted 235 | version: "4.1.0" 236 | plugin_platform_interface: 237 | dependency: transitive 238 | description: 239 | name: plugin_platform_interface 240 | url: "https://pub.dartlang.org" 241 | source: hosted 242 | version: "2.0.1" 243 | pointycastle: 244 | dependency: transitive 245 | description: 246 | name: pointycastle 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "3.3.2" 250 | postgres: 251 | dependency: "direct main" 252 | description: 253 | name: postgres 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "2.4.1+2" 257 | sasl_scram: 258 | dependency: transitive 259 | description: 260 | name: sasl_scram 261 | url: "https://pub.dartlang.org" 262 | source: hosted 263 | version: "0.1.0" 264 | saslprep: 265 | dependency: transitive 266 | description: 267 | name: saslprep 268 | url: "https://pub.dartlang.org" 269 | source: hosted 270 | version: "1.0.2" 271 | sky_engine: 272 | dependency: transitive 273 | description: flutter 274 | source: sdk 275 | version: "0.0.99" 276 | source_span: 277 | dependency: transitive 278 | description: 279 | name: source_span 280 | url: "https://pub.dartlang.org" 281 | source: hosted 282 | version: "1.8.1" 283 | stack_trace: 284 | dependency: transitive 285 | description: 286 | name: stack_trace 287 | url: "https://pub.dartlang.org" 288 | source: hosted 289 | version: "1.10.0" 290 | stream_channel: 291 | dependency: transitive 292 | description: 293 | name: stream_channel 294 | url: "https://pub.dartlang.org" 295 | source: hosted 296 | version: "2.1.0" 297 | string_scanner: 298 | dependency: transitive 299 | description: 300 | name: string_scanner 301 | url: "https://pub.dartlang.org" 302 | source: hosted 303 | version: "1.1.0" 304 | term_glyph: 305 | dependency: transitive 306 | description: 307 | name: term_glyph 308 | url: "https://pub.dartlang.org" 309 | source: hosted 310 | version: "1.2.0" 311 | test_api: 312 | dependency: transitive 313 | description: 314 | name: test_api 315 | url: "https://pub.dartlang.org" 316 | source: hosted 317 | version: "0.3.0" 318 | typed_data: 319 | dependency: transitive 320 | description: 321 | name: typed_data 322 | url: "https://pub.dartlang.org" 323 | source: hosted 324 | version: "1.3.0" 325 | unorm_dart: 326 | dependency: transitive 327 | description: 328 | name: unorm_dart 329 | url: "https://pub.dartlang.org" 330 | source: hosted 331 | version: "0.2.0" 332 | vector_math: 333 | dependency: transitive 334 | description: 335 | name: vector_math 336 | url: "https://pub.dartlang.org" 337 | source: hosted 338 | version: "2.1.0" 339 | xml: 340 | dependency: transitive 341 | description: 342 | name: xml 343 | url: "https://pub.dartlang.org" 344 | source: hosted 345 | version: "5.1.2" 346 | sdks: 347 | dart: ">=2.12.0 <3.0.0" 348 | flutter: ">=2.0.0" 349 | -------------------------------------------------------------------------------- /lib/database/app_database.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | import 'package:postgres/postgres.dart'; 4 | 5 | class AppDatabase { 6 | String buyerEmailValue = ''; 7 | String sellerEmailValue = ''; 8 | String passwordValue = ''; 9 | String mobileValue = ''; 10 | String companyNameValue = ''; 11 | String landlineValue = ''; 12 | String fNameValue = ''; 13 | String lNameValue = ''; 14 | 15 | PostgreSQLConnection? connection; 16 | PostgreSQLResult? newSellerRegisterResult, newBuyerRegisterResult; 17 | PostgreSQLResult? sellerAlreadyRegistered, buyerAlreadyRegistered; 18 | 19 | PostgreSQLResult? loginResult, userRegisteredResult; 20 | 21 | PostgreSQLResult? updateBuyerResult; 22 | PostgreSQLResult? updateSellerResult; 23 | 24 | static String? sellerEmailAddress, buyerEmailAddress; 25 | 26 | PostgreSQLResult? _fetchSellerDataResult; 27 | 28 | AppDatabase() { 29 | connection = (connection == null || connection!.isClosed == true 30 | ? PostgreSQLConnection( 31 | // for external device like mobile phone use domain.com or 32 | // your computer machine IP address (i.e,192.168.0.1,etc) 33 | // when using AVD add this IP 10.0.2.2 34 | '10.0.2.2', 35 | 5432, 36 | 'flutterdb', 37 | username: 'flutterdb_admin', 38 | password: '123456', 39 | timeoutInSeconds: 30, 40 | queryTimeoutInSeconds: 30, 41 | timeZone: 'UTC', 42 | useSSL: false, 43 | isUnixSocket: false, 44 | ) 45 | : connection); 46 | 47 | fetchDataFuture = []; 48 | } 49 | 50 | // Register Database Section 51 | String newSellerFuture = ''; 52 | Future registerSeller( 53 | String email, String password, String mobile) async { 54 | try { 55 | await connection!.open(); 56 | await connection!.transaction((newSellerConn) async { 57 | //Stage 1 : Make sure email or mobile not registered. 58 | sellerAlreadyRegistered = await newSellerConn.query( 59 | 'select * from myAppData.register where emailDB = @emailValue OR mobileDB = @mobileValue', 60 | substitutionValues: {'emailValue': email, 'mobileValue': mobile}, 61 | allowReuse: true, 62 | timeoutInSeconds: 30, 63 | ); 64 | if (sellerAlreadyRegistered!.affectedRowCount > 0) { 65 | newSellerFuture = 'alr'; 66 | } else { 67 | //Stage 2 : If user not already registered then we start the registration 68 | newSellerRegisterResult = await newSellerConn.query( 69 | 'insert into myAppData.register(emailDB,passDB,mobileDB,registerDateDB,roleDB,authDB,statusDB,isSellerDB) ' 70 | 'values(@emailValue,@passwordValue,@mobileValue,@registrationValue,@roleValue,@authValue,@statusValue,@isSellerValue )', 71 | substitutionValues: { 72 | 'emailValue': email, 73 | 'passwordValue': password, 74 | 'mobileValue': mobile, 75 | 'statusValue': true, 76 | 'roleValue': 'ROLE_SELLER', 77 | 'authValue': 'seller', 78 | 'registrationValue': DateTime.now(), 79 | 'isSellerValue': true, 80 | }, 81 | allowReuse: true, 82 | timeoutInSeconds: 30, 83 | ); 84 | newSellerFuture = 85 | (newSellerRegisterResult!.affectedRowCount > 0 ? 'reg' : 'nop'); 86 | } 87 | }); 88 | } catch (exc) { 89 | newSellerFuture = 'exc'; 90 | exc.toString(); 91 | } 92 | return newSellerFuture; 93 | } 94 | 95 | String newBuyerFuture = ''; 96 | Future registerBuyer( 97 | String email, String password, String fName, String lName) async { 98 | try { 99 | await connection!.open(); 100 | await connection!.transaction((newBuyerConn) async { 101 | buyerAlreadyRegistered = await newBuyerConn.query( 102 | 'select * from myAppData.register where emailDB = @emailValue order by idDB', 103 | substitutionValues: {'emailValue': email}, 104 | allowReuse: true, 105 | timeoutInSeconds: 30, 106 | ); 107 | if (buyerAlreadyRegistered!.affectedRowCount > 0) { 108 | newBuyerFuture = 'alr'; 109 | } else { 110 | newBuyerRegisterResult = await newBuyerConn.query( 111 | 'insert into myAppData.register (emailDB,passDB,fNameDB,lNameDB,statusDB,roleDB,authDB,registerDateDB)' 112 | 'values(@emailValue,@passwordValue,@fNameValue,@lNameValue,@statusValue,@roleValue,@authValue,@registrationValue)', 113 | substitutionValues: { 114 | 'emailValue': email, 115 | 'passwordValue': password, 116 | 'fNameValue': fName, 117 | 'lNameValue': lName, 118 | 'statusValue': true, 119 | 'roleValue': 'ROLE_BUYER', 120 | 'authValue': 'buyer', 121 | 'registrationValue': DateTime.now(), 122 | }, 123 | allowReuse: true, 124 | timeoutInSeconds: 30, 125 | ); 126 | newBuyerFuture = 127 | (newBuyerRegisterResult!.affectedRowCount > 0 ? 'reg' : 'nop'); 128 | } 129 | }); 130 | } catch (exc) { 131 | exc.toString(); 132 | newBuyerFuture = 'exc'; 133 | } 134 | return newBuyerFuture; 135 | } 136 | 137 | //Login Database Section 138 | String userLoginFuture = ''; 139 | Future loginUser(String email, String password) async { 140 | try { 141 | await connection!.open(); 142 | await connection!.transaction((loginConn) async { 143 | //Step 1 : Check email registered or no 144 | loginResult = await loginConn.query( 145 | 'select emailDB,passDB,isSellerDB from myAppData.register where emailDB = @emailValue order by idDB', 146 | substitutionValues: {'emailValue': email}, 147 | allowReuse: true, 148 | timeoutInSeconds: 30, 149 | ); 150 | if (loginResult!.affectedRowCount > 0) { 151 | // Usually we check if account expired or no ...but I will 152 | // not add the code and skip here to simplify things 153 | // We will check the entered credentials..and decide 154 | // weather the user is a buyer or seller 155 | 156 | sellerEmailAddress = loginResult!.first 157 | .elementAt(0); //This to use when update seller details 158 | 159 | if (loginResult!.first.elementAt(1).contains(password) == true && 160 | loginResult!.first.elementAt(2) == true) { 161 | userLoginFuture = 'sel'; 162 | } else if (loginResult!.first.elementAt(1).contains(password) == 163 | true && 164 | loginResult!.first.elementAt(2) == false) { 165 | userLoginFuture = 'buy'; 166 | } else if (loginResult!.first.elementAt(1).contains(password) == 167 | false) { 168 | userLoginFuture = 'fai'; 169 | } else { 170 | userLoginFuture = 'exc'; 171 | } 172 | } else { 173 | userLoginFuture = 'not'; 174 | } 175 | }); 176 | } catch (exc) { 177 | userLoginFuture = 'exc'; 178 | exc.toString(); 179 | } 180 | return userLoginFuture; 181 | } 182 | 183 | //Update Database Section 184 | String futureBuyerUpdate = ''; 185 | Future updateBuyerData(int ssn, String mobile) async { 186 | try { 187 | await connection!.open(); 188 | await connection!.transaction((updateBuyerConn) async { 189 | print('update buyer'); 190 | // Mobile column in DB is unique..so we check the buyer mobile first 191 | PostgreSQLResult checkBuyerMobile = await updateBuyerConn.query( 192 | 'select mobileDB from myAppData.register where mobileDB = @mobileValue', 193 | substitutionValues: {'mobileValue': mobile}, 194 | allowReuse: false, 195 | timeoutInSeconds: 30, 196 | ); 197 | if (checkBuyerMobile.affectedRowCount > 0) { 198 | futureBuyerUpdate = 'alr'; 199 | } else { 200 | //If check fails ..then we update buyer data 201 | updateBuyerResult = await updateBuyerConn.query( 202 | 'update myAppData.register set SSN_DB = @ssnValue, mobileDB = @mobileValue where emailDB = @emailValue', 203 | substitutionValues: { 204 | 'ssnValue': ssn, 205 | 'mobileValue': mobile, 206 | 'emailValue': AppDatabase.sellerEmailAddress, 207 | }, 208 | allowReuse: false, 209 | timeoutInSeconds: 30, 210 | ); 211 | print('update buyer 1'); 212 | futureBuyerUpdate = 213 | (updateBuyerResult!.affectedRowCount > 0 ? 'upd' : 'nop'); 214 | } 215 | }); 216 | } catch (exc) { 217 | futureBuyerUpdate = 'exc'; 218 | exc.toString(); 219 | } 220 | return futureBuyerUpdate; 221 | } 222 | 223 | String sellerDetailsFuture = ''; 224 | Future updateSellerData( 225 | String companyNameValue, String fNameValue, String logoImage) async { 226 | try { 227 | await connection!.open(); 228 | await connection!.transaction((sellerUpdateConn) async { 229 | updateSellerResult = await sellerUpdateConn.query( 230 | 'update myAppData.register set companyDB = @companyValue , fNameDB = @fNameValue , avatar = @avatarValue where emailDB = @emailValue', 231 | substitutionValues: { 232 | 'companyValue': companyNameValue, 233 | 'fNameValue': fNameValue, 234 | 'avatarValue': logoImage, 235 | 'emailValue': AppDatabase.sellerEmailAddress, 236 | }, 237 | allowReuse: false, 238 | timeoutInSeconds: 30, 239 | ); 240 | sellerDetailsFuture = 241 | (updateSellerResult!.affectedRowCount > 0 ? 'upd' : 'not'); 242 | }); 243 | } catch (exc) { 244 | sellerDetailsFuture = 'exc'; 245 | exc.toString(); 246 | } 247 | return sellerDetailsFuture; 248 | } 249 | 250 | // Fetch Data Section 251 | List fetchDataFuture = []; 252 | Future> fetchSellerData(String emailText) async { 253 | try { 254 | await connection!.open(); 255 | await connection!.transaction((fetchDataConn) async { 256 | _fetchSellerDataResult = await fetchDataConn.query( 257 | 'select companydb,emaildb,fnamedb,mobiledb,avatar from myAppData.register where emailDB = @emailValue order by idDB', 258 | substitutionValues: {'emailValue': emailText}, 259 | allowReuse: false, 260 | timeoutInSeconds: 30, 261 | ); 262 | if (_fetchSellerDataResult!.affectedRowCount > 0) { 263 | fetchDataFuture = _fetchSellerDataResult!.first.toList(growable: true); 264 | } else { 265 | fetchDataFuture = []; 266 | } 267 | }); 268 | } catch (exc) { 269 | fetchDataFuture = []; 270 | exc.toString(); 271 | } 272 | 273 | return fetchDataFuture; 274 | } 275 | } 276 | -------------------------------------------------------------------------------- /lib/widgets/login.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_db/models/model_user.dart'; 6 | import 'package:flutter_db/shared_widgets/buttons.dart'; 7 | import 'package:flutter_db/shared_widgets/form_text_field.dart'; 8 | 9 | class Login extends StatelessWidget { 10 | const Login({Key? key}) : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Scaffold( 15 | appBar: AppBar( 16 | backgroundColor: Colors.blue, 17 | title: Text( 18 | 'Login Page', 19 | style: TextStyle( 20 | color: Colors.white, 21 | fontSize: 20, 22 | fontStyle: FontStyle.italic, 23 | fontWeight: FontWeight.bold, 24 | letterSpacing: 2.0, 25 | ), 26 | ), 27 | centerTitle: true, 28 | ), 29 | body: LoginPage(), 30 | ); 31 | } 32 | } 33 | 34 | class LoginPage extends StatefulWidget { 35 | const LoginPage({Key? key}) : super(key: key); 36 | 37 | @override 38 | _LoginPageState createState() => _LoginPageState(); 39 | } 40 | 41 | class _LoginPageState extends State { 42 | final _loginFormKey = GlobalKey(); 43 | /*...Create a controller for every field ...*/ 44 | final _emailController = TextEditingController(); 45 | final _passwordController = TextEditingController(); 46 | 47 | /*...Make sure the field has value entered ...*/ 48 | String emailValue = ''; 49 | String _emailLatestValue() { 50 | return emailValue = ((_emailController.text).isNotEmpty && 51 | (_emailController.text).length > 0 52 | ? _emailController.text 53 | : ''); 54 | } 55 | 56 | String passwordValue = ''; 57 | String _passwordLatestValue() { 58 | return passwordValue = ((_passwordController.text).isNotEmpty && 59 | (_passwordController.text).length > 0 60 | ? _passwordController.text 61 | : ''); 62 | } 63 | 64 | @override 65 | void initState() { 66 | // TODO: implement initState 67 | super.initState(); 68 | _emailController.addListener(() { 69 | _emailLatestValue(); 70 | }); 71 | _passwordController.addListener(() { 72 | _passwordLatestValue(); 73 | }); 74 | } 75 | 76 | @override 77 | void dispose() { 78 | // TODO: implement dispose 79 | _emailController.dispose(); 80 | _passwordController.dispose(); 81 | 82 | super.dispose(); 83 | } 84 | 85 | @override 86 | Widget build(BuildContext context) { 87 | return Scaffold( 88 | body: Padding( 89 | padding: EdgeInsets.all(10.0), 90 | child: ListView( 91 | scrollDirection: Axis.vertical, 92 | reverse: false, 93 | controller: ScrollController(), 94 | primary: false, 95 | physics: AlwaysScrollableScrollPhysics(), 96 | children: [ 97 | Container( 98 | alignment: Alignment.center, 99 | padding: EdgeInsets.all(10.0), 100 | constraints: BoxConstraints( 101 | minWidth: 380.0, 102 | maxWidth: 420.0, 103 | minHeight: 250.0, 104 | maxHeight: 300.0, 105 | ), 106 | decoration: BoxDecoration( 107 | image: DecorationImage( 108 | image: AssetImage('res/flowersonsea.jpg'), 109 | fit: BoxFit.fill, 110 | ), 111 | ), 112 | ), 113 | SizedBox( 114 | height: 20.0, 115 | ), 116 | Form( 117 | key: _loginFormKey, 118 | child: Column( 119 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 120 | crossAxisAlignment: CrossAxisAlignment.stretch, 121 | mainAxisSize: MainAxisSize.min, 122 | children: [ 123 | FormTextFieldStandard( 124 | controller: _emailController, 125 | textInputType: TextInputType.emailAddress, 126 | textInputAction: TextInputAction.next, 127 | fontSize: 16.0, 128 | fontWeight: FontWeight.w400, 129 | fontColor: Colors.black, 130 | icon: Icons.email, 131 | tooltip: "Email", 132 | maxLines: 1, 133 | formTextFieldLabel: "Email Address", 134 | validate: (stringEmailValue) => 135 | stringEmailValue!.isEmpty == true ? "Email" : null, 136 | ), 137 | SizedBox( 138 | height: 10.0, 139 | ), 140 | FormTextFieldStandardObsecured( 141 | controller: _passwordController, 142 | textInputType: TextInputType.visiblePassword, 143 | textInputAction: TextInputAction.next, 144 | fontSize: 16.0, 145 | fontWeight: FontWeight.w400, 146 | fontColor: Colors.black, 147 | icon: Icons.security, 148 | tooltip: "Password", 149 | maxLines: 1, 150 | formTextFieldLabel: "Password", 151 | validate: (stringPassValue) => 152 | stringPassValue!.isEmpty == true 153 | ? "Add Password" 154 | : null, 155 | ), 156 | SizedBox( 157 | height: 20.0, 158 | ), 159 | Container( 160 | alignment: Alignment.center, 161 | constraints: BoxConstraints( 162 | minWidth: 380.0, 163 | maxWidth: 420.0, 164 | minHeight: 50.0, 165 | maxHeight: 50.0, 166 | ), 167 | child: StandardElevatedButton( 168 | style: ButtonStyle(), 169 | child: Text( 170 | "Login", 171 | style: TextStyle( 172 | fontSize: 17.0, 173 | fontStyle: FontStyle.italic, 174 | fontWeight: FontWeight.bold, 175 | letterSpacing: 2.0, 176 | ), 177 | ), 178 | onPressed: () { 179 | processLoginData(context); 180 | }, 181 | ), 182 | ), 183 | SizedBox( 184 | height: 20.0, 185 | ), 186 | Container( 187 | alignment: Alignment.center, 188 | constraints: BoxConstraints( 189 | minWidth: 380.0, 190 | maxWidth: 420.0, 191 | minHeight: 50.0, 192 | maxHeight: 50.0, 193 | ), 194 | child: Row( 195 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 196 | crossAxisAlignment: CrossAxisAlignment.stretch, 197 | mainAxisSize: MainAxisSize.min, 198 | children: [ 199 | Expanded( 200 | flex: 1, 201 | child: InkWell( 202 | child: Text( 203 | "Register Account", 204 | style: TextStyle( 205 | color: Colors.blue, 206 | fontSize: 14.0, 207 | fontStyle: FontStyle.italic, 208 | fontWeight: FontWeight.bold, 209 | decoration: TextDecoration.underline, 210 | ), 211 | textAlign: TextAlign.center, 212 | ), 213 | onTap: () { 214 | Navigator.pushNamed(context, '/register'); 215 | }, 216 | ), 217 | ), 218 | Expanded( 219 | flex: 1, 220 | child: InkWell( 221 | child: Text( 222 | 'Seller Shop', 223 | style: TextStyle( 224 | color: Colors.blue, 225 | fontSize: 14.0, 226 | fontStyle: FontStyle.italic, 227 | fontWeight: FontWeight.bold, 228 | decoration: TextDecoration.underline, 229 | ), 230 | textAlign: TextAlign.center, 231 | ), 232 | onTap: () { 233 | Navigator.pushNamed(context, '/sellerShop'); 234 | }, 235 | ), 236 | ) 237 | ], 238 | ), 239 | ), 240 | ], 241 | ), 242 | ), 243 | ], 244 | ), 245 | ), 246 | ); 247 | } 248 | 249 | Future processLoginData(BuildContext context) async { 250 | if (_loginFormKey.currentState!.validate()) { 251 | _loginFormKey.currentState!.save(); 252 | 253 | ModelsUsers() 254 | .userLoginModel(emailValue, passwordValue) 255 | .then((loginFuture) { 256 | if (loginFuture.toString().contains('buy')) { 257 | Navigator.pushNamed(context, '/buyerAccount'); 258 | setState(() { 259 | _emailController.clear(); 260 | _passwordController.clear(); 261 | }); 262 | } else if (loginFuture.toString().contains('sel')) { 263 | Navigator.pushNamed(context, '/sellerAccount'); 264 | setState(() { 265 | _emailController.clear(); 266 | _passwordController.clear(); 267 | }); 268 | } else if (loginFuture.toString().contains('not')) { 269 | setState(() { 270 | ScaffoldMessenger.of(context).showSnackBar( 271 | SnackBar( 272 | backgroundColor: Colors.white, 273 | elevation: 10.0, 274 | shape: Border.all( 275 | color: Colors.red, width: 0.5, style: BorderStyle.solid), 276 | content: Text( 277 | "Email Not Registered", 278 | style: TextStyle( 279 | color: Colors.black, 280 | fontSize: 16.0, 281 | fontWeight: FontWeight.bold, 282 | fontStyle: FontStyle.italic, 283 | letterSpacing: 1.0, 284 | ), 285 | textAlign: TextAlign.center, 286 | ), 287 | ), 288 | ); 289 | _emailController.clear(); 290 | _passwordController.clear(); 291 | Timer(Duration(seconds: 3), () { 292 | Navigator.pushNamed(context, '/'); 293 | }); 294 | }); 295 | } else if (loginFuture.contains('fai')) { 296 | setState(() { 297 | ScaffoldMessenger.of(context).showSnackBar( 298 | SnackBar( 299 | backgroundColor: Colors.white, 300 | elevation: 10.0, 301 | shape: Border.all( 302 | color: Colors.red, 303 | width: 0.5, 304 | style: BorderStyle.solid, 305 | ), 306 | content: Text( 307 | "Login Failed..wrong email or password", 308 | style: TextStyle( 309 | color: Colors.black, 310 | fontSize: 16.0, 311 | fontWeight: FontWeight.bold, 312 | fontStyle: FontStyle.italic, 313 | letterSpacing: 1.0, 314 | ), 315 | textAlign: TextAlign.center, 316 | ), 317 | ), 318 | ); 319 | _emailController.clear(); 320 | _passwordController.clear(); 321 | Timer(Duration(seconds: 3), () { 322 | Navigator.pushNamed(context, '/login'); 323 | }); 324 | }); 325 | } else if (loginFuture.contains('exc')) { 326 | setState(() { 327 | ScaffoldMessenger.of(context).showSnackBar( 328 | SnackBar( 329 | backgroundColor: Colors.white, 330 | elevation: 10.0, 331 | shape: Border.all( 332 | color: Colors.orange, width: 0.5, style: BorderStyle.solid), 333 | content: Text( 334 | "Something Went Wrong", 335 | style: TextStyle( 336 | color: Colors.black, 337 | fontSize: 16.0, 338 | fontWeight: FontWeight.bold, 339 | fontStyle: FontStyle.italic, 340 | letterSpacing: 1.0, 341 | ), 342 | textAlign: TextAlign.center, 343 | ), 344 | ), 345 | ); 346 | _emailController.clear(); 347 | _passwordController.clear(); 348 | Timer(Duration(seconds: 4), () { 349 | Navigator.pushNamed(context, '/login'); 350 | }); 351 | }); 352 | } 353 | }).catchError((err) { 354 | setState(() { 355 | ScaffoldMessenger.of(context).showSnackBar( 356 | SnackBar( 357 | backgroundColor: Colors.white, 358 | elevation: 10.0, 359 | shape: Border.all( 360 | color: Colors.orange, width: 0.5, style: BorderStyle.solid), 361 | content: Text( 362 | "Something Went Wrong", 363 | style: TextStyle( 364 | color: Colors.black, 365 | fontSize: 16.0, 366 | fontWeight: FontWeight.bold, 367 | fontStyle: FontStyle.italic, 368 | letterSpacing: 1.0, 369 | ), 370 | textAlign: TextAlign.center, 371 | ), 372 | ), 373 | ); 374 | _emailController.clear(); 375 | _passwordController.clear(); 376 | Timer(Duration(seconds: 4), () { 377 | Navigator.pushNamed(context, '/login'); 378 | }); 379 | }); 380 | }).whenComplete(() => null); 381 | } else { 382 | setState(() { 383 | ScaffoldMessenger.of(context).showSnackBar( 384 | SnackBar( 385 | backgroundColor: Colors.white, 386 | elevation: 10.0, 387 | shape: Border.all( 388 | color: Colors.orange, 389 | width: 0.5, 390 | style: BorderStyle.solid, 391 | ), 392 | content: Text( 393 | "Fill All Details", 394 | style: TextStyle( 395 | color: Colors.black, 396 | fontSize: 16.0, 397 | fontWeight: FontWeight.bold, 398 | fontStyle: FontStyle.italic, 399 | letterSpacing: 1.0, 400 | ), 401 | textAlign: TextAlign.center, 402 | ), 403 | ), 404 | ); 405 | _emailController.clear(); 406 | _passwordController.clear(); 407 | Timer(Duration(seconds: 4), () { 408 | Navigator.pushNamed(context, '/login'); 409 | }); 410 | }); 411 | } 412 | } 413 | 414 | loginFieldsData() {} 415 | } 416 | -------------------------------------------------------------------------------- /lib/widgets/seller_account.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | import 'dart:io'; 4 | import 'dart:typed_data'; 5 | 6 | import 'package:flutter/material.dart'; 7 | import 'package:flutter/services.dart'; 8 | import 'package:flutter_db/models/model_user.dart'; 9 | import 'package:flutter_db/shared_widgets/buttons.dart'; 10 | import 'package:flutter_db/shared_widgets/form_text_field.dart'; 11 | import 'package:image_picker/image_picker.dart'; 12 | 13 | class SellerAccount extends StatelessWidget { 14 | const SellerAccount({Key? key}) : super(key: key); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return SellerPage(); 19 | } 20 | } 21 | 22 | class SellerPage extends StatefulWidget { 23 | const SellerPage({Key? key}) : super(key: key); 24 | 25 | @override 26 | _SellerPageState createState() => _SellerPageState(); 27 | } 28 | 29 | class _SellerPageState extends State { 30 | final _companyNameFieldController = TextEditingController(); 31 | final _fNameFieldController = TextEditingController(); 32 | 33 | final _updateSellerAccount = GlobalKey(); 34 | 35 | /*...Make sure the field has value entered ...*/ 36 | String _companyValue = ''; 37 | String _companyLatestValue() { 38 | return _companyValue = ((_companyNameFieldController.text).isNotEmpty && 39 | (_companyNameFieldController.text).length > 0 40 | ? _companyNameFieldController.text 41 | : ''); 42 | } 43 | 44 | /*...Make sure the field has value entered ...*/ 45 | String _fNameValue = ''; 46 | String _fNameLatestValue() { 47 | return _fNameValue = ((_fNameFieldController.text).isNotEmpty && 48 | (_fNameFieldController.text).length > 0 49 | ? _fNameFieldController.text 50 | : ''); 51 | } 52 | 53 | String? logoFromGallery; 54 | File? _logoFile; 55 | Uint8List? logoUint8List; 56 | String? _logoImage; 57 | 58 | Future _getLogoFromGallery(var logoFile) async { 59 | try { 60 | var logoPickedFile = await ImagePicker().pickImage( 61 | source: ImageSource.gallery, 62 | imageQuality: 60, 63 | preferredCameraDevice: CameraDevice.rear); 64 | //Read the image as bytes 65 | logoUint8List = await logoPickedFile!.readAsBytes(); 66 | 67 | //Convert the image to base64 String 68 | var logoBase64 = base64Encode(logoUint8List!); 69 | 70 | //Assign the encoded base64 string to this method's return value 71 | if (logoUint8List!.lengthInBytes > 0) { 72 | logoFromGallery = logoBase64; 73 | setState(() => _logoFile = File(logoPickedFile.path)); 74 | } else { 75 | logoFromGallery = null; 76 | setState(() => _logoFile = (null)); 77 | } 78 | } catch (exc) { 79 | logoFromGallery = null; 80 | setState(() => _logoFile = (null)); 81 | exc.toString(); 82 | } 83 | return logoFromGallery; 84 | } 85 | 86 | ///This to set the no product image in case seller add less than 10 products 87 | String? noImage; 88 | String? noLogoImageBase64; 89 | 90 | // If seller not select a logo imae..we have to set a replacement image from 91 | // resources 92 | Future getNoImageData() async { 93 | ByteData bytes = await rootBundle.load('res/noproduct.png'); 94 | noImage = base64Encode(bytes.buffer.asUint8List(0, bytes.lengthInBytes)); 95 | var noImageBase64String = getNoImageBase64String(noImage!); 96 | return noImage; 97 | } 98 | 99 | String? getNoImageBase64String(String noImageBase64String) { 100 | noLogoImageBase64 = noImageBase64String; 101 | return noLogoImageBase64; 102 | } 103 | 104 | /* Seller can remove any image before saving it ...Except Company Logo */ 105 | Future replaceCompanyLogo(var image) async { 106 | this._logoFile = image; 107 | image = await ImagePicker().pickImage( 108 | source: ImageSource.gallery, 109 | imageQuality: 60, 110 | ); 111 | setState(() => _logoFile = image); 112 | } 113 | 114 | @override 115 | void initState() { 116 | // TODO: implement initState 117 | super.initState(); 118 | //Initialize the controllers and add listener to listen to any changes in 119 | // The text fields 120 | _companyNameFieldController.addListener(() { 121 | _companyLatestValue(); 122 | }); 123 | _fNameFieldController.addListener(() { 124 | _fNameLatestValue(); 125 | }); 126 | } 127 | 128 | @override 129 | void dispose() { 130 | // TODO: implement dispose 131 | //Dispose the values of the controllers after use 132 | _companyNameFieldController.dispose(); 133 | _fNameFieldController.dispose(); 134 | 135 | super.dispose(); 136 | } 137 | 138 | @override 139 | Widget build(BuildContext context) { 140 | return Scaffold( 141 | appBar: AppBar( 142 | backgroundColor: Colors.blue[200], 143 | title: Text('Seller Update Details Page '), 144 | ), 145 | body: Container( 146 | alignment: Alignment.center, 147 | color: Colors.white, 148 | child: ListView( 149 | scrollDirection: Axis.vertical, 150 | controller: ScrollController(), 151 | reverse: false, 152 | shrinkWrap: true, 153 | padding: EdgeInsets.all(20.0), 154 | children: [ 155 | Form( 156 | key: _updateSellerAccount, 157 | child: Column( 158 | mainAxisAlignment: MainAxisAlignment.center, 159 | crossAxisAlignment: CrossAxisAlignment.center, 160 | mainAxisSize: MainAxisSize.min, 161 | children: [ 162 | FormTextFieldStandard( 163 | controller: _companyNameFieldController, 164 | textInputType: TextInputType.name, 165 | textInputAction: TextInputAction.next, 166 | fontSize: 16.0, 167 | fontWeight: FontWeight.w400, 168 | fontColor: Colors.black, 169 | icon: Icons.local_post_office_outlined, 170 | tooltip: "Company Name", 171 | maxLines: 1, 172 | formTextFieldLabel: "Company Name ", 173 | validate: (stringEmailValue) => 174 | stringEmailValue!.isEmpty == true 175 | ? "Enter Company Name" 176 | : null, 177 | ), 178 | SizedBox( 179 | height: 10.0, 180 | ), 181 | FormTextFieldStandard( 182 | controller: _fNameFieldController, 183 | textInputType: TextInputType.name, 184 | textInputAction: TextInputAction.next, 185 | fontSize: 16.0, 186 | fontWeight: FontWeight.w400, 187 | fontColor: Colors.black, 188 | icon: Icons.person, 189 | tooltip: "First Name", 190 | maxLines: 1, 191 | formTextFieldLabel: "First Name", 192 | validate: (stringEmailValue) => 193 | stringEmailValue!.isEmpty == true ? "First Name" : null, 194 | ), 195 | SizedBox( 196 | height: 10.0, 197 | ), 198 | ProductsImagesGridView( 199 | imageFile: _logoFile, 200 | //image:Image.file(selectedFile(_image)) , 201 | iconGallery: Icons.photo, 202 | iconCamera: Icons.camera, 203 | iconRemove: Icons.add_photo_alternate, 204 | onPressedGallery: () => _getLogoFromGallery(_logoFile), 205 | onPressedRemove: () => replaceCompanyLogo(_logoFile), 206 | ), 207 | SizedBox( 208 | height: 10.0, 209 | ), 210 | StandardElevatedButton( 211 | style: ButtonStyle(), 212 | child: Text( 213 | "Update", 214 | style: TextStyle( 215 | fontSize: 17.0, 216 | fontStyle: FontStyle.italic, 217 | fontWeight: FontWeight.bold, 218 | letterSpacing: 2.0, 219 | ), 220 | ), 221 | onPressed: () => updateSellerDetailsMethod(context), 222 | ), 223 | ], 224 | ), 225 | ), 226 | ], 227 | ), 228 | ), 229 | ); 230 | } 231 | 232 | void updateSellerDetailsMethod(BuildContext context) { 233 | if (_updateSellerAccount.currentState!.validate()) { 234 | _updateSellerAccount.currentState!.save(); 235 | // Here we arrange all inputs data from the application 236 | //and forward to the update model class 237 | 238 | _logoImage = 239 | (logoFromGallery == null ? noLogoImageBase64 : logoFromGallery); 240 | 241 | ModelsUsers() 242 | .updateSellerDetails(_companyValue, _fNameValue, _logoImage!) 243 | .then((updateSellerFuture) { 244 | if (updateSellerFuture.toString().contains('upd')) { 245 | setState(() { 246 | ScaffoldMessenger.of(context).showSnackBar( 247 | SnackBar( 248 | backgroundColor: Colors.white, 249 | elevation: 10.0, 250 | shape: Border.all( 251 | color: Colors.orange, 252 | width: 0.5, 253 | style: BorderStyle.solid, 254 | ), 255 | content: Text( 256 | "Update Successful", 257 | style: TextStyle( 258 | color: Colors.black, 259 | fontSize: 16.0, 260 | fontWeight: FontWeight.bold, 261 | fontStyle: FontStyle.italic, 262 | letterSpacing: 1.0, 263 | ), 264 | textAlign: TextAlign.center, 265 | ), 266 | ), 267 | ); 268 | _companyNameFieldController.clear(); 269 | _fNameFieldController.clear(); 270 | Timer(Duration(seconds: 4), () { 271 | Navigator.pushNamed(context, '/login'); 272 | }); 273 | }); 274 | } else if (updateSellerFuture.toString().contains('not')) { 275 | setState(() { 276 | ScaffoldMessenger.of(context).showSnackBar( 277 | SnackBar( 278 | backgroundColor: Colors.white, 279 | elevation: 10.0, 280 | shape: Border.all( 281 | color: Colors.orange, 282 | width: 0.5, 283 | style: BorderStyle.solid, 284 | ), 285 | content: Text( 286 | "Update Failed", 287 | style: TextStyle( 288 | color: Colors.black, 289 | fontSize: 16.0, 290 | fontWeight: FontWeight.bold, 291 | fontStyle: FontStyle.italic, 292 | letterSpacing: 1.0, 293 | ), 294 | textAlign: TextAlign.center, 295 | ), 296 | ), 297 | ); 298 | _companyNameFieldController.clear(); 299 | _fNameFieldController.clear(); 300 | Timer(Duration(seconds: 4), () { 301 | Navigator.pushNamed(context, '/sellerAccount'); 302 | }); 303 | }); 304 | } else if (updateSellerFuture.toString().contains('exc')) { 305 | setState(() { 306 | ScaffoldMessenger.of(context).showSnackBar( 307 | SnackBar( 308 | backgroundColor: Colors.white, 309 | elevation: 10.0, 310 | shape: Border.all( 311 | color: Colors.orange, 312 | width: 0.5, 313 | style: BorderStyle.solid, 314 | ), 315 | content: Text( 316 | "Something Went Wrong..Try Again", 317 | style: TextStyle( 318 | color: Colors.black, 319 | fontSize: 16.0, 320 | fontWeight: FontWeight.bold, 321 | fontStyle: FontStyle.italic, 322 | letterSpacing: 1.0, 323 | ), 324 | textAlign: TextAlign.center, 325 | ), 326 | ), 327 | ); 328 | _companyNameFieldController.clear(); 329 | _fNameFieldController.clear(); 330 | Timer(Duration(seconds: 4), () { 331 | Navigator.pushNamed(context, '/sellerAccount'); 332 | }); 333 | }); 334 | } 335 | }); 336 | } else { 337 | setState(() { 338 | ScaffoldMessenger.of(context).showSnackBar( 339 | SnackBar( 340 | backgroundColor: Colors.white, 341 | elevation: 10.0, 342 | shape: Border.all( 343 | color: Colors.orange, 344 | width: 0.5, 345 | style: BorderStyle.solid, 346 | ), 347 | content: Text( 348 | "Fill All Details", 349 | style: TextStyle( 350 | color: Colors.black, 351 | fontSize: 16.0, 352 | fontWeight: FontWeight.bold, 353 | fontStyle: FontStyle.italic, 354 | letterSpacing: 1.0, 355 | ), 356 | textAlign: TextAlign.center, 357 | ), 358 | ), 359 | ); 360 | _companyNameFieldController.clear(); 361 | _fNameFieldController.clear(); 362 | Timer(Duration(seconds: 4), () { 363 | Navigator.pushNamed(context, '/sellerAccount'); 364 | }); 365 | }); 366 | } 367 | } 368 | } 369 | 370 | class ProductsImagesGridView extends StatelessWidget { 371 | final File? imageFile; 372 | final Image? image; 373 | final IconData? iconGallery; 374 | final IconData? iconCamera; 375 | final IconData? iconRemove; 376 | final Function()? onPressedGallery; 377 | final Function()? onPressedCamera; 378 | final Function()? onPressedRemove; 379 | 380 | ProductsImagesGridView({ 381 | this.imageFile, 382 | this.image, 383 | this.iconGallery, 384 | this.iconCamera, 385 | this.iconRemove, 386 | this.onPressedGallery, 387 | this.onPressedCamera, 388 | this.onPressedRemove, 389 | }); 390 | 391 | @override 392 | Widget build(BuildContext context) { 393 | return GridView.count( 394 | scrollDirection: Axis.vertical, 395 | reverse: false, 396 | controller: ScrollController( 397 | initialScrollOffset: 0, 398 | keepScrollOffset: true, 399 | debugLabel: 'userAccount_Grid', 400 | ), 401 | primary: false, 402 | physics: AlwaysScrollableScrollPhysics(), 403 | shrinkWrap: true, 404 | padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), 405 | addAutomaticKeepAlives: true, 406 | addRepaintBoundaries: true, 407 | addSemanticIndexes: true, 408 | crossAxisCount: 4, 409 | mainAxisSpacing: 10.0, 410 | crossAxisSpacing: 10.0, 411 | children: [ 412 | Container( 413 | padding: EdgeInsets.all(2.0), 414 | //height: 70.0, 415 | decoration: BoxDecoration( 416 | border: Border.all( 417 | color: Colors.black, 418 | width: 0.5, 419 | style: BorderStyle.solid, 420 | ), 421 | borderRadius: BorderRadius.all(Radius.circular(10.0)), 422 | ), 423 | alignment: Alignment.center, 424 | child: imageFile == null ? Text("No Logo") : Image.file(imageFile!), 425 | ), 426 | UserAccountImageButton( 427 | icon: Icon( 428 | iconGallery, 429 | size: 30, 430 | color: Colors.white, 431 | semanticLabel: 'userAccountGalleryImage', 432 | ), 433 | onPressed: onPressedGallery, 434 | ), 435 | UserAccountImageButton( 436 | icon: Icon( 437 | iconRemove, 438 | size: 30, 439 | color: Colors.white, 440 | semanticLabel: 'userAccountRemoveImage', 441 | ), 442 | onPressed: onPressedRemove, 443 | ), 444 | ], 445 | ); 446 | } 447 | } 448 | -------------------------------------------------------------------------------- /lib/widgets/buyer_account.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:clay_containers/constants.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_db/models/model_user.dart'; 6 | import 'package:flutter_db/shared_widgets/buttons.dart'; 7 | import 'package:flutter_db/shared_widgets/clay.dart'; 8 | import 'package:flutter_db/shared_widgets/form_text_field.dart'; 9 | 10 | class BuyerAccount extends StatelessWidget { 11 | const BuyerAccount({Key? key}) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Scaffold( 16 | appBar: AppBar( 17 | title: Text( 18 | 'Buyer Account Page', 19 | style: TextStyle( 20 | fontSize: 20.0, 21 | fontStyle: FontStyle.italic, 22 | fontWeight: FontWeight.bold), 23 | ), 24 | backgroundColor: Colors.grey[100], 25 | ), 26 | body: BuyerPage(), 27 | ); 28 | } 29 | } 30 | 31 | class BuyerPage extends StatefulWidget { 32 | const BuyerPage({Key? key}) : super(key: key); 33 | 34 | @override 35 | _BuyerPageState createState() => _BuyerPageState(); 36 | } 37 | 38 | class _BuyerPageState extends State { 39 | Color baseColor = Color(0xFFF2F2F2); 40 | 41 | /// Get Form key to update the buyer's data 42 | final _updateBuyerKey = GlobalKey(); 43 | 44 | /*...Create a controller for every field buyer wish to update...*/ 45 | final _ssnController = TextEditingController(); 46 | final _mobileController = TextEditingController(); 47 | 48 | /*...Get value of the fields when values entered ...*/ 49 | 50 | int ssnValue = 0; 51 | int _ssnLatestValue() { 52 | 53 | if ((int.parse(_ssnController.text)) != 0 && 54 | (int.parse(_ssnController.text)).isNegative == false) { 55 | ssnValue = int.parse(_ssnController.text); 56 | } 57 | return ssnValue; 58 | } 59 | 60 | String mobileValue = ''; 61 | String _mobileLatestValue() { 62 | if ((_mobileController.text).isNotEmpty == true && 63 | (_mobileController.text).length > 0) { 64 | mobileValue = _mobileController.text; 65 | } 66 | return mobileValue; 67 | } 68 | 69 | @override 70 | void initState() { 71 | // TODO: implement initState 72 | super.initState(); 73 | 74 | /// Listen to any changes in the fields values 75 | _ssnController.addListener(() { 76 | _ssnLatestValue(); 77 | }); 78 | _mobileController.addListener(() { 79 | _mobileLatestValue(); 80 | }); 81 | } 82 | 83 | @override 84 | void dispose() { 85 | // TODO: implement dispose 86 | super.dispose(); 87 | _ssnController.dispose(); 88 | _mobileController.dispose(); 89 | } 90 | 91 | @override 92 | Widget build(BuildContext context) { 93 | return Scaffold( 94 | body: Padding( 95 | padding: EdgeInsets.all(20.0), 96 | child: ListView( 97 | scrollDirection: Axis.vertical, 98 | reverse: false, 99 | controller: ScrollController(), 100 | primary: false, 101 | physics: AlwaysScrollableScrollPhysics(), 102 | shrinkWrap: true, 103 | addAutomaticKeepAlives: true, 104 | addSemanticIndexes: true, 105 | addRepaintBoundaries: true, 106 | children: [ 107 | SizedBox( 108 | height: 20.0, 109 | ), 110 | Container( 111 | alignment: Alignment.center, 112 | child: Column( 113 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 114 | crossAxisAlignment: CrossAxisAlignment.stretch, 115 | mainAxisSize: MainAxisSize.min, 116 | children: [ 117 | ClayContainerDesign( 118 | containerColor: baseColor, 119 | borderRadius: 10.0, 120 | customBorderRadius: BorderRadius.circular(20.0), 121 | curveType: CurveType.convex, 122 | height: 70.0, 123 | textDetails: "Fill All Details", 124 | clayTextSize: 32.0, 125 | clayTextColor: Colors.white, 126 | clayTextColorText: Colors.grey, 127 | ), 128 | ], 129 | ), 130 | ), 131 | SizedBox( 132 | height: 20.0, 133 | ), 134 | Form( 135 | key: _updateBuyerKey, 136 | child: Column( 137 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 138 | crossAxisAlignment: CrossAxisAlignment.stretch, 139 | mainAxisSize: MainAxisSize.min, 140 | children: [ 141 | SizedBox( 142 | height: 10.0, 143 | ), 144 | Flexible( 145 | flex: 1, 146 | fit: FlexFit.loose, 147 | child: FormTextFieldStandard( 148 | controller: _ssnController, 149 | textInputType: TextInputType.text, 150 | textInputAction: TextInputAction.next, 151 | fontSize: 17.0, 152 | fontWeight: FontWeight.w400, 153 | fontColor: Colors.blueGrey, 154 | icon: Icons.confirmation_number_outlined, 155 | formTextFieldLabel: "SSN Number", 156 | validate: (stringFieldValue) => 157 | stringFieldValue!.isEmpty == true 158 | ? "Fill All Fields" 159 | : null, 160 | ), 161 | ), 162 | SizedBox( 163 | height: 10.0, 164 | ), 165 | Flexible( 166 | flex: 1, 167 | fit: FlexFit.loose, 168 | child: FormTextFieldStandard( 169 | controller: _mobileController, 170 | textInputType: TextInputType.text, 171 | textInputAction: TextInputAction.none, 172 | fontSize: 17.0, 173 | fontWeight: FontWeight.w400, 174 | fontColor: Colors.blueGrey, 175 | icon: Icons.phone_android, 176 | formTextFieldLabel: "Mobile", 177 | validate: (stringFieldValue) => 178 | stringFieldValue!.isEmpty == true 179 | ? "Fill All Fields" 180 | : null, 181 | ), 182 | ), 183 | SizedBox( 184 | height: 20.0, 185 | ), 186 | StandardElevatedButton( 187 | style: ButtonStyle(), 188 | child: Text( 189 | "Update", 190 | style: TextStyle( 191 | fontSize: 22.0, 192 | fontWeight: FontWeight.bold, 193 | fontStyle: FontStyle.italic, 194 | color: Colors.red, 195 | ), 196 | ), 197 | onPressed: () { 198 | if (_updateBuyerKey.currentState!.validate()) { 199 | _updateBuyerKey.currentState!.save(); 200 | ModelsUsers() 201 | .updateBuyerDetails( 202 | ssnValue, 203 | mobileValue, 204 | ) 205 | .then((updateBuyerFuture) { 206 | if (updateBuyerFuture.toString().contains('upd')) { 207 | setState(() { 208 | ScaffoldMessenger.of(context).showSnackBar( 209 | SnackBar( 210 | backgroundColor: Colors.white, 211 | elevation: 10.0, 212 | shape: Border.all( 213 | color: Colors.red, 214 | width: 0.5, 215 | style: BorderStyle.solid), 216 | content: Text( 217 | "Update Successful", 218 | style: TextStyle( 219 | color: Colors.black, 220 | fontSize: 20.0, 221 | fontWeight: FontWeight.bold, 222 | fontStyle: FontStyle.italic, 223 | letterSpacing: 1.0, 224 | ), 225 | textAlign: TextAlign.center, 226 | ), 227 | ), 228 | ); 229 | _ssnController.clear(); 230 | _mobileController.clear(); 231 | Timer(Duration(seconds: 3), () { 232 | Navigator.pushNamed(context, '/login'); 233 | }); 234 | }); 235 | } else if(updateBuyerFuture.toString().contains('nop')){ 236 | setState(() { 237 | ScaffoldMessenger.of(context).showSnackBar( 238 | SnackBar( 239 | backgroundColor: Colors.white, 240 | elevation: 10.0, 241 | shape: Border.all( 242 | color: Colors.red, 243 | width: 0.5, 244 | style: BorderStyle.solid), 245 | content: Text( 246 | "Update Failed", 247 | style: TextStyle( 248 | color: Colors.black, 249 | fontSize: 18.0, 250 | fontWeight: FontWeight.bold, 251 | fontStyle: FontStyle.italic, 252 | letterSpacing: 1.0, 253 | ), 254 | textAlign: TextAlign.center, 255 | ), 256 | ), 257 | ); 258 | Timer(Duration(seconds: 3), () { 259 | Navigator.pushNamed(context, '/buyerAccount'); 260 | }); 261 | }); 262 | }else if(updateBuyerFuture.toString().contains('exc')){ 263 | setState(() { 264 | ScaffoldMessenger.of(context).showSnackBar( 265 | SnackBar( 266 | backgroundColor: Colors.white, 267 | elevation: 10.0, 268 | shape: Border.all( 269 | color: Colors.red, 270 | width: 0.5, 271 | style: BorderStyle.solid), 272 | content: Text( 273 | "Something Went Wrong..try Again", 274 | style: TextStyle( 275 | color: Colors.black, 276 | fontSize: 18.0, 277 | fontWeight: FontWeight.bold, 278 | fontStyle: FontStyle.italic, 279 | letterSpacing: 1.0, 280 | ), 281 | textAlign: TextAlign.center, 282 | ), 283 | ), 284 | ); 285 | Timer(Duration(seconds: 3), () { 286 | Navigator.pushNamed(context, '/buyerAccount'); 287 | }); 288 | }); 289 | }else if(updateBuyerFuture.toString().contains('alr')){ 290 | setState(() { 291 | ScaffoldMessenger.of(context).showSnackBar( 292 | SnackBar( 293 | backgroundColor: Colors.white, 294 | elevation: 10.0, 295 | shape: Border.all( 296 | color: Colors.red, 297 | width: 0.5, 298 | style: BorderStyle.solid), 299 | content: Text( 300 | "Mobile Number Registered ..select another number", 301 | style: TextStyle( 302 | color: Colors.black, 303 | fontSize: 18.0, 304 | fontWeight: FontWeight.bold, 305 | fontStyle: FontStyle.italic, 306 | letterSpacing: 1.0, 307 | ), 308 | textAlign: TextAlign.center, 309 | ), 310 | ), 311 | ); 312 | Timer(Duration(seconds: 3), () { 313 | Navigator.pushNamed(context, '/buyerAccount'); 314 | }); 315 | }); 316 | } 317 | }).catchError((err) { 318 | setState(() { 319 | ScaffoldMessenger.of(context).showSnackBar( 320 | SnackBar( 321 | backgroundColor: Colors.white, 322 | elevation: 10.0, 323 | shape: Border.all( 324 | color: Colors.red, 325 | width: 0.5, 326 | style: BorderStyle.solid, 327 | ), 328 | content: Text( 329 | "Something Went Wrong", 330 | style: TextStyle( 331 | color: Colors.black, 332 | fontSize: 18.0, 333 | fontWeight: FontWeight.bold, 334 | fontStyle: FontStyle.italic, 335 | letterSpacing: 1.0, 336 | ), 337 | textAlign: TextAlign.center, 338 | ), 339 | ), 340 | ); 341 | _ssnController.clear(); 342 | _mobileController.clear(); 343 | Timer(Duration(seconds: 3), () { 344 | Navigator.pushNamed(context, '/buyerAccount'); 345 | }); 346 | }); 347 | err.toString(); 348 | }).whenComplete(() => null); 349 | } else { 350 | setState(() { 351 | ScaffoldMessenger.of(context).showSnackBar( 352 | SnackBar( 353 | backgroundColor: Colors.white, 354 | elevation: 10.0, 355 | shape: Border.all( 356 | color: Colors.red, 357 | width: 0.5, 358 | style: BorderStyle.solid), 359 | content: Text( 360 | "Fill All Fields", 361 | style: TextStyle( 362 | color: Colors.black, 363 | fontSize: 18.0, 364 | fontWeight: FontWeight.bold, 365 | fontStyle: FontStyle.italic, 366 | letterSpacing: 1.0, 367 | ), 368 | textAlign: TextAlign.center, 369 | ), 370 | ), 371 | ); 372 | _ssnController.clear(); 373 | _mobileController.clear(); 374 | Timer(Duration(seconds: 3), () { 375 | Navigator.pushNamed(context, '/buyerAccount'); 376 | }); 377 | }); 378 | } 379 | }, 380 | ), 381 | ], 382 | ), 383 | ), 384 | ], 385 | ), 386 | ), 387 | ); 388 | } 389 | } 390 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 97 | ); 98 | path = Runner; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 97C146ED1CF9000F007C117D /* Runner */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 107 | buildPhases = ( 108 | 9740EEB61CF901F6004384FC /* Run Script */, 109 | 97C146EA1CF9000F007C117D /* Sources */, 110 | 97C146EB1CF9000F007C117D /* Frameworks */, 111 | 97C146EC1CF9000F007C117D /* Resources */, 112 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = Runner; 120 | productName = Runner; 121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | 97C146E61CF9000F007C117D /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 1020; 131 | ORGANIZATIONNAME = ""; 132 | TargetAttributes = { 133 | 97C146ED1CF9000F007C117D = { 134 | CreatedOnToolsVersion = 7.3.1; 135 | LastSwiftMigration = 1100; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 140 | compatibilityVersion = "Xcode 9.3"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 97C146E51CF9000F007C117D; 148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 97C146ED1CF9000F007C117D /* Runner */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 97C146EC1CF9000F007C117D /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXShellScriptBuildPhase section */ 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | ); 177 | inputPaths = ( 178 | ); 179 | name = "Thin Binary"; 180 | outputPaths = ( 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 185 | }; 186 | 9740EEB61CF901F6004384FC /* Run Script */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | ); 193 | name = "Run Script"; 194 | outputPaths = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 199 | }; 200 | /* End PBXShellScriptBuildPhase section */ 201 | 202 | /* Begin PBXSourcesBuildPhase section */ 203 | 97C146EA1CF9000F007C117D /* Sources */ = { 204 | isa = PBXSourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXSourcesBuildPhase section */ 213 | 214 | /* Begin PBXVariantGroup section */ 215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 216 | isa = PBXVariantGroup; 217 | children = ( 218 | 97C146FB1CF9000F007C117D /* Base */, 219 | ); 220 | name = Main.storyboard; 221 | sourceTree = ""; 222 | }; 223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C147001CF9000F007C117D /* Base */, 227 | ); 228 | name = LaunchScreen.storyboard; 229 | sourceTree = ""; 230 | }; 231 | /* End PBXVariantGroup section */ 232 | 233 | /* Begin XCBuildConfiguration section */ 234 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_COMMA = YES; 246 | CLANG_WARN_CONSTANT_CONVERSION = YES; 247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INFINITE_RECURSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 258 | CLANG_WARN_STRICT_PROTOTYPES = YES; 259 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | SUPPORTED_PLATFORMS = iphoneos; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Profile; 283 | }; 284 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 285 | isa = XCBuildConfiguration; 286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | CLANG_ENABLE_MODULES = YES; 290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 291 | ENABLE_BITCODE = NO; 292 | INFOPLIST_FILE = Runner/Info.plist; 293 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 294 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterDb; 295 | PRODUCT_NAME = "$(TARGET_NAME)"; 296 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 297 | SWIFT_VERSION = 5.0; 298 | VERSIONING_SYSTEM = "apple-generic"; 299 | }; 300 | name = Profile; 301 | }; 302 | 97C147031CF9000F007C117D /* Debug */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | ALWAYS_SEARCH_USER_PATHS = NO; 306 | CLANG_ANALYZER_NONNULL = YES; 307 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 308 | CLANG_CXX_LIBRARY = "libc++"; 309 | CLANG_ENABLE_MODULES = YES; 310 | CLANG_ENABLE_OBJC_ARC = YES; 311 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 312 | CLANG_WARN_BOOL_CONVERSION = YES; 313 | CLANG_WARN_COMMA = YES; 314 | CLANG_WARN_CONSTANT_CONVERSION = YES; 315 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 316 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 317 | CLANG_WARN_EMPTY_BODY = YES; 318 | CLANG_WARN_ENUM_CONVERSION = YES; 319 | CLANG_WARN_INFINITE_RECURSION = YES; 320 | CLANG_WARN_INT_CONVERSION = YES; 321 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 322 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 323 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 324 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 325 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 326 | CLANG_WARN_STRICT_PROTOTYPES = YES; 327 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 328 | CLANG_WARN_UNREACHABLE_CODE = YES; 329 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 330 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 331 | COPY_PHASE_STRIP = NO; 332 | DEBUG_INFORMATION_FORMAT = dwarf; 333 | ENABLE_STRICT_OBJC_MSGSEND = YES; 334 | ENABLE_TESTABILITY = YES; 335 | GCC_C_LANGUAGE_STANDARD = gnu99; 336 | GCC_DYNAMIC_NO_PIC = NO; 337 | GCC_NO_COMMON_BLOCKS = YES; 338 | GCC_OPTIMIZATION_LEVEL = 0; 339 | GCC_PREPROCESSOR_DEFINITIONS = ( 340 | "DEBUG=1", 341 | "$(inherited)", 342 | ); 343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 345 | GCC_WARN_UNDECLARED_SELECTOR = YES; 346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 347 | GCC_WARN_UNUSED_FUNCTION = YES; 348 | GCC_WARN_UNUSED_VARIABLE = YES; 349 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 350 | MTL_ENABLE_DEBUG_INFO = YES; 351 | ONLY_ACTIVE_ARCH = YES; 352 | SDKROOT = iphoneos; 353 | TARGETED_DEVICE_FAMILY = "1,2"; 354 | }; 355 | name = Debug; 356 | }; 357 | 97C147041CF9000F007C117D /* Release */ = { 358 | isa = XCBuildConfiguration; 359 | buildSettings = { 360 | ALWAYS_SEARCH_USER_PATHS = NO; 361 | CLANG_ANALYZER_NONNULL = YES; 362 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 363 | CLANG_CXX_LIBRARY = "libc++"; 364 | CLANG_ENABLE_MODULES = YES; 365 | CLANG_ENABLE_OBJC_ARC = YES; 366 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 367 | CLANG_WARN_BOOL_CONVERSION = YES; 368 | CLANG_WARN_COMMA = YES; 369 | CLANG_WARN_CONSTANT_CONVERSION = YES; 370 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 371 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 372 | CLANG_WARN_EMPTY_BODY = YES; 373 | CLANG_WARN_ENUM_CONVERSION = YES; 374 | CLANG_WARN_INFINITE_RECURSION = YES; 375 | CLANG_WARN_INT_CONVERSION = YES; 376 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 377 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 378 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 379 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 380 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 381 | CLANG_WARN_STRICT_PROTOTYPES = YES; 382 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 383 | CLANG_WARN_UNREACHABLE_CODE = YES; 384 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 385 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 386 | COPY_PHASE_STRIP = NO; 387 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 388 | ENABLE_NS_ASSERTIONS = NO; 389 | ENABLE_STRICT_OBJC_MSGSEND = YES; 390 | GCC_C_LANGUAGE_STANDARD = gnu99; 391 | GCC_NO_COMMON_BLOCKS = YES; 392 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 393 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 394 | GCC_WARN_UNDECLARED_SELECTOR = YES; 395 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 396 | GCC_WARN_UNUSED_FUNCTION = YES; 397 | GCC_WARN_UNUSED_VARIABLE = YES; 398 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 399 | MTL_ENABLE_DEBUG_INFO = NO; 400 | SDKROOT = iphoneos; 401 | SUPPORTED_PLATFORMS = iphoneos; 402 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 403 | TARGETED_DEVICE_FAMILY = "1,2"; 404 | VALIDATE_PRODUCT = YES; 405 | }; 406 | name = Release; 407 | }; 408 | 97C147061CF9000F007C117D /* Debug */ = { 409 | isa = XCBuildConfiguration; 410 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 411 | buildSettings = { 412 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 413 | CLANG_ENABLE_MODULES = YES; 414 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 415 | ENABLE_BITCODE = NO; 416 | INFOPLIST_FILE = Runner/Info.plist; 417 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 418 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterDb; 419 | PRODUCT_NAME = "$(TARGET_NAME)"; 420 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 421 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 422 | SWIFT_VERSION = 5.0; 423 | VERSIONING_SYSTEM = "apple-generic"; 424 | }; 425 | name = Debug; 426 | }; 427 | 97C147071CF9000F007C117D /* Release */ = { 428 | isa = XCBuildConfiguration; 429 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 430 | buildSettings = { 431 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 432 | CLANG_ENABLE_MODULES = YES; 433 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 434 | ENABLE_BITCODE = NO; 435 | INFOPLIST_FILE = Runner/Info.plist; 436 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 437 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterDb; 438 | PRODUCT_NAME = "$(TARGET_NAME)"; 439 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 440 | SWIFT_VERSION = 5.0; 441 | VERSIONING_SYSTEM = "apple-generic"; 442 | }; 443 | name = Release; 444 | }; 445 | /* End XCBuildConfiguration section */ 446 | 447 | /* Begin XCConfigurationList section */ 448 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 449 | isa = XCConfigurationList; 450 | buildConfigurations = ( 451 | 97C147031CF9000F007C117D /* Debug */, 452 | 97C147041CF9000F007C117D /* Release */, 453 | 249021D3217E4FDB00AE95B9 /* Profile */, 454 | ); 455 | defaultConfigurationIsVisible = 0; 456 | defaultConfigurationName = Release; 457 | }; 458 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 459 | isa = XCConfigurationList; 460 | buildConfigurations = ( 461 | 97C147061CF9000F007C117D /* Debug */, 462 | 97C147071CF9000F007C117D /* Release */, 463 | 249021D4217E4FDB00AE95B9 /* Profile */, 464 | ); 465 | defaultConfigurationIsVisible = 0; 466 | defaultConfigurationName = Release; 467 | }; 468 | /* End XCConfigurationList section */ 469 | }; 470 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 471 | } 472 | -------------------------------------------------------------------------------- /lib/widgets/register.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:clay_containers/clay_containers.dart'; 6 | import 'package:flutter_db/models/model_user.dart'; 7 | import 'package:flutter_db/shared_widgets/buttons.dart'; 8 | import 'package:flutter_db/shared_widgets/clay.dart'; 9 | import 'package:flutter_db/shared_widgets/form_text_field.dart'; 10 | 11 | class Register extends StatelessWidget { 12 | const Register({Key? key}) : super(key: key); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return RegisterPage(); 17 | } 18 | } 19 | 20 | class RegisterPage extends StatefulWidget { 21 | const RegisterPage({Key? key}) : super(key: key); 22 | 23 | @override 24 | _RegisterPageState createState() => _RegisterPageState(); 25 | } 26 | 27 | class _RegisterPageState extends State 28 | with SingleTickerProviderStateMixin { 29 | /*... 1 Create the required tabs ...*/ 30 | final List registerAccountsTabs = [ 31 | Tab( 32 | text: "BuyerAccount", 33 | ), 34 | Tab( 35 | text: "Seller Account", 36 | ), 37 | ]; 38 | 39 | /*.. 2- Create a Tabs controller ..*/ 40 | TabController? _userAccountController; 41 | 42 | // Global Keys to use with the form text fields 43 | final _buyerAccountFormKey = GlobalKey(); 44 | final _sellerAccountFormKey = GlobalKey(); 45 | 46 | // A controller for each field 47 | final buyerEmailFieldController = TextEditingController(); 48 | final sellerEmailFieldController = TextEditingController(); 49 | final passwordFieldController = TextEditingController(); 50 | final companyFieldController = TextEditingController(); 51 | final fNameFieldController = TextEditingController(); 52 | final lNameFieldController = TextEditingController(); 53 | final landlineFieldController = TextEditingController(); 54 | final mobileFieldController = TextEditingController(); 55 | 56 | //This will be used when searching for city & country to setup the user account 57 | String searchedCityName = ''; 58 | String searchedCountryName = ''; 59 | 60 | // Methods to get the latest value of each form text field 61 | String buyerEmailText = ''; 62 | String _buyerEmailFieldLatestValue() { 63 | return buyerEmailText = ((buyerEmailFieldController.text).isNotEmpty && 64 | (buyerEmailFieldController.text).length > 0 65 | ? buyerEmailFieldController.text 66 | : ""); 67 | } 68 | 69 | String sellerEmailText = ''; 70 | String _sellerEmailFieldLatestValue() { 71 | return sellerEmailText = ((sellerEmailFieldController.text).isNotEmpty && 72 | (sellerEmailFieldController.text).length > 0 73 | ? sellerEmailFieldController.text 74 | : ""); 75 | } 76 | 77 | String passwordTextValue = ''; 78 | String _passwordFieldLatestValue() { 79 | return passwordTextValue = ((passwordFieldController.text).isNotEmpty && 80 | (passwordFieldController.text).length > 0 81 | ? passwordFieldController.text 82 | : ""); 83 | } 84 | 85 | String companyNameText = ''; 86 | String _companyNameFieldLatestValue() { 87 | return companyNameText = ((companyFieldController.text).isNotEmpty && 88 | (companyFieldController.text).length > 0 89 | ? companyFieldController.text 90 | : ""); 91 | } 92 | 93 | String fNameText = ''; 94 | String _fNameFieldLatestValue() { 95 | return fNameText = ((fNameFieldController.text).isNotEmpty && 96 | (fNameFieldController.text).length > 0 97 | ? fNameFieldController.text 98 | : ""); 99 | } 100 | 101 | String lNameText = ''; 102 | String _lNameFieldLatestValue() { 103 | return lNameText = ((lNameFieldController.text).isNotEmpty && 104 | (lNameFieldController.text).length > 0 105 | ? lNameFieldController.text 106 | : ""); 107 | } 108 | 109 | String landlineText = ''; 110 | String _landlineFieldLatestValue() { 111 | return landlineText = ((landlineFieldController.text).isNotEmpty && 112 | (landlineFieldController.text).length > 0 113 | ? landlineFieldController.text 114 | : ''); 115 | } 116 | 117 | String mobileText = ''; 118 | String _mobileFieldLatestValue() { 119 | return mobileText = ((mobileFieldController.text).isNotEmpty && 120 | (mobileFieldController.text).length > 0 121 | ? mobileFieldController.text 122 | : ''); 123 | } 124 | 125 | /*...When user select to become a seller..we activate the registration form 126 | ..user click a button and the registration form fields shows up using method 127 | .. showWidget() ...*/ 128 | bool viewVisible = false; 129 | 130 | // The seller fields widget will show and hide upon clicking on a button 131 | void showWidget() { 132 | setState(() { 133 | viewVisible = true; 134 | }); 135 | } 136 | 137 | @override 138 | void initState() { 139 | // TODO: implement initState 140 | super.initState(); 141 | 142 | //Initialize the Tabs controller 143 | _userAccountController = TabController( 144 | initialIndex: 0, vsync: this, length: registerAccountsTabs.length); 145 | 146 | // Start listening to changes in fields upon entering text. 147 | buyerEmailFieldController.addListener(() { 148 | _buyerEmailFieldLatestValue(); 149 | }); 150 | sellerEmailFieldController.addListener(() { 151 | _sellerEmailFieldLatestValue(); 152 | }); 153 | passwordFieldController.addListener(() { 154 | _passwordFieldLatestValue(); 155 | }); 156 | companyFieldController.addListener(() { 157 | _companyNameFieldLatestValue(); 158 | }); 159 | fNameFieldController.addListener(() { 160 | _fNameFieldLatestValue(); 161 | }); 162 | lNameFieldController.addListener(() { 163 | _lNameFieldLatestValue(); 164 | }); 165 | landlineFieldController.addListener(() { 166 | _landlineFieldLatestValue(); 167 | }); 168 | mobileFieldController.addListener(() { 169 | _mobileFieldLatestValue(); 170 | }); 171 | } 172 | 173 | @override 174 | void dispose() { 175 | // TODO: implement dispose 176 | // Clean up the controller when the widget is removed from the 177 | // widget tree. 178 | buyerEmailFieldController.dispose(); 179 | sellerEmailFieldController.dispose(); 180 | passwordFieldController.dispose(); 181 | companyFieldController.dispose(); 182 | fNameFieldController.dispose(); 183 | lNameFieldController.dispose(); 184 | landlineFieldController.dispose(); 185 | mobileFieldController.dispose(); 186 | 187 | super.dispose(); 188 | } 189 | 190 | Color baseColor = Color(0xFFF2F2F2); 191 | 192 | @override 193 | Widget build(BuildContext context) { 194 | return Scaffold( 195 | appBar: AppBar( 196 | backgroundColor: baseColor, 197 | title: ClayContainerDesign( 198 | containerColor: baseColor, 199 | borderRadius: 10.0, 200 | customBorderRadius: BorderRadius.circular(20.0), 201 | height: 60.0, 202 | curveType: CurveType.none, 203 | textDetails: "Fill Details", 204 | clayTextSize: 25.0, 205 | clayTextColor: Colors.white, 206 | clayTextColorText: Colors.grey, 207 | ), 208 | bottom: TabBar( 209 | controller: _userAccountController, 210 | tabs: registerAccountsTabs, 211 | isScrollable: false, 212 | indicator: BoxDecoration( 213 | //color: Colors.green, 214 | //border: Border(top: BorderSide(color:Colors.white ,width:1.0 ,style: BorderStyle.solid) ), 215 | border: Border.all( 216 | color: Colors.white, width: 1.0, style: BorderStyle.solid), 217 | borderRadius: BorderRadius.all( 218 | Radius.circular(10.0), 219 | ), 220 | gradient: LinearGradient( 221 | begin: Alignment.centerLeft, 222 | end: Alignment.centerRight, 223 | colors: [Colors.teal, Colors.tealAccent], 224 | stops: [0.1, 0.8], 225 | transform: GradientRotation(0.45), 226 | tileMode: TileMode.clamp, 227 | ), 228 | ), 229 | //indicatorColor: Colors.black, //ignored if indicator ins selected 230 | //indicatorPadding: EdgeInsets.all(5.0), //ignored if indicator ins selected 231 | //indicatorWeight: 2.0, //ignored if indicator ins selected 232 | indicatorSize: TabBarIndicatorSize.tab, 233 | labelColor: Colors.white, 234 | labelStyle: TextStyle( 235 | color: Colors.white, 236 | fontSize: 22.0, 237 | fontWeight: FontWeight.bold, 238 | fontStyle: FontStyle.italic, 239 | letterSpacing: 2.0, 240 | ), 241 | labelPadding: EdgeInsets.all(2.0), 242 | unselectedLabelColor: Colors.black, 243 | unselectedLabelStyle: TextStyle( 244 | fontSize: 15.0, 245 | ), 246 | onTap: (int) {}, //what to do here ?!!! 247 | ), 248 | ), 249 | body: Builder( 250 | builder: (BuildContext context) { 251 | return TabBarView(controller: _userAccountController, children: [ 252 | ListView( 253 | scrollDirection: Axis.vertical, 254 | reverse: false, 255 | controller: ScrollController( 256 | initialScrollOffset: 0, 257 | keepScrollOffset: true, 258 | debugLabel: 'scroll_label', 259 | ), 260 | //physics: const AlwaysScrollableScrollPhysics(), 261 | //shrinkWrap: false, 262 | padding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), 263 | children: [ 264 | Form( 265 | key: _buyerAccountFormKey, 266 | child: Column( 267 | crossAxisAlignment: CrossAxisAlignment.start, 268 | mainAxisSize: MainAxisSize.min, 269 | children: [ 270 | SizedBox( 271 | height: 15.0, 272 | ), 273 | Flexible( 274 | flex: 1, 275 | fit: FlexFit.loose, 276 | child: FormTextFieldStandard( 277 | controller: fNameFieldController, 278 | textInputType: TextInputType.name, 279 | textInputAction: TextInputAction.next, 280 | fontSize: 16.0, 281 | fontWeight: FontWeight.w400, 282 | fontColor: Colors.black, 283 | icon: Icons.person, 284 | tooltip: 'First Name', 285 | maxLines: 1, 286 | formTextFieldLabel: "Name", 287 | validate: (stringFieldValue) => 288 | stringFieldValue!.isEmpty == true 289 | ? 'Fill The Details' 290 | : null, 291 | ), 292 | ), 293 | SizedBox( 294 | height: 10.0, 295 | ), 296 | Flexible( 297 | flex: 1, 298 | fit: FlexFit.loose, 299 | child: FormTextFieldStandard( 300 | controller: lNameFieldController, 301 | textInputType: TextInputType.name, 302 | textInputAction: TextInputAction.next, 303 | fontSize: 16.0, 304 | fontWeight: FontWeight.w400, 305 | fontColor: Colors.black, 306 | icon: Icons.person, 307 | tooltip: "Surname", 308 | maxLines: 1, 309 | formTextFieldLabel: "Surname", 310 | validate: (stringFieldValue) => 311 | stringFieldValue!.isEmpty == true 312 | ? 'Fill The Details' 313 | : null, 314 | ), 315 | ), 316 | SizedBox( 317 | height: 10.0, 318 | ), 319 | Flexible( 320 | flex: 1, 321 | fit: FlexFit.loose, 322 | child: FormTextFieldStandard( 323 | controller: buyerEmailFieldController, 324 | textInputType: TextInputType.emailAddress, 325 | textInputAction: TextInputAction.next, 326 | fontSize: 16.0, 327 | fontWeight: FontWeight.w400, 328 | fontColor: Colors.black, 329 | icon: Icons.email, 330 | tooltip: "Email", 331 | maxLines: 1, 332 | formTextFieldLabel: "Email", 333 | validate: (stringFieldValue) => 334 | stringFieldValue!.isEmpty == true 335 | ? 'Fill The Details' 336 | : null, 337 | ), 338 | ), 339 | SizedBox( 340 | height: 10.0, 341 | ), 342 | Flexible( 343 | flex: 1, 344 | fit: FlexFit.loose, 345 | child: FormTextFieldStandardObsecured( 346 | controller: passwordFieldController, 347 | textInputType: TextInputType.visiblePassword, 348 | textInputAction: TextInputAction.next, 349 | fontSize: 16.0, 350 | fontWeight: FontWeight.w400, 351 | fontColor: Colors.black, 352 | icon: Icons.security, 353 | tooltip: "Password", 354 | maxLines: 1, 355 | formTextFieldLabel: "Password", 356 | validate: (stringFieldValue) => 357 | stringFieldValue!.isEmpty == true 358 | ? "Password" 359 | : null, 360 | ), 361 | ), 362 | SizedBox( 363 | height: 10.0, 364 | ), 365 | Flexible( 366 | flex: 1, 367 | fit: FlexFit.loose, 368 | child: Container( 369 | padding: EdgeInsets.fromLTRB(50.0, 0.0, 50.0, 10.0), 370 | alignment: Alignment.center, 371 | child: StandardElevatedButton( 372 | style: ButtonStyle(), 373 | child: Text( 374 | "Register", 375 | style: TextStyle( 376 | fontSize: 19.0, 377 | fontStyle: FontStyle.italic, 378 | fontWeight: FontWeight.bold, 379 | letterSpacing: 2.0, 380 | ), 381 | ), 382 | onPressed: () => registerBuyerMethod(context), 383 | ), 384 | ), 385 | ), 386 | ], 387 | ), 388 | ), 389 | ], 390 | ), 391 | ListView( 392 | scrollDirection: Axis.vertical, 393 | reverse: false, 394 | controller: ScrollController( 395 | initialScrollOffset: 0, 396 | keepScrollOffset: true, 397 | debugLabel: 'scroll_label', 398 | ), 399 | //physics: const AlwaysScrollableScrollPhysics(), 400 | //shrinkWrap: false, 401 | padding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), 402 | children: [ 403 | SizedBox( 404 | height: 15.0, 405 | ), 406 | Text( 407 | "Open Shop", 408 | style: TextStyle( 409 | color: Colors.black, 410 | fontSize: 23.0, 411 | fontStyle: FontStyle.italic, 412 | fontWeight: FontWeight.w400, 413 | ), 414 | softWrap: true, 415 | textAlign: TextAlign.center, 416 | ), 417 | SizedBox( 418 | height: 5.0, 419 | ), 420 | StandardElevatedButton( 421 | style: ButtonStyle(), 422 | child: Text( 423 | "Create", 424 | ), 425 | onPressed: showWidget, 426 | ), 427 | Visibility( 428 | maintainSize: true, 429 | maintainAnimation: true, 430 | maintainState: true, 431 | visible: viewVisible, 432 | maintainInteractivity: true, 433 | child: Form( 434 | key: _sellerAccountFormKey, 435 | child: Column( 436 | mainAxisAlignment: MainAxisAlignment.start, 437 | mainAxisSize: MainAxisSize.min, 438 | children: [ 439 | SizedBox( 440 | height: 10.0, 441 | ), 442 | SizedBox( 443 | height: 10.0, 444 | ), 445 | Flexible( 446 | flex: 1, 447 | fit: FlexFit.loose, 448 | child: FormTextFieldStandard( 449 | controller: sellerEmailFieldController, 450 | textInputType: TextInputType.emailAddress, 451 | textInputAction: TextInputAction.next, 452 | fontSize: 16.0, 453 | fontWeight: FontWeight.w400, 454 | fontColor: Colors.black, 455 | icon: Icons.email, 456 | tooltip: "Email", 457 | maxLines: 1, 458 | formTextFieldLabel: "Seller", 459 | validate: (emailStringValue) => 460 | emailStringValue!.isEmpty == true 461 | ? "Fill Details" 462 | : null, 463 | ), 464 | ), 465 | SizedBox( 466 | height: 10.0, 467 | ), 468 | Flexible( 469 | flex: 1, 470 | fit: FlexFit.loose, 471 | child: FormTextFieldStandardObsecured( 472 | controller: passwordFieldController, 473 | textInputType: TextInputType.visiblePassword, 474 | textInputAction: TextInputAction.next, 475 | fontSize: 16.0, 476 | fontWeight: FontWeight.w400, 477 | fontColor: Colors.black, 478 | icon: Icons.security, 479 | tooltip: "Password", 480 | maxLines: 1, 481 | formTextFieldLabel: "Password", 482 | validate: (passwordFieldString) => 483 | passwordFieldString!.isEmpty == true 484 | ? "Fill Details" 485 | : null, 486 | ), 487 | ), 488 | SizedBox( 489 | height: 10.0, 490 | ), 491 | Flexible( 492 | flex: 1, 493 | fit: FlexFit.loose, 494 | child: FormTextFieldStandard( 495 | controller: mobileFieldController, 496 | textInputType: TextInputType.text, 497 | textInputAction: TextInputAction.next, 498 | fontSize: 16.0, 499 | fontWeight: FontWeight.w400, 500 | fontColor: Colors.black, 501 | icon: Icons.phone_android, 502 | tooltip: "Mobile", 503 | maxLines: 1, 504 | formTextFieldLabel: 505 | '+123 123456789 Or +12 123456789', 506 | validate: (mobileValueString) => 507 | mobileValueString!.isEmpty == true 508 | ? "Fill Details" 509 | : null, 510 | ), 511 | ), 512 | SizedBox( 513 | height: 20.0, 514 | ), 515 | Container( 516 | padding: EdgeInsets.fromLTRB(50.0, 0.0, 50.0, 10.0), 517 | alignment: Alignment.center, 518 | child: StandardElevatedButton( 519 | style: ButtonStyle(), 520 | child: Text( 521 | "Register", 522 | style: TextStyle( 523 | fontSize: 19.0, 524 | fontStyle: FontStyle.italic, 525 | fontWeight: FontWeight.bold, 526 | letterSpacing: 2.0, 527 | ), 528 | ), 529 | onPressed: () { 530 | registerSellerMethod(context); 531 | }, 532 | ), 533 | ), 534 | ], 535 | ), 536 | ), 537 | //replacement: SizedBox.shrink(), 538 | ), 539 | ], 540 | ), 541 | //physics: , 542 | ]); 543 | }, 544 | ), 545 | ); 546 | } 547 | 548 | void registerSellerMethod(BuildContext context) { 549 | if (_sellerAccountFormKey.currentState!.validate()) { 550 | _sellerAccountFormKey.currentState!.save(); 551 | 552 | ModelsUsers() 553 | .registerNewSeller( 554 | sellerEmailText, 555 | passwordTextValue, 556 | mobileText, 557 | ) 558 | .then((futureSeller) { 559 | if (futureSeller.toString().contains('reg')) { 560 | setState(() { 561 | ScaffoldMessenger.of(context).showSnackBar(SnackBar( 562 | backgroundColor: Colors.blue[100], 563 | elevation: 10.0, 564 | shape: Border.all( 565 | color: Colors.green, width: 0.5, style: BorderStyle.solid), 566 | content: Text( 567 | "Register Successful", 568 | style: TextStyle( 569 | color: Colors.black, 570 | fontSize: 18.0, 571 | fontStyle: FontStyle.italic, 572 | fontWeight: FontWeight.bold, 573 | letterSpacing: 2.0, 574 | ), 575 | textAlign: TextAlign.center, 576 | ), 577 | )); 578 | sellerEmailFieldController.clear(); 579 | passwordFieldController.clear(); 580 | mobileFieldController.clear(); 581 | 582 | Timer(Duration(seconds: 4), () { 583 | Navigator.pushNamed(context, '/login'); 584 | }); 585 | }); 586 | } else if (futureSeller.toString().contains('nop')) { 587 | setState(() { 588 | ScaffoldMessenger.of(context).showSnackBar( 589 | SnackBar( 590 | backgroundColor: Colors.blue[100], 591 | elevation: 10.0, 592 | shape: Border.all( 593 | color: Colors.red, width: 0.5, style: BorderStyle.solid), 594 | content: Text( 595 | "Register Failed", 596 | style: TextStyle( 597 | color: Colors.black, 598 | fontSize: 18.0, 599 | fontStyle: FontStyle.italic, 600 | fontWeight: FontWeight.bold, 601 | letterSpacing: 2.0, 602 | ), 603 | textAlign: TextAlign.center, 604 | ), 605 | ), 606 | ); 607 | sellerEmailFieldController.clear(); 608 | passwordFieldController.clear(); 609 | mobileFieldController.clear(); 610 | Timer(Duration(seconds: 3), () { 611 | Navigator.pushNamed(context, '/register'); 612 | }); 613 | }); 614 | } else if (futureSeller.toString().contains('alr')) { 615 | setState(() { 616 | ScaffoldMessenger.of(context).showSnackBar( 617 | SnackBar( 618 | backgroundColor: Colors.blue[100], 619 | elevation: 10.0, 620 | shape: Border.all( 621 | color: Colors.yellow, width: 0.5, style: BorderStyle.solid), 622 | content: Text( 623 | "Email Already Registered", 624 | style: TextStyle( 625 | color: Colors.black, 626 | fontSize: 18.0, 627 | fontStyle: FontStyle.italic, 628 | fontWeight: FontWeight.bold, 629 | letterSpacing: 2.0, 630 | ), 631 | textAlign: TextAlign.center, 632 | ), 633 | ), 634 | ); 635 | sellerEmailFieldController.clear(); 636 | passwordFieldController.clear(); 637 | mobileFieldController.clear(); 638 | Timer(Duration(seconds: 3), () { 639 | Navigator.pushNamed(context, '/login'); 640 | }); 641 | }); 642 | } else { 643 | setState(() { 644 | ScaffoldMessenger.of(context).showSnackBar( 645 | SnackBar( 646 | backgroundColor: Colors.white, 647 | elevation: 10.0, 648 | shape: Border.all( 649 | color: Colors.red, 650 | width: 0.5, 651 | style: BorderStyle.solid, 652 | ), 653 | content: Text( 654 | "Something Went Wrong", 655 | style: TextStyle( 656 | color: Colors.black, 657 | fontSize: 18.0, 658 | fontStyle: FontStyle.italic, 659 | fontWeight: FontWeight.bold, 660 | letterSpacing: 1.0, 661 | ), 662 | textAlign: TextAlign.center, 663 | ), 664 | ), 665 | ); 666 | sellerEmailFieldController.clear(); 667 | passwordFieldController.clear(); 668 | mobileFieldController.clear(); 669 | Timer(Duration(seconds: 3), () { 670 | Navigator.pushNamed(context, '/register'); 671 | }); 672 | }); 673 | } 674 | }).catchError((err) { 675 | setState(() { 676 | ScaffoldMessenger.of(context).showSnackBar( 677 | SnackBar( 678 | backgroundColor: Colors.blue[100], 679 | elevation: 10.0, 680 | shape: Border.all( 681 | color: Colors.red, width: 0.5, style: BorderStyle.solid), 682 | content: Text( 683 | "Something Went Wrong", 684 | style: TextStyle( 685 | color: Colors.black, 686 | fontSize: 18.0, 687 | fontStyle: FontStyle.italic, 688 | fontWeight: FontWeight.bold, 689 | letterSpacing: 2.0, 690 | ), 691 | textAlign: TextAlign.center, 692 | ), 693 | ), 694 | ); 695 | sellerEmailFieldController.clear(); 696 | passwordFieldController.clear(); 697 | mobileFieldController.clear(); 698 | Timer(Duration(seconds: 3), () { 699 | Navigator.pushNamed(context, '/register'); 700 | }); 701 | }); 702 | }).whenComplete(() => null); 703 | } else { 704 | setState(() { 705 | ScaffoldMessenger.of(context).showSnackBar( 706 | SnackBar( 707 | backgroundColor: Colors.blue[100], 708 | elevation: 10.0, 709 | shape: Border.all( 710 | color: Colors.red, width: 0.5, style: BorderStyle.solid), 711 | content: Text( 712 | "Fill All Fields", 713 | style: TextStyle( 714 | color: Colors.black, 715 | fontSize: 18.0, 716 | fontStyle: FontStyle.italic, 717 | fontWeight: FontWeight.bold, 718 | letterSpacing: 2.0, 719 | ), 720 | textAlign: TextAlign.center, 721 | ), 722 | ), 723 | ); 724 | sellerEmailFieldController.clear(); 725 | passwordFieldController.clear(); 726 | mobileFieldController.clear(); 727 | Timer(Duration(seconds: 4), () { 728 | Navigator.pushNamed(context, '/register'); 729 | }); 730 | }); 731 | } 732 | } 733 | 734 | void registerBuyerMethod(BuildContext context) { 735 | if (_buyerAccountFormKey.currentState!.validate()) { 736 | _buyerAccountFormKey.currentState!.save(); 737 | 738 | //Update Buyer Data info section..using Postgres 739 | ModelsUsers() 740 | .registerNewBuyer( 741 | buyerEmailText, 742 | passwordTextValue, 743 | fNameText, 744 | lNameText, 745 | ) 746 | .then((futureBuyer) { 747 | if (futureBuyer.toString().contains('reg')) { 748 | print('Here 1'); 749 | setState(() { 750 | ScaffoldMessenger.of(context).showSnackBar( 751 | SnackBar( 752 | backgroundColor: Colors.white, 753 | elevation: 10.0, 754 | shape: Border.all( 755 | color: Colors.green, 756 | width: 0.5, 757 | style: BorderStyle.solid, 758 | ), 759 | content: Text( 760 | "Registration Successful", 761 | style: TextStyle( 762 | color: Colors.black, 763 | fontSize: 18.0, 764 | fontStyle: FontStyle.italic, 765 | fontWeight: FontWeight.bold, 766 | letterSpacing: 1.0, 767 | ), 768 | textAlign: TextAlign.center, 769 | ), 770 | ), 771 | ); 772 | buyerEmailFieldController.clear(); 773 | passwordFieldController.clear(); 774 | fNameFieldController.clear(); 775 | lNameFieldController.clear(); 776 | Timer(Duration(seconds: 3), () { 777 | Navigator.pushNamed(context, '/login'); 778 | }); 779 | }); 780 | } else if (futureBuyer.toString().contains('nop')) { 781 | print('Here 2'); 782 | setState(() { 783 | ScaffoldMessenger.of(context).showSnackBar( 784 | SnackBar( 785 | backgroundColor: Colors.white, 786 | elevation: 10.0, 787 | shape: Border.all( 788 | color: Colors.red, 789 | width: 0.5, 790 | style: BorderStyle.solid, 791 | ), 792 | content: Text( 793 | "Registration Failed", 794 | style: TextStyle( 795 | color: Colors.black, 796 | fontSize: 18.0, 797 | fontStyle: FontStyle.italic, 798 | fontWeight: FontWeight.bold, 799 | letterSpacing: 1.0, 800 | ), 801 | textAlign: TextAlign.center, 802 | ), 803 | ), 804 | ); 805 | buyerEmailFieldController.clear(); 806 | passwordFieldController.clear(); 807 | fNameFieldController.clear(); 808 | lNameFieldController.clear(); 809 | Timer(Duration(seconds: 3), () { 810 | Navigator.pushNamed(context, '/register'); 811 | }); 812 | }); 813 | } else if (futureBuyer.toString().contains('alr')) { 814 | print('Here 3'); 815 | setState(() { 816 | ScaffoldMessenger.of(context).showSnackBar( 817 | SnackBar( 818 | backgroundColor: Colors.white, 819 | elevation: 10.0, 820 | shape: Border.all( 821 | color: Colors.yellow, 822 | width: 0.5, 823 | style: BorderStyle.solid, 824 | ), 825 | content: Text( 826 | "Email Already Registered", 827 | style: TextStyle( 828 | color: Colors.black, 829 | fontSize: 18.0, 830 | fontStyle: FontStyle.italic, 831 | fontWeight: FontWeight.bold, 832 | letterSpacing: 1.0, 833 | ), 834 | textAlign: TextAlign.center, 835 | ), 836 | ), 837 | ); 838 | buyerEmailFieldController.clear(); 839 | passwordFieldController.clear(); 840 | fNameFieldController.clear(); 841 | lNameFieldController.clear(); 842 | Timer(Duration(seconds: 4), () { 843 | Navigator.pushNamed(context, '/login'); 844 | }); 845 | }); 846 | } else { 847 | print('Here 4'); 848 | setState(() { 849 | ScaffoldMessenger.of(context).showSnackBar( 850 | SnackBar( 851 | backgroundColor: Colors.white, 852 | elevation: 10.0, 853 | shape: Border.all( 854 | color: Colors.red, 855 | width: 0.5, 856 | style: BorderStyle.solid, 857 | ), 858 | content: Text( 859 | "Something Went Wrong", 860 | style: TextStyle( 861 | color: Colors.black, 862 | fontSize: 18.0, 863 | fontStyle: FontStyle.italic, 864 | fontWeight: FontWeight.bold, 865 | letterSpacing: 1.0, 866 | ), 867 | textAlign: TextAlign.center, 868 | ), 869 | ), 870 | ); 871 | buyerEmailFieldController.clear(); 872 | passwordFieldController.clear(); 873 | fNameFieldController.clear(); 874 | lNameFieldController.clear(); 875 | Timer(Duration(seconds: 3), () { 876 | Navigator.pushNamed(context, '/register'); 877 | }); 878 | }); 879 | } 880 | }).catchError((err) { 881 | err.toString(); 882 | setState(() { 883 | ScaffoldMessenger.of(context).showSnackBar( 884 | SnackBar( 885 | backgroundColor: Colors.white, 886 | elevation: 10.0, 887 | shape: Border.all( 888 | color: Colors.red, width: 0.5, style: BorderStyle.solid), 889 | content: Text( 890 | "Something Went Wrong", 891 | style: TextStyle( 892 | color: Colors.black, 893 | fontSize: 16.0, 894 | fontStyle: FontStyle.italic, 895 | fontWeight: FontWeight.bold, 896 | letterSpacing: 1.0, 897 | ), 898 | textAlign: TextAlign.center, 899 | ), 900 | ), 901 | ); 902 | buyerEmailFieldController.clear(); 903 | passwordFieldController.clear(); 904 | fNameFieldController.clear(); 905 | lNameFieldController.clear(); 906 | Timer(Duration(seconds: 3), () { 907 | Navigator.pushNamed(context, '/register'); 908 | }); 909 | }); 910 | }).whenComplete(() => null); 911 | } else { 912 | setState(() { 913 | ScaffoldMessenger.of(context).showSnackBar(SnackBar( 914 | backgroundColor: Colors.white, 915 | elevation: 10.0, 916 | shape: Border.all( 917 | color: Colors.orange, 918 | width: 0.5, 919 | style: BorderStyle.solid, 920 | ), 921 | content: Text( 922 | "Something Went Wrong", 923 | style: TextStyle( 924 | color: Colors.black, 925 | fontSize: 16.0, 926 | fontWeight: FontWeight.bold, 927 | fontStyle: FontStyle.italic, 928 | letterSpacing: 1.0, 929 | ), 930 | textAlign: TextAlign.center, 931 | ), 932 | )); 933 | Timer(Duration(seconds: 4), () { 934 | Navigator.pushNamed(context, '/register'); 935 | }); 936 | }); 937 | } 938 | } 939 | } 940 | --------------------------------------------------------------------------------