├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── Runner-Bridging-Header.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ └── project.pbxproj ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── WorkspaceSettings.xcsettings │ │ └── IDEWorkspaceChecks.plist └── .gitignore ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ └── Icon-512.png ├── manifest.json └── index.html ├── android ├── gradle.properties ├── app │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable-v21 │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── values │ │ │ │ │ └── styles.xml │ │ │ │ └── values-night │ │ │ │ │ └── styles.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── food_dashboard │ │ │ │ │ └── MainActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle └── build.gradle ├── assets └── images │ ├── lureme.jpg │ ├── molon_lave.jpg │ ├── powerhouse.jpg │ ├── family_bean.jpg │ ├── Joaquin_Phoenix.jpg │ └── boston_barista.jpg ├── lib ├── domain │ └── entities │ │ ├── user.dart │ │ ├── menu.dart │ │ ├── category.dart │ │ └── restaurant.dart ├── screens │ ├── bloc │ │ ├── page_event.dart │ │ ├── page_state.dart │ │ └── page_bloc.dart │ ├── sign_in │ │ └── sign_in_screen.dart │ ├── sign_up │ │ └── sign_up_screen.dart │ ├── restaurant_management │ │ ├── restaurant_management.dart │ │ └── custom_dialog.dart │ └── home │ │ └── home_screen.dart ├── datasources │ ├── service │ │ ├── auth_service_contract.dart │ │ ├── restaurant_service_contract.dart │ │ ├── auth_service_impl.dart │ │ └── restaurant_service_impl.dart │ ├── model │ │ └── userModel.dart │ └── api_client │ │ └── http_client.dart ├── widgets │ ├── counter_with_text.dart │ ├── custom_circle_button.dart │ ├── custom_text_button.dart │ ├── menu_item.dart │ ├── form_title_and_field.dart │ ├── location_card.dart │ ├── category_icon_with_text.dart │ ├── side_menu.dart │ ├── restaurant_card.dart │ ├── restaurant_list.dart │ └── my_dialog.dart ├── constants.dart ├── responsive.dart ├── di │ └── get_it.dart └── main.dart ├── .metadata ├── .gitignore ├── test └── widget_test.dart ├── README.md ├── pubspec.yaml └── pubspec.lock /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/web/icons/Icon-512.png -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /assets/images/lureme.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/assets/images/lureme.jpg -------------------------------------------------------------------------------- /assets/images/molon_lave.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/assets/images/molon_lave.jpg -------------------------------------------------------------------------------- /assets/images/powerhouse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/assets/images/powerhouse.jpg -------------------------------------------------------------------------------- /assets/images/family_bean.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/assets/images/family_bean.jpg -------------------------------------------------------------------------------- /assets/images/Joaquin_Phoenix.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/assets/images/Joaquin_Phoenix.jpg -------------------------------------------------------------------------------- /assets/images/boston_barista.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/assets/images/boston_barista.jpg -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhansheng97/food_dashboard_frontend/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/food_dashboard/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.food_dashboard 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/domain/entities/user.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | class User extends Equatable { 4 | final String name; 5 | 6 | User({required this.name}); 7 | 8 | @override 9 | List get props => [name]; 10 | } 11 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip 7 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: d79295af24c3ed621c33713ecda14ad196fd9c31 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. -------------------------------------------------------------------------------- /lib/screens/bloc/page_event.dart: -------------------------------------------------------------------------------- 1 | part of 'page_bloc.dart'; 2 | 3 | abstract class PageEvent extends Equatable { 4 | const PageEvent(); 5 | 6 | @override 7 | List get props => []; 8 | } 9 | 10 | class ChangePageEvent extends PageEvent { 11 | final int index; 12 | 13 | ChangePageEvent({required this.index}); 14 | 15 | @override 16 | List get props => [index]; 17 | } 18 | -------------------------------------------------------------------------------- /lib/datasources/service/auth_service_contract.dart: -------------------------------------------------------------------------------- 1 | import 'package:food_dashboard/datasources/model/userModel.dart'; 2 | 3 | abstract class IAuthService { 4 | Future signIn({ 5 | required String username, 6 | required String password, 7 | }); 8 | Future signUp({ 9 | required String username, 10 | required String email, 11 | required String password, 12 | }); 13 | } 14 | -------------------------------------------------------------------------------- /lib/screens/bloc/page_state.dart: -------------------------------------------------------------------------------- 1 | part of 'page_bloc.dart'; 2 | 3 | abstract class PageState extends Equatable { 4 | const PageState(); 5 | 6 | @override 7 | List get props => []; 8 | } 9 | 10 | class PageInitial extends PageState {} 11 | 12 | class PageLoaded extends PageState { 13 | final Widget page; 14 | PageLoaded(this.page); 15 | 16 | @override 17 | List get props => [page]; 18 | } 19 | -------------------------------------------------------------------------------- /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/domain/entities/menu.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:font_awesome_flutter/font_awesome_flutter.dart'; 3 | 4 | class Menu { 5 | final IconData icon; 6 | final String title; 7 | 8 | Menu(this.icon, this.title); 9 | } 10 | 11 | final List menuList = [ 12 | Menu(FontAwesomeIcons.home, "Home"), 13 | Menu(FontAwesomeIcons.slack, "Categories"), 14 | Menu(FontAwesomeIcons.clipboardCheck, "Reservations"), 15 | Menu(FontAwesomeIcons.solidHeart, "Favourites"), 16 | ]; 17 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/datasources/service/restaurant_service_contract.dart: -------------------------------------------------------------------------------- 1 | import 'dart:html'; 2 | import 'dart:typed_data'; 3 | 4 | import 'package:food_dashboard/domain/entities/restaurant.dart'; 5 | 6 | abstract class IRestaurantService { 7 | Future> getAllRestaurant(); 8 | Future addRestaurant( 9 | Restaurant restaurant, Uint8List bytes, File file); 10 | Future getRestaurantById(String id); 11 | Future updateRestaurant( 12 | String id, 13 | Restaurant restaurant, 14 | Uint8List? bytes, 15 | File? file, 16 | ); 17 | Future deleteRestaurant(String id); 18 | } 19 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "food_dashboard", 3 | "short_name": "food_dashboard", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:4.1.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/ephemeral/ 22 | Flutter/app.flx 23 | Flutter/app.zip 24 | Flutter/flutter_assets/ 25 | Flutter/flutter_export_environment.sh 26 | ServiceDefinitions.json 27 | Runner/GeneratedPluginRegistrant.* 28 | 29 | # Exceptions to above rules. 30 | !default.mode1v3 31 | !default.mode2v3 32 | !default.pbxuser 33 | !default.perspectivev3 34 | -------------------------------------------------------------------------------- /lib/widgets/counter_with_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class CounterWithText extends StatelessWidget { 4 | final int number; 5 | final String text; 6 | 7 | const CounterWithText({ 8 | Key? key, 9 | required this.number, 10 | required this.text, 11 | }) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Column( 16 | children: [ 17 | Text( 18 | number.toString(), 19 | style: TextStyle(fontWeight: FontWeight.bold, fontSize: 25), 20 | ), 21 | Text( 22 | text, 23 | style: TextStyle(color: Colors.grey.shade600, fontSize: 12), 24 | ), 25 | ], 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/datasources/model/userModel.dart: -------------------------------------------------------------------------------- 1 | class UserModel { 2 | int id; 3 | String username; 4 | String email; 5 | List roles; 6 | String accessToken; 7 | String tokenType; 8 | 9 | UserModel({ 10 | required this.id, 11 | required this.username, 12 | required this.email, 13 | required this.roles, 14 | required this.accessToken, 15 | required this.tokenType, 16 | }); 17 | 18 | factory UserModel.fromJson(Map json) { 19 | return UserModel( 20 | id: json['id'], 21 | username: json['username'], 22 | email: json['email'], 23 | roles: json['roles'].cast(), 24 | accessToken: json['accessToken'], 25 | tokenType: json['tokenType'], 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/domain/entities/category.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:font_awesome_flutter/font_awesome_flutter.dart'; 3 | 4 | class Category { 5 | final IconData icon; 6 | final String text; 7 | 8 | Category({ 9 | required this.icon, 10 | required this.text, 11 | }); 12 | } 13 | 14 | final List categories = [ 15 | Category(icon: FontAwesomeIcons.pizzaSlice, text: "Italian"), 16 | Category(icon: FontAwesomeIcons.utensilSpoon, text: "Asian"), 17 | Category(icon: FontAwesomeIcons.glassMartini, text: "Bars"), 18 | Category(icon: FontAwesomeIcons.hamburger, text: "Burgers"), 19 | Category(icon: FontAwesomeIcons.mugHot, text: "Cafe"), 20 | Category(icon: FontAwesomeIcons.beer, text: "Pubs"), 21 | Category(icon: FontAwesomeIcons.seedling, text: "Vegan"), 22 | Category(icon: FontAwesomeIcons.fish, text: "Seafood"), 23 | ]; 24 | -------------------------------------------------------------------------------- /lib/screens/bloc/page_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc/bloc.dart'; 2 | import 'package:equatable/equatable.dart'; 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:food_dashboard/screens/home/home_screen.dart'; 6 | import 'package:food_dashboard/screens/restaurant_management/restaurant_management.dart'; 7 | 8 | part 'page_event.dart'; 9 | part 'page_state.dart'; 10 | 11 | class PageBloc extends Bloc { 12 | PageBloc() : super(PageInitial()) { 13 | on((event, emit) { 14 | switch (event.index) { 15 | case 0: 16 | emit(PageLoaded(HomeScreen())); 17 | break; 18 | case 1: 19 | emit(PageLoaded(RestaurantManagement())); 20 | break; 21 | default: 22 | emit(PageLoaded(HomeScreen())); 23 | } 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /lib/constants.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:google_fonts/google_fonts.dart'; 3 | 4 | const Color kGreyColor = Colors.grey; 5 | const double kdefaultPadding = 20; 6 | const Color kWhiteColor = Colors.white; 7 | Color? kLightGreyColor = Colors.grey[500]; 8 | 9 | TextStyle largestText = GoogleFonts.montserrat( 10 | fontSize: 30, 11 | fontWeight: FontWeight.bold, 12 | ); 13 | 14 | TextStyle largeText = GoogleFonts.montserrat( 15 | fontSize: 22, 16 | fontWeight: FontWeight.w600, 17 | ); 18 | 19 | TextStyle normalText = GoogleFonts.montserrat(fontSize: 12); 20 | 21 | TextStyle normalGreyText = GoogleFonts.montserrat( 22 | fontSize: 12, 23 | color: Colors.grey.shade600, 24 | ); 25 | 26 | TextStyle normalBoldText = GoogleFonts.montserrat( 27 | fontSize: 12, 28 | fontWeight: FontWeight.w500, 29 | ); 30 | 31 | List tableTitle = [ 32 | "ID", 33 | "Image", 34 | "Name", 35 | "Category", 36 | "Rating", 37 | "Price", 38 | "Distance", 39 | ]; 40 | -------------------------------------------------------------------------------- /lib/widgets/custom_circle_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:font_awesome_flutter/font_awesome_flutter.dart'; 3 | 4 | class CustomCircleButton extends StatelessWidget { 5 | final IconData icon; 6 | final VoidCallback onTap; 7 | 8 | const CustomCircleButton({ 9 | Key? key, 10 | required this.icon, 11 | required this.onTap, 12 | }) : super(key: key); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return Material( 17 | color: Colors.transparent, 18 | borderRadius: BorderRadius.circular(50), 19 | child: InkWell( 20 | onTap: onTap, 21 | borderRadius: BorderRadius.circular(50), 22 | child: Container( 23 | height: 50, 24 | width: 50, 25 | alignment: Alignment.center, 26 | child: RotatedBox( 27 | quarterTurns: 1, 28 | child: FaIcon( 29 | icon, 30 | size: 20, 31 | )), 32 | ), 33 | ), 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/widgets/custom_text_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:food_dashboard/constants.dart'; 3 | 4 | class CustomTextButton extends StatelessWidget { 5 | final String text; 6 | final Color color; 7 | final VoidCallback onTap; 8 | 9 | const CustomTextButton({ 10 | Key? key, 11 | required this.text, 12 | this.color = Colors.black, 13 | required this.onTap, 14 | }) : super(key: key); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return Material( 19 | color: color, 20 | borderRadius: BorderRadius.circular(12), 21 | child: InkWell( 22 | onTap: onTap, 23 | borderRadius: BorderRadius.circular(12), 24 | child: Container( 25 | height: 50, 26 | width: 150, 27 | alignment: Alignment.center, 28 | child: Text( 29 | text, 30 | style: TextStyle( 31 | color: kWhiteColor, 32 | fontSize: 12, 33 | ), 34 | ), 35 | ), 36 | ), 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /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:food_dashboard/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/responsive.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ResponsiveWidget extends StatelessWidget { 4 | final Widget? mobile; 5 | final Widget? tablet; 6 | final Widget desktop; 7 | 8 | const ResponsiveWidget({ 9 | Key? key, 10 | this.mobile, 11 | this.tablet, 12 | required this.desktop, 13 | }) : super(key: key); 14 | 15 | static bool isMobile(BuildContext context) => 16 | MediaQuery.of(context).size.width < 650; 17 | 18 | static bool isTablet(BuildContext context) => 19 | MediaQuery.of(context).size.width < 800 && 20 | MediaQuery.of(context).size.width >= 650; 21 | 22 | static bool isDesktop(BuildContext context) => 23 | MediaQuery.of(context).size.width >= 800; 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return LayoutBuilder( 28 | builder: (context, constraints) { 29 | if (constraints.maxWidth >= 900) { 30 | return desktop; 31 | } 32 | // If width it less then 900 and more then 650 we consider it as tablet 33 | else if (constraints.maxWidth >= 650) { 34 | return tablet ?? desktop; 35 | } 36 | // Or less then that we called it mobile 37 | else { 38 | return mobile ?? desktop; 39 | } 40 | }, 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/di/get_it.dart: -------------------------------------------------------------------------------- 1 | import 'package:food_dashboard/datasources/api_client/http_client.dart'; 2 | import 'package:food_dashboard/datasources/service/auth_service_contract.dart'; 3 | import 'package:food_dashboard/datasources/service/auth_service_impl.dart'; 4 | import 'package:food_dashboard/datasources/service/restaurant_service_contract.dart'; 5 | import 'package:food_dashboard/datasources/service/restaurant_service_impl.dart'; 6 | import 'package:food_dashboard/screens/bloc/page_bloc.dart'; 7 | import 'package:get_it/get_it.dart'; 8 | import 'package:http/http.dart'; 9 | import 'package:shared_preferences/shared_preferences.dart'; 10 | 11 | final getIt = GetIt.instance; 12 | 13 | Future init() async { 14 | getIt.registerLazySingleton(() => Client()); 15 | 16 | final sharedPref = await SharedPreferences.getInstance(); 17 | getIt.registerLazySingleton(() => sharedPref); 18 | 19 | getIt.registerLazySingleton( 20 | () => HttpClient(client: getIt(), sharedPreferences: getIt())); 21 | 22 | getIt.registerLazySingleton( 23 | () => AuthServiceImpl(httpClient: getIt(), sharedPreferences: getIt())); 24 | 25 | getIt.registerLazySingleton( 26 | () => RestaurantServiceImpl(getIt())); 27 | 28 | getIt.registerFactory(() => PageBloc()); 29 | } 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # food_dashboard 2 | 3 | A Food DashBoard project with frontend (Flutter) & backend (Spring Boot) 4 | 5 | Backend repo: https://github.com/zhansheng97/food_dashboard_backend 6 | 7 | The Design is based on the UI Design from dribble 8 | 9 | https://dribbble.com/shots/15844040-I-Food-Dashboard 10 | 11 | ## Pages 12 | - Sign In Pages 13 | - Home Pages 14 | - Restaurant Management Pages 15 | 16 | ## Features 17 | - Sign Up / Sign In 18 | - Get Restaurant 19 | - Add Restaraunt 20 | - Update Restaurant 21 | - Delete Restaurant 22 | 23 | ## Sign In Pages 24 | ![image](https://user-images.githubusercontent.com/71022967/136674314-e354708f-606c-4395-82ae-8d61c8212d33.png) 25 | 26 | ## Home Pages 27 | 28 | ![image](https://user-images.githubusercontent.com/71022967/136674319-d9883b21-e35a-4131-b92c-b4b749d48b05.png) 29 | 30 | 31 | ## Restaurant Management Pages 32 | 33 | ![image](https://user-images.githubusercontent.com/71022967/136674378-639f58c0-437b-47d8-b323-cc562d99ed90.png) 34 | 35 | ## Add Restaurant 36 | 37 | ![image](https://user-images.githubusercontent.com/71022967/136674372-be383c73-7e66-42c9-b2a2-2bbff47881ac.png) 38 | 39 | ## Restaurant Detail 40 | 41 | ![image](https://user-images.githubusercontent.com/71022967/136674411-cf4b2741-d84d-49f9-8d06-57dce6d7f6a8.png) 42 | 43 | ## Update Restaurant 44 | 45 | ![image](https://user-images.githubusercontent.com/71022967/136674419-107c7602-1694-4bcf-9070-84d0b32e67c2.png) 46 | 47 | ## Delete Restaurant 48 | 49 | ![image](https://user-images.githubusercontent.com/71022967/136674426-a39f1c92-0ffc-41e0-9102-d228c3bdb177.png) 50 | 51 | -------------------------------------------------------------------------------- /lib/widgets/menu_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:font_awesome_flutter/font_awesome_flutter.dart'; 3 | import 'package:food_dashboard/constants.dart'; 4 | 5 | class MenuItem extends StatelessWidget { 6 | final String text; 7 | final IconData icon; 8 | final VoidCallback onTap; 9 | final bool isSeleted; 10 | final Function(bool) onHover; 11 | final bool isHovered; 12 | 13 | const MenuItem({ 14 | Key? key, 15 | required this.text, 16 | required this.icon, 17 | required this.onTap, 18 | required this.isSeleted, 19 | required this.onHover, 20 | required this.isHovered, 21 | }) : super(key: key); 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return Material( 26 | color: Colors.transparent, 27 | child: InkWell( 28 | onTap: onTap, 29 | onHover: onHover, 30 | child: Container( 31 | width: double.infinity, 32 | padding: EdgeInsets.symmetric(vertical: 15), 33 | child: Row( 34 | children: [ 35 | const SizedBox(width: kdefaultPadding * 2.5), 36 | FaIcon( 37 | icon, 38 | color: isSeleted || isHovered ? kWhiteColor : kGreyColor, 39 | size: 16, 40 | ), 41 | const SizedBox(width: 10), 42 | Text( 43 | text, 44 | style: TextStyle( 45 | color: isSeleted || isHovered ? kWhiteColor : kGreyColor, 46 | fontSize: 12), 47 | ), 48 | ], 49 | ), 50 | ), 51 | ), 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /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 | food_dashboard 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 30 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | defaultConfig { 36 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 37 | applicationId "com.example.food_dashboard" 38 | minSdkVersion 16 39 | targetSdkVersion 30 40 | versionCode flutterVersionCode.toInteger() 41 | versionName flutterVersionName 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 59 | } 60 | -------------------------------------------------------------------------------- /lib/datasources/service/auth_service_impl.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:food_dashboard/datasources/api_client/http_client.dart'; 4 | import 'package:food_dashboard/datasources/model/userModel.dart'; 5 | import 'package:food_dashboard/datasources/service/auth_service_contract.dart'; 6 | import 'package:http/http.dart'; 7 | import 'package:shared_preferences/shared_preferences.dart'; 8 | 9 | class AuthServiceImpl implements IAuthService { 10 | final SharedPreferences sharedPreferences; 11 | final HttpClient httpClient; 12 | 13 | AuthServiceImpl({ 14 | required this.httpClient, 15 | required this.sharedPreferences, 16 | }); 17 | 18 | @override 19 | Future signIn({ 20 | required String username, 21 | required String password, 22 | }) async { 23 | String body = jsonEncode({ 24 | "userName": username, 25 | "password": password, 26 | }); 27 | 28 | Response response = await httpClient.post("/auth/signin", body); 29 | 30 | if (response.statusCode == 200) { 31 | var jsonDecoded = jsonDecode(response.body); 32 | UserModel userModel = UserModel.fromJson(jsonDecoded); 33 | sharedPreferences.setString("token", userModel.accessToken); 34 | return userModel; 35 | } else { 36 | var jsonDecoded = jsonDecode(response.body); 37 | print(jsonDecoded); 38 | throw Exception("Error"); 39 | } 40 | } 41 | 42 | @override 43 | Future signUp({ 44 | required String username, 45 | required String email, 46 | required String password, 47 | }) async { 48 | String body = jsonEncode({ 49 | "userName": username, 50 | "email": email, 51 | "password": password, 52 | }); 53 | 54 | Response response = await httpClient.post("/auth/signup", body); 55 | 56 | if (response.statusCode == 200) { 57 | dynamic jsonDecoded = jsonDecode(response.body); 58 | return response.body; 59 | } else { 60 | print(response.body); 61 | throw Exception("Error"); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /lib/widgets/form_title_and_field.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:google_fonts/google_fonts.dart'; 3 | 4 | class FormTitleAndField extends StatelessWidget { 5 | final String title; 6 | final String? hintText; 7 | final String? suffixText; 8 | final TextEditingController textEditingController; 9 | final Function(String value) onChanged; 10 | final Function(String? value) onSaved; 11 | final String? Function(String? value) validate; 12 | final bool obscure; 13 | const FormTitleAndField({ 14 | Key? key, 15 | required this.title, 16 | this.hintText, 17 | this.suffixText, 18 | required this.textEditingController, 19 | required this.onChanged, 20 | required this.onSaved, 21 | required this.validate, 22 | this.obscure = false, 23 | }) : super(key: key); 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return Padding( 28 | padding: const EdgeInsets.only(bottom: 20), 29 | child: Column( 30 | crossAxisAlignment: CrossAxisAlignment.start, 31 | children: [ 32 | Text( 33 | title, 34 | style: GoogleFonts.montserrat( 35 | fontSize: 16, 36 | fontWeight: FontWeight.bold, 37 | ), 38 | ), 39 | TextFormField( 40 | autovalidateMode: AutovalidateMode.onUserInteraction, 41 | onChanged: onChanged, 42 | onSaved: onSaved, 43 | validator: validate, 44 | controller: textEditingController, 45 | style: GoogleFonts.montserrat( 46 | fontSize: 14, 47 | ), 48 | obscureText: obscure, 49 | decoration: InputDecoration( 50 | floatingLabelBehavior: FloatingLabelBehavior.always, 51 | hintText: hintText, 52 | suffixText: suffixText, 53 | suffixStyle: 54 | GoogleFonts.montserrat(fontWeight: FontWeight.bold)), 55 | ), 56 | ], 57 | ), 58 | ); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 13 | 17 | 21 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /lib/domain/entities/restaurant.dart: -------------------------------------------------------------------------------- 1 | class Restaurant { 2 | final String? id; 3 | final String imageUrl; 4 | final String name; 5 | final String resType; 6 | final String rating; 7 | final String price; 8 | final String distance; 9 | 10 | Restaurant({ 11 | this.id, 12 | required this.imageUrl, 13 | required this.name, 14 | required this.resType, 15 | required this.rating, 16 | required this.price, 17 | required this.distance, 18 | }); 19 | 20 | factory Restaurant.fromJson(Map json) { 21 | return Restaurant( 22 | id: json['id'].toString(), 23 | imageUrl: json['imageUrl'] ?? "", 24 | name: json['name'], 25 | resType: json['resType'], 26 | rating: json['rating'], 27 | price: json['price'], 28 | distance: json['distance'], 29 | ); 30 | } 31 | 32 | Map toJson() { 33 | final Map data = new Map(); 34 | data['imageUrl'] = this.imageUrl; 35 | data['name'] = this.name; 36 | data['resType'] = this.resType; 37 | data['rating'] = this.rating; 38 | data['price'] = this.price; 39 | data['distance'] = this.distance; 40 | return data; 41 | } 42 | } 43 | 44 | List cachedRestaurantList = [ 45 | Restaurant( 46 | id: "1", 47 | imageUrl: "assets/images/molon_lave.jpg", 48 | name: "Molon Lave", 49 | resType: "Asian Kitchen", 50 | rating: "4.7", 51 | price: "30", 52 | distance: "0.2", 53 | ), 54 | Restaurant( 55 | id: "2", 56 | imageUrl: "assets/images/boston_barista.jpg", 57 | name: "Bostan Barista", 58 | resType: "Pubs", 59 | rating: "4.8", 60 | price: "50", 61 | distance: "1.2", 62 | ), 63 | Restaurant( 64 | id: "3", 65 | imageUrl: "assets/images/family_bean.jpg", 66 | name: "Family Bean", 67 | resType: "Cafe", 68 | rating: "3.9", 69 | price: "45", 70 | distance: "3.1", 71 | ), 72 | Restaurant( 73 | id: "4", 74 | imageUrl: "assets/images/powerhouse.jpg", 75 | name: "Power House", 76 | resType: "Vegan", 77 | rating: "4.2", 78 | price: "28", 79 | distance: "0.6", 80 | ), 81 | Restaurant( 82 | id: "5", 83 | imageUrl: "assets/images/lureme.jpg", 84 | name: "Lureme", 85 | resType: "Cocktail Bar", 86 | rating: "4.3", 87 | price: "55", 88 | distance: "1.2", 89 | ), 90 | ]; 91 | -------------------------------------------------------------------------------- /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/datasources/api_client/http_client.dart: -------------------------------------------------------------------------------- 1 | import 'package:http/http.dart'; 2 | import 'package:shared_preferences/shared_preferences.dart'; 3 | 4 | class HttpClient { 5 | final Client client; 6 | final SharedPreferences sharedPreferences; 7 | 8 | HttpClient({ 9 | required this.client, 10 | required this.sharedPreferences, 11 | }); 12 | 13 | static const String BASEURL = "http://localhost:8080/api/v1"; 14 | 15 | Future get(String url) async { 16 | Uri uri = parseUrl(url); 17 | 18 | if (sharedPreferences.getString("token") != null) { 19 | String token = sharedPreferences.getString("token")!; 20 | 21 | Response response = await client.get( 22 | uri, 23 | headers: {"Authorization": "Bearer $token"}, 24 | ); 25 | 26 | return response; 27 | } else { 28 | Response response = await client.get(uri); 29 | return response; 30 | } 31 | } 32 | 33 | Future post(String url, body) async { 34 | Uri uri = parseUrl(url); 35 | print(uri); 36 | 37 | if (sharedPreferences.getString("token") != null) { 38 | String token = sharedPreferences.getString("token")!; 39 | Response response = await client.post( 40 | uri, 41 | body: body, 42 | headers: { 43 | "Content-Type": "application/json", 44 | "Authorization": "Bearer $token", 45 | }, 46 | ); 47 | return response; 48 | } else { 49 | Response response = await client.post( 50 | uri, 51 | body: body, 52 | headers: {"Content-Type": "application/json"}, 53 | ); 54 | return response; 55 | } 56 | } 57 | 58 | Future put(String url, body) async { 59 | Uri uri = parseUrl(url); 60 | 61 | if (sharedPreferences.getString("token") != null) { 62 | String token = sharedPreferences.getString("token")!; 63 | Response response = await client.put( 64 | uri, 65 | body: body, 66 | headers: { 67 | "Content-Type": "application/json", 68 | "Authorization": "Bearer $token", 69 | }, 70 | ); 71 | return response; 72 | } else { 73 | Response response = await client.put( 74 | uri, 75 | body: body, 76 | headers: { 77 | "Content-Type": "application/json", 78 | }, 79 | ); 80 | return response; 81 | } 82 | } 83 | 84 | Future delete(String url) async { 85 | Uri uri = parseUrl(url); 86 | 87 | if (sharedPreferences.getString("token") != null) { 88 | String token = sharedPreferences.getString("token")!; 89 | Response response = await client.delete( 90 | uri, 91 | headers: { 92 | "Authorization": "Bearer $token", 93 | }, 94 | ); 95 | return response; 96 | } else { 97 | Response response = await client.delete(uri); 98 | return response; 99 | } 100 | } 101 | 102 | Uri parseUrl(String url) { 103 | Uri uri = Uri.parse(BASEURL + url); 104 | return uri; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: food_dashboard 2 | description: A new Flutter project. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: "none" # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.0.0+1 19 | 20 | environment: 21 | sdk: ">=2.12.0 <3.0.0" 22 | 23 | dependencies: 24 | cached_network_image: ^3.1.0 25 | cupertino_icons: ^1.0.2 26 | dio: ^4.0.0 27 | equatable: ^2.0.3 28 | firebase: ^9.0.2 29 | firebase_core: ^1.6.0 30 | firebase_storage: ^10.0.3 31 | flutter: 32 | sdk: flutter 33 | flutter_bloc: ^7.3.0 34 | font_awesome_flutter: ^9.1.0 35 | get_it: ^7.2.0 36 | google_fonts: ^2.1.0 37 | http: ^0.13.3 38 | http_parser: ^4.0.0 39 | image_picker_web: ^2.0.3+1 40 | mime_type: ^1.0.0 41 | shared_preferences: ^2.0.7 42 | 43 | dev_dependencies: 44 | flutter_test: 45 | sdk: flutter 46 | 47 | # For information on the generic Dart part of this file, see the 48 | # following page: https://dart.dev/tools/pub/pubspec 49 | # The following section is specific to Flutter. 50 | flutter: 51 | # The following line ensures that the Material Icons font is 52 | # included with your application, so that you can use the icons in 53 | # the material Icons class. 54 | uses-material-design: true 55 | 56 | # To add assets to your application, add an assets section, like this: 57 | assets: 58 | - assets/images/ 59 | # - images/a_dot_ham.jpeg 60 | # An image asset can refer to one or more resolution-specific "variants", see 61 | # https://flutter.dev/assets-and-images/#resolution-aware. 62 | # For details regarding adding assets from package dependencies, see 63 | # https://flutter.dev/assets-and-images/#from-packages 64 | # To add custom fonts to your application, add a fonts section here, 65 | # in this "flutter" section. Each entry in this list should have a 66 | # "family" key with the font family name, and a "fonts" key with a 67 | # list giving the asset and other descriptors for the font. For 68 | # example: 69 | # fonts: 70 | # - family: Schyler 71 | # fonts: 72 | # - asset: fonts/Schyler-Regular.ttf 73 | # - asset: fonts/Schyler-Italic.ttf 74 | # style: italic 75 | # - family: Trajan Pro 76 | # fonts: 77 | # - asset: fonts/TrajanPro.ttf 78 | # - asset: fonts/TrajanPro_Bold.ttf 79 | # weight: 700 80 | # 81 | # For details regarding fonts from package dependencies, 82 | # see https://flutter.dev/custom-fonts/#from-packages 83 | -------------------------------------------------------------------------------- /lib/widgets/location_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:font_awesome_flutter/font_awesome_flutter.dart'; 3 | 4 | import 'package:food_dashboard/constants.dart'; 5 | 6 | class LocationCardWidget extends StatelessWidget { 7 | const LocationCardWidget({ 8 | Key? key, 9 | }) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Padding( 14 | padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 40), 15 | child: Stack( 16 | children: [ 17 | Container( 18 | height: 250, 19 | padding: EdgeInsets.symmetric( 20 | horizontal: 25, 21 | vertical: 25, 22 | ), 23 | width: double.infinity, 24 | decoration: BoxDecoration( 25 | color: Colors.grey.shade900, 26 | borderRadius: BorderRadius.circular(16), 27 | ), 28 | child: Column( 29 | mainAxisAlignment: MainAxisAlignment.end, 30 | crossAxisAlignment: CrossAxisAlignment.start, 31 | children: [ 32 | Text( 33 | "Local advisor", 34 | style: TextStyle( 35 | color: kWhiteColor, 36 | fontWeight: FontWeight.bold, 37 | ), 38 | ), 39 | const SizedBox(height: kdefaultPadding / 2), 40 | Container( 41 | padding: EdgeInsets.symmetric( 42 | horizontal: 10, 43 | vertical: 2, 44 | ), 45 | decoration: BoxDecoration( 46 | color: Colors.grey.shade700, 47 | borderRadius: BorderRadius.circular(12), 48 | ), 49 | child: Text( 50 | "beta", 51 | style: TextStyle( 52 | fontSize: 10, 53 | fontWeight: FontWeight.bold, 54 | ), 55 | ), 56 | ) 57 | ], 58 | ), 59 | ), 60 | Positioned( 61 | left: 40, 62 | top: 40, 63 | child: CircleAvatar(backgroundColor: kWhiteColor, radius: 3), 64 | ), 65 | Positioned( 66 | right: 60, 67 | top: 35, 68 | child: CircleAvatar( 69 | backgroundColor: kWhiteColor, 70 | radius: 10, 71 | child: CircleAvatar( 72 | radius: 3, 73 | backgroundColor: Colors.black, 74 | ), 75 | ), 76 | ), 77 | Positioned( 78 | left: 45, 79 | top: 120, 80 | child: FaIcon( 81 | FontAwesomeIcons.locationArrow, 82 | color: Colors.white, 83 | size: 18, 84 | ), 85 | ), 86 | Positioned( 87 | right: 80, 88 | bottom: 150, 89 | child: CircleAvatar(backgroundColor: kWhiteColor, radius: 3), 90 | ), 91 | Positioned( 92 | right: 40, 93 | bottom: 90, 94 | child: CircleAvatar(backgroundColor: kWhiteColor, radius: 3), 95 | ), 96 | ], 97 | ), 98 | ); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /lib/widgets/category_icon_with_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:font_awesome_flutter/font_awesome_flutter.dart'; 3 | import 'package:food_dashboard/domain/entities/category.dart'; 4 | 5 | class CategoryIconWithText extends StatelessWidget { 6 | const CategoryIconWithText({ 7 | Key? key, 8 | }) : super(key: key); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return Container( 13 | height: 75, 14 | width: double.infinity, 15 | child: ListView.builder( 16 | shrinkWrap: true, 17 | scrollDirection: Axis.horizontal, 18 | itemCount: categories.length + 1, 19 | itemBuilder: (context, index) { 20 | if (index == categories.length) { 21 | return Padding( 22 | padding: const EdgeInsets.only(right: 30), 23 | child: Column( 24 | children: [ 25 | Material( 26 | color: Colors.transparent, 27 | borderRadius: BorderRadius.circular(50.0), 28 | child: InkWell( 29 | onTap: () {}, 30 | borderRadius: BorderRadius.circular(50.0), 31 | child: CircleAvatar( 32 | backgroundColor: Colors 33 | .primaries[index % Colors.primaries.length] 34 | .withOpacity(0.5), 35 | child: FaIcon( 36 | FontAwesomeIcons.plus, 37 | color: Colors.black, 38 | size: 16, 39 | ), 40 | ), 41 | ), 42 | ), 43 | const SizedBox(height: 10), 44 | Text( 45 | "More", 46 | style: TextStyle( 47 | fontSize: 10, 48 | color: Colors.grey.shade600, 49 | ), 50 | ), 51 | ], 52 | ), 53 | ); 54 | } 55 | 56 | return Padding( 57 | padding: const EdgeInsets.only(right: 30), 58 | child: Column( 59 | children: [ 60 | Material( 61 | color: Colors.transparent, 62 | borderRadius: BorderRadius.circular(50.0), 63 | child: InkWell( 64 | onTap: () {}, 65 | borderRadius: BorderRadius.circular(50.0), 66 | child: CircleAvatar( 67 | backgroundColor: Colors 68 | .primaries[index % Colors.primaries.length] 69 | .withOpacity(0.5), 70 | child: FaIcon( 71 | categories[index].icon, 72 | color: Colors.black, 73 | size: 16, 74 | ), 75 | ), 76 | )), 77 | const SizedBox(height: 10), 78 | Text( 79 | categories[index].text.toUpperCase(), 80 | style: TextStyle( 81 | fontSize: 10, 82 | color: Colors.grey.shade600, 83 | ), 84 | ), 85 | ], 86 | ), 87 | ); 88 | }, 89 | ), 90 | ); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | food_dashboard 27 | 28 | 29 | 30 | 31 | 32 | 33 | 36 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /lib/datasources/service/restaurant_service_impl.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:html'; 3 | import 'dart:typed_data'; 4 | import 'package:food_dashboard/datasources/api_client/http_client.dart'; 5 | import 'package:food_dashboard/datasources/service/restaurant_service_contract.dart'; 6 | import 'package:food_dashboard/domain/entities/restaurant.dart'; 7 | import 'package:http/http.dart'; 8 | 9 | class RestaurantServiceImpl implements IRestaurantService { 10 | final HttpClient client; 11 | 12 | RestaurantServiceImpl(this.client); 13 | 14 | @override 15 | Future> getAllRestaurant() async { 16 | Response response = await client.get("/restaurant/all"); 17 | 18 | if (response.statusCode == 200) { 19 | var jsonDecoded = jsonDecode(response.body) as List; 20 | List allRestaurant = jsonDecoded.map((json) { 21 | Restaurant restaurant = Restaurant.fromJson(json); 22 | return restaurant; 23 | }).toList(); 24 | return allRestaurant; 25 | } else { 26 | print("Connection Error"); 27 | throw Exception("Error"); 28 | } 29 | } 30 | 31 | @override 32 | Future addRestaurant( 33 | Restaurant restaurant, 34 | Uint8List bytes, 35 | File file, 36 | ) async { 37 | String filename = file.name; 38 | String base64encode = base64Encode(bytes); 39 | String fileType = file.type; 40 | 41 | String body = jsonEncode( 42 | { 43 | 'name': restaurant.name, 44 | 'resType': restaurant.resType, 45 | 'rating': restaurant.rating, 46 | 'price': restaurant.price, 47 | 'distance': restaurant.distance, 48 | "fileName": filename, 49 | "fileType": fileType, 50 | "bytes": base64encode, 51 | }, 52 | ); 53 | 54 | Response response = await client.post("/restaurant/add", body); 55 | 56 | if (response.statusCode == 201) { 57 | var jsonDecoded = jsonDecode(response.body); 58 | Restaurant restaurant = Restaurant.fromJson(jsonDecoded); 59 | print(jsonDecoded); 60 | return restaurant; 61 | } else { 62 | throw Exception("Error"); 63 | } 64 | } 65 | 66 | @override 67 | Future deleteRestaurant(String id) async { 68 | Response response = await client.delete("/restaurant/delete/$id"); 69 | if (response.statusCode == 200) { 70 | print("restaurant $id deleted"); 71 | } else { 72 | throw Exception("Something went wrong"); 73 | } 74 | } 75 | 76 | @override 77 | Future getRestaurantById(String id) async { 78 | Response response = await client.get("/restaurant/$id"); 79 | if (response.statusCode == 200) { 80 | print(response.body); 81 | var json = jsonDecode(response.body); 82 | 83 | return Restaurant.fromJson(json); 84 | } else { 85 | throw Exception("Something went wrong"); 86 | } 87 | } 88 | 89 | @override 90 | Future updateRestaurant( 91 | String id, 92 | Restaurant restaurant, 93 | Uint8List? bytes, 94 | File? file, 95 | ) async { 96 | String body; 97 | 98 | if (bytes != null && file != null) { 99 | String filename = file.name; 100 | String base64encode = base64Encode(bytes); 101 | String fileType = file.type; 102 | 103 | body = jsonEncode( 104 | { 105 | 'name': restaurant.name, 106 | 'resType': restaurant.resType, 107 | 'rating': restaurant.rating, 108 | 'price': restaurant.price, 109 | 'distance': restaurant.distance, 110 | "fileName": filename, 111 | "fileType": fileType, 112 | "bytes": base64encode, 113 | }, 114 | ); 115 | } else { 116 | body = jsonEncode(restaurant.toJson()); 117 | } 118 | 119 | Response response = await client.put("/restaurant/update/$id", body); 120 | if (response.statusCode == 200) { 121 | print(response.body); 122 | var json = jsonDecode(response.body); 123 | 124 | return Restaurant.fromJson(json); 125 | } else { 126 | throw Exception("Something went wrong"); 127 | } 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /lib/widgets/side_menu.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:food_dashboard/constants.dart'; 4 | import 'package:food_dashboard/domain/entities/menu.dart'; 5 | import 'package:food_dashboard/screens/bloc/page_bloc.dart'; 6 | import 'package:food_dashboard/widgets/location_card.dart'; 7 | import 'package:food_dashboard/widgets/menu_item.dart'; 8 | 9 | class SideMenu extends StatefulWidget { 10 | const SideMenu({Key? key}) : super(key: key); 11 | 12 | @override 13 | _SideMenuState createState() => _SideMenuState(); 14 | } 15 | 16 | class _SideMenuState extends State { 17 | int currentSelectedIndex = 0; 18 | bool isHovered = false; 19 | int? currentHoveredIndex; 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | return Container( 24 | color: Colors.black, 25 | child: Column( 26 | children: [ 27 | const SizedBox(height: 30), 28 | Row( 29 | mainAxisAlignment: MainAxisAlignment.center, 30 | children: [ 31 | Text( 32 | "I", 33 | style: TextStyle( 34 | fontSize: 18, 35 | fontWeight: FontWeight.bold, 36 | color: Colors.white), 37 | ), 38 | const SizedBox(width: 5), 39 | Icon( 40 | Icons.favorite, 41 | color: Colors.white, 42 | size: 18, 43 | ), 44 | const SizedBox(width: 5), 45 | Text( 46 | "Food", 47 | style: TextStyle( 48 | fontSize: 18, 49 | fontWeight: FontWeight.bold, 50 | color: Colors.white), 51 | ), 52 | ], 53 | ), 54 | const SizedBox(height: 30), 55 | Container( 56 | height: 60, 57 | width: 60, 58 | padding: EdgeInsets.all(2), 59 | decoration: BoxDecoration( 60 | shape: BoxShape.circle, 61 | gradient: LinearGradient( 62 | colors: [ 63 | Colors.blue, 64 | Colors.purple, 65 | Colors.pink, 66 | ], 67 | ), 68 | ), 69 | child: ClipRRect( 70 | borderRadius: BorderRadius.circular(50), 71 | child: Image.asset( 72 | "assets/images/Joaquin_Phoenix.jpg", 73 | fit: BoxFit.cover, 74 | ), 75 | ), 76 | ), 77 | const SizedBox(height: 20), 78 | Text( 79 | "Welcome", 80 | style: TextStyle(color: kGreyColor), 81 | ), 82 | const SizedBox(height: 10), 83 | Text( 84 | "John Miles", 85 | style: TextStyle( 86 | color: kWhiteColor, fontWeight: FontWeight.bold, fontSize: 14), 87 | ), 88 | const SizedBox(height: 20), 89 | ...menuList 90 | .asMap() 91 | .map((index, item) => MapEntry( 92 | index, 93 | MenuItem( 94 | text: item.title, 95 | icon: item.icon, 96 | onTap: () { 97 | setState(() { 98 | currentSelectedIndex = index; 99 | context 100 | .read() 101 | .add(ChangePageEvent(index: currentSelectedIndex)); 102 | }); 103 | }, 104 | isSeleted: index == currentSelectedIndex, 105 | onHover: (value) { 106 | if (value) { 107 | setState(() { 108 | currentHoveredIndex = index; 109 | }); 110 | } else { 111 | setState(() { 112 | currentHoveredIndex = null; 113 | }); 114 | } 115 | }, 116 | isHovered: currentHoveredIndex == index, 117 | ))) 118 | .values 119 | .toList(), 120 | Spacer(), 121 | LocationCardWidget(), 122 | ], 123 | ), 124 | ); 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:food_dashboard/constants.dart'; 4 | import 'package:food_dashboard/responsive.dart'; 5 | import 'package:food_dashboard/screens/bloc/page_bloc.dart'; 6 | import 'package:food_dashboard/screens/home/home_screen.dart'; 7 | import 'package:food_dashboard/screens/sign_in/sign_in_screen.dart'; 8 | import 'package:food_dashboard/widgets/side_menu.dart'; 9 | import 'package:google_fonts/google_fonts.dart'; 10 | import 'package:shared_preferences/shared_preferences.dart'; 11 | import 'di/get_it.dart' as di; 12 | 13 | Future main() async { 14 | WidgetsFlutterBinding.ensureInitialized(); 15 | await di.init(); 16 | runApp(MyApp()); 17 | } 18 | 19 | class MyApp extends StatelessWidget { 20 | // This widget is the root of your application. 21 | @override 22 | Widget build(BuildContext context) { 23 | return BlocProvider( 24 | create: (context) => PageBloc(), 25 | child: MaterialApp( 26 | title: 'Flutter Demo', 27 | debugShowCheckedModeBanner: false, 28 | theme: ThemeData( 29 | textTheme: 30 | GoogleFonts.montserratTextTheme(Theme.of(context).textTheme), 31 | primarySwatch: Colors.blue, 32 | ), 33 | // home: MainScreen(), 34 | home: FutureBuilder( 35 | initialData: SignInScreen(), 36 | future: checkWhetherUserHaveJwtToken(), 37 | builder: (context, snapshot) { 38 | return snapshot.data!; 39 | }, 40 | ), 41 | ), 42 | ); 43 | } 44 | 45 | Future checkWhetherUserHaveJwtToken() async { 46 | var sharedPreferences = await SharedPreferences.getInstance(); 47 | if (sharedPreferences.getString("token") == null) { 48 | return SignInScreen(); 49 | } else { 50 | return MainScreen(); 51 | } 52 | } 53 | } 54 | 55 | class MainScreen extends StatefulWidget { 56 | const MainScreen({Key? key}) : super(key: key); 57 | 58 | @override 59 | _MainScreenState createState() => _MainScreenState(); 60 | } 61 | 62 | class _MainScreenState extends State { 63 | @override 64 | void initState() { 65 | super.initState(); 66 | context.read().add(ChangePageEvent(index: 0)); 67 | } 68 | 69 | @override 70 | Widget build(BuildContext context) { 71 | double width = MediaQuery.of(context).size.width; 72 | return Scaffold( 73 | body: ListView( 74 | children: [ 75 | ResponsiveWidget( 76 | mobile: mobileWidget(), 77 | tablet: tabletWidget(), 78 | desktop: Container( 79 | height: 753.59, 80 | child: Row( 81 | children: [ 82 | Expanded( 83 | flex: (width < 1200) ? 2 : 1, 84 | child: SideMenu(), 85 | ), 86 | Expanded( 87 | flex: (width < 1200) ? 7 : 5, 88 | child: BlocBuilder( 89 | builder: (context, state) { 90 | if (state is PageLoaded) { 91 | return state.page; 92 | } 93 | return Center(child: CircularProgressIndicator()); 94 | }, 95 | ), 96 | ), 97 | ], 98 | ), 99 | ), 100 | ), 101 | ], 102 | ), 103 | ); 104 | } 105 | 106 | Widget mobileWidget() { 107 | return BlocBuilder( 108 | builder: (context, state) { 109 | if (state is PageLoaded) { 110 | return state.page; 111 | } 112 | return Center(child: CircularProgressIndicator()); 113 | }, 114 | ); 115 | } 116 | 117 | Widget tabletWidget() { 118 | return BlocBuilder( 119 | builder: (context, state) { 120 | if (state is PageLoaded) { 121 | return state.page; 122 | } 123 | return Center(child: CircularProgressIndicator()); 124 | }, 125 | ); 126 | } 127 | } 128 | 129 | class ActionButton extends StatelessWidget { 130 | final String text; 131 | final VoidCallback onTap; 132 | final Color color; 133 | 134 | const ActionButton({ 135 | Key? key, 136 | required this.text, 137 | required this.onTap, 138 | required this.color, 139 | }) : super(key: key); 140 | 141 | @override 142 | Widget build(BuildContext context) { 143 | return Padding( 144 | padding: const EdgeInsets.only(right: 10), 145 | child: Material( 146 | color: color, 147 | borderRadius: BorderRadius.circular(12), 148 | child: InkWell( 149 | borderRadius: BorderRadius.circular(12), 150 | onTap: onTap, 151 | child: Padding( 152 | padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10), 153 | child: Text( 154 | text, 155 | style: normalText.copyWith(color: Colors.white), 156 | ), 157 | ), 158 | ), 159 | ), 160 | ); 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /lib/widgets/restaurant_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:food_dashboard/domain/entities/restaurant.dart'; 5 | import 'package:google_fonts/google_fonts.dart'; 6 | 7 | class RestaurantCard extends StatelessWidget { 8 | final Color backgroundColor; 9 | final Restaurant restaurant; 10 | final VoidCallback onTap; 11 | 12 | const RestaurantCard({ 13 | Key? key, 14 | required this.backgroundColor, 15 | required this.restaurant, 16 | required this.onTap, 17 | }) : super(key: key); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | return Material( 22 | borderRadius: BorderRadius.circular( 23 | 10.0, 24 | ), 25 | color: backgroundColor.withOpacity(0.2), 26 | child: InkWell( 27 | onTap: onTap, 28 | borderRadius: BorderRadius.circular( 29 | 10.0, 30 | ), 31 | child: Container( 32 | height: 275, 33 | width: 220, 34 | padding: EdgeInsets.all(20), 35 | child: Column( 36 | children: [ 37 | ClipRRect( 38 | borderRadius: BorderRadius.circular(10.0), 39 | child: Container( 40 | width: 180, 41 | child: AspectRatio( 42 | aspectRatio: 1.8, 43 | child: CachedNetworkImage( 44 | imageUrl: restaurant.imageUrl, 45 | fit: BoxFit.cover, 46 | ), 47 | ), 48 | ), 49 | ), 50 | Spacer(), 51 | Column( 52 | children: [ 53 | Text( 54 | restaurant.name, 55 | style: GoogleFonts.montserrat( 56 | fontSize: 16, 57 | fontWeight: FontWeight.w700, 58 | ), 59 | overflow: TextOverflow.ellipsis, 60 | textAlign: TextAlign.center, 61 | maxLines: 2, 62 | ), 63 | const SizedBox(height: 3), 64 | Text( 65 | restaurant.resType, 66 | overflow: TextOverflow.ellipsis, 67 | style: GoogleFonts.montserrat( 68 | fontSize: 10, 69 | color: Colors.grey.shade600, 70 | ), 71 | ), 72 | ], 73 | ), 74 | Spacer(), 75 | Container( 76 | height: 50, 77 | child: IntrinsicHeight( 78 | child: Row( 79 | mainAxisSize: MainAxisSize.min, 80 | children: [ 81 | Column( 82 | mainAxisAlignment: MainAxisAlignment.center, 83 | children: [ 84 | Icon( 85 | Icons.star, 86 | size: 14, 87 | ), 88 | const SizedBox(height: 10), 89 | Text( 90 | restaurant.rating, 91 | style: GoogleFonts.montserrat( 92 | fontSize: 16, 93 | fontWeight: FontWeight.bold, 94 | ), 95 | ) 96 | ], 97 | ), 98 | CustomDivider(height: 40), 99 | Column( 100 | mainAxisAlignment: MainAxisAlignment.center, 101 | children: [ 102 | Row( 103 | children: [ 104 | CurrencyIcon(size: 10), 105 | CurrencyIcon( 106 | size: 10, color: Colors.grey.shade600), 107 | CurrencyIcon( 108 | size: 10, color: Colors.grey.shade600), 109 | ], 110 | ), 111 | const SizedBox(height: 10), 112 | Text( 113 | restaurant.price, 114 | style: GoogleFonts.montserrat( 115 | fontSize: 16, 116 | fontWeight: FontWeight.bold, 117 | ), 118 | ) 119 | ], 120 | ), 121 | CustomDivider(height: 40), 122 | Column( 123 | mainAxisAlignment: MainAxisAlignment.center, 124 | children: [ 125 | Text( 126 | "km", 127 | style: GoogleFonts.montserrat( 128 | fontSize: 11, 129 | fontWeight: FontWeight.bold, 130 | ), 131 | ), 132 | const SizedBox(height: 10), 133 | Text( 134 | restaurant.distance, 135 | style: GoogleFonts.montserrat( 136 | fontSize: 16, 137 | fontWeight: FontWeight.bold, 138 | ), 139 | ) 140 | ], 141 | ), 142 | ], 143 | ), 144 | ), 145 | ), 146 | ], 147 | ), 148 | ), 149 | ), 150 | ); 151 | } 152 | } 153 | 154 | class CurrencyIcon extends StatelessWidget { 155 | final double size; 156 | final Color color; 157 | const CurrencyIcon({ 158 | Key? key, 159 | required this.size, 160 | this.color = Colors.black, 161 | }) : super(key: key); 162 | 163 | @override 164 | Widget build(BuildContext context) { 165 | return Text( 166 | "\$", 167 | style: GoogleFonts.montserrat( 168 | fontSize: size, 169 | fontWeight: FontWeight.bold, 170 | color: color, 171 | ), 172 | ); 173 | } 174 | } 175 | 176 | class CustomDivider extends StatelessWidget { 177 | final double height; 178 | 179 | const CustomDivider({ 180 | required this.height, 181 | Key? key, 182 | }) : super(key: key); 183 | 184 | @override 185 | Widget build(BuildContext context) { 186 | return Padding( 187 | padding: const EdgeInsets.symmetric(horizontal: 10), 188 | child: Container( 189 | height: height, 190 | width: 1, 191 | color: Colors.grey.shade500, 192 | ), 193 | ); 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /lib/screens/sign_in/sign_in_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:food_dashboard/constants.dart'; 3 | import 'package:food_dashboard/datasources/api_client/http_client.dart'; 4 | import 'package:food_dashboard/datasources/model/userModel.dart'; 5 | import 'package:food_dashboard/datasources/service/auth_service_contract.dart'; 6 | import 'package:food_dashboard/datasources/service/auth_service_impl.dart'; 7 | import 'package:food_dashboard/di/get_it.dart'; 8 | import 'package:food_dashboard/main.dart'; 9 | import 'package:food_dashboard/screens/home/home_screen.dart'; 10 | import 'package:food_dashboard/screens/sign_up/sign_up_screen.dart'; 11 | import 'package:food_dashboard/widgets/custom_text_button.dart'; 12 | import 'package:food_dashboard/widgets/form_title_and_field.dart'; 13 | import 'package:google_fonts/google_fonts.dart'; 14 | import 'package:http/http.dart'; 15 | import 'package:shared_preferences/shared_preferences.dart'; 16 | 17 | class SignInScreen extends StatefulWidget { 18 | const SignInScreen({Key? key}) : super(key: key); 19 | 20 | @override 21 | _SignInScreenState createState() => _SignInScreenState(); 22 | } 23 | 24 | class _SignInScreenState extends State { 25 | String? username; 26 | String? password; 27 | 28 | TextEditingController usernameController = TextEditingController(); 29 | TextEditingController passwordController = TextEditingController(); 30 | GlobalKey formKey = GlobalKey(); 31 | 32 | final authService = getIt(); 33 | 34 | @override 35 | Widget build(BuildContext context) { 36 | Size size = MediaQuery.of(context).size; 37 | 38 | return Scaffold( 39 | body: Form( 40 | key: formKey, 41 | child: GestureDetector( 42 | onTap: () { 43 | FocusScopeNode currentFocus = FocusScope.of(context); 44 | if (!currentFocus.hasPrimaryFocus) { 45 | currentFocus.unfocus(); 46 | } 47 | }, 48 | child: Container( 49 | color: Colors.white, 50 | width: size.width, 51 | height: size.height, 52 | alignment: Alignment.center, 53 | child: SingleChildScrollView( 54 | child: Column( 55 | children: [ 56 | Container( 57 | width: 600, 58 | padding: EdgeInsets.symmetric(horizontal: 40, vertical: 50), 59 | decoration: BoxDecoration( 60 | borderRadius: BorderRadius.circular(10), 61 | color: Colors.green.withOpacity(0.5), 62 | ), 63 | child: Column( 64 | children: [ 65 | Text( 66 | "Sign in", 67 | style: largestText, 68 | ), 69 | const SizedBox(height: 50), 70 | FormTitleAndField( 71 | title: "Username", 72 | textEditingController: usernameController, 73 | onChanged: (value) { 74 | setState(() { 75 | username = value; 76 | }); 77 | }, 78 | onSaved: (value) { 79 | setState(() { 80 | username = value; 81 | }); 82 | }, 83 | validate: (value) { 84 | if (value == null || value.isEmpty) { 85 | return 'Please enter your username'; 86 | } 87 | return null; 88 | }, 89 | ), 90 | FormTitleAndField( 91 | title: "Password", 92 | textEditingController: passwordController, 93 | obscure: true, 94 | onChanged: (value) { 95 | setState(() { 96 | password = value; 97 | }); 98 | }, 99 | onSaved: (value) { 100 | setState(() { 101 | password = value; 102 | }); 103 | }, 104 | validate: (value) { 105 | if (value == null || value.isEmpty) { 106 | return 'Please enter your password'; 107 | } 108 | return null; 109 | }, 110 | ), 111 | Row( 112 | mainAxisAlignment: MainAxisAlignment.end, 113 | children: [ 114 | InkWell( 115 | onTap: () {}, 116 | child: Text("Forgot Password?"), 117 | ), 118 | ], 119 | ), 120 | const SizedBox(height: 30), 121 | CustomTextButton( 122 | text: "Sign In", 123 | onTap: () async { 124 | if (formKey.currentState!.validate()) { 125 | UserModel? user = await authService.signIn( 126 | username: username!, 127 | password: password!, 128 | ); 129 | if (user != null) 130 | Navigator.pushReplacement( 131 | context, 132 | MaterialPageRoute( 133 | builder: (context) => MainScreen(), 134 | )); 135 | } else { 136 | print("Username/password incorrect"); 137 | } 138 | }), 139 | const SizedBox(height: 30), 140 | Row( 141 | mainAxisAlignment: MainAxisAlignment.center, 142 | children: [ 143 | Text("Don't have an account ? "), 144 | InkWell( 145 | onTap: () { 146 | Navigator.push(context, MaterialPageRoute( 147 | builder: (context) { 148 | return SignUpScreen(); 149 | }, 150 | )); 151 | }, 152 | child: Text( 153 | "Sign Up", 154 | style: GoogleFonts.montserrat( 155 | color: Colors.blue, 156 | ), 157 | ), 158 | ), 159 | ], 160 | ), 161 | ], 162 | ), 163 | ), 164 | ], 165 | ), 166 | ), 167 | ), 168 | ), 169 | ), 170 | ); 171 | } 172 | } 173 | -------------------------------------------------------------------------------- /lib/screens/sign_up/sign_up_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:food_dashboard/constants.dart'; 3 | import 'package:food_dashboard/datasources/service/auth_service_contract.dart'; 4 | import 'package:food_dashboard/di/get_it.dart'; 5 | import 'package:food_dashboard/screens/sign_in/sign_in_screen.dart'; 6 | import 'package:food_dashboard/widgets/custom_text_button.dart'; 7 | import 'package:food_dashboard/widgets/form_title_and_field.dart'; 8 | import 'package:google_fonts/google_fonts.dart'; 9 | 10 | class SignUpScreen extends StatefulWidget { 11 | const SignUpScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | _SignUpScreenState createState() => _SignUpScreenState(); 15 | } 16 | 17 | class _SignUpScreenState extends State { 18 | String? username; 19 | String? email; 20 | String? password; 21 | 22 | TextEditingController usernameController = TextEditingController(); 23 | TextEditingController emailController = TextEditingController(); 24 | TextEditingController passwordController = TextEditingController(); 25 | GlobalKey formKey = GlobalKey(); 26 | 27 | final authService = getIt(); 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | Size size = MediaQuery.of(context).size; 32 | 33 | return Scaffold( 34 | body: Form( 35 | key: formKey, 36 | child: GestureDetector( 37 | onTap: () { 38 | FocusScopeNode currentFocus = FocusScope.of(context); 39 | if (!currentFocus.hasPrimaryFocus) { 40 | currentFocus.unfocus(); 41 | } 42 | }, 43 | child: Container( 44 | color: Colors.white, 45 | width: size.width, 46 | height: size.height, 47 | alignment: Alignment.center, 48 | child: SingleChildScrollView( 49 | child: Column( 50 | children: [ 51 | Container( 52 | width: 600, 53 | padding: EdgeInsets.symmetric(horizontal: 40, vertical: 50), 54 | decoration: BoxDecoration( 55 | borderRadius: BorderRadius.circular(10), 56 | color: Colors.green.withOpacity(0.5), 57 | ), 58 | child: Column( 59 | children: [ 60 | Text( 61 | "Sign Up", 62 | style: largestText, 63 | ), 64 | const SizedBox(height: 50), 65 | FormTitleAndField( 66 | title: "Username", 67 | textEditingController: usernameController, 68 | onChanged: (value) { 69 | setState(() { 70 | username = value; 71 | }); 72 | }, 73 | onSaved: (value) { 74 | setState(() { 75 | username = value; 76 | }); 77 | }, 78 | validate: (value) { 79 | if (value == null || value.isEmpty) { 80 | return 'Please enter your username'; 81 | } 82 | return null; 83 | }, 84 | ), 85 | FormTitleAndField( 86 | title: "Email", 87 | textEditingController: emailController, 88 | onChanged: (value) { 89 | setState(() { 90 | email = value; 91 | }); 92 | }, 93 | onSaved: (value) { 94 | setState(() { 95 | email = value; 96 | }); 97 | }, 98 | validate: (value) { 99 | if (value == null || value.isEmpty) { 100 | return 'Please enter your email'; 101 | } 102 | return null; 103 | }, 104 | ), 105 | FormTitleAndField( 106 | title: "Password", 107 | textEditingController: passwordController, 108 | obscure: true, 109 | onChanged: (value) { 110 | setState(() { 111 | password = value; 112 | }); 113 | }, 114 | onSaved: (value) { 115 | setState(() { 116 | password = value; 117 | }); 118 | }, 119 | validate: (value) { 120 | if (value == null || value.isEmpty) { 121 | return 'Please enter your password'; 122 | } 123 | return null; 124 | }, 125 | ), 126 | const SizedBox(height: 30), 127 | CustomTextButton( 128 | text: "Sign Up", 129 | onTap: () async { 130 | if (formKey.currentState!.validate()) { 131 | print(username); 132 | print(email); 133 | print(password); 134 | await authService.signUp( 135 | username: username!, 136 | email: email!, 137 | password: password!, 138 | ); 139 | Navigator.push(context, MaterialPageRoute( 140 | builder: (context) { 141 | return SignInScreen(); 142 | }, 143 | )); 144 | } else { 145 | print("not good"); 146 | } 147 | }), 148 | const SizedBox(height: 30), 149 | Row( 150 | mainAxisAlignment: MainAxisAlignment.center, 151 | children: [ 152 | Text("Already have an account ? "), 153 | InkWell( 154 | onTap: () { 155 | Navigator.push(context, MaterialPageRoute( 156 | builder: (context) { 157 | return SignInScreen(); 158 | }, 159 | )); 160 | }, 161 | child: Text( 162 | "Sign In", 163 | style: GoogleFonts.montserrat( 164 | color: Colors.blue, 165 | ), 166 | ), 167 | ), 168 | ], 169 | ), 170 | ], 171 | ), 172 | ), 173 | ], 174 | ), 175 | ), 176 | ), 177 | ), 178 | ), 179 | ); 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /lib/screens/restaurant_management/restaurant_management.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:food_dashboard/constants.dart'; 3 | import 'package:food_dashboard/datasources/api_client/http_client.dart'; 4 | import 'package:food_dashboard/datasources/service/restaurant_service_contract.dart'; 5 | import 'package:food_dashboard/datasources/service/restaurant_service_impl.dart'; 6 | import 'package:food_dashboard/di/get_it.dart'; 7 | import 'package:food_dashboard/domain/entities/restaurant.dart'; 8 | import 'package:food_dashboard/main.dart'; 9 | import 'package:food_dashboard/screens/restaurant_management/custom_dialog.dart'; 10 | import 'package:food_dashboard/screens/restaurant_management/edit_dialog.dart'; 11 | import 'package:http/http.dart'; 12 | 13 | class RestaurantManagement extends StatefulWidget { 14 | const RestaurantManagement({Key? key}) : super(key: key); 15 | 16 | @override 17 | _RestaurantManagementState createState() => _RestaurantManagementState(); 18 | } 19 | 20 | class _RestaurantManagementState extends State { 21 | List? allRestaurant; 22 | 23 | final restaurantService = getIt(); 24 | 25 | @override 26 | void initState() { 27 | super.initState(); 28 | getAllRestaurant(); 29 | } 30 | 31 | getAllRestaurant() async { 32 | allRestaurant = await restaurantService.getAllRestaurant(); 33 | setState(() {}); 34 | } 35 | 36 | @override 37 | Widget build(BuildContext context) { 38 | print(MediaQuery.of(context).size.width); 39 | return Container( 40 | padding: const EdgeInsets.symmetric( 41 | vertical: 25, 42 | horizontal: 60, 43 | ), 44 | decoration: BoxDecoration(color: Colors.white), 45 | child: Column( 46 | crossAxisAlignment: CrossAxisAlignment.start, 47 | children: [ 48 | Text( 49 | "Restaurant Management", 50 | style: largestText, 51 | ), 52 | const SizedBox(height: kdefaultPadding), 53 | SingleChildScrollView( 54 | scrollDirection: Axis.vertical, 55 | child: SingleChildScrollView( 56 | scrollDirection: Axis.horizontal, 57 | child: DataTable( 58 | dataRowHeight: 70, 59 | columns: [ 60 | ...tableTitle 61 | .map( 62 | (title) => DataColumn( 63 | label: Text( 64 | title, 65 | style: largeText.copyWith(fontSize: 18), 66 | ), 67 | ), 68 | ) 69 | .toList(), 70 | DataColumn( 71 | label: Text( 72 | "Actions", 73 | style: largeText.copyWith(fontSize: 18), 74 | ), 75 | onSort: (columnIndex, ascending) {}, 76 | ), 77 | ], 78 | rows: [ 79 | if (allRestaurant != null) 80 | ...allRestaurant!.map( 81 | (restaurant) => DataRow( 82 | cells: [ 83 | DataCell( 84 | Text(restaurant.id!), 85 | ), 86 | DataCell( 87 | ClipRRect( 88 | borderRadius: BorderRadius.circular(6.0), 89 | child: Container( 90 | height: 50, 91 | width: 60, 92 | child: Image.network( 93 | restaurant.imageUrl, 94 | fit: BoxFit.cover, 95 | ), 96 | ), 97 | ), 98 | ), 99 | DataCell( 100 | Text( 101 | restaurant.name, 102 | maxLines: 3, 103 | overflow: TextOverflow.ellipsis, 104 | ), 105 | ), 106 | DataCell( 107 | Text(restaurant.resType), 108 | ), 109 | DataCell( 110 | Text(restaurant.rating), 111 | ), 112 | DataCell( 113 | Text(restaurant.price), 114 | ), 115 | DataCell( 116 | Text(restaurant.distance), 117 | ), 118 | DataCell( 119 | Row( 120 | children: [ 121 | ActionButton( 122 | text: "View", 123 | onTap: () { 124 | showDialog( 125 | context: context, 126 | builder: (context) { 127 | return CustomDialog( 128 | restaurant: restaurant, 129 | dialogTitle: "Restaurant Details", 130 | buttonText: "Confirm", 131 | onTap: () { 132 | Navigator.pop(context); 133 | }, 134 | ); 135 | }, 136 | ); 137 | }, 138 | color: Colors.blue, 139 | ), 140 | ActionButton( 141 | text: "Edit", 142 | onTap: () async { 143 | await showDialog( 144 | context: context, 145 | builder: (context) { 146 | return EditDialog( 147 | restaurant: restaurant, 148 | ); 149 | }, 150 | ); 151 | }, 152 | color: Colors.green[400]!, 153 | ), 154 | ActionButton( 155 | text: "Delete", 156 | onTap: () { 157 | showDialog( 158 | context: context, 159 | builder: (context) { 160 | return CustomDialog( 161 | restaurant: restaurant, 162 | dialogTitle: "Delete Restaurant", 163 | buttonText: "Delete", 164 | onTap: () { 165 | restaurantService.deleteRestaurant( 166 | restaurant.id!); 167 | Navigator.pop(context); 168 | }, 169 | ); 170 | }, 171 | ); 172 | }, 173 | color: Colors.red, 174 | ), 175 | ], 176 | ), 177 | ), 178 | ], 179 | ), 180 | ), 181 | ], 182 | ), 183 | ), 184 | ) 185 | ], 186 | ), 187 | ); 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /lib/widgets/restaurant_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:food_dashboard/domain/entities/restaurant.dart'; 3 | import 'package:food_dashboard/widgets/my_dialog.dart'; 4 | import 'package:food_dashboard/widgets/restaurant_card.dart'; 5 | import 'package:google_fonts/google_fonts.dart'; 6 | 7 | class RestaurantList extends StatefulWidget { 8 | final List restaurantList; 9 | 10 | const RestaurantList({ 11 | Key? key, 12 | required this.restaurantList, 13 | }) : super(key: key); 14 | 15 | @override 16 | _RestaurantListState createState() => _RestaurantListState(); 17 | } 18 | 19 | class _RestaurantListState extends State { 20 | @override 21 | Widget build(BuildContext context) { 22 | return Container( 23 | margin: EdgeInsets.only(left: 60), 24 | height: 260, 25 | child: ListView.builder( 26 | shrinkWrap: true, 27 | itemCount: widget.restaurantList.length + 1, 28 | scrollDirection: Axis.horizontal, 29 | itemBuilder: (context, index) { 30 | if (index == 0) { 31 | return Padding( 32 | padding: const EdgeInsets.only(right: 30.0), 33 | child: Material( 34 | borderRadius: BorderRadius.circular( 35 | 10.0, 36 | ), 37 | color: Colors.yellow.withOpacity(0.2), 38 | child: InkWell( 39 | onTap: () { 40 | showDialog( 41 | context: context, 42 | builder: (context) { 43 | return MyDialog(); 44 | }, 45 | ); 46 | }, 47 | borderRadius: BorderRadius.circular( 48 | 10.0, 49 | ), 50 | child: Container( 51 | height: 260, 52 | width: 220, 53 | padding: EdgeInsets.all(20), 54 | child: Column( 55 | children: [ 56 | ClipRRect( 57 | borderRadius: BorderRadius.circular(10.0), 58 | child: Container( 59 | width: 180, 60 | child: AspectRatio( 61 | aspectRatio: 1.8, 62 | child: Image.asset( 63 | "assets/images/lureme.jpg", 64 | fit: BoxFit.cover, 65 | ), 66 | ), 67 | ), 68 | ), 69 | Spacer(), 70 | Text( 71 | "Add A Restaurant!", 72 | style: GoogleFonts.montserrat( 73 | fontSize: 14, 74 | fontWeight: FontWeight.w700, 75 | ), 76 | ), 77 | const SizedBox(height: 6), 78 | Text( 79 | "Share a restaurant that you like to everyone", 80 | textAlign: TextAlign.center, 81 | style: GoogleFonts.montserrat( 82 | fontSize: 10, 83 | color: Colors.grey.shade500, 84 | ), 85 | ), 86 | const SizedBox(height: 10), 87 | Material( 88 | color: Colors.white, 89 | borderRadius: BorderRadius.circular(50), 90 | child: Container( 91 | height: 45, 92 | width: 45, 93 | alignment: Alignment.center, 94 | child: Icon(Icons.add), 95 | ), 96 | ), 97 | ], 98 | ), 99 | ), 100 | ), 101 | ), 102 | ); 103 | } 104 | 105 | return Padding( 106 | padding: const EdgeInsets.only(right: 30.0), 107 | child: RestaurantCard( 108 | onTap: () {}, 109 | backgroundColor: 110 | Colors.primaries[index % Colors.primaries.length], 111 | restaurant: widget.restaurantList[index - 1], 112 | ), 113 | ); 114 | }, 115 | ), 116 | ); 117 | } 118 | } 119 | 120 | // return Container( 121 | // margin: EdgeInsets.only(left: 60), 122 | // height: 260, 123 | // child: ListView.builder( 124 | // shrinkWrap: true, 125 | // itemCount: restaurantList.length + 1, 126 | // scrollDirection: Axis.horizontal, 127 | // itemBuilder: (context, index) { 128 | // if (index == 0) { 129 | // return Padding( 130 | // padding: const EdgeInsets.only(right: 30.0), 131 | // child: Material( 132 | // borderRadius: BorderRadius.circular( 133 | // 10.0, 134 | // ), 135 | // color: Colors.yellow.withOpacity(0.2), 136 | // child: InkWell( 137 | // onTap: () { 138 | // showDialog( 139 | // context: context, 140 | // builder: (context) { 141 | // return MyDialog(); 142 | // }, 143 | // ); 144 | // }, 145 | // borderRadius: BorderRadius.circular( 146 | // 10.0, 147 | // ), 148 | // child: Container( 149 | // height: 260, 150 | // width: 220, 151 | // padding: EdgeInsets.all(20), 152 | // child: Column( 153 | // children: [ 154 | // ClipRRect( 155 | // borderRadius: BorderRadius.circular(10.0), 156 | // child: Container( 157 | // width: 180, 158 | // child: AspectRatio( 159 | // aspectRatio: 1.8, 160 | // child: Image.asset( 161 | // "assets/images/lureme.jpg", 162 | // fit: BoxFit.cover, 163 | // ), 164 | // ), 165 | // ), 166 | // ), 167 | // Spacer(), 168 | // Text( 169 | // "Add A Restaurant!", 170 | // style: GoogleFonts.montserrat( 171 | // fontSize: 14, 172 | // fontWeight: FontWeight.w700, 173 | // ), 174 | // ), 175 | // const SizedBox(height: 6), 176 | // Text( 177 | // "Share a restaurant that you like to everyone", 178 | // textAlign: TextAlign.center, 179 | // style: GoogleFonts.montserrat( 180 | // fontSize: 10, 181 | // color: Colors.grey.shade500, 182 | // ), 183 | // ), 184 | // const SizedBox(height: 10), 185 | // Material( 186 | // color: Colors.white, 187 | // borderRadius: BorderRadius.circular(50), 188 | // child: Container( 189 | // height: 45, 190 | // width: 45, 191 | // alignment: Alignment.center, 192 | // child: Icon(Icons.add), 193 | // ), 194 | // ), 195 | // ], 196 | // ), 197 | // ), 198 | // ), 199 | // ), 200 | // ); 201 | // } 202 | 203 | // return Padding( 204 | // padding: const EdgeInsets.only(right: 30.0), 205 | // child: RestaurantCard( 206 | // onTap: () {}, 207 | // backgroundColor: 208 | // Colors.primaries[index % Colors.primaries.length], 209 | // restaurant: restaurantList[index - 1], 210 | // ), 211 | // ); 212 | // }, 213 | // ), 214 | // ); -------------------------------------------------------------------------------- /lib/screens/home/home_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:font_awesome_flutter/font_awesome_flutter.dart'; 3 | import 'package:food_dashboard/constants.dart'; 4 | import 'package:food_dashboard/datasources/service/restaurant_service_contract.dart'; 5 | import 'package:food_dashboard/di/get_it.dart'; 6 | import 'package:food_dashboard/domain/entities/restaurant.dart'; 7 | import 'package:food_dashboard/widgets/category_icon_with_text.dart'; 8 | import 'package:food_dashboard/widgets/counter_with_text.dart'; 9 | import 'package:food_dashboard/widgets/custom_circle_button.dart'; 10 | import 'package:food_dashboard/widgets/custom_text_button.dart'; 11 | import 'package:food_dashboard/widgets/restaurant_list.dart'; 12 | import 'package:google_fonts/google_fonts.dart'; 13 | import 'package:http/http.dart'; 14 | 15 | class HomeScreen extends StatefulWidget { 16 | const HomeScreen({Key? key}) : super(key: key); 17 | 18 | @override 19 | _HomeScreenState createState() => _HomeScreenState(); 20 | } 21 | 22 | class _HomeScreenState extends State { 23 | double valueKm = 0; 24 | List? restaurantList; 25 | 26 | @override 27 | void initState() { 28 | super.initState(); 29 | getAllRestaurant(); 30 | } 31 | 32 | getAllRestaurant() async { 33 | final getItInstance = getIt(); 34 | restaurantList = await getItInstance.getAllRestaurant(); 35 | setState(() {}); 36 | } 37 | 38 | @override 39 | Widget build(BuildContext context) { 40 | Size size = MediaQuery.of(context).size; 41 | return GestureDetector( 42 | onTap: () { 43 | //* ---------------------------------------------------- 44 | //* This help to unfocus searchfield when click outside 45 | //* ---------------------------------------------------- 46 | FocusScopeNode currentFocus = FocusScope.of(context); 47 | if (!currentFocus.hasPrimaryFocus) { 48 | currentFocus.unfocus(); 49 | } 50 | }, 51 | child: Container( 52 | color: Colors.white, 53 | padding: const EdgeInsets.symmetric( 54 | vertical: 25, 55 | ), 56 | child: Column( 57 | crossAxisAlignment: CrossAxisAlignment.start, 58 | children: [ 59 | Padding( 60 | padding: const EdgeInsets.symmetric(horizontal: 60.0), 61 | child: Column( 62 | crossAxisAlignment: CrossAxisAlignment.start, 63 | children: [ 64 | Row( 65 | children: [ 66 | (size.width < 900) 67 | ? Material( 68 | color: Colors.transparent, 69 | borderRadius: BorderRadius.circular(50), 70 | child: InkWell( 71 | onTap: () {}, 72 | borderRadius: BorderRadius.circular(50), 73 | child: Container( 74 | height: 45, 75 | width: 45, 76 | decoration: BoxDecoration( 77 | color: Colors.black, 78 | borderRadius: BorderRadius.circular(6.0), 79 | ), 80 | alignment: Alignment.center, 81 | child: Icon(Icons.menu, color: Colors.white), 82 | ), 83 | ), 84 | ) 85 | : Container( 86 | width: 350, 87 | child: TextField( 88 | style: TextStyle(fontSize: 12), 89 | decoration: InputDecoration( 90 | hintText: "Enter your search request...", 91 | prefixIcon: Padding( 92 | padding: 93 | const EdgeInsets.fromLTRB(10, 5, 0, 0), 94 | child: FaIcon( 95 | FontAwesomeIcons.search, 96 | size: 16, 97 | ), 98 | ), 99 | ), 100 | ), 101 | ), 102 | Spacer(), 103 | CustomCircleButton( 104 | icon: FontAwesomeIcons.slidersH, 105 | onTap: () {}, 106 | ), 107 | const SizedBox(width: 10), 108 | CustomTextButton( 109 | onTap: () {}, 110 | text: "Go to Premium", 111 | ), 112 | ], 113 | ), 114 | //* --------------------------------- 115 | //* --------------------------------- 116 | //* --------------------------------- 117 | const SizedBox(height: 50), 118 | Row( 119 | children: [ 120 | Column( 121 | crossAxisAlignment: CrossAxisAlignment.start, 122 | children: [ 123 | Text( 124 | "Find the best place", 125 | style: largestText, 126 | ), 127 | RichText( 128 | text: TextSpan( 129 | style: GoogleFonts.montserrat( 130 | fontSize: 12, 131 | fontWeight: FontWeight.w500, 132 | ), 133 | children: [ 134 | TextSpan(text: "249 restaurants, "), 135 | TextSpan( 136 | text: "choose yours", 137 | style: GoogleFonts.montserrat( 138 | fontSize: 12, 139 | color: Colors.grey.shade600, 140 | ), 141 | ), 142 | ], 143 | ), 144 | ) 145 | ], 146 | ), 147 | Spacer(), 148 | if (size.width > 590) SpecialAndCategoriesCounter(), 149 | ], 150 | ), 151 | if (size.width <= 590) ...[ 152 | SizedBox(height: 30), 153 | SpecialAndCategoriesCounter(), 154 | ], 155 | //* -------------------------------------------- 156 | //* Categories Section 157 | //* -------------------------------------------- 158 | const SizedBox(height: 40), 159 | CategoryIconWithText(), 160 | const SizedBox(height: 30), 161 | //*------------------------------------------ 162 | //* New Restaurant Section 163 | //*------------------------------------------ 164 | Row( 165 | children: [ 166 | Text( 167 | "New restaurants", 168 | style: largeText, 169 | ), 170 | Spacer(), 171 | Slider( 172 | divisions: 10, 173 | value: valueKm, 174 | onChanged: (value) { 175 | setState(() { 176 | valueKm = value; 177 | }); 178 | }, 179 | min: 0, 180 | max: 10, 181 | activeColor: Colors.black, 182 | inactiveColor: Colors.black, 183 | label: "$valueKm Km", 184 | ), 185 | ], 186 | ), 187 | const SizedBox(height: 30), 188 | ], 189 | ), 190 | ), 191 | //* -------------------------------- 192 | //* List of New Restaurant 193 | //* -------------------------------- 194 | RestaurantList( 195 | restaurantList: restaurantList ?? cachedRestaurantList, 196 | ), 197 | ], 198 | ), 199 | ), 200 | ); 201 | } 202 | } 203 | 204 | class SpecialAndCategoriesCounter extends StatelessWidget { 205 | const SpecialAndCategoriesCounter({ 206 | Key? key, 207 | }) : super(key: key); 208 | 209 | @override 210 | Widget build(BuildContext context) { 211 | return Row( 212 | children: [ 213 | CounterWithText(number: 94, text: "Specials"), 214 | Container( 215 | margin: EdgeInsets.symmetric(horizontal: 20), 216 | width: 1, 217 | height: 50, 218 | color: Colors.grey.shade300, 219 | ), 220 | CounterWithText(number: 23, text: "Delivery"), 221 | ], 222 | ); 223 | } 224 | } 225 | -------------------------------------------------------------------------------- /lib/screens/restaurant_management/custom_dialog.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:food_dashboard/constants.dart'; 4 | import 'package:food_dashboard/datasources/api_client/http_client.dart'; 5 | import 'package:food_dashboard/datasources/service/restaurant_service_contract.dart'; 6 | import 'package:food_dashboard/datasources/service/restaurant_service_impl.dart'; 7 | import 'package:food_dashboard/di/get_it.dart'; 8 | import 'package:food_dashboard/domain/entities/restaurant.dart'; 9 | import 'package:food_dashboard/widgets/custom_text_button.dart'; 10 | import 'package:food_dashboard/widgets/restaurant_card.dart'; 11 | import 'package:google_fonts/google_fonts.dart'; 12 | import 'package:http/http.dart'; 13 | 14 | class CustomDialog extends StatefulWidget { 15 | final String dialogTitle; 16 | final String buttonText; 17 | final VoidCallback onTap; 18 | final Restaurant restaurant; 19 | 20 | const CustomDialog({ 21 | Key? key, 22 | required this.restaurant, 23 | required this.dialogTitle, 24 | required this.buttonText, 25 | required this.onTap, 26 | }) : super(key: key); 27 | 28 | @override 29 | _CustomDialogState createState() => _CustomDialogState(); 30 | } 31 | 32 | class _CustomDialogState extends State { 33 | final restaurantService = getIt(); 34 | 35 | @override 36 | Widget build(BuildContext context) { 37 | return GestureDetector( 38 | onTap: () { 39 | FocusScopeNode currentFocus = FocusScope.of(context); 40 | if (!currentFocus.hasPrimaryFocus) { 41 | currentFocus.unfocus(); 42 | } 43 | }, 44 | child: AlertDialog( 45 | contentPadding: EdgeInsets.all(0), 46 | content: Container( 47 | width: 750, 48 | // height: 700, 49 | child: ListView( 50 | shrinkWrap: true, 51 | children: [ 52 | Padding( 53 | padding: EdgeInsets.symmetric(horizontal: 35, vertical: 25), 54 | child: Column( 55 | crossAxisAlignment: CrossAxisAlignment.start, 56 | children: [ 57 | Text( 58 | widget.dialogTitle, 59 | style: GoogleFonts.montserrat( 60 | fontSize: 24, 61 | fontWeight: FontWeight.bold, 62 | ), 63 | ), 64 | const SizedBox(height: kdefaultPadding), 65 | Row( 66 | children: [ 67 | Expanded( 68 | child: Column( 69 | mainAxisAlignment: MainAxisAlignment.start, 70 | crossAxisAlignment: CrossAxisAlignment.start, 71 | children: [ 72 | DetailInfo( 73 | title: "ID", info: widget.restaurant.id!), 74 | Row( 75 | crossAxisAlignment: CrossAxisAlignment.start, 76 | children: [ 77 | Container( 78 | width: 150, 79 | child: Text( 80 | "Image", 81 | style: GoogleFonts.montserrat( 82 | fontSize: 18, 83 | fontWeight: FontWeight.bold, 84 | ), 85 | ), 86 | ), 87 | ClipRRect( 88 | borderRadius: BorderRadius.circular(2.0), 89 | child: Container( 90 | width: 250, 91 | child: AspectRatio( 92 | aspectRatio: 1.8, 93 | child: CachedNetworkImage( 94 | imageUrl: widget.restaurant.imageUrl, 95 | fit: BoxFit.cover, 96 | ), 97 | ), 98 | ), 99 | ), 100 | ], 101 | ), 102 | DetailInfo( 103 | title: "Category", 104 | info: widget.restaurant.resType), 105 | DetailInfo( 106 | title: "Rating", 107 | info: widget.restaurant.rating), 108 | DetailInfo( 109 | title: "Price", 110 | info: widget.restaurant.price), 111 | DetailInfo( 112 | title: "Distance", 113 | info: widget.restaurant.distance), 114 | ], 115 | ), 116 | ), 117 | const SizedBox(width: 50), 118 | Material( 119 | borderRadius: BorderRadius.circular( 120 | 10.0, 121 | ), 122 | color: Colors.primaries[ 123 | int.parse(widget.restaurant.id!) % 124 | Colors.primaries.length] 125 | .withOpacity(0.2), 126 | child: Container( 127 | height: 275, 128 | width: 220, 129 | padding: EdgeInsets.all(20), 130 | child: Column( 131 | children: [ 132 | ClipRRect( 133 | borderRadius: BorderRadius.circular(10.0), 134 | child: Container( 135 | width: 180, 136 | child: AspectRatio( 137 | aspectRatio: 1.8, 138 | child: CachedNetworkImage( 139 | imageUrl: widget.restaurant.imageUrl, 140 | fit: BoxFit.cover, 141 | )), 142 | ), 143 | ), 144 | Spacer(), 145 | Column( 146 | children: [ 147 | Text( 148 | widget.restaurant.name, 149 | style: GoogleFonts.montserrat( 150 | fontSize: 16, 151 | fontWeight: FontWeight.w700, 152 | ), 153 | overflow: TextOverflow.ellipsis, 154 | textAlign: TextAlign.center, 155 | maxLines: 2, 156 | ), 157 | const SizedBox(height: 3), 158 | Text( 159 | widget.restaurant.resType, 160 | overflow: TextOverflow.ellipsis, 161 | style: GoogleFonts.montserrat( 162 | fontSize: 10, 163 | color: Colors.grey.shade600, 164 | ), 165 | ), 166 | ], 167 | ), 168 | Spacer(), 169 | Container( 170 | height: 50, 171 | child: IntrinsicHeight( 172 | child: Row( 173 | mainAxisSize: MainAxisSize.min, 174 | children: [ 175 | Column( 176 | mainAxisAlignment: 177 | MainAxisAlignment.center, 178 | children: [ 179 | Icon( 180 | Icons.star, 181 | size: 14, 182 | ), 183 | const SizedBox(height: 10), 184 | Text( 185 | widget.restaurant.rating, 186 | style: GoogleFonts.montserrat( 187 | fontSize: 16, 188 | fontWeight: FontWeight.bold, 189 | ), 190 | ) 191 | ], 192 | ), 193 | CustomDivider(height: 40), 194 | Column( 195 | mainAxisAlignment: 196 | MainAxisAlignment.center, 197 | children: [ 198 | Row( 199 | children: [ 200 | CurrencyIcon(size: 10), 201 | CurrencyIcon( 202 | size: 10, 203 | color: 204 | Colors.grey.shade600), 205 | CurrencyIcon( 206 | size: 10, 207 | color: 208 | Colors.grey.shade600), 209 | ], 210 | ), 211 | const SizedBox(height: 10), 212 | Text( 213 | widget.restaurant.price, 214 | style: GoogleFonts.montserrat( 215 | fontSize: 16, 216 | fontWeight: FontWeight.bold, 217 | ), 218 | ) 219 | ], 220 | ), 221 | CustomDivider(height: 40), 222 | Column( 223 | mainAxisAlignment: 224 | MainAxisAlignment.center, 225 | children: [ 226 | Text( 227 | "km", 228 | style: GoogleFonts.montserrat( 229 | fontSize: 11, 230 | fontWeight: FontWeight.bold, 231 | ), 232 | ), 233 | const SizedBox(height: 10), 234 | Text( 235 | widget.restaurant.distance, 236 | textAlign: TextAlign.center, 237 | style: GoogleFonts.montserrat( 238 | fontSize: 16, 239 | fontWeight: FontWeight.bold, 240 | ), 241 | ), 242 | ], 243 | ), 244 | ], 245 | ), 246 | ), 247 | ), 248 | ], 249 | ), 250 | ), 251 | ), 252 | ], 253 | ), 254 | const SizedBox(height: 30), 255 | Align( 256 | alignment: Alignment.centerRight, 257 | child: CustomTextButton( 258 | text: widget.buttonText, 259 | onTap: widget.onTap, 260 | ), 261 | ), 262 | ], 263 | ), 264 | ), 265 | ], 266 | ), 267 | ), 268 | ), 269 | ); 270 | } 271 | } 272 | 273 | class DetailInfo extends StatelessWidget { 274 | final String title; 275 | final String info; 276 | 277 | const DetailInfo({ 278 | Key? key, 279 | required this.title, 280 | required this.info, 281 | }) : super(key: key); 282 | 283 | @override 284 | Widget build(BuildContext context) { 285 | return Padding( 286 | padding: const EdgeInsets.symmetric(vertical: 10), 287 | child: Row( 288 | children: [ 289 | Container( 290 | width: 150, 291 | child: Text( 292 | title, 293 | style: GoogleFonts.montserrat( 294 | fontSize: 18, 295 | fontWeight: FontWeight.bold, 296 | ), 297 | ), 298 | ), 299 | Text( 300 | info, 301 | style: GoogleFonts.montserrat( 302 | fontSize: 15, 303 | ), 304 | ), 305 | ], 306 | ), 307 | ); 308 | } 309 | } 310 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.6.1" 11 | bloc: 12 | dependency: transitive 13 | description: 14 | name: bloc 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "7.2.1" 18 | boolean_selector: 19 | dependency: transitive 20 | description: 21 | name: boolean_selector 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.1.0" 25 | cached_network_image: 26 | dependency: "direct main" 27 | description: 28 | name: cached_network_image 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "3.1.0" 32 | cached_network_image_platform_interface: 33 | dependency: transitive 34 | description: 35 | name: cached_network_image_platform_interface 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.0.0" 39 | cached_network_image_web: 40 | dependency: transitive 41 | description: 42 | name: cached_network_image_web 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.0.1" 46 | characters: 47 | dependency: transitive 48 | description: 49 | name: characters 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.1.0" 53 | charcode: 54 | dependency: transitive 55 | description: 56 | name: charcode 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "1.2.0" 60 | clock: 61 | dependency: transitive 62 | description: 63 | name: clock 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.1.0" 67 | collection: 68 | dependency: transitive 69 | description: 70 | name: collection 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "1.15.0" 74 | crypto: 75 | dependency: transitive 76 | description: 77 | name: crypto 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "3.0.1" 81 | cupertino_icons: 82 | dependency: "direct main" 83 | description: 84 | name: cupertino_icons 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "1.0.3" 88 | dio: 89 | dependency: "direct main" 90 | description: 91 | name: dio 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "4.0.0" 95 | equatable: 96 | dependency: "direct main" 97 | description: 98 | name: equatable 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "2.0.3" 102 | fake_async: 103 | dependency: transitive 104 | description: 105 | name: fake_async 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "1.2.0" 109 | ffi: 110 | dependency: transitive 111 | description: 112 | name: ffi 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "1.1.2" 116 | file: 117 | dependency: transitive 118 | description: 119 | name: file 120 | url: "https://pub.dartlang.org" 121 | source: hosted 122 | version: "6.1.2" 123 | firebase: 124 | dependency: "direct main" 125 | description: 126 | name: firebase 127 | url: "https://pub.dartlang.org" 128 | source: hosted 129 | version: "9.0.2" 130 | firebase_core: 131 | dependency: "direct main" 132 | description: 133 | name: firebase_core 134 | url: "https://pub.dartlang.org" 135 | source: hosted 136 | version: "1.6.0" 137 | firebase_core_platform_interface: 138 | dependency: transitive 139 | description: 140 | name: firebase_core_platform_interface 141 | url: "https://pub.dartlang.org" 142 | source: hosted 143 | version: "4.0.1" 144 | firebase_core_web: 145 | dependency: transitive 146 | description: 147 | name: firebase_core_web 148 | url: "https://pub.dartlang.org" 149 | source: hosted 150 | version: "1.1.0" 151 | firebase_storage: 152 | dependency: "direct main" 153 | description: 154 | name: firebase_storage 155 | url: "https://pub.dartlang.org" 156 | source: hosted 157 | version: "10.0.3" 158 | firebase_storage_platform_interface: 159 | dependency: transitive 160 | description: 161 | name: firebase_storage_platform_interface 162 | url: "https://pub.dartlang.org" 163 | source: hosted 164 | version: "4.0.2" 165 | firebase_storage_web: 166 | dependency: transitive 167 | description: 168 | name: firebase_storage_web 169 | url: "https://pub.dartlang.org" 170 | source: hosted 171 | version: "3.0.2" 172 | flutter: 173 | dependency: "direct main" 174 | description: flutter 175 | source: sdk 176 | version: "0.0.0" 177 | flutter_bloc: 178 | dependency: "direct main" 179 | description: 180 | name: flutter_bloc 181 | url: "https://pub.dartlang.org" 182 | source: hosted 183 | version: "7.3.0" 184 | flutter_blurhash: 185 | dependency: transitive 186 | description: 187 | name: flutter_blurhash 188 | url: "https://pub.dartlang.org" 189 | source: hosted 190 | version: "0.6.0" 191 | flutter_cache_manager: 192 | dependency: transitive 193 | description: 194 | name: flutter_cache_manager 195 | url: "https://pub.dartlang.org" 196 | source: hosted 197 | version: "3.1.2" 198 | flutter_test: 199 | dependency: "direct dev" 200 | description: flutter 201 | source: sdk 202 | version: "0.0.0" 203 | flutter_web_plugins: 204 | dependency: transitive 205 | description: flutter 206 | source: sdk 207 | version: "0.0.0" 208 | font_awesome_flutter: 209 | dependency: "direct main" 210 | description: 211 | name: font_awesome_flutter 212 | url: "https://pub.dartlang.org" 213 | source: hosted 214 | version: "9.1.0" 215 | get_it: 216 | dependency: "direct main" 217 | description: 218 | name: get_it 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "7.2.0" 222 | google_fonts: 223 | dependency: "direct main" 224 | description: 225 | name: google_fonts 226 | url: "https://pub.dartlang.org" 227 | source: hosted 228 | version: "2.1.0" 229 | http: 230 | dependency: "direct main" 231 | description: 232 | name: http 233 | url: "https://pub.dartlang.org" 234 | source: hosted 235 | version: "0.13.3" 236 | http_parser: 237 | dependency: "direct main" 238 | description: 239 | name: http_parser 240 | url: "https://pub.dartlang.org" 241 | source: hosted 242 | version: "4.0.0" 243 | image_picker_web: 244 | dependency: "direct main" 245 | description: 246 | name: image_picker_web 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "2.0.3+1" 250 | js: 251 | dependency: transitive 252 | description: 253 | name: js 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "0.6.3" 257 | matcher: 258 | dependency: transitive 259 | description: 260 | name: matcher 261 | url: "https://pub.dartlang.org" 262 | source: hosted 263 | version: "0.12.10" 264 | meta: 265 | dependency: transitive 266 | description: 267 | name: meta 268 | url: "https://pub.dartlang.org" 269 | source: hosted 270 | version: "1.3.0" 271 | mime_type: 272 | dependency: "direct main" 273 | description: 274 | name: mime_type 275 | url: "https://pub.dartlang.org" 276 | source: hosted 277 | version: "1.0.0" 278 | nested: 279 | dependency: transitive 280 | description: 281 | name: nested 282 | url: "https://pub.dartlang.org" 283 | source: hosted 284 | version: "1.0.0" 285 | octo_image: 286 | dependency: transitive 287 | description: 288 | name: octo_image 289 | url: "https://pub.dartlang.org" 290 | source: hosted 291 | version: "1.0.0+1" 292 | path: 293 | dependency: transitive 294 | description: 295 | name: path 296 | url: "https://pub.dartlang.org" 297 | source: hosted 298 | version: "1.8.0" 299 | path_provider: 300 | dependency: transitive 301 | description: 302 | name: path_provider 303 | url: "https://pub.dartlang.org" 304 | source: hosted 305 | version: "2.0.4" 306 | path_provider_linux: 307 | dependency: transitive 308 | description: 309 | name: path_provider_linux 310 | url: "https://pub.dartlang.org" 311 | source: hosted 312 | version: "2.1.0" 313 | path_provider_macos: 314 | dependency: transitive 315 | description: 316 | name: path_provider_macos 317 | url: "https://pub.dartlang.org" 318 | source: hosted 319 | version: "2.0.2" 320 | path_provider_platform_interface: 321 | dependency: transitive 322 | description: 323 | name: path_provider_platform_interface 324 | url: "https://pub.dartlang.org" 325 | source: hosted 326 | version: "2.0.1" 327 | path_provider_windows: 328 | dependency: transitive 329 | description: 330 | name: path_provider_windows 331 | url: "https://pub.dartlang.org" 332 | source: hosted 333 | version: "2.0.3" 334 | pedantic: 335 | dependency: transitive 336 | description: 337 | name: pedantic 338 | url: "https://pub.dartlang.org" 339 | source: hosted 340 | version: "1.11.1" 341 | platform: 342 | dependency: transitive 343 | description: 344 | name: platform 345 | url: "https://pub.dartlang.org" 346 | source: hosted 347 | version: "3.0.2" 348 | plugin_platform_interface: 349 | dependency: transitive 350 | description: 351 | name: plugin_platform_interface 352 | url: "https://pub.dartlang.org" 353 | source: hosted 354 | version: "2.0.1" 355 | process: 356 | dependency: transitive 357 | description: 358 | name: process 359 | url: "https://pub.dartlang.org" 360 | source: hosted 361 | version: "4.2.3" 362 | provider: 363 | dependency: transitive 364 | description: 365 | name: provider 366 | url: "https://pub.dartlang.org" 367 | source: hosted 368 | version: "6.0.1" 369 | rxdart: 370 | dependency: transitive 371 | description: 372 | name: rxdart 373 | url: "https://pub.dartlang.org" 374 | source: hosted 375 | version: "0.27.2" 376 | shared_preferences: 377 | dependency: "direct main" 378 | description: 379 | name: shared_preferences 380 | url: "https://pub.dartlang.org" 381 | source: hosted 382 | version: "2.0.7" 383 | shared_preferences_linux: 384 | dependency: transitive 385 | description: 386 | name: shared_preferences_linux 387 | url: "https://pub.dartlang.org" 388 | source: hosted 389 | version: "2.0.2" 390 | shared_preferences_macos: 391 | dependency: transitive 392 | description: 393 | name: shared_preferences_macos 394 | url: "https://pub.dartlang.org" 395 | source: hosted 396 | version: "2.0.2" 397 | shared_preferences_platform_interface: 398 | dependency: transitive 399 | description: 400 | name: shared_preferences_platform_interface 401 | url: "https://pub.dartlang.org" 402 | source: hosted 403 | version: "2.0.0" 404 | shared_preferences_web: 405 | dependency: transitive 406 | description: 407 | name: shared_preferences_web 408 | url: "https://pub.dartlang.org" 409 | source: hosted 410 | version: "2.0.2" 411 | shared_preferences_windows: 412 | dependency: transitive 413 | description: 414 | name: shared_preferences_windows 415 | url: "https://pub.dartlang.org" 416 | source: hosted 417 | version: "2.0.2" 418 | sky_engine: 419 | dependency: transitive 420 | description: flutter 421 | source: sdk 422 | version: "0.0.99" 423 | source_span: 424 | dependency: transitive 425 | description: 426 | name: source_span 427 | url: "https://pub.dartlang.org" 428 | source: hosted 429 | version: "1.8.1" 430 | sqflite: 431 | dependency: transitive 432 | description: 433 | name: sqflite 434 | url: "https://pub.dartlang.org" 435 | source: hosted 436 | version: "2.0.0+4" 437 | sqflite_common: 438 | dependency: transitive 439 | description: 440 | name: sqflite_common 441 | url: "https://pub.dartlang.org" 442 | source: hosted 443 | version: "2.0.1+1" 444 | stack_trace: 445 | dependency: transitive 446 | description: 447 | name: stack_trace 448 | url: "https://pub.dartlang.org" 449 | source: hosted 450 | version: "1.10.0" 451 | stream_channel: 452 | dependency: transitive 453 | description: 454 | name: stream_channel 455 | url: "https://pub.dartlang.org" 456 | source: hosted 457 | version: "2.1.0" 458 | string_scanner: 459 | dependency: transitive 460 | description: 461 | name: string_scanner 462 | url: "https://pub.dartlang.org" 463 | source: hosted 464 | version: "1.1.0" 465 | synchronized: 466 | dependency: transitive 467 | description: 468 | name: synchronized 469 | url: "https://pub.dartlang.org" 470 | source: hosted 471 | version: "3.0.0" 472 | term_glyph: 473 | dependency: transitive 474 | description: 475 | name: term_glyph 476 | url: "https://pub.dartlang.org" 477 | source: hosted 478 | version: "1.2.0" 479 | test_api: 480 | dependency: transitive 481 | description: 482 | name: test_api 483 | url: "https://pub.dartlang.org" 484 | source: hosted 485 | version: "0.3.0" 486 | typed_data: 487 | dependency: transitive 488 | description: 489 | name: typed_data 490 | url: "https://pub.dartlang.org" 491 | source: hosted 492 | version: "1.3.0" 493 | uuid: 494 | dependency: transitive 495 | description: 496 | name: uuid 497 | url: "https://pub.dartlang.org" 498 | source: hosted 499 | version: "3.0.4" 500 | vector_math: 501 | dependency: transitive 502 | description: 503 | name: vector_math 504 | url: "https://pub.dartlang.org" 505 | source: hosted 506 | version: "2.1.0" 507 | win32: 508 | dependency: transitive 509 | description: 510 | name: win32 511 | url: "https://pub.dartlang.org" 512 | source: hosted 513 | version: "2.2.9" 514 | xdg_directories: 515 | dependency: transitive 516 | description: 517 | name: xdg_directories 518 | url: "https://pub.dartlang.org" 519 | source: hosted 520 | version: "0.2.0" 521 | sdks: 522 | dart: ">=2.13.0 <3.0.0" 523 | flutter: ">=2.0.0" 524 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 97 | ); 98 | path = Runner; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 97C146ED1CF9000F007C117D /* Runner */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 107 | buildPhases = ( 108 | 9740EEB61CF901F6004384FC /* Run Script */, 109 | 97C146EA1CF9000F007C117D /* Sources */, 110 | 97C146EB1CF9000F007C117D /* Frameworks */, 111 | 97C146EC1CF9000F007C117D /* Resources */, 112 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = Runner; 120 | productName = Runner; 121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | 97C146E61CF9000F007C117D /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 1020; 131 | ORGANIZATIONNAME = ""; 132 | TargetAttributes = { 133 | 97C146ED1CF9000F007C117D = { 134 | CreatedOnToolsVersion = 7.3.1; 135 | LastSwiftMigration = 1100; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 140 | compatibilityVersion = "Xcode 9.3"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 97C146E51CF9000F007C117D; 148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 97C146ED1CF9000F007C117D /* Runner */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 97C146EC1CF9000F007C117D /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXShellScriptBuildPhase section */ 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | ); 177 | inputPaths = ( 178 | ); 179 | name = "Thin Binary"; 180 | outputPaths = ( 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 185 | }; 186 | 9740EEB61CF901F6004384FC /* Run Script */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | ); 193 | name = "Run Script"; 194 | outputPaths = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 199 | }; 200 | /* End PBXShellScriptBuildPhase section */ 201 | 202 | /* Begin PBXSourcesBuildPhase section */ 203 | 97C146EA1CF9000F007C117D /* Sources */ = { 204 | isa = PBXSourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXSourcesBuildPhase section */ 213 | 214 | /* Begin PBXVariantGroup section */ 215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 216 | isa = PBXVariantGroup; 217 | children = ( 218 | 97C146FB1CF9000F007C117D /* Base */, 219 | ); 220 | name = Main.storyboard; 221 | sourceTree = ""; 222 | }; 223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C147001CF9000F007C117D /* Base */, 227 | ); 228 | name = LaunchScreen.storyboard; 229 | sourceTree = ""; 230 | }; 231 | /* End PBXVariantGroup section */ 232 | 233 | /* Begin XCBuildConfiguration section */ 234 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_COMMA = YES; 246 | CLANG_WARN_CONSTANT_CONVERSION = YES; 247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INFINITE_RECURSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 258 | CLANG_WARN_STRICT_PROTOTYPES = YES; 259 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | SUPPORTED_PLATFORMS = iphoneos; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Profile; 283 | }; 284 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 285 | isa = XCBuildConfiguration; 286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | CLANG_ENABLE_MODULES = YES; 290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 291 | ENABLE_BITCODE = NO; 292 | INFOPLIST_FILE = Runner/Info.plist; 293 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 294 | PRODUCT_BUNDLE_IDENTIFIER = com.example.foodDashboard; 295 | PRODUCT_NAME = "$(TARGET_NAME)"; 296 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 297 | SWIFT_VERSION = 5.0; 298 | VERSIONING_SYSTEM = "apple-generic"; 299 | }; 300 | name = Profile; 301 | }; 302 | 97C147031CF9000F007C117D /* Debug */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | ALWAYS_SEARCH_USER_PATHS = NO; 306 | CLANG_ANALYZER_NONNULL = YES; 307 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 308 | CLANG_CXX_LIBRARY = "libc++"; 309 | CLANG_ENABLE_MODULES = YES; 310 | CLANG_ENABLE_OBJC_ARC = YES; 311 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 312 | CLANG_WARN_BOOL_CONVERSION = YES; 313 | CLANG_WARN_COMMA = YES; 314 | CLANG_WARN_CONSTANT_CONVERSION = YES; 315 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 316 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 317 | CLANG_WARN_EMPTY_BODY = YES; 318 | CLANG_WARN_ENUM_CONVERSION = YES; 319 | CLANG_WARN_INFINITE_RECURSION = YES; 320 | CLANG_WARN_INT_CONVERSION = YES; 321 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 322 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 323 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 324 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 325 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 326 | CLANG_WARN_STRICT_PROTOTYPES = YES; 327 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 328 | CLANG_WARN_UNREACHABLE_CODE = YES; 329 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 330 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 331 | COPY_PHASE_STRIP = NO; 332 | DEBUG_INFORMATION_FORMAT = dwarf; 333 | ENABLE_STRICT_OBJC_MSGSEND = YES; 334 | ENABLE_TESTABILITY = YES; 335 | GCC_C_LANGUAGE_STANDARD = gnu99; 336 | GCC_DYNAMIC_NO_PIC = NO; 337 | GCC_NO_COMMON_BLOCKS = YES; 338 | GCC_OPTIMIZATION_LEVEL = 0; 339 | GCC_PREPROCESSOR_DEFINITIONS = ( 340 | "DEBUG=1", 341 | "$(inherited)", 342 | ); 343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 345 | GCC_WARN_UNDECLARED_SELECTOR = YES; 346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 347 | GCC_WARN_UNUSED_FUNCTION = YES; 348 | GCC_WARN_UNUSED_VARIABLE = YES; 349 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 350 | MTL_ENABLE_DEBUG_INFO = YES; 351 | ONLY_ACTIVE_ARCH = YES; 352 | SDKROOT = iphoneos; 353 | TARGETED_DEVICE_FAMILY = "1,2"; 354 | }; 355 | name = Debug; 356 | }; 357 | 97C147041CF9000F007C117D /* Release */ = { 358 | isa = XCBuildConfiguration; 359 | buildSettings = { 360 | ALWAYS_SEARCH_USER_PATHS = NO; 361 | CLANG_ANALYZER_NONNULL = YES; 362 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 363 | CLANG_CXX_LIBRARY = "libc++"; 364 | CLANG_ENABLE_MODULES = YES; 365 | CLANG_ENABLE_OBJC_ARC = YES; 366 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 367 | CLANG_WARN_BOOL_CONVERSION = YES; 368 | CLANG_WARN_COMMA = YES; 369 | CLANG_WARN_CONSTANT_CONVERSION = YES; 370 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 371 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 372 | CLANG_WARN_EMPTY_BODY = YES; 373 | CLANG_WARN_ENUM_CONVERSION = YES; 374 | CLANG_WARN_INFINITE_RECURSION = YES; 375 | CLANG_WARN_INT_CONVERSION = YES; 376 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 377 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 378 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 379 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 380 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 381 | CLANG_WARN_STRICT_PROTOTYPES = YES; 382 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 383 | CLANG_WARN_UNREACHABLE_CODE = YES; 384 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 385 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 386 | COPY_PHASE_STRIP = NO; 387 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 388 | ENABLE_NS_ASSERTIONS = NO; 389 | ENABLE_STRICT_OBJC_MSGSEND = YES; 390 | GCC_C_LANGUAGE_STANDARD = gnu99; 391 | GCC_NO_COMMON_BLOCKS = YES; 392 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 393 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 394 | GCC_WARN_UNDECLARED_SELECTOR = YES; 395 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 396 | GCC_WARN_UNUSED_FUNCTION = YES; 397 | GCC_WARN_UNUSED_VARIABLE = YES; 398 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 399 | MTL_ENABLE_DEBUG_INFO = NO; 400 | SDKROOT = iphoneos; 401 | SUPPORTED_PLATFORMS = iphoneos; 402 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 403 | TARGETED_DEVICE_FAMILY = "1,2"; 404 | VALIDATE_PRODUCT = YES; 405 | }; 406 | name = Release; 407 | }; 408 | 97C147061CF9000F007C117D /* Debug */ = { 409 | isa = XCBuildConfiguration; 410 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 411 | buildSettings = { 412 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 413 | CLANG_ENABLE_MODULES = YES; 414 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 415 | ENABLE_BITCODE = NO; 416 | INFOPLIST_FILE = Runner/Info.plist; 417 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 418 | PRODUCT_BUNDLE_IDENTIFIER = com.example.foodDashboard; 419 | PRODUCT_NAME = "$(TARGET_NAME)"; 420 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 421 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 422 | SWIFT_VERSION = 5.0; 423 | VERSIONING_SYSTEM = "apple-generic"; 424 | }; 425 | name = Debug; 426 | }; 427 | 97C147071CF9000F007C117D /* Release */ = { 428 | isa = XCBuildConfiguration; 429 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 430 | buildSettings = { 431 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 432 | CLANG_ENABLE_MODULES = YES; 433 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 434 | ENABLE_BITCODE = NO; 435 | INFOPLIST_FILE = Runner/Info.plist; 436 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 437 | PRODUCT_BUNDLE_IDENTIFIER = com.example.foodDashboard; 438 | PRODUCT_NAME = "$(TARGET_NAME)"; 439 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 440 | SWIFT_VERSION = 5.0; 441 | VERSIONING_SYSTEM = "apple-generic"; 442 | }; 443 | name = Release; 444 | }; 445 | /* End XCBuildConfiguration section */ 446 | 447 | /* Begin XCConfigurationList section */ 448 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 449 | isa = XCConfigurationList; 450 | buildConfigurations = ( 451 | 97C147031CF9000F007C117D /* Debug */, 452 | 97C147041CF9000F007C117D /* Release */, 453 | 249021D3217E4FDB00AE95B9 /* Profile */, 454 | ); 455 | defaultConfigurationIsVisible = 0; 456 | defaultConfigurationName = Release; 457 | }; 458 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 459 | isa = XCConfigurationList; 460 | buildConfigurations = ( 461 | 97C147061CF9000F007C117D /* Debug */, 462 | 97C147071CF9000F007C117D /* Release */, 463 | 249021D4217E4FDB00AE95B9 /* Profile */, 464 | ); 465 | defaultConfigurationIsVisible = 0; 466 | defaultConfigurationName = Release; 467 | }; 468 | /* End XCConfigurationList section */ 469 | }; 470 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 471 | } 472 | -------------------------------------------------------------------------------- /lib/widgets/my_dialog.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:food_dashboard/constants.dart'; 3 | import 'package:food_dashboard/datasources/service/restaurant_service_contract.dart'; 4 | import 'package:food_dashboard/di/get_it.dart'; 5 | import 'package:food_dashboard/domain/entities/restaurant.dart'; 6 | import 'package:food_dashboard/widgets/custom_text_button.dart'; 7 | import 'package:food_dashboard/widgets/form_title_and_field.dart'; 8 | import 'package:food_dashboard/widgets/restaurant_card.dart'; 9 | import 'package:google_fonts/google_fonts.dart'; 10 | import 'package:image_picker_web/image_picker_web.dart'; 11 | import 'package:mime_type/mime_type.dart'; 12 | import 'dart:html' as html; 13 | import 'package:path/path.dart' as Path; 14 | 15 | class MyDialog extends StatefulWidget { 16 | const MyDialog({Key? key}) : super(key: key); 17 | 18 | @override 19 | _MyDialogState createState() => _MyDialogState(); 20 | } 21 | 22 | class _MyDialogState extends State { 23 | html.File? _cloudFile; 24 | var _fileBytes; 25 | String? name; 26 | String? category; 27 | String? rating; 28 | String? price; 29 | String? distance; 30 | GlobalKey formKey = GlobalKey(); 31 | bool showSelectFileMessage = false; 32 | 33 | TextEditingController nameController = TextEditingController(); 34 | TextEditingController categoryController = TextEditingController(); 35 | TextEditingController ratingController = TextEditingController(); 36 | TextEditingController priceController = TextEditingController(); 37 | TextEditingController distanceController = TextEditingController(); 38 | 39 | Future _pickImage() async { 40 | var mediaData = await ImagePickerWeb.getImageInfo; 41 | String mimeType = mime(Path.basename(mediaData.fileName!))!; 42 | html.File mediaFile = 43 | new html.File(mediaData.data!, mediaData.fileName!, {'type': mimeType}); 44 | 45 | setState(() { 46 | _cloudFile = mediaFile; 47 | _fileBytes = mediaData.data; 48 | }); 49 | } 50 | 51 | final restaurantService = getIt(); 52 | 53 | @override 54 | Widget build(BuildContext context) { 55 | return GestureDetector( 56 | onTap: () { 57 | FocusScopeNode currentFocus = FocusScope.of(context); 58 | if (!currentFocus.hasPrimaryFocus) { 59 | currentFocus.unfocus(); 60 | } 61 | }, 62 | child: AlertDialog( 63 | contentPadding: EdgeInsets.all(0), 64 | content: Form( 65 | key: formKey, 66 | child: Container( 67 | width: 750, 68 | // height: 700, 69 | child: ListView( 70 | shrinkWrap: true, 71 | children: [ 72 | Padding( 73 | padding: EdgeInsets.symmetric(horizontal: 35, vertical: 25), 74 | child: Column( 75 | crossAxisAlignment: CrossAxisAlignment.start, 76 | children: [ 77 | Text( 78 | "Add Restaurant", 79 | style: GoogleFonts.montserrat( 80 | fontSize: 24, 81 | fontWeight: FontWeight.bold, 82 | ), 83 | ), 84 | const SizedBox(height: kdefaultPadding), 85 | Row( 86 | children: [ 87 | Expanded( 88 | child: Column( 89 | crossAxisAlignment: CrossAxisAlignment.start, 90 | children: [ 91 | FormTitleAndField( 92 | validate: (value) { 93 | if (value == null || value.isEmpty) { 94 | return 'Please enter some text'; 95 | } 96 | return null; 97 | }, 98 | textEditingController: nameController, 99 | onChanged: (value) { 100 | setState(() { 101 | name = value; 102 | }); 103 | }, 104 | onSaved: (value) { 105 | name = value; 106 | }, 107 | title: "Name", 108 | hintText: "Enter a name", 109 | ), 110 | FormTitleAndField( 111 | validate: (value) { 112 | if (value == null || value.isEmpty) { 113 | return 'Please enter some text'; 114 | } 115 | return null; 116 | }, 117 | textEditingController: categoryController, 118 | onChanged: (value) { 119 | setState(() { 120 | category = value; 121 | }); 122 | }, 123 | onSaved: (value) { 124 | category = value; 125 | }, 126 | title: "Category", 127 | hintText: "Cafe / Bars / Asian ...", 128 | ), 129 | FormTitleAndField( 130 | validate: (value) { 131 | if (value == null || value.isEmpty) { 132 | return 'Please enter some text'; 133 | } 134 | return null; 135 | }, 136 | textEditingController: ratingController, 137 | onChanged: (value) { 138 | setState(() { 139 | rating = value; 140 | }); 141 | }, 142 | onSaved: (value) { 143 | rating = value; 144 | }, 145 | title: "Rating", 146 | hintText: "Rate the restaurant ! (0 - 5)", 147 | ), 148 | FormTitleAndField( 149 | validate: (value) { 150 | if (value == null || value.isEmpty) { 151 | return 'Please enter some text'; 152 | } 153 | return null; 154 | }, 155 | textEditingController: priceController, 156 | onChanged: (value) { 157 | setState(() { 158 | price = value; 159 | }); 160 | }, 161 | onSaved: (value) { 162 | price = value; 163 | }, 164 | title: "Price", 165 | hintText: 166 | "Enter the average food price of the restaurant", 167 | ), 168 | FormTitleAndField( 169 | validate: (value) { 170 | if (value == null || value.isEmpty) { 171 | return 'Please enter some text'; 172 | } 173 | return null; 174 | }, 175 | textEditingController: distanceController, 176 | onChanged: (value) { 177 | setState(() { 178 | distance = value; 179 | }); 180 | }, 181 | onSaved: (value) { 182 | distance = value; 183 | }, 184 | title: "Distance", 185 | hintText: "Enter the distance", 186 | suffixText: "km", 187 | ), 188 | ], 189 | ), 190 | ), 191 | const SizedBox(width: 50), 192 | Material( 193 | borderRadius: BorderRadius.circular( 194 | 10.0, 195 | ), 196 | color: Colors.pink.withOpacity(0.2), 197 | child: Container( 198 | height: 275, 199 | width: 220, 200 | padding: EdgeInsets.all(20), 201 | child: Column( 202 | children: [ 203 | ClipRRect( 204 | borderRadius: BorderRadius.circular(10.0), 205 | child: Container( 206 | width: 180, 207 | child: AspectRatio( 208 | aspectRatio: 1.8, 209 | child: _cloudFile != null 210 | ? Image.memory(_fileBytes, 211 | fit: BoxFit.cover) 212 | : Image.asset( 213 | cachedRestaurantList[0] 214 | .imageUrl, 215 | fit: BoxFit.cover, 216 | ), 217 | ), 218 | ), 219 | ), 220 | Spacer(), 221 | Column( 222 | children: [ 223 | Text( 224 | (name == null || name == "") 225 | ? cachedRestaurantList[0].name 226 | : name!, 227 | style: GoogleFonts.montserrat( 228 | fontSize: 16, 229 | fontWeight: FontWeight.w700, 230 | ), 231 | overflow: TextOverflow.ellipsis, 232 | textAlign: TextAlign.center, 233 | maxLines: 2, 234 | ), 235 | const SizedBox(height: 3), 236 | Text( 237 | (category == null || category == "") 238 | ? cachedRestaurantList[0].resType 239 | : category!, 240 | overflow: TextOverflow.ellipsis, 241 | style: GoogleFonts.montserrat( 242 | fontSize: 10, 243 | color: Colors.grey.shade600, 244 | ), 245 | ), 246 | ], 247 | ), 248 | Spacer(), 249 | Container( 250 | height: 50, 251 | child: IntrinsicHeight( 252 | child: Row( 253 | mainAxisSize: MainAxisSize.min, 254 | children: [ 255 | Column( 256 | mainAxisAlignment: 257 | MainAxisAlignment.center, 258 | children: [ 259 | Icon( 260 | Icons.star, 261 | size: 14, 262 | ), 263 | const SizedBox(height: 10), 264 | Text( 265 | (rating == null || rating == "") 266 | ? cachedRestaurantList[0] 267 | .rating 268 | : rating!, 269 | style: GoogleFonts.montserrat( 270 | fontSize: 16, 271 | fontWeight: FontWeight.bold, 272 | ), 273 | ) 274 | ], 275 | ), 276 | CustomDivider(height: 40), 277 | Column( 278 | mainAxisAlignment: 279 | MainAxisAlignment.center, 280 | children: [ 281 | Row( 282 | children: [ 283 | CurrencyIcon(size: 10), 284 | CurrencyIcon( 285 | size: 10, 286 | color: 287 | Colors.grey.shade600), 288 | CurrencyIcon( 289 | size: 10, 290 | color: 291 | Colors.grey.shade600), 292 | ], 293 | ), 294 | const SizedBox(height: 10), 295 | Text( 296 | (price == null || price == "") 297 | ? cachedRestaurantList[0] 298 | .price 299 | : price!, 300 | style: GoogleFonts.montserrat( 301 | fontSize: 16, 302 | fontWeight: FontWeight.bold, 303 | ), 304 | ) 305 | ], 306 | ), 307 | CustomDivider(height: 40), 308 | Column( 309 | mainAxisAlignment: 310 | MainAxisAlignment.center, 311 | children: [ 312 | Text( 313 | "km", 314 | style: GoogleFonts.montserrat( 315 | fontSize: 11, 316 | fontWeight: FontWeight.bold, 317 | ), 318 | ), 319 | const SizedBox(height: 10), 320 | Text( 321 | (distance == null || 322 | distance == "") 323 | ? cachedRestaurantList[0] 324 | .distance 325 | : distance!, 326 | textAlign: TextAlign.center, 327 | style: GoogleFonts.montserrat( 328 | fontSize: 16, 329 | fontWeight: FontWeight.bold, 330 | ), 331 | ), 332 | ], 333 | ), 334 | ], 335 | ), 336 | ), 337 | ), 338 | ], 339 | ), 340 | ), 341 | ), 342 | ], 343 | ), 344 | Text( 345 | "Image", 346 | style: GoogleFonts.montserrat( 347 | fontSize: 16, 348 | fontWeight: FontWeight.bold, 349 | ), 350 | ), 351 | const SizedBox(height: 10), 352 | Row( 353 | children: [ 354 | Material( 355 | borderRadius: BorderRadius.circular(12), 356 | color: Colors.grey[400], 357 | child: InkWell( 358 | borderRadius: BorderRadius.circular(12), 359 | onTap: () { 360 | _pickImage(); 361 | if (showSelectFileMessage == true) { 362 | setState(() { 363 | showSelectFileMessage = false; 364 | }); 365 | } 366 | }, 367 | child: Container( 368 | padding: EdgeInsets.symmetric( 369 | horizontal: 20, vertical: 10), 370 | child: Text( 371 | "Select a file", 372 | style: TextStyle(fontSize: 14), 373 | ), 374 | ), 375 | ), 376 | ), 377 | const SizedBox(width: 20), 378 | _cloudFile == null 379 | ? Text( 380 | "No File Chosen", 381 | style: TextStyle(fontSize: 14), 382 | ) 383 | : Expanded( 384 | child: Text( 385 | _cloudFile!.name, 386 | style: TextStyle(fontSize: 14), 387 | overflow: TextOverflow.ellipsis, 388 | ), 389 | ), 390 | ], 391 | ), 392 | (showSelectFileMessage) 393 | ? Padding( 394 | padding: const EdgeInsets.only(top: 10), 395 | child: Text( 396 | "Please select a file", 397 | style: TextStyle( 398 | fontSize: 12.5, color: Colors.red[700]), 399 | ), 400 | ) 401 | : SizedBox.shrink(), 402 | const SizedBox(height: 30), 403 | Align( 404 | alignment: Alignment.centerRight, 405 | child: CustomTextButton( 406 | text: "Submit", 407 | onTap: () async { 408 | if (formKey.currentState!.validate() && 409 | _cloudFile != null) { 410 | Restaurant restaurant = Restaurant( 411 | imageUrl: "", 412 | name: name!, 413 | resType: category!, 414 | rating: rating!, 415 | price: price!, 416 | distance: distance!, 417 | ); 418 | 419 | restaurantService.addRestaurant( 420 | restaurant, 421 | _fileBytes, 422 | _cloudFile!, 423 | ); 424 | Navigator.pop(context); 425 | } else { 426 | setState(() { 427 | showSelectFileMessage = true; 428 | }); 429 | print("fill in all"); 430 | } 431 | }, 432 | ), 433 | ), 434 | ], 435 | ), 436 | ), 437 | ], 438 | ), 439 | ), 440 | ), 441 | ), 442 | ); 443 | } 444 | } 445 | 446 | String parseToDouble(String value) { 447 | num number = num.parse(value); 448 | return number.toStringAsFixed(1); 449 | } 450 | 451 | Restaurant resObject = Restaurant( 452 | imageUrl: "assets/images/molon_lave.jpg", 453 | name: "Molon Lave", 454 | resType: "Asian Kitchen", 455 | rating: "4.7", 456 | price: "30", 457 | distance: "0.2", 458 | ); 459 | --------------------------------------------------------------------------------