├── 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 │ │ │ │ ├── values │ │ │ │ │ └── styles.xml │ │ │ │ └── drawable │ │ │ │ │ └── launch_background.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── digital_wallet │ │ │ │ │ └── MainActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── settings.gradle └── build.gradle ├── 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.xcworkspace │ └── contents.xcworkspacedata └── Runner.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── xcshareddata │ └── xcschemes │ └── Runner.xcscheme ├── assets ├── images │ ├── ccsad.png │ ├── search.png │ ├── thumb.jpg │ ├── thumb2.jpg │ ├── default.png │ ├── cards │ │ ├── gymCC.png │ │ ├── CreditCC.png │ │ ├── HealthCC.png │ │ ├── driveCC.png │ │ ├── giftCC.png │ │ ├── airlineCC.png │ │ ├── employeeCC.png │ │ ├── loyalityCC.png │ │ ├── studentCC.png │ │ ├── identitycard.png │ │ └── transportCC.png │ ├── category │ │ ├── cc.png │ │ ├── id.png │ │ ├── other.png │ │ ├── student.jpg │ │ ├── loyality.png │ │ └── transport.png │ ├── mockups │ │ ├── gym.PNG │ │ ├── id.PNG │ │ ├── health.PNG │ │ ├── driving.PNG │ │ ├── loyality.PNG │ │ ├── passport.PNG │ │ ├── student.PNG │ │ └── transport.PNG │ └── notification.jpg └── fonts │ ├── Billabong.ttf │ └── GoogleSansRegular.ttf ├── .metadata ├── .vscode └── launch.json ├── lib ├── models │ ├── User.dart │ ├── stats.dart │ └── creditcard_model.dart ├── main.dart ├── addPublicCard.dart ├── provider_models │ └── theme_provider.dart ├── helper │ ├── formatters.dart │ ├── category_items.dart │ └── DBHelper.dart ├── screens │ ├── notifications_screen.dart │ ├── add_screen.dart │ ├── search_screen.dart │ ├── home_screen.dart │ ├── cardManage.dart │ ├── profile_screen.dart │ └── publicCardsViewer.dart ├── ui │ ├── card_create.dart │ ├── publicCards.dart │ ├── viewStats.dart │ └── createcard.dart ├── homepage.dart ├── addCard.dart ├── cardViewer.dart ├── creations │ ├── cheque.dart │ ├── giftCard.dart │ ├── other.dart │ ├── creditCC.dart │ └── debitCard.dart └── services │ ├── Login.dart │ └── signup.dart ├── README.md ├── test └── widget_test.dart ├── .gitignore ├── pubspec.yaml └── pubspec.lock /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | 3 | -------------------------------------------------------------------------------- /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" -------------------------------------------------------------------------------- /assets/images/ccsad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/ccsad.png -------------------------------------------------------------------------------- /assets/images/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/search.png -------------------------------------------------------------------------------- /assets/images/thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/thumb.jpg -------------------------------------------------------------------------------- /assets/images/thumb2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/thumb2.jpg -------------------------------------------------------------------------------- /assets/fonts/Billabong.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/fonts/Billabong.ttf -------------------------------------------------------------------------------- /assets/images/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/default.png -------------------------------------------------------------------------------- /assets/images/cards/gymCC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/cards/gymCC.png -------------------------------------------------------------------------------- /assets/images/category/cc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/category/cc.png -------------------------------------------------------------------------------- /assets/images/category/id.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/category/id.png -------------------------------------------------------------------------------- /assets/images/mockups/gym.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/mockups/gym.PNG -------------------------------------------------------------------------------- /assets/images/mockups/id.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/mockups/id.PNG -------------------------------------------------------------------------------- /assets/images/cards/CreditCC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/cards/CreditCC.png -------------------------------------------------------------------------------- /assets/images/cards/HealthCC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/cards/HealthCC.png -------------------------------------------------------------------------------- /assets/images/cards/driveCC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/cards/driveCC.png -------------------------------------------------------------------------------- /assets/images/cards/giftCC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/cards/giftCC.png -------------------------------------------------------------------------------- /assets/images/category/other.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/category/other.png -------------------------------------------------------------------------------- /assets/images/mockups/health.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/mockups/health.PNG -------------------------------------------------------------------------------- /assets/images/notification.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/notification.jpg -------------------------------------------------------------------------------- /assets/fonts/GoogleSansRegular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/fonts/GoogleSansRegular.ttf -------------------------------------------------------------------------------- /assets/images/cards/airlineCC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/cards/airlineCC.png -------------------------------------------------------------------------------- /assets/images/cards/employeeCC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/cards/employeeCC.png -------------------------------------------------------------------------------- /assets/images/cards/loyalityCC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/cards/loyalityCC.png -------------------------------------------------------------------------------- /assets/images/cards/studentCC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/cards/studentCC.png -------------------------------------------------------------------------------- /assets/images/category/student.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/category/student.jpg -------------------------------------------------------------------------------- /assets/images/mockups/driving.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/mockups/driving.PNG -------------------------------------------------------------------------------- /assets/images/mockups/loyality.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/mockups/loyality.PNG -------------------------------------------------------------------------------- /assets/images/mockups/passport.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/mockups/passport.PNG -------------------------------------------------------------------------------- /assets/images/mockups/student.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/mockups/student.PNG -------------------------------------------------------------------------------- /assets/images/cards/identitycard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/cards/identitycard.png -------------------------------------------------------------------------------- /assets/images/cards/transportCC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/cards/transportCC.png -------------------------------------------------------------------------------- /assets/images/category/loyality.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/category/loyality.png -------------------------------------------------------------------------------- /assets/images/category/transport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/category/transport.png -------------------------------------------------------------------------------- /assets/images/mockups/transport.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/assets/images/mockups/transport.PNG -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/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/X-SLAYER/Card-Holder-Wallet-Stouche-/master/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/X-SLAYER/Card-Holder-Wallet-Stouche-/master/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/X-SLAYER/Card-Holder-Wallet-Stouche-/master/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/X-SLAYER/Card-Holder-Wallet-Stouche-/master/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/X-SLAYER/Card-Holder-Wallet-Stouche-/master/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/X-SLAYER/Card-Holder-Wallet-Stouche-/master/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/X-SLAYER/Card-Holder-Wallet-Stouche-/master/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/X-SLAYER/Card-Holder-Wallet-Stouche-/master/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/X-SLAYER/Card-Holder-Wallet-Stouche-/master/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/X-SLAYER/Card-Holder-Wallet-Stouche-/master/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/X-SLAYER/Card-Holder-Wallet-Stouche-/master/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/X-SLAYER/Card-Holder-Wallet-Stouche-/master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-SLAYER/Card-Holder-Wallet-Stouche-/master/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/X-SLAYER/Card-Holder-Wallet-Stouche-/master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /.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: 68587a0916366e9512a78df22c44163d041dd5f3 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. -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/digital_wallet/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.digital_wallet 2 | 3 | import android.os.Bundle 4 | 5 | import io.flutter.app.FlutterActivity 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | GeneratedPluginRegistrant.registerWith(this) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Flutter", 9 | "request": "launch", 10 | "type": "dart", 11 | // "flutterMode": "profile" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/models/User.dart: -------------------------------------------------------------------------------- 1 | 2 | class User { 3 | String usrename; 4 | String password; 5 | int imageIndex; 6 | 7 | User(this.usrename, this.password, this.imageIndex); 8 | 9 | Map toMap() { 10 | var map = { 11 | 'username': this.usrename, 12 | 'password': this.password, 13 | }; 14 | return map; 15 | } 16 | 17 | User.fromMap(Map map) { 18 | usrename = map['username']; 19 | password = map['password']; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/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/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /lib/models/stats.dart: -------------------------------------------------------------------------------- 1 | class Stats { 2 | String usrename; 3 | String description; 4 | String date; 5 | int code; 6 | 7 | Stats(this.usrename, this.description, this.date, this.code); 8 | 9 | Map toMap() { 10 | var map = { 11 | 'username': this.usrename, 12 | 'description': this.description, 13 | 'time': this.date, 14 | 'code': this.code, 15 | }; 16 | return map; 17 | } 18 | 19 | Stats.fromMap(Map map) { 20 | usrename = map['username']; 21 | description = map['description']; 22 | date = map['time']; 23 | code = map['code']; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.2.71' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.2.1' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Card Holder Wallet (Stouch) 2 | 3 | hold your cards, identity cards, visiting cards, bank cards, loyalty cards, credit & debit card, driving licence and more cards card with original photo and saved in local database. 4 | 5 | # Show some ❤️ and star the repo to support the project 6 | 7 | ## Screenshots 8 | 9 | 10 | ![Downloading](https://i.imgur.com/6rdG3NW.png) 11 | 12 | 13 | ![Downloading](https://i.imgur.com/GKkXDZY.png) 14 | 15 | 16 | ![Downloading](https://i.imgur.com/JpGnnfz.png) 17 | 18 | 19 | ![Downloading](https://i.imgur.com/s0ZyDFg.png) 20 | 21 | 22 | ![Downloading](https://i.imgur.com/OO4oPLl.png) 23 | 24 | 25 | ![Downloading](https://i.imgur.com/zG35bnV.jpg) 26 | 27 | 28 | ![Downloading](https://i.imgur.com/HG7LfBT.png) 29 | 30 | 31 | - [Youtube Channel](https://www.youtube.com/c/XSLAYERTN) 32 | - [Linkedin](https://www.linkedin.com/in/x-slayer/) 33 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /lib/models/creditcard_model.dart: -------------------------------------------------------------------------------- 1 | class CreditCard { 2 | String username; 3 | String cardNumber; 4 | String expiryDate; 5 | String cardHolderName; 6 | String cvvCode; 7 | int colorIndex; 8 | 9 | CreditCard(this.username,{this.cardNumber, this.expiryDate, this.cardHolderName, this.cvvCode , this.colorIndex}); 10 | 11 | Map toMap() { 12 | var map = { 13 | 'username': this.username, 14 | 'cardNumber': this.cardNumber, 15 | 'expiryDate': this.expiryDate, 16 | 'cardHolderName': this.cardHolderName, 17 | 'cvvCode': this.cvvCode, 18 | 'colorIndex': this.colorIndex, 19 | }; 20 | return map; 21 | } 22 | 23 | CreditCard.fromMap(Map map){ 24 | username = map['username']; 25 | cardNumber = map['cardNumber']; 26 | expiryDate = map['expiryDate']; 27 | cardHolderName = map['cardHolderName']; 28 | cvvCode = map['cvvCode']; 29 | colorIndex = map['colorIndex']; 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provider/provider.dart'; 3 | import 'package:digital_wallet/provider_models/theme_provider.dart'; 4 | import 'package:digital_wallet/services/Login.dart'; 5 | import 'package:digital_wallet/services/signup.dart'; 6 | 7 | import 'homepage.dart'; 8 | 9 | Future main() async { 10 | runApp( 11 | ChangeNotifierProvider( 12 | builder: (_) => ThemeProvider(isLightTheme: true), 13 | child: MyApp(), 14 | ), 15 | ); 16 | } 17 | 18 | class MyApp extends StatelessWidget { 19 | @override 20 | Widget build(BuildContext context) { 21 | final themeProvider = Provider.of(context); 22 | return MaterialApp( 23 | routes: { 24 | Login.id: (context) => Login(), 25 | SignUp.id: (context) => SignUp(), 26 | HomePage.id: (context) => HomePage(), 27 | }, 28 | debugShowMaterialGrid: false, 29 | title: 'digital_wallet', 30 | theme: themeProvider.getThemeData, 31 | debugShowCheckedModeBanner: false, 32 | home: Login(), 33 | ); 34 | } 35 | } -------------------------------------------------------------------------------- /lib/addPublicCard.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class AddPublicCard extends StatelessWidget { 4 | final List children; 5 | AddPublicCard({@required this.children}); 6 | @override 7 | Widget build(BuildContext context) { 8 | return Scaffold( 9 | appBar: AppBar( 10 | centerTitle: true, 11 | leading: IconButton( 12 | onPressed: () => Navigator.of(context).pop(), 13 | icon: Icon(Icons.clear, 14 | color: Theme.of(context).accentColor, size: 18.0), 15 | ), 16 | title: Text( 17 | "Select Type", 18 | style: TextStyle(color: Theme.of(context).accentColor), 19 | ), 20 | backgroundColor: Theme.of(context).cardColor, 21 | ), 22 | body: Container( 23 | color: Colors.white30, 24 | child: Padding( 25 | padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 35.0), 26 | child: Container( 27 | child: Column( 28 | children: this.children 29 | ), 30 | ), 31 | ), 32 | ), 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /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:digital_wallet/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/provider_models/theme_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ThemeProvider with ChangeNotifier { 4 | bool isLightTheme; 5 | 6 | ThemeProvider({this.isLightTheme}); 7 | 8 | ThemeData get getThemeData => isLightTheme ? lightTheme : darkTheme; 9 | 10 | set setThemeData(bool val) { 11 | if (val) { 12 | isLightTheme = true; 13 | } else { 14 | isLightTheme = false; 15 | } 16 | notifyListeners(); 17 | } 18 | } 19 | 20 | final darkTheme = ThemeData( 21 | primarySwatch: Colors.grey, 22 | primaryColor: Colors.black, 23 | brightness: Brightness.dark, 24 | backgroundColor: Color(0xFF000000), 25 | accentColor: Colors.white, 26 | cardColor: Color.fromRGBO(28,28,28, 1), 27 | accentIconTheme: IconThemeData(color: Colors.black), 28 | dividerColor: Colors.black54, 29 | ); 30 | 31 | final lightTheme = ThemeData( 32 | primarySwatch: Colors.grey, 33 | primaryColor: Colors.white, 34 | brightness: Brightness.light, 35 | backgroundColor: Color(0xFFE5E5E5), 36 | cardColor: Colors.grey[100], 37 | accentColor: Colors.black, 38 | accentIconTheme: IconThemeData(color: Colors.white), 39 | dividerColor: Colors.white54, 40 | ); -------------------------------------------------------------------------------- /lib/helper/formatters.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | 4 | class MaskedTextInputFormatter extends TextInputFormatter { 5 | final String mask; 6 | final String separator; 7 | 8 | MaskedTextInputFormatter({ 9 | @required this.mask, 10 | @required this.separator, 11 | }) { 12 | assert(mask != null); 13 | assert(separator != null); 14 | } 15 | 16 | @override 17 | TextEditingValue formatEditUpdate( 18 | TextEditingValue oldValue, TextEditingValue newValue) { 19 | if (newValue.text.length > 0) { 20 | if (newValue.text.length > oldValue.text.length) { 21 | if (newValue.text.length > mask.length) return oldValue; 22 | if (newValue.text.length < mask.length && 23 | mask[newValue.text.length - 1] == separator) { 24 | return TextEditingValue( 25 | text: 26 | '${oldValue.text}$separator${newValue.text.substring(newValue.text.length - 1)}', 27 | selection: TextSelection.collapsed( 28 | offset: newValue.selection.end + 1, 29 | ), 30 | ); 31 | } 32 | } 33 | } 34 | return newValue; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/screens/notifications_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class NotifcationsScreen extends StatefulWidget { 4 | NotifcationsScreen({Key key}) : super(key: key); 5 | 6 | @override 7 | _NotifcationsScreenState createState() => _NotifcationsScreenState(); 8 | } 9 | 10 | class _NotifcationsScreenState extends State { 11 | @override 12 | Widget build(BuildContext context) { 13 | return Scaffold( 14 | body: Center( 15 | child: Container( 16 | child: Column( 17 | mainAxisAlignment: MainAxisAlignment.center, 18 | children: [ 19 | Image( 20 | width: 162.0, 21 | height: 162.0, 22 | image: AssetImage("assets/images/notification.jpg"), 23 | ), 24 | SizedBox( 25 | height: 20.0, 26 | ), 27 | Text( 28 | "No Notifications Right Now !", 29 | style: TextStyle( 30 | color: Theme.of(context).accentColor, 31 | fontFamily: "Google", 32 | fontSize: 25.0), 33 | ) 34 | ], 35 | ), 36 | )), 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/ui/card_create.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:digital_wallet/creations/cheque.dart'; 3 | import 'package:digital_wallet/creations/creditCC.dart'; 4 | import 'package:digital_wallet/creations/debitCard.dart'; 5 | import 'package:digital_wallet/creations/giftCard.dart'; 6 | import 'package:digital_wallet/creations/other.dart'; 7 | 8 | class CardCreate extends StatefulWidget { 9 | final String type; 10 | 11 | CardCreate({@required this.type}); 12 | 13 | @override 14 | _CardCreateState createState() => _CardCreateState(); 15 | } 16 | 17 | class _CardCreateState extends State { 18 | Widget what = CreditCC(); 19 | 20 | @override 21 | void initState() { 22 | super.initState(); 23 | switch (widget.type) { 24 | case "DC": 25 | what = DebitCard(); 26 | break; 27 | case "CC": 28 | what = CreditCC(); 29 | break; 30 | case "CH": 31 | what = Check(); 32 | break; 33 | case "GC": 34 | what = GiftCard(); 35 | break; 36 | case "OC": 37 | what = OtherCard(); 38 | break; 39 | } 40 | } 41 | 42 | @override 43 | Widget build(BuildContext context) { 44 | return Scaffold( 45 | appBar: AppBar( 46 | backgroundColor: Colors.transparent, 47 | elevation: 0.0, 48 | leading: IconButton( 49 | color: Theme.of(context).accentColor, 50 | onPressed: () => Navigator.of(context).pop(), 51 | icon: Icon(Icons.clear), 52 | ), 53 | ), 54 | body: SingleChildScrollView( 55 | child: what, 56 | ), 57 | ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /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 | digital_wallet 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 | -------------------------------------------------------------------------------- /.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 | .dart_tool/ 26 | .flutter-plugins 27 | .packages 28 | .pub-cache/ 29 | .pub/ 30 | /build/ 31 | 32 | # Android related 33 | **/android/**/gradle-wrapper.jar 34 | **/android/.gradle 35 | **/android/captures/ 36 | **/android/gradlew 37 | **/android/gradlew.bat 38 | **/android/local.properties 39 | **/android/**/GeneratedPluginRegistrant.java 40 | 41 | # iOS/XCode related 42 | **/ios/**/*.mode1v3 43 | **/ios/**/*.mode2v3 44 | **/ios/**/*.moved-aside 45 | **/ios/**/*.pbxuser 46 | **/ios/**/*.perspectivev3 47 | **/ios/**/*sync/ 48 | **/ios/**/.sconsign.dblite 49 | **/ios/**/.tags* 50 | **/ios/**/.vagrant/ 51 | **/ios/**/DerivedData/ 52 | **/ios/**/Icon? 53 | **/ios/**/Pods/ 54 | **/ios/**/.symlinks/ 55 | **/ios/**/profile 56 | **/ios/**/xcuserdata 57 | **/ios/.generated/ 58 | **/ios/Flutter/App.framework 59 | **/ios/Flutter/Flutter.framework 60 | **/ios/Flutter/Generated.xcconfig 61 | **/ios/Flutter/app.flx 62 | **/ios/Flutter/app.zip 63 | **/ios/Flutter/flutter_assets/ 64 | **/ios/Flutter/flutter_export_environment.sh 65 | **/ios/ServiceDefinitions.json 66 | **/ios/Runner/GeneratedPluginRegistrant.* 67 | 68 | # Exceptions to above rules. 69 | !**/ios/**/default.mode1v3 70 | !**/ios/**/default.mode2v3 71 | !**/ios/**/default.pbxuser 72 | !**/ios/**/default.perspectivev3 73 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 74 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.example.digital_wallet" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 66 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 67 | } 68 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/homepage.dart: -------------------------------------------------------------------------------- 1 | import 'package:digital_wallet/models/User.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:digital_wallet/screens/add_screen.dart'; 4 | import 'package:digital_wallet/screens/home_screen.dart'; 5 | import 'package:digital_wallet/screens/notifications_screen.dart'; 6 | import 'package:digital_wallet/screens/profile_screen.dart'; 7 | import 'package:digital_wallet/screens/search_screen.dart'; 8 | 9 | class HomePage extends StatefulWidget { 10 | static final id = "home_screen"; 11 | static User user; 12 | 13 | HomePage(); 14 | 15 | @override 16 | _HomePageState createState() => _HomePageState(); 17 | } 18 | 19 | class _HomePageState extends State { 20 | int currentIndex = 0; 21 | PageController pageController; 22 | 23 | @override 24 | void initState() { 25 | super.initState(); 26 | pageController = PageController(); 27 | } 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | return WillPopScope( 32 | onWillPop: () { 33 | return; 34 | }, 35 | child: Scaffold( 36 | body: PageView( 37 | controller: pageController, 38 | children: [ 39 | Dashboard(), 40 | SearchScreen(), 41 | AddScreen(), 42 | NotifcationsScreen(), 43 | ProfileScreen(), 44 | ], 45 | onPageChanged: (int index) { 46 | setState(() { 47 | currentIndex = index; 48 | }); 49 | }, 50 | ), 51 | bottomNavigationBar: bottomItems(), 52 | ), 53 | ); 54 | } 55 | 56 | BottomNavigationBar bottomItems() { 57 | return BottomNavigationBar( 58 | selectedItemColor: Colors.blue, 59 | onTap: (int index) { 60 | setState( 61 | () { 62 | currentIndex = index; 63 | }, 64 | ); 65 | pageController.animateToPage( 66 | index, 67 | duration: Duration( 68 | milliseconds: 200, 69 | ), 70 | curve: Curves.easeIn, 71 | ); 72 | }, 73 | currentIndex: currentIndex, 74 | type: BottomNavigationBarType.fixed, 75 | items: [ 76 | BottomNavigationBarItem( 77 | icon: Icon(Icons.home), 78 | title: SizedBox.shrink(), 79 | ), 80 | BottomNavigationBarItem( 81 | icon: Icon(Icons.search), 82 | title: SizedBox.shrink(), 83 | ), 84 | BottomNavigationBarItem( 85 | icon: Icon( 86 | Icons.add_circle, 87 | size: 35.0, 88 | ), 89 | title: SizedBox.shrink(), 90 | ), 91 | BottomNavigationBarItem( 92 | icon: Icon(Icons.notifications), 93 | title: SizedBox.shrink(), 94 | ), 95 | BottomNavigationBarItem( 96 | icon: Icon(Icons.supervised_user_circle), 97 | title: SizedBox.shrink(), 98 | ), 99 | ], 100 | ); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/screens/add_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:digital_wallet/helper/category_items.dart'; 3 | 4 | class AddScreen extends StatefulWidget { 5 | AddScreen({Key key}) : super(key: key); 6 | 7 | @override 8 | _AddScreenState createState() => _AddScreenState(); 9 | } 10 | 11 | class _AddScreenState extends State { 12 | @override 13 | Widget build(BuildContext context) { 14 | return Scaffold( 15 | body: Container( 16 | padding: EdgeInsets.only(top: 20.0), 17 | color: Theme.of(context).backgroundColor, 18 | child: ListView.builder( 19 | itemCount: CategoryItems.cards.length, 20 | itemBuilder: (context, index) { 21 | return GestureDetector( 22 | onTap: () { 23 | Navigator.push( 24 | context, 25 | MaterialPageRoute( 26 | builder: (context) => 27 | CategoryItems.cards[index]['screen']), 28 | ); 29 | }, 30 | child: buildCard(index), 31 | ); 32 | }, 33 | ), 34 | ), 35 | ); 36 | } 37 | 38 | Column buildCard(int index) { 39 | return Column( 40 | mainAxisAlignment: MainAxisAlignment.start, 41 | children: [ 42 | Padding( 43 | padding: const EdgeInsets.symmetric(horizontal: 8.0), 44 | child: Container( 45 | height: 120.0, 46 | decoration: BoxDecoration( 47 | boxShadow: [ 48 | BoxShadow( 49 | color: Colors.black45, 50 | blurRadius: 15.0, // has the effect of softening the shadow 51 | spreadRadius: 1.0, // has the effect of extending the shadow 52 | offset: Offset( 53 | 3.0, // horizontal, move right 10 54 | 3.0, // vertical, move down 10 55 | ), 56 | ) 57 | ], 58 | color: Theme.of(context).cardColor, 59 | borderRadius: BorderRadius.circular(8.0), 60 | ), 61 | child: Row( 62 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 63 | children: [ 64 | Container( 65 | padding: EdgeInsets.only(left: 35.0), 66 | child: Text( 67 | CategoryItems.cards[index]['name'], 68 | style: TextStyle( 69 | fontSize: 16.0, 70 | fontFamily: "Google", 71 | fontStyle: FontStyle.italic, 72 | fontWeight: FontWeight.bold), 73 | ), 74 | ), 75 | Container( 76 | width: 175.0, 77 | decoration: BoxDecoration( 78 | image: DecorationImage( 79 | fit: BoxFit.cover, 80 | image: AssetImage( 81 | CategoryItems.cards[index]['img'], 82 | ), 83 | ), 84 | ), 85 | ) 86 | ], 87 | ), 88 | ), 89 | ), 90 | SizedBox( 91 | height: 20.0, 92 | ) 93 | ], 94 | ); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: digital_wallet 2 | description: A new Flutter project. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # In Android, build-name is used as versionName while build-number used as versionCode. 10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 12 | # Read more about iOS versioning at 13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 14 | version: 1.0.0+1 15 | 16 | environment: 17 | sdk: ">=2.1.0 <3.0.0" 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | toast: ^0.1.5 23 | 24 | # The following adds the Cupertino Icons font to your application. 25 | # Use with the CupertinoIcons class for iOS style icons. 26 | cupertino_icons: ^0.1.2 27 | 28 | dev_dependencies: 29 | flutter_test: 30 | sdk: flutter 31 | flutter_credit_card: 0.1.1 32 | flutter_swiper: ^1.1.6 33 | provider: ^3.1.0+1 34 | snappable: ^1.0.1 35 | path_provider: ^0.5.0+1 36 | image_picker: ^0.6.2+1 37 | sqflite: ^1.1.7+3 38 | intl: ^0.16.0 39 | 40 | 41 | 42 | 43 | 44 | # For information on the generic Dart part of this file, see the 45 | # following page: https://dart.dev/tools/pub/pubspec 46 | 47 | # The following section is specific to Flutter. 48 | flutter: 49 | 50 | # The following line ensures that the Material Icons font is 51 | # included with your application, so that you can use the icons in 52 | # the material Icons class. 53 | uses-material-design: true 54 | 55 | # To add assets to your application, add an assets section, like this: 56 | assets: 57 | - assets/images/ 58 | - assets/images/cards/ 59 | - assets/images/category/ 60 | - assets/images/mockups/ 61 | # - images/a_dot_ham.jpeg 62 | 63 | # An image asset can refer to one or more resolution-specific "variants", see 64 | # https://flutter.dev/assets-and-images/#resolution-aware. 65 | 66 | # For details regarding adding assets from package dependencies, see 67 | # https://flutter.dev/assets-and-images/#from-packages 68 | 69 | # To add custom fonts to your application, add a fonts section here, 70 | # in this "flutter" section. Each entry in this list should have a 71 | # "family" key with the font family name, and a "fonts" key with a 72 | # list giving the asset and other descriptors for the font. For 73 | # example: 74 | fonts: 75 | - family: Google 76 | fonts: 77 | - asset: assets/fonts/GoogleSansRegular.ttf 78 | - family: Billabong 79 | fonts: 80 | - asset: assets/fonts/Billabong.ttf 81 | # - asset: fonts/Schyler-Italic.ttf 82 | # style: italic 83 | # - family: Trajan Pro 84 | # fonts: 85 | # - asset: fonts/TrajanPro.ttf 86 | # - asset: fonts/TrajanPro_Bold.ttf 87 | # weight: 700 88 | # 89 | # For details regarding fonts from package dependencies, 90 | # see https://flutter.dev/custom-fonts/#from-packages 91 | -------------------------------------------------------------------------------- /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/ui/publicCards.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Cards extends StatefulWidget { 4 | String userName; 5 | String name; 6 | String prenom; 7 | String birthDate; 8 | String nationality; 9 | double height; 10 | CardType type; 11 | String imgBase64; 12 | 13 | Cards( 14 | {this.userName, 15 | this.name, 16 | this.prenom, 17 | this.birthDate, 18 | this.nationality, 19 | this.height, 20 | this.type, 21 | this.imgBase64}); 22 | 23 | CardType getType(String str) { 24 | switch (str) { 25 | case "CardType.id": 26 | return CardType.id; 27 | break; 28 | case "CardType.driver": 29 | return CardType.driver; 30 | break; 31 | case "CardType.gym": 32 | return CardType.gym; 33 | break; 34 | case "CardType.health": 35 | return CardType.health; 36 | break; 37 | case "CardType.loyality": 38 | return CardType.loyality; 39 | break; 40 | case "CardType.passport": 41 | return CardType.passport; 42 | break; 43 | case "CardType.transport": 44 | return CardType.transport; 45 | break; 46 | case "CardType.student": 47 | return CardType.student; 48 | break; 49 | default: 50 | return CardType.driver; 51 | } 52 | } 53 | 54 | Map toMap() { 55 | var map = { 56 | 'username': this.userName, 57 | 'name': this.name, 58 | 'prenom': this.prenom, 59 | 'birthDate': this.birthDate, 60 | 'nationality': this.nationality, 61 | 'type': this.type.toString(), 62 | 'img': this.imgBase64, 63 | }; 64 | return map; 65 | } 66 | 67 | Cards.fromMap(Map map) { 68 | userName = map['username']; 69 | name = map['name']; 70 | prenom = map['prenom']; 71 | birthDate = map['birthDate']; 72 | nationality = map['nationality']; 73 | type = getType(map['type'].toString()); 74 | imgBase64 = map['img']; 75 | } 76 | 77 | @override 78 | _CardsState createState() => _CardsState(); 79 | } 80 | 81 | class _CardsState extends State { 82 | @override 83 | void initState() { 84 | super.initState(); 85 | } 86 | 87 | String revealMockup() { 88 | switch (this.widget.type) { 89 | case CardType.id: 90 | return "assets/images/mockups/id.PNG"; 91 | break; 92 | case CardType.driver: 93 | return "assets/images/mockups/driving.PNG"; 94 | break; 95 | case CardType.gym: 96 | return "assets/images/mockups/gym.PNG"; 97 | break; 98 | case CardType.health: 99 | return "assets/images/mockups/health.PNG"; 100 | break; 101 | case CardType.loyality: 102 | return "assets/images/mockups/loyality.PNG"; 103 | break; 104 | case CardType.passport: 105 | return "assets/images/mockups/passport.PNG"; 106 | break; 107 | case CardType.transport: 108 | return "assets/images/mockups/transport.PNG"; 109 | break; 110 | case CardType.student: 111 | return "assets/images/mockups/student.PNG"; 112 | break; 113 | default: 114 | return "Idle"; 115 | } 116 | } 117 | 118 | @override 119 | Widget build(BuildContext context) { 120 | return Container( 121 | height: this.widget.height, 122 | width: double.infinity, 123 | decoration: BoxDecoration( 124 | image: DecorationImage( 125 | image: AssetImage( 126 | revealMockup(), 127 | ), 128 | fit: BoxFit.cover), 129 | boxShadow: [ 130 | BoxShadow( 131 | color: Colors.black45, 132 | blurRadius: 15.0, 133 | spreadRadius: 1.0, 134 | offset: Offset( 135 | 3.0, 136 | 3.0, 137 | ), 138 | ) 139 | ], 140 | borderRadius: BorderRadius.circular(18.0), 141 | ), 142 | child: Padding( 143 | padding: const EdgeInsets.all(20.0), 144 | ), 145 | ); 146 | } 147 | } 148 | 149 | enum CardType { 150 | id, 151 | passport, 152 | driver, 153 | health, 154 | gym, 155 | transport, 156 | loyality, 157 | student 158 | } 159 | -------------------------------------------------------------------------------- /lib/addCard.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:digital_wallet/ui/card_create.dart'; 3 | 4 | class AddCards extends StatelessWidget { 5 | const AddCards({Key key}) : super(key: key); 6 | 7 | @override 8 | Widget build(BuildContext context) { 9 | return Scaffold( 10 | appBar: AppBar( 11 | centerTitle: true, 12 | leading: IconButton( 13 | onPressed: () => Navigator.of(context).pop(), 14 | icon: Icon(Icons.clear, 15 | color: Theme.of(context).accentColor, size: 18.0), 16 | ), 17 | title: Text( 18 | "Select Type", 19 | style: TextStyle(color: Theme.of(context).accentColor), 20 | ), 21 | backgroundColor: Theme.of(context).cardColor, 22 | ), 23 | body: Container( 24 | color: Colors.white30, 25 | child: Padding( 26 | padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 35.0), 27 | child: Container( 28 | child: Column( 29 | children: [ 30 | addButton( 31 | context, 1, "Credit Card", Colors.white70, Colors.blue), 32 | SizedBox( 33 | height: 20.0, 34 | ), 35 | addButton( 36 | context, 2, "Debit Card", Colors.black54, Colors.white), 37 | SizedBox( 38 | height: 20.0, 39 | ), 40 | addButton(context, 3, "Check", Colors.black54, Colors.white), 41 | SizedBox( 42 | height: 20.0, 43 | ), 44 | addButton( 45 | context, 4, "Gift Card", Colors.black54, Colors.white), 46 | SizedBox(height: 28.0), 47 | addButton( 48 | context, 5, "Other Card", Colors.black54, Colors.white), 49 | SizedBox(height: 28.0), 50 | Text( 51 | "You Can now add credit cards with specific balance into wallet." + 52 | " when the cards hits \$0.00 it will auomatically disappear.want to know if your gift card will link ?", 53 | textAlign: TextAlign.center, 54 | style: TextStyle( 55 | fontFamily: "Google", 56 | fontSize: 16.0, 57 | ), 58 | ) 59 | ], 60 | ), 61 | ), 62 | ), 63 | ), 64 | ); 65 | } 66 | 67 | MaterialButton addButton(BuildContext context, int indice, String text, 68 | Color txtColor, Color buttonColor) { 69 | return MaterialButton( 70 | onPressed: () { 71 | switch (indice) { 72 | case 1: 73 | { 74 | Navigator.push( 75 | context, 76 | MaterialPageRoute( 77 | builder: (BuildContext context) => CardCreate(type: "CC"), 78 | ), 79 | ); 80 | break; 81 | } 82 | case 2: 83 | { 84 | Navigator.push( 85 | context, 86 | MaterialPageRoute( 87 | builder: (BuildContext context) => CardCreate(type: "DC"), 88 | ), 89 | ); 90 | break; 91 | } 92 | case 3: 93 | { 94 | Navigator.push( 95 | context, 96 | MaterialPageRoute( 97 | builder: (BuildContext context) => CardCreate(type: "CH"), 98 | ), 99 | ); 100 | break; 101 | } 102 | case 4: 103 | { 104 | Navigator.push( 105 | context, 106 | MaterialPageRoute( 107 | builder: (BuildContext context) => CardCreate(type: "GC"), 108 | ), 109 | ); 110 | break; 111 | } 112 | case 5: 113 | { 114 | Navigator.push( 115 | context, 116 | MaterialPageRoute( 117 | builder: (BuildContext context) => CardCreate(type: "OC"), 118 | ), 119 | ); 120 | break; 121 | } 122 | default: 123 | {} 124 | } 125 | }, 126 | color: buttonColor, 127 | child: Center( 128 | child: Text( 129 | text, 130 | style: TextStyle(color: txtColor), 131 | ), 132 | ), 133 | ); 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /lib/cardViewer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:digital_wallet/addCard.dart'; 3 | import 'package:digital_wallet/helper/category_items.dart'; 4 | import 'package:flutter_credit_card/flutter_credit_card.dart'; 5 | import 'package:digital_wallet/homepage.dart'; 6 | import 'package:digital_wallet/screens/cardManage.dart' as cc; 7 | 8 | class CardViewer extends StatefulWidget { 9 | @override 10 | _CardViewerState createState() => _CardViewerState(); 11 | } 12 | 13 | class _CardViewerState extends State { 14 | @override 15 | void initState() { 16 | super.initState(); 17 | } 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | final _screenSize = MediaQuery.of(context).size; 22 | return Scaffold( 23 | appBar: AppBar( 24 | centerTitle: true, 25 | title: Text( 26 | "Your Cards (${CategoryItems.cardsList.length})", 27 | style: TextStyle(color: Theme.of(context).accentColor), 28 | ), 29 | backgroundColor: Theme.of(context).cardColor, 30 | elevation: 1.5, 31 | leading: IconButton( 32 | onPressed: () { 33 | Navigator.push( 34 | context, 35 | MaterialPageRoute(builder: (BuildContext context) => HomePage()), 36 | ); 37 | }, 38 | icon: Icon( 39 | Icons.clear, 40 | size: 25.0, 41 | color: Theme.of(context).accentColor, 42 | ), 43 | ), 44 | actions: [ 45 | IconButton( 46 | onPressed: () { 47 | Navigator.push( 48 | context, 49 | MaterialPageRoute( 50 | builder: (BuildContext context) => AddCards(), 51 | ), 52 | ); 53 | }, 54 | icon: Icon( 55 | Icons.add, 56 | size: 25.0, 57 | color: Theme.of(context).accentColor, 58 | ), 59 | ), 60 | ], 61 | ), 62 | body: (CategoryItems.cardsList == null || 63 | CategoryItems.cardsList.length == 0) 64 | ? noCards() 65 | : Column( 66 | children: [ 67 | SizedBox( 68 | height: _screenSize.height * 0.8, 69 | child: ListView.builder( 70 | itemCount: CategoryItems.cardsList.length == 0 71 | ? 0 72 | : CategoryItems.cardsList.length, 73 | itemBuilder: (BuildContext context, int index) { 74 | return InkWell( 75 | onTap: () { 76 | Navigator.push( 77 | context, 78 | MaterialPageRoute( 79 | builder: (BuildContext context) => 80 | cc.CardManagment( 81 | indice: index, 82 | card: CategoryItems.cardsList[index], 83 | ), 84 | ), 85 | ); 86 | }, 87 | child: CreditCardWidget( 88 | height: _screenSize.height * 0.35, 89 | cardHolderName: 90 | CategoryItems.cardsList[index].cardHolderName, 91 | cardNumber: CategoryItems.cardsList[index].cardNumber, 92 | cvvCode: CategoryItems.cardsList[index].cvvCode, 93 | expiryDate: CategoryItems.cardsList[index].expiryDate, 94 | showBackView: false, 95 | cardbgColor: CategoryItems.colorsList[ 96 | CategoryItems.cardsList[index].colorIndex], 97 | ), 98 | ); 99 | }, 100 | ), 101 | ), 102 | ], 103 | ), 104 | ); 105 | } 106 | 107 | Widget noCards() { 108 | return Center( 109 | child: Column( 110 | mainAxisAlignment: MainAxisAlignment.center, 111 | children: [ 112 | Image( 113 | image: AssetImage("assets/images/ccsad.png"), 114 | width: 165.0, 115 | height: 155.0, 116 | ), 117 | SizedBox( 118 | height: 9.0, 119 | ), 120 | Text( 121 | "You have no cards to display", 122 | textAlign: TextAlign.center, 123 | style: TextStyle( 124 | fontStyle: FontStyle.italic, 125 | fontSize: 20.0, 126 | color: Theme.of(context).accentColor), 127 | ) 128 | ], 129 | ), 130 | ); 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /lib/screens/search_screen.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:typed_data'; 3 | 4 | import 'package:digital_wallet/helper/category_items.dart'; 5 | import 'package:digital_wallet/ui/publicCards.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:toast/toast.dart'; 8 | 9 | class SearchScreen extends StatefulWidget { 10 | 11 | 12 | @override 13 | _SearchScreenState createState() => _SearchScreenState(); 14 | } 15 | 16 | class _SearchScreenState extends State { 17 | TextEditingController searchController = new TextEditingController(); 18 | List lookCards = []; 19 | 20 | _searchForCards(String keyword) { 21 | if (keyword.isEmpty) return; 22 | for (var pCard in CategoryItems.publicCardsList) { 23 | if (pCard.type.toString().toLowerCase().contains(keyword.toLowerCase())) { 24 | setState(() { 25 | lookCards.add(pCard); 26 | }); 27 | } 28 | } 29 | } 30 | 31 | _showOriginal(int index) { 32 | showDialog( 33 | context: context, 34 | builder: (BuildContext context) { 35 | return AlertDialog( 36 | content: Container( 37 | child: _b64Toimage(lookCards[index].imgBase64), 38 | ), 39 | ); 40 | }, 41 | ); 42 | } 43 | 44 | _b64Toimage(String base) { 45 | Uint8List bytes = base64.decode(base); 46 | return Image.memory( 47 | bytes, 48 | fit: BoxFit.cover, 49 | ); 50 | } 51 | 52 | showToast() { 53 | return Toast.show("You Have No Original Copy To Display", context, 54 | duration: 3, gravity: Toast.BOTTOM); 55 | } 56 | 57 | @override 58 | Widget build(BuildContext context) { 59 | return Scaffold( 60 | appBar: AppBar( 61 | leading: SizedBox.shrink(), 62 | backgroundColor: Theme.of(context).backgroundColor, 63 | title: Container( 64 | child: TextField( 65 | controller: searchController, 66 | decoration: InputDecoration( 67 | filled: true, 68 | contentPadding: EdgeInsets.symmetric(vertical: 15.0), 69 | border: InputBorder.none, 70 | hintText: "Search For Card ..", 71 | hintStyle: TextStyle( 72 | color: Theme.of(context).accentColor, fontSize: 16.0), 73 | prefixIcon: Icon( 74 | Icons.search, 75 | size: 30.0, 76 | ), 77 | suffixIcon: IconButton( 78 | onPressed: () { 79 | WidgetsBinding.instance.addPostFrameCallback((_) { 80 | searchController.clear(); 81 | lookCards.clear(); 82 | }); 83 | }, 84 | icon: Icon( 85 | Icons.clear, 86 | ), 87 | ), 88 | ), 89 | onSubmitted: (input) => _searchForCards(input), 90 | ), 91 | ), 92 | ), 93 | body: lookCards.length != 0 94 | ? searchList() 95 | : Padding( 96 | padding: 97 | const EdgeInsets.symmetric(horizontal: 20.0, vertical: 33.0), 98 | child: Column( 99 | children: [ 100 | Image( 101 | image: AssetImage( 102 | "assets/images/search.png", 103 | ), 104 | width: 145, 105 | height: 155, 106 | ), 107 | Text( 108 | "Enter a few words to search for on stouche.", 109 | textAlign: TextAlign.center, 110 | style: TextStyle( 111 | fontSize: 19.0, 112 | color: Theme.of(context).accentColor, 113 | fontFamily: "Google", 114 | ), 115 | ) 116 | ], 117 | ), 118 | ), 119 | ); 120 | } 121 | 122 | Widget searchList() { 123 | return ListView.builder( 124 | itemCount: lookCards.length, 125 | itemBuilder: (context, index) { 126 | return InkWell( 127 | onTap: () { 128 | lookCards[index].imgBase64 != null 129 | ? _showOriginal(index) 130 | : showToast(); 131 | }, 132 | child: Padding( 133 | padding: const EdgeInsets.all(15.0), 134 | child: Cards( 135 | userName: lookCards[index].userName, 136 | height: MediaQuery.of(context).size.height * 0.35, 137 | name: lookCards[index].name, 138 | prenom: lookCards[index].prenom, 139 | nationality: CategoryItems.publicCardsList[index].nationality, 140 | type: lookCards[index].type, 141 | birthDate: lookCards[index].birthDate, 142 | ), 143 | ), 144 | ); 145 | }, 146 | ); 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /lib/ui/viewStats.dart: -------------------------------------------------------------------------------- 1 | import 'package:digital_wallet/helper/DBHelper.dart'; 2 | import 'package:digital_wallet/models/stats.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:digital_wallet/helper/DBHelper.dart'; 5 | 6 | import '../homepage.dart'; 7 | 8 | class ViewStats extends StatefulWidget { 9 | ViewStats({Key key}) : super(key: key); 10 | 11 | @override 12 | _ViewStatsState createState() => _ViewStatsState(); 13 | } 14 | 15 | class _ViewStatsState extends State { 16 | List stats = []; 17 | 18 | Widget _getLeading(int code) { 19 | switch (code) { 20 | case 1: 21 | return Icon( 22 | Icons.done, 23 | color: Colors.greenAccent, 24 | size: 35.0, 25 | ); 26 | break; 27 | case 2: 28 | return Icon( 29 | Icons.delete_outline, 30 | color: Colors.red, 31 | size: 35.0, 32 | ); 33 | break; 34 | default: 35 | return null; 36 | } 37 | } 38 | 39 | _getStats() async { 40 | try { 41 | stats.clear(); 42 | List statis = await DBHlper().getStats(HomePage.user.usrename); 43 | if (statis.length == 0) return; 44 | setState(() { 45 | stats = statis; 46 | }); 47 | } catch (ex) {} 48 | } 49 | 50 | _clearStats() async { 51 | try { 52 | setState(() { 53 | DBHlper().deleteStats(HomePage.user.usrename); 54 | stats.clear(); 55 | }); 56 | } catch (ex) {} 57 | } 58 | 59 | @override 60 | void initState() { 61 | super.initState(); 62 | _getStats(); 63 | } 64 | 65 | @override 66 | Widget build(BuildContext context) { 67 | ThemeData theme = Theme.of(context); 68 | return Scaffold( 69 | appBar: AppBar( 70 | elevation: 0.0, 71 | title: Text( 72 | "My Statistics", 73 | style: TextStyle(color: Theme.of(context).accentColor), 74 | ), 75 | actions: [ 76 | Padding( 77 | padding: EdgeInsets.all(10.0), 78 | child: IconButton( 79 | color: Colors.redAccent, 80 | onPressed: () { 81 | showDialog( 82 | context: context, 83 | builder: (context) { 84 | return AlertDialog( 85 | title: new Text("Are You Sure !", 86 | style: TextStyle(fontWeight: FontWeight.bold)), 87 | content: new Text("This will delete all your stats !"), 88 | actions: [ 89 | new FlatButton( 90 | child: new Text("continue"), 91 | onPressed: () { 92 | _clearStats(); 93 | Navigator.of(context).pop(); 94 | }, 95 | ), 96 | new FlatButton( 97 | child: new Text("Close"), 98 | onPressed: () { 99 | Navigator.of(context).pop(); 100 | }, 101 | ), 102 | ], 103 | ); 104 | }); 105 | }, 106 | icon: Icon( 107 | Icons.clear_all, 108 | size: 30.0, 109 | ), 110 | ), 111 | ), 112 | ], 113 | ), 114 | body: stats.length != 0 115 | ? listStats(theme) 116 | : Center( 117 | child: Padding( 118 | padding: const EdgeInsets.symmetric(horizontal: 20.0), 119 | child: Text( 120 | "You Have No Data To Display", 121 | textAlign: TextAlign.center, 122 | style: TextStyle( 123 | color: theme.accentColor, 124 | fontSize: 30.0, 125 | fontFamily: "Google"), 126 | ), 127 | ), 128 | ), 129 | ); 130 | } 131 | 132 | Widget listStats(ThemeData theme) { 133 | return Container( 134 | child: ListView.builder( 135 | itemCount: stats.length == 0 ? 0 : stats.length, 136 | itemBuilder: (context, index) { 137 | return Padding( 138 | padding: const EdgeInsets.only(top: 12.0), 139 | child: Column( 140 | children: [ 141 | ListTile( 142 | leading: _getLeading(stats[index].code), 143 | title: Text( 144 | stats[index].description, 145 | overflow: TextOverflow.ellipsis, 146 | style: TextStyle(color: theme.accentColor), 147 | ), 148 | subtitle: Text( 149 | stats[index].date, 150 | style: TextStyle(color: theme.accentColor.withOpacity(0.8)), 151 | ), 152 | ), 153 | Divider(), 154 | ], 155 | ), 156 | ); 157 | }, 158 | ), 159 | ); 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /lib/creations/cheque.dart: -------------------------------------------------------------------------------- 1 | import 'package:digital_wallet/helper/DBHelper.dart'; 2 | import 'package:digital_wallet/homepage.dart'; 3 | import 'package:digital_wallet/models/stats.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:digital_wallet/cardViewer.dart'; 6 | import 'package:digital_wallet/helper/category_items.dart'; 7 | import 'package:digital_wallet/models/creditcard_model.dart'; 8 | import 'package:flutter_credit_card/flutter_credit_card.dart' as cr; 9 | 10 | class Check extends StatefulWidget { 11 | static String name = "Check"; 12 | 13 | @override 14 | _CheckState createState() => _CheckState(); 15 | } 16 | 17 | class _CheckState extends State { 18 | FocusNode ccvFocused = new FocusNode(); 19 | bool ccv = false; 20 | TextEditingController cardNumber = TextEditingController(); 21 | TextEditingController cardHolderName = TextEditingController(); 22 | TextEditingController _ccv = TextEditingController(); 23 | TextEditingController expiredate = TextEditingController(); 24 | 25 | String name, number, expir, cc; 26 | 27 | @override 28 | void initState() { 29 | super.initState(); 30 | 31 | ccvFocused.addListener(() { 32 | setState(() { 33 | ccv = ccvFocused.hasFocus; 34 | }); 35 | }); 36 | } 37 | 38 | @override 39 | void dispose() { 40 | cardHolderName.dispose(); 41 | super.dispose(); 42 | } 43 | 44 | @override 45 | Widget build(BuildContext context) { 46 | return Container( 47 | child: Column( 48 | crossAxisAlignment: CrossAxisAlignment.start, 49 | children: [ 50 | cardModel(), 51 | SizedBox( 52 | height: 2.0, 53 | ), 54 | Padding( 55 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 56 | child: Container( 57 | padding: EdgeInsets.all(8.0), 58 | child: TextField( 59 | controller: expiredate, 60 | onChanged: (nb) { 61 | setState(() { 62 | expir = nb; 63 | }); 64 | }, 65 | decoration: InputDecoration( 66 | border: OutlineInputBorder( 67 | borderSide: BorderSide( 68 | color: Theme.of(context).accentColor, 69 | ), 70 | ), 71 | labelText: "Pay To John Doe", 72 | hintStyle: TextStyle(color: Colors.blueGrey, fontSize: 16.0), 73 | ), 74 | ), 75 | ), 76 | ), 77 | 78 | Padding( 79 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 80 | child: Container( 81 | padding: EdgeInsets.all(8.0), 82 | child: TextField( 83 | keyboardType: TextInputType.number, 84 | controller: cardHolderName, 85 | onChanged: (input) { 86 | setState( 87 | () { 88 | name = input; 89 | }, 90 | ); 91 | }, 92 | decoration: InputDecoration( 93 | border: OutlineInputBorder( 94 | borderSide: BorderSide( 95 | color: Theme.of(context).accentColor, 96 | ), 97 | ), 98 | labelText: "Montant", 99 | hintStyle: TextStyle(color: Colors.blueGrey, fontSize: 16.0), 100 | ), 101 | ), 102 | ), 103 | ), 104 | //--------------------------------------- 105 | Padding( 106 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 107 | child: MaterialButton( 108 | onPressed: () { 109 | CreditCard cCard = CreditCard(HomePage.user.usrename, 110 | cardHolderName: cardHolderName.text, 111 | cardNumber: cardNumber.text, 112 | cvvCode: _ccv.text, 113 | expiryDate: expiredate.text, 114 | colorIndex: 2); 115 | DBHlper().insertCC(cCard); 116 | DBHlper().insertSTAT( 117 | new Stats(HomePage.user.usrename, "New Cheque has been added", 118 | CategoryItems.returnDate(), 1), 119 | ); 120 | setState(() { 121 | CategoryItems.cardsList.add(cCard); 122 | }); 123 | Navigator.push( 124 | context, 125 | MaterialPageRoute( 126 | builder: (BuildContext context) => CardViewer(), 127 | ), 128 | ); 129 | }, 130 | color: Colors.blue, 131 | child: Center( 132 | child: Text( 133 | "Add Card", 134 | style: TextStyle(color: Colors.white), 135 | ), 136 | ), 137 | ), 138 | ), 139 | ], 140 | ), 141 | ); 142 | } 143 | 144 | Widget cardModel() { 145 | return Container( 146 | child: cr.CreditCardWidget( 147 | cardbgColor: CategoryItems.colorsList[2], 148 | height: 200.0, 149 | cardHolderName: name == null ? "John Doe" : name + "£", 150 | cardNumber: 151 | cardNumber == null ? "1111 1111 1111 1111" : cardNumber.text, 152 | cvvCode: _ccv == null ? "111" : _ccv.text, 153 | expiryDate: expiredate == null ? "11/1999" : expiredate.text, 154 | showBackView: ccvFocused.hasFocus, 155 | ), 156 | ); 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /lib/creations/giftCard.dart: -------------------------------------------------------------------------------- 1 | import 'package:digital_wallet/helper/DBHelper.dart'; 2 | import 'package:digital_wallet/models/stats.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:digital_wallet/cardViewer.dart'; 5 | import 'package:digital_wallet/helper/category_items.dart'; 6 | import 'package:digital_wallet/models/creditcard_model.dart'; 7 | import 'package:flutter_credit_card/flutter_credit_card.dart' as cr; 8 | 9 | import '../homepage.dart'; 10 | 11 | class GiftCard extends StatefulWidget { 12 | @override 13 | _GiftCardState createState() => _GiftCardState(); 14 | } 15 | 16 | class _GiftCardState extends State { 17 | FocusNode ccvFocused = new FocusNode(); 18 | bool ccv = false; 19 | TextEditingController cardNumber = TextEditingController(); 20 | TextEditingController cardHolderName = TextEditingController(); 21 | TextEditingController _ccv = TextEditingController(); 22 | TextEditingController expiredate = TextEditingController(); 23 | 24 | String name, number, expir, cc; 25 | 26 | @override 27 | void initState() { 28 | super.initState(); 29 | number = "1111 1111 1111 1111"; 30 | cc = "111"; 31 | ccvFocused.addListener(() { 32 | setState(() { 33 | ccv = ccvFocused.hasFocus; 34 | }); 35 | }); 36 | } 37 | 38 | @override 39 | void dispose() { 40 | cardHolderName.dispose(); 41 | super.dispose(); 42 | } 43 | 44 | @override 45 | Widget build(BuildContext context) { 46 | return Container( 47 | child: Column( 48 | crossAxisAlignment: CrossAxisAlignment.start, 49 | children: [ 50 | cardModel(), 51 | SizedBox( 52 | height: 2.0, 53 | ), 54 | Padding( 55 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 56 | child: Container( 57 | padding: EdgeInsets.all(8.0), 58 | child: TextField( 59 | controller: expiredate, 60 | onChanged: (nb) { 61 | setState(() { 62 | number = nb; 63 | }); 64 | }, 65 | decoration: InputDecoration( 66 | border: OutlineInputBorder( 67 | borderSide: BorderSide( 68 | color: Theme.of(context).accentColor, 69 | ), 70 | ), 71 | labelText: "Google , Steam , Itunes ...", 72 | hintStyle: TextStyle(color: Colors.blueGrey, fontSize: 16.0), 73 | ), 74 | ), 75 | ), 76 | ), 77 | //--------------------------------------- 78 | 79 | Padding( 80 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 81 | child: Container( 82 | padding: EdgeInsets.all(8.0), 83 | child: TextField( 84 | controller: cardHolderName, 85 | onChanged: (input) { 86 | setState( 87 | () { 88 | name = input; 89 | }, 90 | ); 91 | }, 92 | decoration: InputDecoration( 93 | border: OutlineInputBorder( 94 | borderSide: BorderSide( 95 | color: Theme.of(context).accentColor, 96 | ), 97 | ), 98 | labelText: "Holder Name", 99 | hintStyle: TextStyle(color: Colors.blueGrey, fontSize: 16.0), 100 | ), 101 | ), 102 | ), 103 | ), 104 | //--------------------------------------- 105 | Padding( 106 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 107 | child: MaterialButton( 108 | onPressed: () { 109 | CreditCard cCard = CreditCard(HomePage.user.usrename, 110 | cardHolderName: cardHolderName.text, 111 | cardNumber: cardNumber.text, 112 | cvvCode: _ccv.text, 113 | expiryDate: expiredate.text, 114 | colorIndex: 3); 115 | DBHlper().insertCC(cCard); 116 | DBHlper().insertSTAT( 117 | new Stats( 118 | HomePage.user.usrename, 119 | "New Gift Card has been added", 120 | CategoryItems.returnDate(), 121 | 1), 122 | ); 123 | setState(() { 124 | CategoryItems.cardsList.add(cCard); 125 | }); 126 | Navigator.push( 127 | context, 128 | MaterialPageRoute( 129 | builder: (BuildContext context) => CardViewer(), 130 | ), 131 | ); 132 | }, 133 | color: Colors.blue, 134 | child: Center( 135 | child: Text( 136 | "Add Card", 137 | style: TextStyle(color: Colors.white), 138 | ), 139 | ), 140 | ), 141 | ), 142 | ], 143 | ), 144 | ); 145 | } 146 | 147 | Widget cardModel() { 148 | return Container( 149 | child: cr.CreditCardWidget( 150 | cardbgColor: CategoryItems.colorsList[3], 151 | height: 200.0, 152 | cardHolderName: name == null ? "John Doe" : name, 153 | cardNumber: 154 | cardNumber == null ? "1111 1111 1111 1111" : cardNumber.text, 155 | cvvCode: _ccv == null ? "111" : _ccv.text, 156 | expiryDate: expiredate == null ? "11/1999" : expiredate.text, 157 | showBackView: ccvFocused.hasFocus, 158 | ), 159 | ); 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /lib/creations/other.dart: -------------------------------------------------------------------------------- 1 | import 'package:digital_wallet/helper/DBHelper.dart'; 2 | import 'package:digital_wallet/models/stats.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:digital_wallet/cardViewer.dart'; 5 | import 'package:digital_wallet/helper/category_items.dart'; 6 | import 'package:digital_wallet/models/creditcard_model.dart'; 7 | import 'package:flutter_credit_card/flutter_credit_card.dart' as cr; 8 | 9 | import '../homepage.dart'; 10 | 11 | class OtherCard extends StatefulWidget { 12 | static String name = "OtherCard"; 13 | 14 | @override 15 | _OtherCardState createState() => _OtherCardState(); 16 | } 17 | 18 | class _OtherCardState extends State { 19 | FocusNode ccvFocused = new FocusNode(); 20 | bool ccv = false; 21 | TextEditingController cardNumber = TextEditingController(); 22 | TextEditingController cardHolderName = TextEditingController(); 23 | TextEditingController _ccv = TextEditingController(); 24 | TextEditingController expiredate = TextEditingController(); 25 | 26 | String name, number, expir, cc; 27 | 28 | @override 29 | void initState() { 30 | super.initState(); 31 | 32 | ccvFocused.addListener(() { 33 | setState(() { 34 | ccv = ccvFocused.hasFocus; 35 | }); 36 | }); 37 | } 38 | 39 | @override 40 | void dispose() { 41 | cardHolderName.dispose(); 42 | super.dispose(); 43 | } 44 | 45 | @override 46 | Widget build(BuildContext context) { 47 | return Container( 48 | child: Column( 49 | crossAxisAlignment: CrossAxisAlignment.start, 50 | children: [ 51 | cardModel(), 52 | SizedBox( 53 | height: 2.0, 54 | ), 55 | Padding( 56 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 57 | child: Container( 58 | padding: EdgeInsets.all(8.0), 59 | child: TextField( 60 | maxLines: 4, 61 | controller: expiredate, 62 | onChanged: (nb) { 63 | setState(() { 64 | expir = nb; 65 | }); 66 | }, 67 | decoration: InputDecoration( 68 | border: OutlineInputBorder( 69 | borderSide: BorderSide( 70 | color: Theme.of(context).accentColor, 71 | ), 72 | ), 73 | labelText: "Description ", 74 | hintStyle: TextStyle( 75 | color: Colors.blueGrey, 76 | fontSize: 16.0, 77 | ), 78 | ), 79 | ), 80 | ), 81 | ), 82 | 83 | Padding( 84 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 85 | child: Container( 86 | padding: EdgeInsets.all(8.0), 87 | child: TextField( 88 | keyboardType: TextInputType.number, 89 | controller: cardHolderName, 90 | onChanged: (input) { 91 | setState( 92 | () { 93 | name = input; 94 | }, 95 | ); 96 | }, 97 | decoration: InputDecoration( 98 | border: OutlineInputBorder( 99 | borderSide: BorderSide( 100 | color: Theme.of(context).accentColor, 101 | ), 102 | ), 103 | labelText: "Name", 104 | hintStyle: TextStyle(color: Colors.blueGrey, fontSize: 16.0), 105 | ), 106 | ), 107 | ), 108 | ), 109 | //--------------------------------------- 110 | Padding( 111 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 112 | child: MaterialButton( 113 | onPressed: () { 114 | CreditCard cCard = CreditCard(HomePage.user.usrename, 115 | cardHolderName: cardHolderName.text, 116 | cardNumber: "1111 1111 1111 1111", 117 | cvvCode: "111", 118 | expiryDate: expiredate.text, 119 | colorIndex: 5); 120 | DBHlper().insertCC(cCard); 121 | DBHlper().insertSTAT( 122 | new Stats(HomePage.user.usrename, "New Others card has been added", 123 | CategoryItems.returnDate(), 1), 124 | ); 125 | setState(() { 126 | CategoryItems.cardsList.add(cCard); 127 | }); 128 | Navigator.push( 129 | context, 130 | MaterialPageRoute( 131 | builder: (BuildContext context) => CardViewer(), 132 | ), 133 | ); 134 | }, 135 | color: Colors.blue, 136 | child: Center( 137 | child: Text( 138 | "Add Card", 139 | style: TextStyle(color: Colors.white), 140 | ), 141 | ), 142 | ), 143 | ), 144 | ], 145 | ), 146 | ); 147 | } 148 | 149 | Widget cardModel() { 150 | return Container( 151 | child: cr.CreditCardWidget( 152 | cardbgColor: CategoryItems.colorsList[5], 153 | height: 200.0, 154 | cardHolderName: name == null ? "John Doe" : name + "£", 155 | cardNumber: 156 | cardNumber == null ? "1111 1111 1111 1111" : cardNumber.text, 157 | cvvCode: _ccv == null ? "111" : _ccv.text, 158 | expiryDate: expiredate == null ? "11/1999" : expiredate.text, 159 | showBackView: ccvFocused.hasFocus, 160 | ), 161 | ); 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /lib/screens/home_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:digital_wallet/helper/category_items.dart'; 4 | 5 | class Dashboard extends StatefulWidget { 6 | Dashboard({Key key}) : super(key: key); 7 | 8 | @override 9 | _DashboardState createState() => _DashboardState(); 10 | } 11 | 12 | class _DashboardState extends State { 13 | @override 14 | void initState() { 15 | super.initState(); 16 | } 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | var screenHeight = MediaQuery.of(context).size; 21 | 22 | return Scaffold( 23 | body: SafeArea( 24 | child: SingleChildScrollView( 25 | child: Stack( 26 | children: [ 27 | Container( 28 | height: screenHeight.height, 29 | ), 30 | buildThumbnail(screenHeight.height), 31 | floatingContainer(), 32 | thirdPart(screenHeight.width), 33 | ], 34 | ), 35 | ), 36 | ), 37 | ); 38 | } 39 | 40 | Container buildThumbnail(double screenHeight) { 41 | return Container( 42 | height: screenHeight / 4, 43 | width: double.infinity, 44 | decoration: BoxDecoration( 45 | image: DecorationImage( 46 | image: AssetImage('assets/images/thumb.jpg'), 47 | fit: BoxFit.fill, 48 | ), 49 | ), 50 | ); 51 | } 52 | 53 | Padding floatingContainer() { 54 | return Padding( 55 | padding: const EdgeInsets.only(top: 110.0, left: 25.0, right: 25.0), 56 | child: Container( 57 | height: 110.0, 58 | width: double.infinity, 59 | padding: EdgeInsets.only(left: 25.0, right: 25.0), 60 | decoration: BoxDecoration( 61 | color: Color.fromRGBO(36, 49, 64, 0.9), 62 | borderRadius: BorderRadius.circular(18.0), 63 | ), 64 | child: Center( 65 | child: Container( 66 | padding: EdgeInsets.symmetric(horizontal: 20.0), 67 | decoration: BoxDecoration( 68 | // color: Colors.white, 69 | borderRadius: BorderRadius.circular(10.0), 70 | ), 71 | child: Text( 72 | "Welcome To Stouche", 73 | textAlign: TextAlign.center, 74 | style: TextStyle( 75 | color: Colors.white, 76 | fontSize: 35.0, 77 | fontFamily: "Billabong", 78 | fontWeight: FontWeight.bold, 79 | ), 80 | ), 81 | // child: TextField( 82 | // decoration: InputDecoration( 83 | // border: InputBorder.none, 84 | // hintText: "Search here ..", 85 | // hintStyle: TextStyle(color: Colors.blueGrey, fontSize: 16.0), 86 | // icon: Icon( 87 | // Icons.search, 88 | // color: Colors.blueGrey, 89 | // ), 90 | // ), 91 | // ), 92 | ), 93 | ), 94 | ), 95 | ); 96 | } 97 | 98 | Widget gridView(List whom) { 99 | return Container( 100 | child: GridView.builder( 101 | shrinkWrap: true, 102 | itemCount: whom.length, 103 | gridDelegate: 104 | SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), 105 | physics: ScrollPhysics(), 106 | itemBuilder: (context, index) { 107 | return GestureDetector( 108 | onTap: () => Navigator.push( 109 | context, 110 | MaterialPageRoute( 111 | builder: (BuildContext context) => whom[index]['screen'], 112 | ), 113 | ), 114 | child: Card( 115 | elevation: 1.0, 116 | child: Column( 117 | crossAxisAlignment: CrossAxisAlignment.center, 118 | children: [ 119 | Container( 120 | padding: EdgeInsets.all(8.0), 121 | width: 60.0, 122 | height: 54.0, 123 | decoration: BoxDecoration( 124 | image: DecorationImage( 125 | image: AssetImage(whom[index]['img']), 126 | fit: BoxFit.contain), 127 | ), 128 | ), 129 | SizedBox( 130 | height: 7.0, 131 | ), 132 | Expanded( 133 | child: Text( 134 | whom[index]['name'], 135 | overflow: TextOverflow.ellipsis, 136 | style: TextStyle( 137 | color: Theme.of(context).accentColor, 138 | fontSize: 14.0, 139 | fontFamily: "Google"), 140 | ), 141 | ) 142 | ], 143 | ), 144 | ), 145 | ); 146 | }, 147 | ), 148 | ); 149 | } 150 | 151 | Widget thirdPart(double width) { 152 | return Positioned( 153 | top: 220.0, 154 | child: Padding( 155 | padding: EdgeInsets.only(top: 25.0), 156 | child: Container( 157 | width: width, 158 | padding: EdgeInsets.symmetric(horizontal: 35.0), 159 | child: Column( 160 | crossAxisAlignment: CrossAxisAlignment.center, 161 | children: [ 162 | //Here Welcome 163 | SizedBox( 164 | height: 20.0, 165 | ), 166 | Text( 167 | "Stouche allows you to store all your cards & id's safe in one place without having carrying them all with you every time", 168 | textAlign: TextAlign.center, 169 | style: TextStyle( 170 | color: Theme.of(context).accentColor, 171 | fontSize: 16.0, 172 | fontFamily: "Google", 173 | fontStyle: FontStyle.italic), 174 | ), 175 | SizedBox( 176 | height: 20.0, 177 | ), 178 | gridView(CategoryItems.category), 179 | ], 180 | ), 181 | ), 182 | ), 183 | ); 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /lib/services/Login.dart: -------------------------------------------------------------------------------- 1 | import 'package:digital_wallet/helper/DBHelper.dart'; 2 | import 'package:digital_wallet/helper/category_items.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:digital_wallet/services/signup.dart'; 5 | import 'package:toast/toast.dart'; 6 | 7 | import '../homepage.dart'; 8 | 9 | class Login extends StatefulWidget { 10 | static final id = "Login_screen"; 11 | @override 12 | _LoginState createState() => _LoginState(); 13 | } 14 | 15 | class _LoginState extends State { 16 | final formKey = GlobalKey(); 17 | String username, password; 18 | bool isLoading = false; 19 | 20 | _revealCC(String userName) async { 21 | setState(() { 22 | CategoryItems.cardsList.clear(); 23 | }); 24 | var o = await DBHlper().getCC(userName); 25 | if (o.length == 0) return; 26 | o.forEach((card) { 27 | setState(() { 28 | CategoryItems.cardsList.add(card); 29 | }); 30 | }); 31 | print(o[0].cardHolderName); 32 | } 33 | 34 | _revealPC(String userName) async { 35 | setState(() { 36 | CategoryItems.publicCardsList.clear(); 37 | }); 38 | var o = await DBHlper().getPC(userName); 39 | if (o.length == 0) return; 40 | o.forEach((card) { 41 | setState(() { 42 | CategoryItems.publicCardsList.add(card); 43 | }); 44 | }); 45 | } 46 | 47 | _submit() async { 48 | if (formKey.currentState.validate()) { 49 | formKey.currentState.save(); 50 | try { 51 | setState(() { 52 | isLoading = true; 53 | }); 54 | var users = await DBHlper().getUser(username, password); 55 | setState(() { 56 | isLoading = false; 57 | }); 58 | if (users.length == 0) { 59 | Toast.show("Inccorect Credentials", context, 60 | duration: 3, gravity: Toast.BOTTOM); 61 | } else { 62 | HomePage.user = users[0]; 63 | _revealCC(users[0].usrename); 64 | _revealPC(users[0].usrename); 65 | Navigator.push( 66 | context, 67 | MaterialPageRoute( 68 | builder: (BuildContext context) => HomePage(), 69 | ), 70 | ); 71 | } 72 | } catch (ex) { 73 | print(ex.toString()); 74 | } 75 | } 76 | } 77 | 78 | @override 79 | Widget build(BuildContext context) { 80 | return WillPopScope( 81 | onWillPop: () { 82 | return; 83 | }, 84 | child: Scaffold( 85 | body: Center( 86 | child: Column( 87 | mainAxisAlignment: MainAxisAlignment.center, 88 | children: [ 89 | Text( 90 | "Stouche", 91 | style: TextStyle( 92 | color: Theme.of(context).accentColor, 93 | fontSize: 50.0, 94 | fontFamily: "Billabong"), 95 | ), 96 | Form( 97 | key: formKey, 98 | child: Column( 99 | mainAxisSize: MainAxisSize.min, 100 | children: [ 101 | Padding( 102 | padding: EdgeInsets.symmetric( 103 | horizontal: 35.0, vertical: 10.0), 104 | child: TextFormField( 105 | decoration: InputDecoration( 106 | labelText: "Username", 107 | labelStyle: TextStyle( 108 | color: 109 | Theme.of(context).accentColor.withOpacity(0.7), 110 | ), 111 | ), 112 | validator: (String inpute) => 113 | inpute.isEmpty ? "fill the username !" : null, 114 | onSaved: (input) => username = input, 115 | ), 116 | ), 117 | Padding( 118 | padding: EdgeInsets.symmetric( 119 | horizontal: 35.0, vertical: 10.0), 120 | child: TextFormField( 121 | decoration: InputDecoration( 122 | labelText: "Password", 123 | labelStyle: TextStyle( 124 | color: 125 | Theme.of(context).accentColor.withOpacity(0.7), 126 | ), 127 | ), 128 | validator: (String inpute) => 129 | inpute.isEmpty ? "fill the Password !" : null, 130 | onSaved: (input) => password = input, 131 | obscureText: true, 132 | ), 133 | ), 134 | SizedBox( 135 | height: 20.0, 136 | ), 137 | Container( 138 | width: 250.0, 139 | child: FlatButton( 140 | padding: EdgeInsets.all(10.0), 141 | onPressed: _submit, 142 | color: Colors.blue, 143 | child: Text( 144 | "Login", 145 | style: TextStyle(color: Colors.white, fontSize: 16.0), 146 | ), 147 | ), 148 | ), 149 | SizedBox( 150 | height: 10.0, 151 | ), 152 | Container( 153 | width: 250.0, 154 | child: FlatButton( 155 | padding: EdgeInsets.all(10.0), 156 | onPressed: () => 157 | Navigator.pushNamed(context, SignUp.id), 158 | color: Theme.of(context).accentColor, 159 | child: Text( 160 | "Signup", 161 | style: TextStyle( 162 | color: Theme.of(context).primaryColor, 163 | fontSize: 16.0), 164 | ), 165 | ), 166 | ) 167 | ], 168 | ), 169 | ) 170 | ], 171 | ), 172 | ), 173 | ), 174 | ); 175 | } 176 | } 177 | -------------------------------------------------------------------------------- /lib/services/signup.dart: -------------------------------------------------------------------------------- 1 | import 'package:digital_wallet/helper/DBHelper.dart'; 2 | import 'package:digital_wallet/models/User.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:toast/toast.dart'; 5 | 6 | class SignUp extends StatefulWidget { 7 | static final id = "Signup_screen"; 8 | 9 | @override 10 | _SignUpState createState() => _SignUpState(); 11 | } 12 | 13 | class _SignUpState extends State { 14 | final formKey = GlobalKey(); 15 | String username, password, email; 16 | bool isLoading = false; 17 | 18 | _submit() async { 19 | if (formKey.currentState.validate()) { 20 | formKey.currentState.save(); 21 | try { 22 | setState(() { 23 | isLoading = true; 24 | }); 25 | User user = await DBHlper().insert(new User(username, password, 1)); 26 | print(user.usrename); 27 | setState(() { 28 | isLoading = false; 29 | }); 30 | Toast.show("Inscription Completed", context, 31 | duration: 2, gravity: Toast.BOTTOM); 32 | Navigator.pop(context); 33 | } catch (ex) { 34 | setState(() { 35 | isLoading = false; 36 | }); 37 | Toast.show("Username already in use", context, duration: 3, gravity: Toast.BOTTOM); 38 | } 39 | } 40 | } 41 | 42 | @override 43 | Widget build(BuildContext context) { 44 | return Scaffold( 45 | body: Center( 46 | child: SingleChildScrollView( 47 | child: Column( 48 | mainAxisAlignment: MainAxisAlignment.center, 49 | children: [ 50 | Text( 51 | "Stouche", 52 | style: TextStyle( 53 | color: Theme.of(context).accentColor, 54 | fontSize: 50.0, 55 | fontFamily: "Billabong"), 56 | ), 57 | Form( 58 | key: formKey, 59 | child: Column( 60 | mainAxisSize: MainAxisSize.min, 61 | children: [ 62 | Padding( 63 | padding: EdgeInsets.symmetric( 64 | horizontal: 35.0, vertical: 10.0), 65 | child: TextFormField( 66 | decoration: InputDecoration( 67 | labelText: "Username", 68 | labelStyle: TextStyle( 69 | color: 70 | Theme.of(context).accentColor.withOpacity(0.7), 71 | ), 72 | ), 73 | validator: (String inpute) => 74 | inpute.isEmpty ? "fill the username !" : null, 75 | onSaved: (input) => username = input, 76 | ), 77 | ), 78 | Padding( 79 | padding: EdgeInsets.symmetric( 80 | horizontal: 35.0, vertical: 10.0), 81 | child: TextFormField( 82 | decoration: InputDecoration( 83 | labelText: "Password", 84 | labelStyle: TextStyle( 85 | color: 86 | Theme.of(context).accentColor.withOpacity(0.7), 87 | ), 88 | ), 89 | validator: (String inpute) => 90 | inpute.isEmpty ? "fill the Password !" : null, 91 | onSaved: (input) => password = input, 92 | obscureText: true, 93 | ), 94 | ), 95 | Padding( 96 | padding: EdgeInsets.symmetric( 97 | horizontal: 35.0, vertical: 10.0), 98 | child: TextFormField( 99 | decoration: InputDecoration( 100 | labelText: "email", 101 | labelStyle: TextStyle( 102 | color: 103 | Theme.of(context).accentColor.withOpacity(0.7), 104 | ), 105 | ), 106 | validator: (String inpute) => 107 | inpute.isEmpty ? "fill the email !" : null, 108 | onSaved: (input) => email = input, 109 | obscureText: true, 110 | ), 111 | ), 112 | SizedBox( 113 | height: 20.0, 114 | ), 115 | Container( 116 | width: 250.0, 117 | child: FlatButton( 118 | padding: EdgeInsets.all(10.0), 119 | onPressed: () { 120 | isLoading ? print("Nothing") : _submit(); 121 | }, 122 | color: Colors.blue, 123 | child: isLoading 124 | ? CircularProgressIndicator() 125 | : Text( 126 | "SignUp", 127 | style: TextStyle( 128 | color: Colors.white, fontSize: 16.0), 129 | ), 130 | ), 131 | ), 132 | SizedBox( 133 | height: 10.0, 134 | ), 135 | isLoading 136 | ? SizedBox.shrink() 137 | : Container( 138 | width: 250.0, 139 | child: FlatButton( 140 | padding: EdgeInsets.all(10.0), 141 | onPressed: () => Navigator.pop(context), 142 | color: Theme.of(context).accentColor, 143 | child: Text( 144 | "Go back To Login", 145 | style: TextStyle( 146 | color: Theme.of(context).primaryColor, 147 | fontSize: 16.0), 148 | ), 149 | ), 150 | ) 151 | ], 152 | ), 153 | ) 154 | ], 155 | ), 156 | ), 157 | ), 158 | ); 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /lib/helper/category_items.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:digital_wallet/cardViewer.dart'; 4 | import 'package:digital_wallet/models/creditcard_model.dart'; 5 | import 'package:digital_wallet/screens/publicCardsViewer.dart'; 6 | import 'package:digital_wallet/ui/card_create.dart'; 7 | import 'package:digital_wallet/ui/createcard.dart'; 8 | import 'package:digital_wallet/ui/publicCards.dart'; 9 | import 'package:intl/intl.dart'; 10 | 11 | class CategoryItems { 12 | static List> category = [ 13 | { 14 | 'name': 'Wallets', 15 | 'img': 'assets/images/category/cc.png', 16 | "screen": CardViewer() 17 | }, 18 | { 19 | 'name': 'Identifications', 20 | 'img': 'assets/images/category/id.png', 21 | "screen": MyCardsViewer(type: TYPE.identifiactions) 22 | }, 23 | { 24 | 'name': 'Shopping', 25 | 'img': 'assets/images/category/loyality.png', 26 | "screen": MyCardsViewer(type: TYPE.shopping) 27 | }, 28 | { 29 | 'name': 'Students', 30 | 'img': 'assets/images/category/student.jpg', 31 | "screen": MyCardsViewer(type: TYPE.students) 32 | }, 33 | { 34 | 'name': 'Transport', 35 | 'img': 'assets/images/category/transport.png', 36 | "screen": MyCardsViewer(type: TYPE.transport) 37 | }, 38 | { 39 | 'name': 'Other Docs', 40 | 'img': 'assets/images/category/other.png', 41 | "screen": MyCardsViewer(type: TYPE.other) 42 | }, 43 | ]; 44 | 45 | static List> cards = [ 46 | { 47 | 'name': 'Identity Card', 48 | 'img': 'assets/images/cards/identitycard.png', 49 | 'screen': Createcard(type: CardType.id, secondeType: TYPE.identifiactions) 50 | }, 51 | { 52 | 'name': 'Driving Licnce', 53 | 'img': 'assets/images/cards/driveCC.png', 54 | 'screen': 55 | Createcard(type: CardType.driver, secondeType: TYPE.identifiactions) 56 | }, 57 | { 58 | 'name': 'Student Card', 59 | 'img': 'assets/images/cards/studentCC.png', 60 | 'screen': Createcard(type: CardType.student, secondeType: TYPE.students) 61 | }, 62 | { 63 | 'name': 'Debit Card', 64 | 'img': 'assets/images/cards/CreditCC.png', 65 | 'screen': CardCreate(type: "DC") 66 | }, 67 | { 68 | 'name': 'Transport Card', 69 | 'img': 'assets/images/cards/transportCC.png', 70 | 'screen': 71 | Createcard(type: CardType.transport, secondeType: TYPE.transport) 72 | }, 73 | { 74 | 'name': 'Employee Card', 75 | 'img': 'assets/images/cards/employeeCC.png', 76 | 'screen': Createcard(type: CardType.student, secondeType: TYPE.students) 77 | }, 78 | { 79 | 'name': 'Loyality Card', 80 | 'img': 'assets/images/cards/loyalityCC.png', 81 | 'screen': Createcard(type: CardType.loyality, secondeType: TYPE.shopping) 82 | }, 83 | { 84 | 'name': 'GYM Card', 85 | 'img': 'assets/images/cards/gymCC.png', 86 | 'screen': Createcard(type: CardType.gym, secondeType: TYPE.other) 87 | }, 88 | { 89 | 'name': 'Health Card', 90 | 'img': 'assets/images/cards/HealthCC.png', 91 | 'screen': Createcard(type: CardType.health, secondeType: TYPE.other) 92 | }, 93 | { 94 | 'name': 'AirLine Card', 95 | 'img': 'assets/images/cards/airlineCC.png', 96 | 'screen': 97 | Createcard(type: CardType.transport, secondeType: TYPE.transport) 98 | }, 99 | { 100 | 'name': 'Gift Card', 101 | 'img': 'assets/images/cards/giftCC.png', 102 | 'screen': CardCreate(type: "GC") 103 | }, 104 | ]; 105 | //?----------------------------------------------- 106 | static List cardsList = [ 107 | // new CreditCard( 108 | // cardHolderName: "Iheb Briki", 109 | // cardNumber: "5118 1574 5711 3526", 110 | // cvvCode: "532", 111 | // expiryDate: "20/2019", 112 | // colorIndex: 0), 113 | // new CreditCard( 114 | // cardHolderName: "Moncer CHtioui", 115 | // cardNumber: "4618 1574 5711 3526", 116 | // cvvCode: "401", 117 | // expiryDate: "20/2019", 118 | // colorIndex: 0), 119 | // new CreditCard( 120 | // cardHolderName: "Firas Boukadida ", 121 | // cardNumber: "3718 1574 5711 7546", 122 | // cvvCode: "125", 123 | // expiryDate: "20/2019", 124 | // colorIndex: 0), 125 | // new CreditCard( 126 | // cardHolderName: "Weld Gzeuez", 127 | // cardNumber: "5118 1574 8975 7826", 128 | // cvvCode: "332", 129 | // expiryDate: "20/2021", 130 | // colorIndex: 0), 131 | // new CreditCard( 132 | // cardHolderName: "Amira Dgham", 133 | // cardNumber: "1111 1111 1111 1111", 134 | // cvvCode: "111", 135 | // expiryDate: "Google Gift Card", 136 | // colorIndex: 3), 137 | ]; 138 | //-------------------------------------------- 139 | static List colorsList = [ 140 | Color.fromRGBO(61, 132, 223, 1.0), //LightBlue credit card 141 | Color.fromRGBO(114, 71, 200, 1.0), //Purple debit card 142 | Color.fromRGBO(106, 188, 121, 1.0), //Green check 143 | Color.fromRGBO(229, 92, 131, 1.0), //Pink gift card 144 | Color.fromRGBO(96, 200, 227, 1.0), //Cyan 145 | Color.fromRGBO(219, 157, 80, 1.0), //Orange 146 | Color.fromRGBO(60, 61, 63, 1.0), //Black 147 | Color.fromRGBO(222, 88, 116, 1.0), //Salmon check 148 | Color.fromRGBO(128, 182, 234, 1.0), //LightCyan 149 | ]; 150 | //?---------------------------------------------- 151 | static List publicCardsList = [ 152 | // new Cards( 153 | // name: "Iheb", 154 | // prenom: "Briki", 155 | // nationality: "Tunisian", 156 | // type: CardType.id, 157 | // userName: HomePage.user.usrename, 158 | // ), 159 | // new Cards( 160 | // name: "Iheb", 161 | // prenom: "Briki", 162 | // birthDate: "15/01/1999", 163 | // nationality: "Tunisian", 164 | // type: CardType.passport, 165 | // userName: HomePage.user.usrename, 166 | // ), 167 | // new Cards( 168 | // name: "Iheb", 169 | // prenom: "Briki", 170 | // birthDate: "15/01/1999", 171 | // nationality: "Tunisian", 172 | // type: CardType.gym, 173 | // userName: HomePage.user.usrename, 174 | // ), 175 | // new Cards( 176 | // name: "Iheb", 177 | // prenom: "Briki", 178 | // birthDate: "15/01/1999", 179 | // nationality: "Tunisian", 180 | // type: CardType.health, 181 | // userName: HomePage.user.usrename, 182 | // ), 183 | // new Cards( 184 | // name: "Iheb", 185 | // prenom: "Briki", 186 | // birthDate: "15/01/1999", 187 | // nationality: "Tunisian", 188 | // type: CardType.student, 189 | // userName: HomePage.user.usrename, 190 | // ), 191 | ]; 192 | 193 | static returnDate() 194 | { 195 | return DateFormat('EEE d MMM,kk:mm:ss').format(DateTime.now()); 196 | } 197 | } 198 | -------------------------------------------------------------------------------- /lib/screens/cardManage.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:digital_wallet/helper/DBHelper.dart'; 4 | import 'package:digital_wallet/helper/category_items.dart'; 5 | import 'package:digital_wallet/models/stats.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:digital_wallet/cardViewer.dart'; 8 | import 'package:digital_wallet/models/creditcard_model.dart'; 9 | import 'package:snappable/snappable.dart'; 10 | import 'package:flutter_credit_card/flutter_credit_card.dart' as credit; 11 | import 'package:toast/toast.dart'; 12 | 13 | import '../cardViewer.dart'; 14 | import '../homepage.dart'; 15 | 16 | class CardManagment extends StatefulWidget { 17 | final CreditCard card; 18 | final int indice; 19 | CardManagment({@required this.indice, this.card}); 20 | 21 | @override 22 | _CardManagmentState createState() => _CardManagmentState(); 23 | } 24 | 25 | class _CardManagmentState extends State { 26 | final key = GlobalKey(); 27 | bool isLoading = false; 28 | 29 | _snap() async { 30 | setState(() { 31 | isLoading = true; 32 | }); 33 | await key.currentState.snap(); 34 | Timer(Duration(milliseconds: 1000), () { 35 | DBHlper().deleteCC(CategoryItems.cardsList[widget.indice]); 36 | DBHlper().insertSTAT( 37 | new Stats(HomePage.user.usrename, "Card has been deleted", 38 | CategoryItems.returnDate(), 2), 39 | ); 40 | setState( 41 | () { 42 | isLoading = false; 43 | CategoryItems.cardsList.removeAt(widget.indice); 44 | }, 45 | ); 46 | Navigator.push( 47 | context, 48 | MaterialPageRoute( 49 | builder: (BuildContext context) => CardViewer(), 50 | ), 51 | ); 52 | }); 53 | } 54 | 55 | @override 56 | void dispose() { 57 | super.dispose(); 58 | } 59 | 60 | @override 61 | Widget build(BuildContext context) { 62 | return Scaffold( 63 | appBar: AppBar( 64 | backgroundColor: Colors.transparent, 65 | elevation: 0, 66 | ), 67 | body: Container( 68 | child: Padding( 69 | padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0), 70 | child: Column( 71 | children: [ 72 | isLoading 73 | ? Padding( 74 | padding: EdgeInsets.only(bottom: 10.0), 75 | child: LinearProgressIndicator( 76 | backgroundColor: Colors.blue[200], 77 | valueColor: AlwaysStoppedAnimation(Colors.blue), 78 | ), 79 | ) 80 | : SizedBox.shrink(), 81 | Snappable( 82 | duration: Duration(milliseconds: 1000), 83 | key: key, 84 | child: Container( 85 | height: MediaQuery.of(context).size.height * .36, 86 | child: credit.CreditCardWidget( 87 | height: MediaQuery.of(context).size.height * .36, 88 | cardHolderName: widget.card.cardHolderName, 89 | cardNumber: widget.card.cardNumber, 90 | cvvCode: widget.card.cvvCode, 91 | expiryDate: widget.card.expiryDate, 92 | showBackView: false, 93 | cardbgColor: 94 | CategoryItems.colorsList[widget.card.colorIndex], 95 | ), 96 | ), 97 | ), 98 | SizedBox( 99 | height: 12.0, 100 | ), 101 | Padding( 102 | padding: const EdgeInsets.symmetric(horizontal: 15.0), 103 | child: MaterialButton( 104 | onPressed: () { 105 | Toast.show( 106 | "This feature is only for premium Member", context, 107 | duration: 3, gravity: Toast.BOTTOM); 108 | }, 109 | color: Theme.of(context).cardColor, 110 | child: Center( 111 | child: Text( 112 | "Set Reminder", 113 | style: TextStyle( 114 | color: Theme.of(context).accentColor, 115 | fontFamily: "Google", 116 | fontSize: 15.0), 117 | ), 118 | ), 119 | ), 120 | ), 121 | SizedBox( 122 | height: 10.0, 123 | ), 124 | Padding( 125 | padding: const EdgeInsets.symmetric(horizontal: 15.0), 126 | child: MaterialButton( 127 | onPressed: () {}, 128 | color: Theme.of(context).cardColor, 129 | child: Center( 130 | child: Text( 131 | "Edit Card", 132 | style: TextStyle( 133 | color: Theme.of(context).accentColor, 134 | fontFamily: "Google", 135 | fontSize: 15.0), 136 | ), 137 | ), 138 | ), 139 | ), 140 | SizedBox( 141 | height: 10.0, 142 | ), 143 | Padding( 144 | padding: const EdgeInsets.symmetric(horizontal: 15.0), 145 | child: MaterialButton( 146 | onPressed: () { 147 | showDialog( 148 | context: context, 149 | builder: (BuildContext context) { 150 | // return object of type Dialog 151 | return AlertDialog( 152 | title: new Text("Are You Sure"), 153 | content: new Text("Complete Deleting ?"), 154 | actions: [ 155 | // usually buttons at the bottom of the dialog 156 | new FlatButton( 157 | child: new Text("Yes"), 158 | onPressed: () { 159 | _snap(); 160 | Navigator.of(context).pop(); 161 | }, 162 | ), 163 | new FlatButton( 164 | child: new Text("No"), 165 | onPressed: () { 166 | Navigator.of(context).pop(); 167 | }, 168 | ), 169 | ], 170 | ); 171 | }, 172 | ); 173 | }, 174 | color: Theme.of(context).cardColor, 175 | child: Center( 176 | child: Text( 177 | "Delete Card", 178 | style: TextStyle( 179 | color: Theme.of(context).accentColor, 180 | fontFamily: "Google", 181 | fontSize: 15.0), 182 | ), 183 | ), 184 | ), 185 | ), 186 | ], 187 | ), 188 | ), 189 | ), 190 | ); 191 | } 192 | } 193 | -------------------------------------------------------------------------------- /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: "2.0.11" 11 | args: 12 | dependency: transitive 13 | description: 14 | name: args 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.5.2" 18 | async: 19 | dependency: transitive 20 | description: 21 | name: async 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.3.0" 25 | boolean_selector: 26 | dependency: transitive 27 | description: 28 | name: boolean_selector 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.0.5" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.2" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.14.11" 46 | convert: 47 | dependency: transitive 48 | description: 49 | name: convert 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "2.1.1" 53 | crypto: 54 | dependency: transitive 55 | description: 56 | name: crypto 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.1.4" 60 | cupertino_icons: 61 | dependency: "direct main" 62 | description: 63 | name: cupertino_icons 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "0.1.3" 67 | flutter: 68 | dependency: "direct main" 69 | description: flutter 70 | source: sdk 71 | version: "0.0.0" 72 | flutter_credit_card: 73 | dependency: "direct dev" 74 | description: 75 | name: flutter_credit_card 76 | url: "https://pub.dartlang.org" 77 | source: hosted 78 | version: "0.1.1" 79 | flutter_page_indicator: 80 | dependency: transitive 81 | description: 82 | name: flutter_page_indicator 83 | url: "https://pub.dartlang.org" 84 | source: hosted 85 | version: "0.0.3" 86 | flutter_swiper: 87 | dependency: "direct dev" 88 | description: 89 | name: flutter_swiper 90 | url: "https://pub.dartlang.org" 91 | source: hosted 92 | version: "1.1.6" 93 | flutter_test: 94 | dependency: "direct dev" 95 | description: flutter 96 | source: sdk 97 | version: "0.0.0" 98 | image: 99 | dependency: transitive 100 | description: 101 | name: image 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "2.1.9" 105 | image_picker: 106 | dependency: "direct dev" 107 | description: 108 | name: image_picker 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "0.6.2+1" 112 | intl: 113 | dependency: "direct dev" 114 | description: 115 | name: intl 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "0.16.0" 119 | matcher: 120 | dependency: transitive 121 | description: 122 | name: matcher 123 | url: "https://pub.dartlang.org" 124 | source: hosted 125 | version: "0.12.5" 126 | meta: 127 | dependency: transitive 128 | description: 129 | name: meta 130 | url: "https://pub.dartlang.org" 131 | source: hosted 132 | version: "1.1.7" 133 | path: 134 | dependency: transitive 135 | description: 136 | name: path 137 | url: "https://pub.dartlang.org" 138 | source: hosted 139 | version: "1.6.4" 140 | path_provider: 141 | dependency: "direct dev" 142 | description: 143 | name: path_provider 144 | url: "https://pub.dartlang.org" 145 | source: hosted 146 | version: "0.5.0+1" 147 | pedantic: 148 | dependency: transitive 149 | description: 150 | name: pedantic 151 | url: "https://pub.dartlang.org" 152 | source: hosted 153 | version: "1.8.0+1" 154 | petitparser: 155 | dependency: transitive 156 | description: 157 | name: petitparser 158 | url: "https://pub.dartlang.org" 159 | source: hosted 160 | version: "2.4.0" 161 | provider: 162 | dependency: "direct dev" 163 | description: 164 | name: provider 165 | url: "https://pub.dartlang.org" 166 | source: hosted 167 | version: "3.2.0" 168 | quiver: 169 | dependency: transitive 170 | description: 171 | name: quiver 172 | url: "https://pub.dartlang.org" 173 | source: hosted 174 | version: "2.0.5" 175 | sky_engine: 176 | dependency: transitive 177 | description: flutter 178 | source: sdk 179 | version: "0.0.99" 180 | snappable: 181 | dependency: "direct dev" 182 | description: 183 | name: snappable 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "1.0.1" 187 | source_span: 188 | dependency: transitive 189 | description: 190 | name: source_span 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "1.5.5" 194 | sqflite: 195 | dependency: "direct dev" 196 | description: 197 | name: sqflite 198 | url: "https://pub.dartlang.org" 199 | source: hosted 200 | version: "1.1.7+3" 201 | stack_trace: 202 | dependency: transitive 203 | description: 204 | name: stack_trace 205 | url: "https://pub.dartlang.org" 206 | source: hosted 207 | version: "1.9.3" 208 | stream_channel: 209 | dependency: transitive 210 | description: 211 | name: stream_channel 212 | url: "https://pub.dartlang.org" 213 | source: hosted 214 | version: "2.0.0" 215 | string_scanner: 216 | dependency: transitive 217 | description: 218 | name: string_scanner 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "1.0.5" 222 | synchronized: 223 | dependency: transitive 224 | description: 225 | name: synchronized 226 | url: "https://pub.dartlang.org" 227 | source: hosted 228 | version: "2.1.1" 229 | term_glyph: 230 | dependency: transitive 231 | description: 232 | name: term_glyph 233 | url: "https://pub.dartlang.org" 234 | source: hosted 235 | version: "1.1.0" 236 | test_api: 237 | dependency: transitive 238 | description: 239 | name: test_api 240 | url: "https://pub.dartlang.org" 241 | source: hosted 242 | version: "0.2.5" 243 | toast: 244 | dependency: "direct main" 245 | description: 246 | name: toast 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "0.1.5" 250 | transformer_page_view: 251 | dependency: transitive 252 | description: 253 | name: transformer_page_view 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "0.1.6" 257 | typed_data: 258 | dependency: transitive 259 | description: 260 | name: typed_data 261 | url: "https://pub.dartlang.org" 262 | source: hosted 263 | version: "1.1.6" 264 | vector_math: 265 | dependency: transitive 266 | description: 267 | name: vector_math 268 | url: "https://pub.dartlang.org" 269 | source: hosted 270 | version: "2.0.8" 271 | xml: 272 | dependency: transitive 273 | description: 274 | name: xml 275 | url: "https://pub.dartlang.org" 276 | source: hosted 277 | version: "3.5.0" 278 | sdks: 279 | dart: ">=2.5.0 <3.0.0" 280 | flutter: ">=1.9.1 <2.0.0" 281 | -------------------------------------------------------------------------------- /lib/helper/DBHelper.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:digital_wallet/models/User.dart'; 3 | import 'package:digital_wallet/models/creditcard_model.dart'; 4 | import 'package:digital_wallet/models/stats.dart'; 5 | import 'package:digital_wallet/ui/publicCards.dart'; 6 | import 'package:sqflite/sqflite.dart'; 7 | import 'package:path_provider/path_provider.dart'; 8 | import 'package:path/path.dart'; 9 | 10 | class DBHlper { 11 | static Database _db; 12 | static const String USERNAME = 'username'; 13 | static const String PASSWORD = 'password'; 14 | static const String TABLE = 'users'; 15 | static const String TABLE_CC = 'CreditCards'; 16 | static const String TABLE_PC = 'PublicCards'; 17 | static const String TABLE_STAT = 'Statistic'; 18 | static const String DB_NAME = 'stouche.db'; 19 | 20 | Future get db async { 21 | if (_db != null) { 22 | return _db; 23 | } 24 | _db = await initDb(); 25 | return _db; 26 | } 27 | 28 | initDb() async { 29 | Directory documentsDirectory = await getApplicationDocumentsDirectory(); 30 | String path = join(documentsDirectory.path, DB_NAME); 31 | var db = await openDatabase(path, version: 2, onCreate: _onCreate); 32 | return db; 33 | } 34 | 35 | //-------Create Table 36 | _onCreate(Database db, int version) async { 37 | await db.execute( 38 | "CREATE TABLE $TABLE ($USERNAME varchar(55) NOT NULL PRIMARY KEY,$PASSWORD varchar(255) NOT NULL)"); 39 | //---Credit Cards 40 | await db.execute( 41 | "CREATE TABLE $TABLE_CC ($USERNAME varchar(55) NOT NULL,cardNumber varchar(55) NOT NULL,cardHolderName varchar(55),expiryDate varchar(55)" + 42 | ",cvvCode varchar(55),colorIndex int , PRIMARY KEY($USERNAME,cardHolderName,cardNumber))"); 43 | //---Public Cards 44 | await db.execute( 45 | "CREATE TABLE $TABLE_PC ($USERNAME varchar(55) NOT NULL,name varchar(55),prenom varchar(55),birthDate varchar(55)" + 46 | ",nationality varchar(55),img varchar,type varchar(55),PRIMARY KEY($USERNAME,name,type,prenom))"); 47 | // ---STATISTICS 48 | await db.execute( 49 | "CREATE TABLE $TABLE_STAT ($USERNAME varchar(55) NOT NULL,description varchar(255) NOT NULL ,time varchar(55) NOT NULL , code int not null)"); 50 | } 51 | 52 | //-------Insert User into table 53 | Future insert(User user) async { 54 | var dbClient = await db; 55 | int id = await dbClient.insert(TABLE, user.toMap()); 56 | print("User N $id"); 57 | return user; 58 | } 59 | 60 | //-------Get user 61 | Future> getUser(String username, String pass) async { 62 | var dbClient = await db; 63 | List maps = await dbClient.rawQuery( 64 | "SELECT * FROM $TABLE where ($USERNAME = '$username') and ($PASSWORD = '$pass')"); 65 | List employees = []; 66 | if (maps.length > 0) { 67 | for (int i = 0; i < maps.length; i++) { 68 | employees.add(User.fromMap(maps[i])); 69 | } 70 | } 71 | return employees; 72 | } 73 | 74 | //----------DROP ALL 75 | drop() async { 76 | // var dbClient = await db; 77 | 78 | // await dbClient.rawDelete("DROP TABLE $TABLE_CC"); 79 | // await dbClient.execute( 80 | // "CREATE TABLE $TABLE_CC ($USERNAME varchar(55) NOT NULL,cardNumber varchar(55) NOT NULL,cardHolderName varchar(55),expiryDate varchar(55)" + 81 | // ",cvvCode varchar(55),colorIndex int , PRIMARY KEY($USERNAME,cardHolderName,cardNumber))"); 82 | 83 | // await dbClient.execute( 84 | // "CREATE TABLE $TABLE_PC ($USERNAME varchar(55) NOT NULL,name varchar(55),prenom varchar(55),birthDate varchar(55)" + 85 | // ",nationality varchar(55),img varchar,type varchar(55),PRIMARY KEY($USERNAME,name,type,prenom))"); 86 | // await dbClient.execute( 87 | // "CREATE TABLE $TABLE_CC ($USERNAME varchar(55) NOT NULL,cardNumber varchar(55) NOT NULL,cardHolderName varchar(55),expiryDate varchar(55)" + 88 | // ",cvvCode varchar(55),colorIndex int , PRIMARY KEY($USERNAME,cardHolderName))"); 89 | //---Public Cards 90 | // await dbClient.execute( 91 | // "CREATE TABLE $TABLE_PC ($USERNAME varchar(55) NOT NULL,name varchar(55),prenom varchar(55),birthDate varchar(55)" + 92 | // ",nationality varchar(55),img varchar,type varchar(55))"); 93 | } 94 | 95 | //-------Delete from table 96 | Future delete(String username) async { 97 | var dbClient = await db; 98 | return await dbClient 99 | .delete(TABLE, where: '$USERNAME = ?', whereArgs: [username]); 100 | } 101 | 102 | //update user 103 | Future update(User user) async { 104 | var dbClient = await db; 105 | return await dbClient.update(TABLE, user.toMap(), 106 | where: '$USERNAME = ?', whereArgs: [user.usrename]); 107 | } 108 | 109 | //-------------------Others Table Handler 110 | 111 | Future> getCC(String username) async { 112 | var dbClient = await db; 113 | List maps = await dbClient 114 | .rawQuery("SELECT * FROM $TABLE_CC where $USERNAME = '$username'"); 115 | List creditCards = []; 116 | if (maps.length > 0) { 117 | for (int i = 0; i < maps.length; i++) { 118 | creditCards.add(CreditCard.fromMap(maps[i])); 119 | } 120 | } 121 | return creditCards; 122 | } 123 | 124 | Future insertCC(CreditCard card) async { 125 | try { 126 | var dbClient = await db; 127 | int id = await dbClient.insert(TABLE_CC, card.toMap()); 128 | print("Card N° $id"); 129 | return card; 130 | } catch (ex) {} 131 | } 132 | 133 | Future deleteCC(CreditCard card) async { 134 | var dbClient = await db; 135 | return await dbClient.rawDelete( 136 | "DELETE FROM $TABLE_CC WHERE ($USERNAME = '${card.username}') and (cardHolderName = '${card.cardHolderName}')"); 137 | } 138 | 139 | //************************************************************/ 140 | Future> getPC(String username) async { 141 | var dbClient = await db; 142 | List maps = await dbClient 143 | .rawQuery("SELECT * FROM $TABLE_PC where $USERNAME = '$username'"); 144 | List cardsList = []; 145 | if (maps.length > 0) { 146 | for (int i = 0; i < maps.length; i++) { 147 | cardsList.add(Cards.fromMap(maps[i])); 148 | } 149 | } 150 | return cardsList; 151 | } 152 | 153 | Future insertPC(Cards card) async { 154 | var dbClient = await db; 155 | int id = await dbClient.insert(TABLE_PC, card.toMap()); 156 | print("Public Card N° $id"); 157 | return card; 158 | } 159 | 160 | Future deletePC(Cards card) async { 161 | var dbClient = await db; 162 | return await dbClient.rawDelete( 163 | "DELETE FROM $TABLE_PC WHERE ($USERNAME = '${card.userName}') and (name = '${card.name}') and (type = '${card.type}') and (prenom = '${card.prenom}')"); 164 | } 165 | //------------------------------------- 166 | 167 | //********************************************************************/ 168 | 169 | Future insertSTAT(Stats statistic) async { 170 | var dbClient = await db; 171 | int id = await dbClient.insert(TABLE_STAT, statistic.toMap()); 172 | print("Stats N° $id"); 173 | return statistic; 174 | } 175 | 176 | Future> getStats(String username) async { 177 | var dbClient = await db; 178 | List maps = await dbClient 179 | .rawQuery("SELECT * FROM $TABLE_STAT where $USERNAME = '$username'"); 180 | List statistics = []; 181 | if (maps.length > 0) { 182 | for (int i = 0; i < maps.length; i++) { 183 | statistics.add(Stats.fromMap(maps[i])); 184 | } 185 | } 186 | return statistics; 187 | } 188 | 189 | Future deleteStats(String username) async { 190 | var dbClient = await db; 191 | return await dbClient 192 | .rawDelete("DELETE FROM $TABLE_STAT WHERE ($USERNAME = '$username')"); 193 | } 194 | 195 | //********************************************************************/ 196 | 197 | Future close() async { 198 | var dbClient = await db; 199 | dbClient.close(); 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /lib/screens/profile_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:digital_wallet/ui/viewStats.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:provider/provider.dart'; 4 | import 'package:digital_wallet/helper/category_items.dart'; 5 | import 'package:digital_wallet/provider_models/theme_provider.dart'; 6 | import 'package:digital_wallet/services/Login.dart'; 7 | 8 | import '../homepage.dart'; 9 | 10 | class ProfileScreen extends StatefulWidget { 11 | @override 12 | _ProfileScreenState createState() => _ProfileScreenState(); 13 | } 14 | 15 | class _ProfileScreenState extends State { 16 | String totalCards; 17 | 18 | @override 19 | void initState() { 20 | super.initState(); 21 | setState(() { 22 | totalCards = (CategoryItems.cardsList.length + 23 | CategoryItems.publicCardsList.length) 24 | .toString(); 25 | }); 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | final themeProvider = Provider.of(context); 31 | return Scaffold( 32 | appBar: AppBar( 33 | backgroundColor: Colors.transparent, 34 | elevation: 0.0, 35 | leading: Switch( 36 | value: themeProvider.isLightTheme, 37 | onChanged: (val) { 38 | themeProvider.setThemeData = val; 39 | }, 40 | ), 41 | actions: [ 42 | Padding( 43 | padding: const EdgeInsets.all(11.0), 44 | child: Container( 45 | padding: const EdgeInsets.symmetric(horizontal: 12.0), 46 | height: 8.0, 47 | child: InkWell( 48 | onTap: () {}, 49 | child: Row( 50 | children: [ 51 | Icon( 52 | Icons.settings, 53 | color: Theme.of(context).accentColor, 54 | ), 55 | SizedBox( 56 | width: 5.0, 57 | ), 58 | Text( 59 | "Edit", 60 | style: TextStyle( 61 | color: Theme.of(context).accentColor, 62 | fontFamily: "Google", 63 | fontWeight: FontWeight.bold, 64 | ), 65 | ), 66 | ], 67 | ), 68 | ), 69 | decoration: BoxDecoration( 70 | color: Colors.grey[400].withOpacity(0.7), 71 | borderRadius: BorderRadius.circular(18.0), 72 | ), 73 | ), 74 | ) 75 | ], 76 | ), 77 | body: SingleChildScrollView( 78 | child: Container( 79 | child: Center( 80 | child: Container( 81 | child: Column( 82 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 83 | children: [ 84 | firstPart(context), 85 | SizedBox( 86 | height: 25.0, 87 | ), 88 | secondePart(), 89 | ], 90 | ), 91 | ), 92 | ), 93 | ), 94 | ), 95 | ); 96 | } 97 | 98 | Widget firstPart(BuildContext context) { 99 | return Container( 100 | height: MediaQuery.of(context).size.height * 0.4, 101 | child: SingleChildScrollView( 102 | child: Container( 103 | child: Column( 104 | mainAxisAlignment: MainAxisAlignment.center, 105 | children: [ 106 | Container( 107 | height: 155.0, 108 | width: 155.0, 109 | decoration: BoxDecoration( 110 | color: Colors.blue.withOpacity(0.4), 111 | shape: BoxShape.circle, 112 | image: DecorationImage( 113 | fit: BoxFit.cover, 114 | image: AssetImage("assets/images/default.png"), 115 | ), 116 | ), 117 | ), 118 | SizedBox( 119 | height: 10.0, 120 | ), 121 | Text( 122 | HomePage.user.usrename, 123 | style: TextStyle( 124 | color: Theme.of(context).accentColor, 125 | fontSize: 18.0, 126 | fontStyle: FontStyle.italic, 127 | fontWeight: FontWeight.w500), 128 | ), 129 | SizedBox( 130 | height: 6.0, 131 | ), 132 | Container( 133 | padding: EdgeInsets.all(8.0), 134 | child: Text( 135 | "Free Member", 136 | style: TextStyle( 137 | fontSize: 12.0, 138 | fontStyle: FontStyle.italic, 139 | color: Theme.of(context).primaryColor), 140 | ), 141 | decoration: BoxDecoration( 142 | color: Colors.redAccent, 143 | borderRadius: BorderRadius.circular(25.0), 144 | ), 145 | ), 146 | Padding( 147 | padding: const EdgeInsets.all(8.0), 148 | child: Text( 149 | totalCards == null 150 | ? "Total Cards : 0" 151 | : "Total Cards : $totalCards", 152 | style: TextStyle( 153 | fontSize: 12.0, 154 | fontWeight: FontWeight.bold, 155 | color: Theme.of(context).accentColor), 156 | ), 157 | ), 158 | ], 159 | ), 160 | ), 161 | ), 162 | ); 163 | } 164 | 165 | Widget secondePart() { 166 | return Container( 167 | decoration: BoxDecoration( 168 | color: Theme.of(context).cardColor, 169 | borderRadius: BorderRadius.only( 170 | topLeft: Radius.circular(25.0), 171 | topRight: Radius.circular(25.0), 172 | ), 173 | ), 174 | child: Padding( 175 | padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 8.0), 176 | child: Column( 177 | children: [ 178 | ListTile( 179 | onTap: () async { 180 | // DBHlper().drop(); 181 | }, 182 | leading: 183 | Icon(Icons.update, size: 35.0, color: Colors.orangeAccent), 184 | title: Text( 185 | "Bcome a pro Member", 186 | style: TextStyle( 187 | color: Theme.of(context).accentColor, 188 | fontFamily: "Google", 189 | fontSize: 16.0), 190 | ), 191 | trailing: Icon(Icons.arrow_forward_ios, 192 | color: Theme.of(context).accentColor), 193 | ), 194 | ListTile( 195 | onTap: () => Navigator.push(context, 196 | MaterialPageRoute(builder: (context) => ViewStats())), 197 | leading: Icon( 198 | Icons.assessment, 199 | size: 35.0, 200 | color: Colors.orange[900], 201 | ), 202 | title: Text( 203 | "My Statistic", 204 | style: TextStyle( 205 | color: Theme.of(context).accentColor, 206 | fontFamily: "Google", 207 | fontSize: 16.0), 208 | ), 209 | trailing: Icon(Icons.arrow_forward_ios, 210 | color: Theme.of(context).accentColor), 211 | ), 212 | Padding( 213 | padding: const EdgeInsets.symmetric(horizontal: 30.0), 214 | child: Divider(), 215 | ), 216 | ListTile( 217 | leading: Icon(Icons.help_outline, size: 35.0, color: Colors.grey), 218 | title: Text( 219 | "Help", 220 | style: TextStyle( 221 | color: Theme.of(context).accentColor, 222 | fontFamily: "Google", 223 | fontSize: 16.0), 224 | ), 225 | trailing: Icon(Icons.arrow_forward_ios, 226 | color: Theme.of(context).accentColor), 227 | ), 228 | ListTile( 229 | onTap: () => Navigator.pushNamed(context, Login.id), 230 | leading: Icon(Icons.assignment_return, 231 | size: 35.0, color: Colors.redAccent), 232 | title: Text( 233 | "Logout", 234 | style: TextStyle( 235 | color: Theme.of(context).accentColor, 236 | fontFamily: "Google", 237 | fontSize: 16.0), 238 | ), 239 | trailing: Icon(Icons.arrow_forward_ios, 240 | color: Theme.of(context).accentColor), 241 | ), 242 | ], 243 | ), 244 | ), 245 | ); 246 | } 247 | } 248 | -------------------------------------------------------------------------------- /lib/creations/creditCC.dart: -------------------------------------------------------------------------------- 1 | import 'package:digital_wallet/helper/DBHelper.dart'; 2 | import 'package:digital_wallet/models/stats.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:digital_wallet/cardViewer.dart'; 5 | import 'package:digital_wallet/helper/category_items.dart'; 6 | import 'package:digital_wallet/helper/formatters.dart'; 7 | import 'package:digital_wallet/models/creditcard_model.dart'; 8 | import 'package:flutter_credit_card/flutter_credit_card.dart' as cr; 9 | 10 | import '../homepage.dart'; 11 | 12 | class CreditCC extends StatefulWidget { 13 | static String name = "Credit Card"; 14 | @override 15 | _CreditCCState createState() => _CreditCCState(); 16 | } 17 | 18 | class _CreditCCState extends State { 19 | FocusNode ccvFocused = new FocusNode(); 20 | bool ccv = false; 21 | TextEditingController cardNumber = TextEditingController(); 22 | TextEditingController cardHolderName = TextEditingController(); 23 | TextEditingController _ccv = TextEditingController(); 24 | TextEditingController expiredate = TextEditingController(); 25 | 26 | String name, number, expir, cc; 27 | 28 | @override 29 | void initState() { 30 | super.initState(); 31 | 32 | ccvFocused.addListener(() { 33 | setState(() { 34 | ccv = ccvFocused.hasFocus; 35 | }); 36 | }); 37 | } 38 | 39 | @override 40 | void dispose() { 41 | cardHolderName.dispose(); 42 | super.dispose(); 43 | } 44 | 45 | @override 46 | Widget build(BuildContext context) { 47 | return Container( 48 | child: Column( 49 | crossAxisAlignment: CrossAxisAlignment.start, 50 | children: [ 51 | cardModel(), 52 | SizedBox( 53 | height: 2.0, 54 | ), 55 | Padding( 56 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 57 | child: Container( 58 | padding: EdgeInsets.all(8.0), 59 | child: TextField( 60 | keyboardType: TextInputType.number, 61 | inputFormatters: [ 62 | MaskedTextInputFormatter( 63 | mask: 'xxxx xxxx xxxx xxxx', 64 | separator: ' ', 65 | ), 66 | ], 67 | controller: cardNumber, 68 | onChanged: (nb) { 69 | setState(() { 70 | number = nb; 71 | }); 72 | }, 73 | decoration: InputDecoration( 74 | border: OutlineInputBorder( 75 | borderSide: BorderSide( 76 | color: Theme.of(context).accentColor, 77 | ), 78 | ), 79 | labelText: "Card Number", 80 | hintStyle: TextStyle(color: Colors.blueGrey, fontSize: 16.0), 81 | ), 82 | ), 83 | ), 84 | ), 85 | //--------------------------------------- 86 | Row( 87 | children: [ 88 | Container( 89 | width: 200.0, 90 | child: Padding( 91 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 92 | child: Container( 93 | padding: EdgeInsets.all(8.0), 94 | child: TextField( 95 | keyboardType: TextInputType.number, 96 | inputFormatters: [ 97 | MaskedTextInputFormatter( 98 | mask: 'xx/xxxx', 99 | separator: '/', 100 | ), 101 | ], 102 | controller: expiredate, 103 | onChanged: (input) { 104 | setState( 105 | () { 106 | expir = input; 107 | }, 108 | ); 109 | }, 110 | decoration: InputDecoration( 111 | border: OutlineInputBorder( 112 | borderSide: BorderSide( 113 | color: Theme.of(context).accentColor, 114 | ), 115 | ), 116 | labelText: "Expiration date", 117 | hintStyle: 118 | TextStyle(color: Colors.blueGrey, fontSize: 16.0), 119 | ), 120 | ), 121 | ), 122 | ), 123 | ), 124 | Expanded( 125 | child: Container( 126 | width: 200.0, 127 | child: Padding( 128 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 129 | child: Container( 130 | padding: EdgeInsets.all(8.0), 131 | child: TextField( 132 | inputFormatters: [ 133 | MaskedTextInputFormatter( 134 | mask: 'xxx', 135 | separator: '', 136 | ), 137 | ], 138 | keyboardType: TextInputType.number, 139 | focusNode: ccvFocused, 140 | controller: _ccv, 141 | onChanged: (ccv) { 142 | setState(() { 143 | cc = ccv; 144 | }); 145 | }, 146 | decoration: InputDecoration( 147 | border: OutlineInputBorder( 148 | borderSide: BorderSide( 149 | color: Theme.of(context).accentColor, 150 | ), 151 | ), 152 | labelText: "CCV", 153 | hintStyle: 154 | TextStyle(color: Colors.blueGrey, fontSize: 16.0), 155 | ), 156 | ), 157 | ), 158 | ), 159 | ), 160 | ), 161 | ], 162 | ), 163 | Padding( 164 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 165 | child: Container( 166 | padding: EdgeInsets.all(8.0), 167 | child: TextField( 168 | controller: cardHolderName, 169 | onChanged: (input) { 170 | setState( 171 | () { 172 | name = input; 173 | }, 174 | ); 175 | }, 176 | decoration: InputDecoration( 177 | border: OutlineInputBorder( 178 | borderSide: BorderSide( 179 | color: Theme.of(context).accentColor, 180 | ), 181 | ), 182 | labelText: "Card Holder Name", 183 | hintStyle: TextStyle(color: Colors.blueGrey, fontSize: 16.0), 184 | ), 185 | ), 186 | ), 187 | ), 188 | //--------------------------------------- 189 | Padding( 190 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 191 | child: MaterialButton( 192 | onPressed: () { 193 | CreditCard cCard = CreditCard(HomePage.user.usrename, 194 | cardHolderName: cardHolderName.text, 195 | cardNumber: cardNumber.text, 196 | cvvCode: _ccv.text, 197 | expiryDate: expiredate.text, 198 | colorIndex: 0); 199 | DBHlper().insertCC(cCard); 200 | DBHlper().insertSTAT( 201 | new Stats( 202 | HomePage.user.usrename, 203 | "New Credit Card has been added", 204 | CategoryItems.returnDate(), 205 | 1), 206 | ); 207 | setState(() { 208 | CategoryItems.cardsList.add(cCard); 209 | }); 210 | Navigator.push( 211 | context, 212 | MaterialPageRoute( 213 | builder: (BuildContext context) => CardViewer(), 214 | ), 215 | ); 216 | }, 217 | color: Colors.blue, 218 | child: Center( 219 | child: Text( 220 | "Add Card", 221 | style: TextStyle(color: Colors.white), 222 | ), 223 | ), 224 | ), 225 | ), 226 | ], 227 | ), 228 | ); 229 | } 230 | 231 | Widget cardModel() { 232 | return Container( 233 | child: cr.CreditCardWidget( 234 | cardbgColor: CategoryItems.colorsList[0], 235 | height: 200.0, 236 | cardHolderName: name == null ? "John Doe" : name, 237 | cardNumber: 238 | cardNumber == null ? "1111 1111 1111 1111" : cardNumber.text, 239 | cvvCode: _ccv == null ? "111" : _ccv.text, 240 | expiryDate: expiredate == null ? "11/1999" : expiredate.text, 241 | showBackView: ccvFocused.hasFocus, 242 | ), 243 | ); 244 | } 245 | } 246 | -------------------------------------------------------------------------------- /lib/creations/debitCard.dart: -------------------------------------------------------------------------------- 1 | import 'package:digital_wallet/helper/DBHelper.dart'; 2 | import 'package:digital_wallet/models/stats.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:digital_wallet/cardViewer.dart'; 5 | import 'package:digital_wallet/helper/category_items.dart'; 6 | import 'package:digital_wallet/helper/formatters.dart'; 7 | import 'package:digital_wallet/models/creditcard_model.dart'; 8 | import 'package:flutter_credit_card/flutter_credit_card.dart' as cr; 9 | 10 | import '../homepage.dart'; 11 | 12 | class DebitCard extends StatefulWidget { 13 | static String name = "Debit Card"; 14 | 15 | @override 16 | _DebitCardState createState() => _DebitCardState(); 17 | } 18 | 19 | class _DebitCardState extends State { 20 | FocusNode ccvFocused = new FocusNode(); 21 | bool ccv = false; 22 | TextEditingController cardNumber = TextEditingController(); 23 | TextEditingController cardHolderName = TextEditingController(); 24 | TextEditingController _ccv = TextEditingController(); 25 | TextEditingController expiredate = TextEditingController(); 26 | 27 | String name, number, expir, cc; 28 | 29 | @override 30 | void initState() { 31 | super.initState(); 32 | 33 | ccvFocused.addListener(() { 34 | setState(() { 35 | ccv = ccvFocused.hasFocus; 36 | }); 37 | }); 38 | } 39 | 40 | @override 41 | void dispose() { 42 | cardHolderName.dispose(); 43 | super.dispose(); 44 | } 45 | 46 | @override 47 | Widget build(BuildContext context) { 48 | return Container( 49 | child: Column( 50 | crossAxisAlignment: CrossAxisAlignment.start, 51 | children: [ 52 | cardModel(), 53 | SizedBox( 54 | height: 2.0, 55 | ), 56 | Padding( 57 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 58 | child: Container( 59 | padding: EdgeInsets.all(8.0), 60 | child: TextField( 61 | keyboardType: TextInputType.number, 62 | inputFormatters: [ 63 | MaskedTextInputFormatter( 64 | mask: 'xxxx xxxx xxxx xxxx', 65 | separator: ' ', 66 | ), 67 | ], 68 | controller: cardNumber, 69 | onChanged: (nb) { 70 | setState(() { 71 | number = nb; 72 | }); 73 | }, 74 | decoration: InputDecoration( 75 | border: OutlineInputBorder( 76 | borderSide: BorderSide( 77 | color: Theme.of(context).accentColor, 78 | ), 79 | ), 80 | labelText: "Card Number", 81 | hintStyle: TextStyle(color: Colors.blueGrey, fontSize: 16.0), 82 | ), 83 | ), 84 | ), 85 | ), 86 | //--------------------------------------- 87 | Row( 88 | children: [ 89 | Container( 90 | width: 200.0, 91 | child: Padding( 92 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 93 | child: Container( 94 | padding: EdgeInsets.all(8.0), 95 | child: TextField( 96 | keyboardType: TextInputType.number, 97 | inputFormatters: [ 98 | MaskedTextInputFormatter( 99 | mask: 'xx/xxxx', 100 | separator: '/', 101 | ), 102 | ], 103 | controller: expiredate, 104 | onChanged: (input) { 105 | setState( 106 | () { 107 | expir = input; 108 | }, 109 | ); 110 | }, 111 | decoration: InputDecoration( 112 | border: OutlineInputBorder( 113 | borderSide: BorderSide( 114 | color: Theme.of(context).backgroundColor, 115 | ), 116 | ), 117 | labelText: "Expiration date", 118 | hintStyle: 119 | TextStyle(color: Colors.blueGrey, fontSize: 16.0), 120 | ), 121 | ), 122 | ), 123 | ), 124 | ), 125 | Expanded( 126 | child: Container( 127 | width: 200.0, 128 | child: Padding( 129 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 130 | child: Container( 131 | padding: EdgeInsets.all(8.0), 132 | child: TextField( 133 | inputFormatters: [ 134 | MaskedTextInputFormatter( 135 | mask: 'xxx', 136 | separator: '', 137 | ), 138 | ], 139 | keyboardType: TextInputType.number, 140 | focusNode: ccvFocused, 141 | controller: _ccv, 142 | onChanged: (ccv) { 143 | setState(() { 144 | cc = ccv; 145 | }); 146 | }, 147 | decoration: InputDecoration( 148 | border: OutlineInputBorder( 149 | borderSide: BorderSide( 150 | color: Theme.of(context).accentColor, 151 | ), 152 | ), 153 | labelText: "CCV", 154 | hintStyle: 155 | TextStyle(color: Colors.blueGrey, fontSize: 16.0), 156 | ), 157 | ), 158 | ), 159 | ), 160 | ), 161 | ), 162 | ], 163 | ), 164 | Padding( 165 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 166 | child: Container( 167 | padding: EdgeInsets.all(8.0), 168 | child: TextField( 169 | controller: cardHolderName, 170 | onChanged: (input) { 171 | setState( 172 | () { 173 | name = input; 174 | }, 175 | ); 176 | }, 177 | decoration: InputDecoration( 178 | border: OutlineInputBorder( 179 | borderSide: BorderSide( 180 | color: Theme.of(context).accentColor, 181 | ), 182 | ), 183 | labelText: "Card Holder Name", 184 | hintStyle: TextStyle(color: Colors.blueGrey, fontSize: 16.0), 185 | ), 186 | ), 187 | ), 188 | ), 189 | //--------------------------------------- 190 | Padding( 191 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 192 | child: MaterialButton( 193 | onPressed: () { 194 | CreditCard cCard = CreditCard(HomePage.user.usrename, 195 | cardHolderName: cardHolderName.text, 196 | cardNumber: cardNumber.text, 197 | cvvCode: _ccv.text, 198 | expiryDate: expiredate.text, 199 | colorIndex: 1); 200 | DBHlper().insertCC(cCard); 201 | DBHlper().insertSTAT( 202 | new Stats( 203 | HomePage.user.usrename, 204 | "New Debit Card has been added", 205 | CategoryItems.returnDate(), 206 | 1), 207 | ); 208 | setState(() { 209 | CategoryItems.cardsList.add(cCard); 210 | }); 211 | Navigator.push( 212 | context, 213 | MaterialPageRoute( 214 | builder: (BuildContext context) => CardViewer(), 215 | ), 216 | ); 217 | }, 218 | color: Colors.blue, 219 | child: Center( 220 | child: Text( 221 | "Add Card", 222 | style: TextStyle(color: Colors.white), 223 | ), 224 | ), 225 | ), 226 | ), 227 | ], 228 | ), 229 | ); 230 | } 231 | 232 | Widget cardModel() { 233 | return Container( 234 | child: cr.CreditCardWidget( 235 | cardbgColor: CategoryItems.colorsList[1], 236 | height: 200.0, 237 | cardHolderName: name == null ? "John Doe" : name, 238 | cardNumber: 239 | cardNumber == null ? "1111 1111 1111 1111" : cardNumber.text, 240 | cvvCode: _ccv == null ? "111" : _ccv.text, 241 | expiryDate: expiredate == null ? "11/1999" : expiredate.text, 242 | showBackView: ccvFocused.hasFocus, 243 | ), 244 | ); 245 | } 246 | } 247 | -------------------------------------------------------------------------------- /lib/ui/createcard.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:io'; 3 | 4 | import 'package:digital_wallet/helper/DBHelper.dart'; 5 | import 'package:digital_wallet/homepage.dart'; 6 | import 'package:digital_wallet/models/stats.dart'; 7 | import 'package:flutter/material.dart'; 8 | import 'package:digital_wallet/helper/category_items.dart'; 9 | import 'package:digital_wallet/helper/formatters.dart'; 10 | import 'package:digital_wallet/screens/publicCardsViewer.dart'; 11 | import 'package:digital_wallet/ui/publicCards.dart'; 12 | import 'package:image_picker/image_picker.dart'; 13 | import 'package:intl/intl.dart'; 14 | import 'package:toast/toast.dart'; 15 | 16 | class Createcard extends StatefulWidget { 17 | final CardType type; 18 | final TYPE secondeType; 19 | 20 | Createcard({@required this.type, @required this.secondeType}); 21 | 22 | @override 23 | _CreatecardState createState() => _CreatecardState(); 24 | } 25 | 26 | class _CreatecardState extends State { 27 | TextEditingController nom = TextEditingController(); 28 | TextEditingController prenom = TextEditingController(); 29 | TextEditingController dob = TextEditingController(); 30 | TextEditingController nationality = TextEditingController(); 31 | File _image; 32 | String imageToBase64; 33 | 34 | _showdialog() { 35 | showDialog( 36 | context: context, 37 | builder: (BuildContext context) { 38 | return SimpleDialog( 39 | title: Text("Add Photo"), 40 | children: [ 41 | SimpleDialogOption( 42 | child: Text("From Gallery"), 43 | onPressed: () => _handleImage(ImageSource.gallery), 44 | ), 45 | SimpleDialogOption( 46 | child: Text("From Camera"), 47 | onPressed: () => _handleImage(ImageSource.camera)), 48 | SimpleDialogOption( 49 | onPressed: () => Navigator.pop(context), 50 | child: Text( 51 | "Cancel", 52 | style: TextStyle(color: Colors.red), 53 | ), 54 | ), 55 | ], 56 | ); 57 | }); 58 | } 59 | 60 | _handleImage(ImageSource source) async { 61 | Navigator.pop(context); 62 | File imageFile = await ImagePicker.pickImage(source: source); 63 | if (imageFile != null) { 64 | setState(() { 65 | _image = imageFile; 66 | }); 67 | imageToBase64 = _imageTo64(_image); 68 | } 69 | } 70 | 71 | _imageTo64(File imageData) { 72 | if (imageData == null) return ""; 73 | List imageBytes = imageData.readAsBytesSync(); 74 | String base64Image = base64Encode(imageBytes); 75 | return base64Image; 76 | } 77 | 78 | bool validator() { 79 | return (nom.text.isEmpty || prenom.text.isEmpty) || 80 | (dob.text.isEmpty || nationality.text.isEmpty); 81 | } 82 | 83 | @override 84 | Widget build(BuildContext context) { 85 | return Scaffold( 86 | appBar: AppBar( 87 | leading: IconButton( 88 | onPressed: () => Navigator.pop(context), 89 | icon: Icon( 90 | Icons.clear, 91 | color: Theme.of(context).accentColor, 92 | size: 30.0, 93 | ), 94 | ), 95 | centerTitle: true, 96 | title: Text("Add New Card"), 97 | ), 98 | body: SingleChildScrollView( 99 | child: Container( 100 | child: Column( 101 | crossAxisAlignment: CrossAxisAlignment.center, 102 | children: [ 103 | Padding( 104 | padding: 105 | const EdgeInsets.symmetric(horizontal: 15.0, vertical: 8.0), 106 | child: Cards( 107 | height: MediaQuery.of(context).size.height * 0.36, 108 | name: "Iheb", 109 | prenom: "Briki", 110 | birthDate: "15/01/1999", 111 | type: this.widget.type, 112 | ), 113 | ), 114 | SizedBox( 115 | height: 10.0, 116 | ), 117 | Padding( 118 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 119 | child: Container( 120 | padding: EdgeInsets.all(8.0), 121 | child: TextField( 122 | controller: nom, 123 | decoration: InputDecoration( 124 | border: OutlineInputBorder( 125 | borderSide: BorderSide( 126 | color: Theme.of(context).accentColor, 127 | ), 128 | ), 129 | labelText: "Name", 130 | hintStyle: 131 | TextStyle(color: Colors.blueGrey, fontSize: 16.0), 132 | ), 133 | ), 134 | ), 135 | ), 136 | Padding( 137 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 138 | child: Container( 139 | padding: EdgeInsets.all(8.0), 140 | child: TextField( 141 | controller: prenom, 142 | decoration: InputDecoration( 143 | border: OutlineInputBorder( 144 | borderSide: BorderSide( 145 | color: Theme.of(context).accentColor, 146 | ), 147 | ), 148 | labelText: "Last Name", 149 | hintStyle: 150 | TextStyle(color: Colors.blueGrey, fontSize: 16.0), 151 | ), 152 | ), 153 | ), 154 | ), 155 | Padding( 156 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 157 | child: Container( 158 | padding: EdgeInsets.all(8.0), 159 | child: TextField( 160 | keyboardType: TextInputType.number, 161 | inputFormatters: [ 162 | MaskedTextInputFormatter( 163 | mask: 'xx/xx/xxxx', 164 | separator: '/', 165 | ), 166 | ], 167 | controller: dob, 168 | decoration: InputDecoration( 169 | border: OutlineInputBorder( 170 | borderSide: BorderSide( 171 | color: Theme.of(context).accentColor, 172 | ), 173 | ), 174 | labelText: "Birth Date", 175 | hintStyle: 176 | TextStyle(color: Colors.blueGrey, fontSize: 16.0), 177 | ), 178 | ), 179 | ), 180 | ), 181 | Padding( 182 | padding: const EdgeInsets.symmetric(horizontal: 22.0), 183 | child: Container( 184 | padding: EdgeInsets.all(8.0), 185 | child: TextField( 186 | controller: nationality, 187 | decoration: InputDecoration( 188 | border: OutlineInputBorder( 189 | borderSide: BorderSide( 190 | color: Theme.of(context).accentColor, 191 | ), 192 | ), 193 | labelText: "Nationality", 194 | hintStyle: 195 | TextStyle(color: Colors.blueGrey, fontSize: 16.0), 196 | ), 197 | ), 198 | ), 199 | ), 200 | SizedBox( 201 | height: 15.0, 202 | ), 203 | Padding( 204 | padding: const EdgeInsets.symmetric(horizontal: 30.0), 205 | child: MaterialButton( 206 | onPressed: () { 207 | _showdialog(); 208 | }, //here image 209 | color: Theme.of(context).cardColor, 210 | child: Center( 211 | child: Row( 212 | mainAxisAlignment: MainAxisAlignment.center, 213 | children: [ 214 | Text( 215 | "Original Copy", 216 | style: 217 | TextStyle(color: Theme.of(context).accentColor), 218 | ), 219 | SizedBox(width: 10.0), 220 | Icon( 221 | Icons.camera_alt, 222 | size: 25.0, 223 | color: Theme.of(context).accentColor, 224 | ) 225 | ], 226 | ), 227 | ), 228 | ), 229 | ), 230 | SizedBox( 231 | height: 15.0, 232 | ), 233 | _image == null 234 | ? SizedBox.shrink() 235 | : Container( 236 | height: 185, 237 | width: 185, 238 | decoration: BoxDecoration( 239 | image: DecorationImage( 240 | image: FileImage(_image), 241 | fit: BoxFit.cover, 242 | ), 243 | ), 244 | ), 245 | SizedBox( 246 | height: 15.0, 247 | ), 248 | addButton(context, 2, "Add Card", Colors.white, Colors.blue) 249 | ], 250 | ), 251 | ), 252 | ), 253 | ); 254 | } 255 | 256 | Widget addButton( 257 | BuildContext context, 258 | int indice, 259 | String text, 260 | Color textcolor, 261 | Color buttonColor, 262 | ) { 263 | return Padding( 264 | padding: const EdgeInsets.symmetric(horizontal: 30.0), 265 | child: MaterialButton( 266 | onPressed: () { 267 | if (!validator()) { 268 | Cards crd = new Cards( 269 | userName: HomePage.user.usrename, 270 | name: nom.text, 271 | prenom: prenom.text, 272 | birthDate: dob.text, 273 | nationality: nationality.text, 274 | type: this.widget.type, 275 | imgBase64: _imageTo64(_image), 276 | ); 277 | DBHlper().insertPC(crd); 278 | DBHlper().insertSTAT( 279 | new Stats( 280 | HomePage.user.usrename, 281 | "New ${this.widget.type.toString().split('.')[1]} card has been added", 282 | DateFormat('EEE d MMM,kk:mm:ss').format(DateTime.now()), 283 | 1), 284 | ); 285 | setState(() { 286 | CategoryItems.publicCardsList.add(crd); 287 | }); 288 | Navigator.push( 289 | context, 290 | MaterialPageRoute( 291 | builder: (context) => MyCardsViewer( 292 | type: widget.secondeType, 293 | ), 294 | ), 295 | ); 296 | } else { 297 | Toast.show("Fill all Fields", context, 298 | duration: 3, gravity: Toast.BOTTOM); 299 | } 300 | }, 301 | color: buttonColor, 302 | child: Center( 303 | child: Text( 304 | text, 305 | style: TextStyle(color: textcolor), 306 | ), 307 | ), 308 | ), 309 | ); 310 | } 311 | } 312 | -------------------------------------------------------------------------------- /lib/screens/publicCardsViewer.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:typed_data'; 3 | 4 | import 'package:digital_wallet/helper/DBHelper.dart'; 5 | import 'package:digital_wallet/models/stats.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:digital_wallet/helper/category_items.dart'; 8 | import 'package:digital_wallet/homepage.dart'; 9 | import 'package:digital_wallet/ui/publicCards.dart'; 10 | import 'package:digital_wallet/ui/createcard.dart'; 11 | import '../addPublicCard.dart'; 12 | import 'package:toast/toast.dart'; 13 | 14 | class MyCardsViewer extends StatefulWidget { 15 | final TYPE type; 16 | MyCardsViewer({@required this.type}); 17 | @override 18 | _MyCardsViewerState createState() => _MyCardsViewerState(); 19 | } 20 | 21 | class _MyCardsViewerState extends State { 22 | List mylist = []; 23 | 24 | _getCards() { 25 | try { 26 | if (CategoryItems.publicCardsList == null || 27 | CategoryItems.publicCardsList.length == 0) return; 28 | mylist.clear(); 29 | if (widget.type == TYPE.other) { 30 | for (Cards carta in CategoryItems.publicCardsList) { 31 | if (carta.type == CardType.gym || carta.type == CardType.health) { 32 | setState(() { 33 | mylist.add(carta); 34 | }); 35 | } 36 | } 37 | } else if (widget.type == TYPE.identifiactions) { 38 | for (Cards carta in CategoryItems.publicCardsList) { 39 | if (carta.type == CardType.id || 40 | carta.type == CardType.passport || 41 | carta.type == CardType.driver) { 42 | setState(() { 43 | mylist.add(carta); 44 | }); 45 | } 46 | } 47 | } else { 48 | for (Cards carta in CategoryItems.publicCardsList) { 49 | if (carta.type == whatsFilter()) { 50 | setState(() { 51 | mylist.add(carta); 52 | }); 53 | } 54 | } 55 | } 56 | } catch (ex) {} 57 | } 58 | 59 | _showOriginal(int index) { 60 | try { 61 | showDialog( 62 | context: context, 63 | builder: (BuildContext context) { 64 | return AlertDialog( 65 | content: Container( 66 | child: _b64Toimage(mylist[index].imgBase64), 67 | ), 68 | ); 69 | }, 70 | ); 71 | } catch (ee) {} 72 | } 73 | 74 | _b64Toimage(String base) { 75 | Uint8List bytes = base64.decode(base); 76 | return Image.memory( 77 | bytes, 78 | fit: BoxFit.cover, 79 | ); 80 | } 81 | 82 | showToast() { 83 | return Toast.show("You Have No Original Copy To Display", context, 84 | duration: 3, gravity: Toast.BOTTOM); 85 | } 86 | 87 | @override 88 | void initState() { 89 | super.initState(); 90 | _getCards(); 91 | } 92 | 93 | CardType whatsFilter() { 94 | switch (widget.type) { 95 | case TYPE.identifiactions: 96 | return CardType.id; 97 | break; 98 | case TYPE.shopping: 99 | return CardType.loyality; 100 | break; 101 | case TYPE.students: 102 | return CardType.student; 103 | break; 104 | case TYPE.transport: 105 | return CardType.transport; 106 | break; 107 | case TYPE.other: 108 | return CardType.gym; 109 | break; 110 | default: 111 | return null; 112 | } 113 | } 114 | 115 | Widget wichPath() { 116 | switch (widget.type) { 117 | case TYPE.identifiactions: 118 | return AddPublicCard( 119 | children: [ 120 | addButton(context, 1, "Identification Card", 121 | Theme.of(context).accentColor, Theme.of(context).cardColor), 122 | SizedBox(height: 10.0), 123 | addButton(context, 2, "Driving Licence", 124 | Theme.of(context).accentColor, Theme.of(context).cardColor), 125 | SizedBox(height: 10.0), 126 | addButton(context, 3, "Passport", Theme.of(context).accentColor, 127 | Theme.of(context).cardColor), 128 | SizedBox(height: 10.0), 129 | ], 130 | ); 131 | break; 132 | case TYPE.shopping: 133 | return Createcard(type: CardType.loyality, secondeType: TYPE.shopping); 134 | break; 135 | case TYPE.students: 136 | return Createcard(type: CardType.student, secondeType: TYPE.students); 137 | break; 138 | case TYPE.transport: 139 | return Createcard( 140 | type: CardType.transport, secondeType: TYPE.transport); 141 | break; 142 | case TYPE.other: 143 | return AddPublicCard( 144 | children: [ 145 | addButton(context, 1, "Health Card", Theme.of(context).accentColor, 146 | Theme.of(context).cardColor), 147 | SizedBox(height: 10.0), 148 | addButton(context, 2, "GYM Card", Theme.of(context).accentColor, 149 | Theme.of(context).cardColor), 150 | SizedBox(height: 10.0), 151 | addButton(context, 3, "Other Documents", 152 | Theme.of(context).accentColor, Theme.of(context).cardColor), 153 | SizedBox(height: 10.0), 154 | ], 155 | ); 156 | break; 157 | default: 158 | return null; 159 | } 160 | } 161 | 162 | @override 163 | Widget build(BuildContext context) { 164 | final _screenSize = MediaQuery.of(context).size; 165 | return Scaffold( 166 | appBar: AppBar( 167 | centerTitle: true, 168 | title: Text( 169 | "Your Cards (${mylist.length})", 170 | style: TextStyle(color: Theme.of(context).accentColor), 171 | ), 172 | backgroundColor: Theme.of(context).cardColor, 173 | elevation: 1.5, 174 | leading: IconButton( 175 | onPressed: () { 176 | Navigator.push( 177 | context, 178 | MaterialPageRoute(builder: (BuildContext context) => HomePage()), 179 | ); 180 | }, 181 | icon: Icon( 182 | Icons.clear, 183 | size: 25.0, 184 | color: Theme.of(context).accentColor, 185 | ), 186 | ), 187 | actions: [ 188 | IconButton( 189 | onPressed: () { 190 | _navigate(); 191 | }, 192 | icon: Icon( 193 | Icons.add, 194 | size: 25.0, 195 | color: Theme.of(context).accentColor, 196 | ), 197 | ), 198 | ], 199 | ), 200 | body: (mylist == null || mylist.length == 0) 201 | ? noCards() 202 | : Column( 203 | children: [ 204 | SizedBox( 205 | height: _screenSize.height * 0.8, 206 | child: ListView.builder( 207 | itemCount: (mylist == null || mylist.length == 0) 208 | ? 0 209 | : mylist.length, 210 | itemBuilder: (BuildContext context, int index) { 211 | return InkWell( 212 | onTap: () { 213 | (mylist[index].imgBase64 == null || 214 | mylist[index].imgBase64.length == 0) 215 | ? showToast() 216 | : _showOriginal(index); 217 | }, 218 | child: Padding( 219 | padding: const EdgeInsets.all(15.0), 220 | child: Stack( 221 | children: [ 222 | Cards( 223 | userName: HomePage.user.usrename, 224 | height: _screenSize.height * 0.35, 225 | name: mylist[index].name, 226 | prenom: mylist[index].prenom, 227 | nationality: CategoryItems 228 | .publicCardsList[index].nationality, 229 | type: mylist[index].type, 230 | birthDate: mylist[index].birthDate, 231 | ), 232 | Positioned( 233 | right: 0, 234 | top: 0, 235 | child: Row( 236 | mainAxisAlignment: MainAxisAlignment.start, 237 | mainAxisSize: MainAxisSize.min, 238 | children: [ 239 | IconButton( 240 | onPressed: () { 241 | if (mylist.length == 1) { 242 | DBHlper().deletePC(mylist[0]); 243 | CategoryItems.publicCardsList 244 | .removeAt(index); 245 | setState(() { 246 | mylist = []; 247 | }); 248 | } else { 249 | DBHlper().deletePC(mylist[index]); 250 | setState(() { 251 | CategoryItems.publicCardsList 252 | .removeAt(index); 253 | _getCards(); 254 | }); 255 | } 256 | DBHlper().insertSTAT( 257 | new Stats( 258 | HomePage.user.usrename, 259 | "${this.widget.type.toString().split('.')[1]} card has been deleted", 260 | CategoryItems.returnDate(), 261 | 2), 262 | ); 263 | }, 264 | icon: Icon( 265 | Icons.delete, 266 | color: Colors.redAccent, 267 | size: 27, 268 | ), 269 | ), 270 | IconButton( 271 | onPressed: () { 272 | print("Edit Here"); 273 | }, 274 | icon: Icon( 275 | Icons.edit, 276 | color: Colors.blue, 277 | size: 27, 278 | ), 279 | ), 280 | ], 281 | ), 282 | ) 283 | ], 284 | ), 285 | ), 286 | ); 287 | }, 288 | ), 289 | ), 290 | ], 291 | ), 292 | ); 293 | } 294 | 295 | Widget noCards() { 296 | return Center( 297 | child: Column( 298 | mainAxisAlignment: MainAxisAlignment.center, 299 | children: [ 300 | Image( 301 | image: AssetImage("assets/images/ccsad.png"), 302 | width: 165.0, 303 | height: 155.0, 304 | ), 305 | SizedBox( 306 | height: 9.0, 307 | ), 308 | Text( 309 | "You have no cards to display", 310 | textAlign: TextAlign.center, 311 | style: TextStyle( 312 | fontStyle: FontStyle.italic, 313 | fontSize: 20.0, 314 | color: Theme.of(context).accentColor), 315 | ) 316 | ], 317 | ), 318 | ); 319 | } 320 | 321 | MaterialButton addButton(BuildContext context, int indice, String text, 322 | Color txtColor, Color buttonColor) { 323 | return MaterialButton( 324 | onPressed: () { 325 | if (widget.type == TYPE.identifiactions) { 326 | switch (indice) { 327 | case 1: 328 | { 329 | Navigator.push( 330 | context, 331 | MaterialPageRoute( 332 | builder: (context) => Createcard( 333 | type: CardType.id, 334 | secondeType: TYPE.identifiactions)), 335 | ); 336 | break; 337 | } 338 | case 2: 339 | { 340 | Navigator.push( 341 | context, 342 | MaterialPageRoute( 343 | builder: (context) => Createcard( 344 | type: CardType.driver, 345 | secondeType: TYPE.identifiactions)), 346 | ); 347 | 348 | break; 349 | } 350 | case 3: 351 | { 352 | Navigator.push( 353 | context, 354 | MaterialPageRoute( 355 | builder: (context) => Createcard( 356 | type: CardType.passport, 357 | secondeType: TYPE.identifiactions)), 358 | ); 359 | break; 360 | } 361 | 362 | default: 363 | {} 364 | } 365 | } else { 366 | switch (indice) { 367 | case 1: 368 | { 369 | Navigator.push( 370 | context, 371 | MaterialPageRoute( 372 | builder: (context) => Createcard( 373 | type: CardType.health, secondeType: TYPE.other), 374 | ), 375 | ); 376 | 377 | break; 378 | } 379 | case 2: 380 | { 381 | Navigator.push( 382 | context, 383 | MaterialPageRoute( 384 | builder: (context) => 385 | Createcard(type: CardType.gym, secondeType: TYPE.other), 386 | ), 387 | ); 388 | 389 | break; 390 | } 391 | case 3: 392 | { 393 | Navigator.push( 394 | context, 395 | MaterialPageRoute( 396 | builder: (context) => Createcard( 397 | type: CardType.gym, secondeType: TYPE.other)), 398 | ); 399 | break; 400 | } 401 | 402 | default: 403 | {} 404 | } 405 | } 406 | }, 407 | color: buttonColor, 408 | child: Center( 409 | child: Text( 410 | text, 411 | style: TextStyle(color: txtColor), 412 | ), 413 | ), 414 | ); 415 | } 416 | 417 | void _navigate() { 418 | Navigator.push( 419 | context, 420 | MaterialPageRoute(builder: (BuildContext context) => wichPath()), 421 | ); 422 | } 423 | } 424 | 425 | enum TYPE { 426 | identifiactions, 427 | shopping, 428 | students, 429 | transport, 430 | other, 431 | } 432 | --------------------------------------------------------------------------------