diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..28a51d5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "compile-hero.disable-compile-files-on-did-save-code": false +} \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index 4f51cd0..d43626c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -38,7 +38,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.flutter.rcapp" + applicationId "com.rourkela.rcapp" minSdkVersion 23 targetSdkVersion 28 versionCode flutterVersionCode.toInteger() diff --git a/android/app/google-services.json b/android/app/google-services.json index 95c0cd7..11a767f 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -1,34 +1,34 @@ { "project_info": { - "project_number": "433660739407", - "firebase_url": "https://rcapp-de25c.firebaseio.com", - "project_id": "rcapp-de25c", - "storage_bucket": "rcapp-de25c.appspot.com" + "project_number": "946016773649", + "firebase_url": "https://rcapp-a57cd.firebaseio.com", + "project_id": "rcapp-a57cd", + "storage_bucket": "rcapp-a57cd.appspot.com" }, "client": [ { "client_info": { - "mobilesdk_app_id": "1:433660739407:android:719770e06797fb89130f3a", + "mobilesdk_app_id": "1:946016773649:android:cd582a95e23ec301a933b0", "android_client_info": { - "package_name": "com.flutter.rcapp" + "package_name": "com.rourkela.rcapp" } }, "oauth_client": [ { - "client_id": "433660739407-fk81st9lddi06arc3toggnlcb311li30.apps.googleusercontent.com", + "client_id": "946016773649-6mequs1kpd3h8o5phpd8ee1juj3c7vg0.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { - "current_key": "AIzaSyBZ2nQ3CT4od1Pt09Wj8wyyyC5JkWVD7tM" + "current_key": "AIzaSyCK8rzg8SncLmjZFItCFLAAg5aFzmazaJc" } ], "services": { "appinvite_service": { "other_platform_oauth_client": [ { - "client_id": "433660739407-fk81st9lddi06arc3toggnlcb311li30.apps.googleusercontent.com", + "client_id": "946016773649-6mequs1kpd3h8o5phpd8ee1juj3c7vg0.apps.googleusercontent.com", "client_type": 3 } ] diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index a28c09f..7fe9db4 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -5,10 +5,26 @@ In most cases you can leave this as-is, but you if you want to provide additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> + + + + + + + + + + qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + } @override Widget build(BuildContext context) { - return Container( - width: 160, - margin: EdgeInsets.only(right: 10.0), - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('$imagePath'), - fit: BoxFit.cover, + return areYouAdmin ? FocusedMenuHolder( + onPressed: () {}, + menuItems: [ + FocusedMenuItem( + title: Text('Delete the item'), + onPressed: () { + deleteMenu(); + }) + ], + child: Container( + width: 168, + margin: EdgeInsets.only(right: 10.0), + decoration: BoxDecoration( + image: DecorationImage( + image: NetworkImage(imagePath), + fit: BoxFit.cover, + ), + borderRadius: BorderRadius.circular(6)), + child: Container( + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + InkWell( + onTap: () { + deleteMenu(); + }, + child: Container( + decoration: BoxDecoration( + color: Colors.deepOrange, + borderRadius: BorderRadius.circular(5)), + child: Icon( + Icons.delete_outline, + color: Colors.white, + ), + ), + ) + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 66, + child: Text( + categoryName, + style: GoogleFonts.inter( + fontWeight: FontWeight.bold, + fontSize: 16.0, + color: Colors.white), + ), + ), + Text( + '₹' + '$itemprice', + style: GoogleFonts.inter(color: Colors.white), + ) + ], + ), + InkWell( + onTap: () { + addToCart(categoryName, itemprice); + showFlushbar(context); + }, + child: Container( + height: 25, + width: 45, + decoration: BoxDecoration( + color: Colors.deepOrange, + border: + Border.all(color: Colors.black, width: 0.1), + borderRadius: BorderRadius.circular(5)), + child: Center( + child: Text( + 'Add', + style: GoogleFonts.inter( + fontWeight: FontWeight.w400, + color: Colors.white), + ), + ), + ), + ) + ]) + ], ), - borderRadius: BorderRadius.circular(6)), - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - categoryName, - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16.0, color: Colors.white), + )), + ) : Container( + width: 160, + margin: EdgeInsets.only(right: 10.0), + decoration: BoxDecoration( + image: DecorationImage( + image: NetworkImage(imagePath), + fit: BoxFit.cover, + ), + borderRadius: BorderRadius.circular(6)), + child: Container( + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5), + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 60, + child: Text( + categoryName, + style: GoogleFonts.inter( + fontWeight: FontWeight.bold, + fontSize: 16.0, + color: Colors.white), + ), + ), + Text( + '₹' + '$itemprice', + style: GoogleFonts.inter(color: Colors.white), + ) + ], + ), + InkWell( + onTap: () { + addToCart(categoryName, itemprice); + showFlushbar(context); + }, + child: Container( + height: 25, + width: 45, + decoration: BoxDecoration( + color: Colors.deepOrange, + border: + Border.all(color: Colors.black, width: 0.1), + borderRadius: BorderRadius.circular(5)), + child: Center( + child: Text( + 'Add', + style: GoogleFonts.inter( + fontWeight: FontWeight.w400, + color: Colors.white), + ), + ), + ), + ) + ]) + ], ), - Text( - '₹' + '$itemprice', - style: TextStyle(color: Colors.white), - ) - ], - )); + )); } } diff --git a/lib/CustomWidget/foot_category.dart b/lib/CustomWidget/foot_category.dart index 1b4d1cd..3d5073d 100644 --- a/lib/CustomWidget/foot_category.dart +++ b/lib/CustomWidget/foot_category.dart @@ -1,5 +1,14 @@ +import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:focused_menu/focused_menu.dart'; +import 'package:focused_menu/modals.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/storeData.dart'; import 'food_card.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; // DAta import '../data/category_data.dart'; @@ -7,24 +16,56 @@ import '../data/category_data.dart'; // Model import '../models/category_model.dart'; +// class FoodCategory extends StatefulWidget { +// @override +// _FoodCategoryState createState() => _FoodCategoryState(); +// } + class FoodCategory extends StatelessWidget { - final List _categories = categories; + // final List _categories = categories; + final bool areYouAdmin; + + FoodCategory(this.areYouAdmin); @override Widget build(BuildContext context) { - return Container( - height: 90.0, - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: _categories.length, - itemBuilder: (BuildContext context, int index) { - return FoodCard( - categoryName: _categories[index].categoryName, - imagePath: _categories[index].imagePath, - itemprice: _categories[index].itemprice, - ); - }, - ), - ); + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 90, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitCircle( + color: Colors.deepOrange, + size: 45, + ), + SizedBox(height: 20), + Text('LOADING', style: GoogleFonts.inter(fontWeight: FontWeight.w400)) + ]), + ); + } else { + return Container( + height: 105.0, + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: _menuList.length, + itemBuilder: (BuildContext context, int index) { + return FocusedMenuHolder( + onPressed: () {}, + menuItems: [ + FocusedMenuItem(title: Text('delete'), onPressed: () {}) + ], + child: FoodCard( + areYouAdmin: areYouAdmin, + categoryName: _menuList[index].category_menu, + imagePath: _menuList[index].imagepath, + itemprice: _menuList[index].price, + ), + ); + }, + ), + ); + } } } diff --git a/lib/CustomWidget/menu_card.dart b/lib/CustomWidget/menu_card.dart index ccb62b3..cf56587 100644 --- a/lib/CustomWidget/menu_card.dart +++ b/lib/CustomWidget/menu_card.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; import 'package:rcapp/services/database.dart'; class MenuCard extends StatelessWidget { @@ -32,7 +33,7 @@ class MenuCard extends StatelessWidget { children: [ Text( '$categoryName', - style: TextStyle( + style: GoogleFonts.inter( fontWeight: FontWeight.bold, ), ) diff --git a/lib/CustomWidget/todays_menucard.dart b/lib/CustomWidget/todays_menucard.dart index 2634812..cc674c9 100644 --- a/lib/CustomWidget/todays_menucard.dart +++ b/lib/CustomWidget/todays_menucard.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; class TodayFoodCard extends StatelessWidget { final String categoryName; @@ -24,11 +25,11 @@ class TodayFoodCard extends StatelessWidget { children: [ Text( categoryName, - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16.0, color: Colors.white), + style: GoogleFonts.inter(fontWeight: FontWeight.bold, fontSize: 16.0, color: Colors.white), ), Text( '₹' + '$itemprice', - style: TextStyle(color: Colors.white), + style: GoogleFonts.inter(color: Colors.white), ) ], )); diff --git a/lib/main.dart b/lib/main.dart index 5489e80..3c9e4cb 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,20 +1,58 @@ +import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_downloader/flutter_downloader.dart'; +import 'package:rcapp/pages/BlueL.dart'; import 'package:rcapp/pages/Cart.dart'; +import 'package:rcapp/pages/CategoryMenuList/Accompaniment_Menu.dart'; +import 'package:rcapp/pages/CategoryMenuList/All_Menu.dart'; +import 'package:rcapp/pages/CategoryMenuList/Biryani_MenuList.dart'; +import 'package:rcapp/pages/CategoryMenuList/Bread_Menu.dart'; +import 'package:rcapp/pages/CategoryMenuList/Breakfast_Menu.dart'; +import 'package:rcapp/pages/CategoryMenuList/Burger_Menu.dart'; +import 'package:rcapp/pages/CategoryMenuList/Chinese_Menu.dart'; +import 'package:rcapp/pages/CategoryMenuList/FriedRiceAndNoodles_Menu.dart'; +import 'package:rcapp/pages/CategoryMenuList/MainCourse_Menu.dart'; +import 'package:rcapp/pages/CategoryMenuList/Pasta_Menu.dart'; +import 'package:rcapp/pages/CategoryMenuList/Pizza_Menu.dart'; +import 'package:rcapp/pages/CategoryMenuList/Roll_Menu.dart'; +import 'package:rcapp/pages/CategoryMenuList/Sandwich_Menu.dart'; +import 'package:rcapp/pages/CategoryMenuList/Snacks_Menu.dart'; +import 'package:rcapp/pages/CategoryMenuList/Soup_Menu.dart'; +import 'package:rcapp/pages/CategoryMenuList/Starter_Menu.dart'; +import 'package:rcapp/pages/CategoryMenuList/Tandoori_Menu.dart'; +import 'package:rcapp/pages/Coluseum.dart'; import 'package:rcapp/pages/Food.dart'; +import 'package:rcapp/pages/Milan.dart'; +import 'package:rcapp/pages/MilapL.dart'; import 'package:rcapp/pages/NavigationBar.dart'; +import 'package:rcapp/pages/YellowL.dart'; import 'package:rcapp/pages/add_event.dart'; import 'package:rcapp/pages/address.dart'; +import 'package:rcapp/pages/adminBooking.dart'; import 'package:rcapp/pages/admin_order_confirm.dart'; import 'package:rcapp/pages/booking_calendar.dart'; import 'package:rcapp/pages/confirmOrder.dart'; +import 'package:rcapp/pages/mainhall.dart'; import 'package:rcapp/pages/orderdetails.dart'; +import 'package:rcapp/pages/previousBooking.dart'; +import 'package:rcapp/pages/previousOrder.dart'; +import 'package:rcapp/pages/uploadAvatar.dart'; +import 'package:rcapp/pages/uploadImage.dart'; +import 'package:rcapp/pages/uploadPdf.dart'; import 'package:rcapp/pages/welcome.dart'; import 'package:rcapp/services/auth.dart'; import 'pages/wrapper.dart'; import 'package:provider/provider.dart'; import 'package:rcapp/models/user.dart'; -void main() => runApp(MyApp()); +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + await FlutterDownloader.initialize( + debug: true // optional: set false to disable printing logs to console + ); + + runApp(MyApp()); +} class MyApp extends StatelessWidget { @override @@ -29,13 +67,49 @@ class MyApp extends StatelessWidget { '/bookingcalendar': (context) => Calendar(), '/cart': (context) => Cart(), '/adminorder': (context) => AdminOrder(), - '/orderdetails': (context) => OrderDetails(), + // '/orderdetails': (context) => OrderDetails(), '/wrapper': (context) => Wrapper(), "/add_event": (context) => AddEventPage(), - "/confirmOrder": (context) => ConfirmOrder(), - "/address" : (context) => AddressForm(), + "/address": (context) => AddressForm(), + "/previousOrder": (context) => PreviousOrder(), + "/previousBooking": (context) => PreviousBooking(), + "/adminBooking": (context) => AdminBooking(), + // "/previousOrder": (context) => PreviousOrderDetails(), + + //routes for different categories of food + "/allmenu": (context) => AllMenu(), + "/biryanimenu": (context) => Biryani_MenuList(), + "/breadmenu": (context) => Bread_MenuList(), + "/breakfastmenu": (context) => Breakfast_MenuList(), + "/burgermenu": (context) => Burger_MenuList(), + "/chinesemenu": (context) => ChineseMenuList(), + "/friedriceandnoodlesmenu": (context) => + FriedRiceAndNoodles_MenuList(), + "/maincoursemenu": (context) => MainCourse_MenuList(), + "/pastamenu": (context) => Pasta_MenuList(), + "/pizzamenu": (context) => Pizza_MenuList(), + "/rollmenu": (context) => Roll_MenuList(), + "/sandwichmenu": (context) => Sandwich_MenuList(), + "/snacksmenu": (context) => Snacks_MenuList(), + "/soupmenu": (context) => Soup_MenuList(), + "/startermenu": (context) => StarterMenuList(), + "/tandoorimenu": (context) => Tandoori_MenuList(), + "/accompanimentmenu": (context) => Accompaniment_Menu(), + + // lounge routes + "/bluelounge": (context) => BlueLounge(), + "/yellowlounge": (context) => YellowLounge(), + "/milanlounge": (context) => MilanLounge(), + "/milaplounge": (context) => MilapLounge(), + "/coluseum": (context) => Coluseum(), + "/mainhall" : (context) => MainHall(), + + //Routes for admin + "/uploadImage": (context) => UploadImage(), + "/uploadPdf": (context) => UploadPdf(), + "/uploadAvatarImage": (context) => UploadAvatar() }, ), ); } -} \ No newline at end of file +} diff --git a/lib/models/event.dart b/lib/models/event.dart index 2e0dede..f728e03 100644 --- a/lib/models/event.dart +++ b/lib/models/event.dart @@ -4,10 +4,12 @@ class EventModel extends DatabaseItem { final String id; final String name; final String personalno; + final int slot; + final int numberOfPeople; final String Lounge; final DateTime eventDate; - EventModel({this.id, this.name, this.personalno, this.Lounge, this.eventDate}) + EventModel({this.id, this.name, this.personalno, this.Lounge, this.eventDate, this.slot, this.numberOfPeople}) : super(id); factory EventModel.fromMap(Map data) { @@ -16,15 +18,18 @@ class EventModel extends DatabaseItem { personalno: data['personal no'], Lounge: data['Lounge'], eventDate: data['event_date'], + slot: data['slot'], + numberOfPeople: data['numberOfPeople'] ); } factory EventModel.fromDS(String id, Map data) { return EventModel( - id: id, name: data['name'], personalno: data['personal no'], Lounge: data['Lounge'], + slot: data['slot'], + numberOfPeople: data['numberOfPeople'], eventDate: data['event_date'].toDate(), ); } @@ -35,7 +40,8 @@ class EventModel extends DatabaseItem { "personal no": personalno, "Lounge": Lounge, "event_date": eventDate, - "id": id, + "slot": slot, + "numberOfPeople": numberOfPeople }; } } \ No newline at end of file diff --git a/lib/models/user.dart b/lib/models/user.dart index a96b80c..8daf7fb 100644 --- a/lib/models/user.dart +++ b/lib/models/user.dart @@ -28,6 +28,150 @@ class Menu { Menu({this.item, this.price, this.searchIndex}); } +class BreakfastMenu { + String item = ''; + int price = 0; + String searchIndex = ''; + + BreakfastMenu({this.item, this.price, this.searchIndex}); +} + +class PaneerMenu { + String item = ''; + int price = 0; + String searchIndex = ''; + + PaneerMenu({this.item, this.price, this.searchIndex}); +} + +class MainCourseMenu { + String item = ''; + int price = 0; + String searchIndex = ''; + + MainCourseMenu({this.item, this.price, this.searchIndex}); +} + +class ChineseMenu { + String item = ''; + int price = 0; + String searchIndex = ''; + + ChineseMenu({this.item, this.price, this.searchIndex}); +} + +class StarterMenu { + String item = ''; + int price = 0; + String searchIndex = ''; + + StarterMenu({this.item, this.price, this.searchIndex}); +} + +class BiryaniMenu { + String item = ''; + int price = 0; + String searchIndex = ''; + + BiryaniMenu({this.item, this.price, this.searchIndex}); +} + +class BreadMenu { + String item = ''; + int price = 0; + String searchIndex = ''; + + BreadMenu({this.item, this.price, this.searchIndex}); +} + +class TandooriMenu { + String item = ''; + int price = 0; + String searchIndex = ''; + + TandooriMenu({this.item, this.price, this.searchIndex}); +} + +class FriedRiceAndNoodlesMenu { + String item = ''; + int price = 0; + String searchIndex = ''; + + FriedRiceAndNoodlesMenu({this.item, this.price, this.searchIndex}); +} + +class RollMenu { + String item = ''; + int price = 0; + String searchIndex = ''; + + RollMenu({this.item, this.price, this.searchIndex}); +} + +class SandwichMenu { + String item = ''; + int price = 0; + String searchIndex = ''; + + SandwichMenu({this.item, this.price, this.searchIndex}); +} + +class PizzaMenu { + String item = ''; + int price = 0; + String searchIndex = ''; + + PizzaMenu({this.item, this.price, this.searchIndex}); +} + +class SnacksMenu { + String item = ''; + int price = 0; + String searchIndex = ''; + + SnacksMenu({this.item, this.price, this.searchIndex}); +} + +class BurgerMenu { + String item = ''; + int price = 0; + String searchIndex = ''; + + BurgerMenu({this.item, this.price, this.searchIndex}); +} + +class PastaMenu { + String item = ''; + int price = 0; + String searchIndex = ''; + + PastaMenu({this.item, this.price, this.searchIndex}); +} + +class SoupMenu { + String item = ''; + int price = 0; + String searchIndex = ''; + + SoupMenu({this.item, this.price, this.searchIndex}); +} + +class AccompanimentMenu { + String item = ''; + int price = 0; + String searchIndex = ''; + + AccompanimentMenu({this.item, this.price, this.searchIndex}); +} + +class Today_Menu { + String imagepath = ''; + int price = 0; + String category_menu = ''; + + Today_Menu({this.imagepath, this.price, this.category_menu}); +} + class Orders { List item; List qty; @@ -36,7 +180,34 @@ class Orders { String address; int total; bool isConfirmed; + String date; Orders( - {this.item, this.qty, this.name, this.number, this.address, this.total, this.isConfirmed}); -} \ No newline at end of file + {this.item, + this.qty, + this.name, + this.number, + this.address, + this.total, + this.isConfirmed, + this.date}); +} + +class PreviousOrders { + List item; + List qty; + String name; + String number; + String address; + int total; + bool isConfirmed; + + PreviousOrders( + {this.item, + this.qty, + this.name, + this.number, + this.address, + this.total, + this.isConfirmed}); +} diff --git a/lib/pages/Add_Food.dart b/lib/pages/Add_Food.dart index c069c98..3fc445c 100644 --- a/lib/pages/Add_Food.dart +++ b/lib/pages/Add_Food.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; class AddFood extends StatefulWidget { final String id; @@ -30,7 +31,7 @@ class _AddFoodState extends State { ), Text( widget.Name, - style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold), + style: GoogleFonts.inter(fontSize: 17, fontWeight: FontWeight.bold), ), ], ), @@ -50,7 +51,7 @@ class _AddFoodState extends State { ), Text( '$FQty', - style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold), + style: GoogleFonts.inter(fontSize: 17, fontWeight: FontWeight.bold), ), IconButton( icon: Icon( @@ -72,7 +73,7 @@ class _AddFoodState extends State { margin: new EdgeInsets.symmetric(horizontal:50.0), child:Text( '₹' + widget.price.toString(), - style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold), + style: GoogleFonts.inter(fontSize: 17, fontWeight: FontWeight.bold), ), ), ], diff --git a/lib/pages/BlueL.dart b/lib/pages/BlueL.dart new file mode 100644 index 0000000..66b8421 --- /dev/null +++ b/lib/pages/BlueL.dart @@ -0,0 +1,65 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; + + +class BlueLounge extends StatefulWidget { + @override + _BlueLoungeState createState() => _BlueLoungeState(); +} + +class _BlueLoungeState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + elevation: 10.0, + backgroundColor: Colors.deepOrange, + title: Text('Blue Lounge'), + ), + body: new Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Container( + height: 200.0, + width: double.infinity, + padding: EdgeInsets.symmetric(horizontal: 50, vertical: 30), + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 20), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/12.jpg"), + fit: BoxFit.fill)), + ), + ), + Text( + "Blue Lounge", + style: GoogleFonts.inter( + color: Colors.blueAccent, + fontSize: 40, + ), + ), + Text( + "The Blue Lounge is a comfortable lounge present in the ground floor of the club. Perfect for small group gatherings like office parties, get togethers amongst friends etc \n \nCapacity : 15 people\n \n \n \n ", + style: GoogleFonts.inter( + fontSize: 20 + ), + ), + SizedBox( + width: double.infinity, + height: 60, + child: ButtonTheme( + child: RaisedButton( + color: Colors.deepOrange, + onPressed: () { + Navigator.pushNamed(context, "/bookingcalendar"); + }, + child: Text('Book', + style: GoogleFonts.inter(color: Colors.white, fontSize: 18))), + )), + ], + ), + ); + } +} diff --git a/lib/pages/Booking.dart b/lib/pages/Booking.dart index 61917a3..5201bc1 100644 --- a/lib/pages/Booking.dart +++ b/lib/pages/Booking.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; import 'package:carousel_pro/carousel_pro.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:rcapp/pages/NavigationBar.dart'; class Booking extends StatefulWidget { @override @@ -9,121 +11,6 @@ class Booking extends StatefulWidget { class _BookingState extends State { @override Widget build(BuildContext context) { - Widget image_carousel1 = new Container( - height: 200.0, - child: new Carousel( - boxFit: BoxFit.cover, - images: [ - Card( - child: Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/12.jpg'), - fit: BoxFit.fitWidth, - alignment: Alignment.topCenter, - ), - ), - child: Text("The Blue Lounge", - style: TextStyle( - color: Colors.white, - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - Card( - child: Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/13.jpg'), - fit: BoxFit.fitWidth, - alignment: Alignment.topCenter, - ), - ), - child: Text("The Yellow Lounge", - style: TextStyle( - color: Colors.white, - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - Card( - child: Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/17.jpg'), - fit: BoxFit.fitWidth, - alignment: Alignment.topCenter, - ), - ), - child: Text("Milap Reception Hall", - style: TextStyle( - color: Colors.white, - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - autoplay: true, - animationCurve: Curves.fastOutSlowIn, - animationDuration: Duration(milliseconds: 1000), - ), - ); - - Widget image_carousel2 = new Container( - height: 200.0, - child: new Carousel( - boxFit: BoxFit.cover, - images: [ - Card( - child: Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/15.jpg'), - fit: BoxFit.fitWidth, - alignment: Alignment.topCenter, - ), - ), - child: Text("Main Banquet", - style: TextStyle( - color: Colors.white, - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - Card( - child: Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/16.jpg'), - fit: BoxFit.fitWidth, - alignment: Alignment.topCenter, - ), - ), - child: Text("Wedding Reception Hall", - style: TextStyle( - color: Colors.white, - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - - ], - autoplay: true, - animationCurve: Curves.fastOutSlowIn, - animationDuration: Duration(milliseconds: 1000), - ), - ); - return Scaffold( appBar: AppBar( @@ -140,7 +27,7 @@ class _BookingState extends State { children: [ Text( " Lounges", - style: TextStyle( + style: GoogleFonts.inter( color: Colors.grey, fontSize: 25, fontWeight: FontWeight.bold, @@ -157,20 +44,192 @@ class _BookingState extends State { ], ), SizedBox(height: 10.0), - image_carousel1, - SizedBox(height: 50.0), + Container( + margin: const EdgeInsets.symmetric(vertical: 0, horizontal: 10), + height: 150.0, + width: double.infinity, + child: new Column( + children: [ + Expanded( + child: ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + scrollDirection: Axis.horizontal, + children: [ + InkWell( + onTap: () { + Navigator.pushNamed(context, "/bluelounge"); + }, + child: Container( + height: 100.0, + width: 150.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Blue Lounge', + style: GoogleFonts.inter(color: Colors.white, fontWeight: FontWeight.bold), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/12.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + InkWell( + onTap: () { + Navigator.pushNamed(context, "/yellowlounge"); + }, + child: Container( + height: 100.0, + width: 150.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Yellow Lounge', + style: GoogleFonts.inter(color: Colors.white, fontWeight: FontWeight.bold), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/13.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + InkWell( + onTap: () { + Navigator.pushNamed(context, "/milaplounge"); + }, + child: Container( + height: 100.0, + width: 150.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Milap Hall', + style: GoogleFonts.inter(color: Colors.white, fontWeight: FontWeight.bold), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/17.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + InkWell( + onTap: () { + Navigator.pushNamed(context, "/milanlounge"); + }, + child: Container( + height: 100.0, + width: 150.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Milan Lounge', + style: GoogleFonts.inter(color: Colors.white, fontWeight: FontWeight.bold), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/18.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + ], + ), + ), + SizedBox(height: 20), + ], + )), + SizedBox(height: 30.0), Text( " Banquet Halls", - style: TextStyle( + style: GoogleFonts.inter( color: Colors.grey, fontSize: 25, fontWeight: FontWeight.bold, ), ), SizedBox(height: 10.0), - image_carousel2, + Container( + margin: const EdgeInsets.symmetric(vertical: 0, horizontal: 10), + height: 150.0, + width: double.infinity, + child: new Column( + children: [ + Expanded( + child: ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + scrollDirection: Axis.horizontal, + children: [ + InkWell( + onTap: () { + Navigator.pushNamed(context, "/mainhall"); + }, + child: Container( + height: 100.0, + width: 150.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Main Hall', + style: GoogleFonts.inter(color: Colors.white, fontWeight: FontWeight.bold), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/15.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + InkWell( + onTap: () { + Navigator.pushNamed(context, "/yellowlounge"); + }, + child: Container( + height: 100.0, + width: 150.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Wedding Hall', + style: GoogleFonts.inter(color: Colors.white, fontWeight: FontWeight.bold), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/16.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + ], + ), + ), + SizedBox(height: 20), + ], + )), ], ), ); } -} \ No newline at end of file +} diff --git a/lib/pages/Cart.dart b/lib/pages/Cart.dart index a0a095b..2ee1cc2 100644 --- a/lib/pages/Cart.dart +++ b/lib/pages/Cart.dart @@ -1,7 +1,13 @@ +import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:google_fonts/google_fonts.dart'; import 'package:rcapp/pages/Food.dart'; import 'package:rcapp/pages/order_cart.dart'; import 'package:rcapp/pages/storeData.dart'; +import 'package:rcapp/services/database.dart'; +import './confirmOrder.dart'; class Cart extends StatefulWidget { @override @@ -15,10 +21,25 @@ class _CartState extends State { StoreData storeDataforCart = StoreData(); + var address = ''; + + void init() async { + var user = await FirebaseAuth.instance.currentUser(); + var _dat = await Firestore.instance + .collection('userInfo') + .document(user.uid) + .get(); + + setState(() { + address = _dat.data["address"]; + }); + } + @override void initState() { // TODO: implement initState super.initState(); + init(); updateTotal(); } @@ -29,9 +50,13 @@ class _CartState extends State { Map qtyDetail = storeDataforCart.retrieveQtyDetails(); total = 0; + totalquantity = 0; setState(() { - qtyDetail.forEach((key, value) => qtyList.add(value)); + qtyDetail.forEach((key, value) { + totalquantity += value; + qtyList.add(value); + }); foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); }); } @@ -71,7 +96,53 @@ class _CartState extends State { title: Text('Cart'), ), body: Column(children: [ - SizedBox(height: 30), + SizedBox(height: 10), + Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.only(left: 20), + child: Text( + 'Deliver To:', + style: GoogleFonts.inter( + color: Colors.deepOrange, + fontWeight: FontWeight.bold), + ), + ), + Row(children: [ + Container( + child: Text( + 'Change/Add', + style: GoogleFonts.inter( + decoration: TextDecoration.underline, + color: Colors.deepOrange, + fontWeight: FontWeight.bold), + ), + ), + Container( + margin: EdgeInsets.only(right: 15), + child: IconButton( + icon: Icon(Icons.edit), + color: Colors.deepOrange, + onPressed: () { + Navigator.popAndPushNamed(context, '/address'); + }, + ), + ) + ]) + ], + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 20, vertical: 0), + child: Text( + '$address', + style: GoogleFonts.inter(fontSize: 16), + )) + ], + ), + SizedBox(height: 20), OrderCard(total: total), Expanded( child: ListView.builder( @@ -82,9 +153,9 @@ class _CartState extends State { int price = _foodNamePrice[keyname]; int qty = _foodQtyPrice[keyname]; return ListTile( - onTap: () { - removeItem(keyname); - }, + // onTap: () { + // removeItem(keyname); + // }, title: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -104,7 +175,7 @@ class _CartState extends State { ), Text( keyname, - style: TextStyle( + style: GoogleFonts.inter( fontSize: 17, fontWeight: FontWeight.bold), ), @@ -117,17 +188,18 @@ class _CartState extends State { qty: qty, keyname: keyname, quantityDecreement: quantityDecreement, - quantityIncreement: quantityIncreement) + quantityIncreement: quantityIncreement, + removeItem: removeItem) ], ), Row( children: [ Container( margin: - new EdgeInsets.symmetric(horizontal: 50.0), + new EdgeInsets.symmetric(horizontal: 50.0), child: Text( '₹' + '$price' + ' Quantity: ' + '$qty', - style: TextStyle( + style: GoogleFonts.inter( fontSize: 15, fontWeight: FontWeight.bold), ), ), @@ -146,16 +218,8 @@ class _CartState extends State { ); }), ), - Container( - width: double.infinity, - height: 50, - child:FlatButton( - color: Colors.deepOrange, - onPressed: () { - Navigator.pushNamed(context, '/confirmOrder'); - }, - child: Text('Proceed to Pay', style: TextStyle(color: Colors.white),)) - ), + // BottomItemView(total: total, qty: totalquantity), + ProceedAccess(address: address) ])); } } @@ -168,15 +232,17 @@ class QuantityInCart extends StatefulWidget { String keyname; final quantityIncreement; final quantityDecreement; + final removeItem; QuantityInCart( {this.index, - this.price, - this.qtyList, - this.qty, - this.keyname, - this.quantityDecreement, - this.quantityIncreement}); + this.price, + this.qtyList, + this.qty, + this.keyname, + this.quantityDecreement, + this.quantityIncreement, + this.removeItem}); @override _QuantityInCartState createState() => _QuantityInCartState(); } @@ -204,7 +270,7 @@ class _QuantityInCartState extends State { height: 25, width: 62, child: Center( - child: Text('Add', style: TextStyle(color: Colors.deepOrange))), + child: Text('Add', style: GoogleFonts.inter(color: Colors.deepOrange))), ), ); } else { @@ -236,6 +302,9 @@ class _QuantityInCartState extends State { if (widget.qtyList[widget.index] > 0) { print(widget.key); widget.quantityDecreement(widget.keyname); + if (widget.qty == 1) { + widget.removeItem(widget.keyname); + } } }, ), @@ -257,12 +326,12 @@ class _QuantityInCartState extends State { width: 33, child: Text( '${widget.qty}', - style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold), + style: GoogleFonts.inter(fontSize: 17, fontWeight: FontWeight.bold), ), ), // Text( // '$FQty', - // style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold), + // style: GoogleFonts.inter(fontSize: 17, fontWeight: FontWeight.bold), // ), Container( alignment: Alignment.center, @@ -299,4 +368,90 @@ class _QuantityInCartState extends State { ); } } -} \ No newline at end of file +} + +class ProceedAccess extends StatefulWidget { + var address; + ProceedAccess({this.address}); + @override + _ProceedAccessState createState() => _ProceedAccessState(); +} + +class _ProceedAccessState extends State { + @override + Widget build(BuildContext context) { + if (widget.address == '') { + return Container( + width: double.infinity, + height: 50, + child: FlatButton( + color: Colors.deepOrange, + onPressed: () { + Navigator.pushNamed(context, '/address'); + }, + child: Text( + 'Add address to proceed', + style: GoogleFonts.inter(color: Colors.white), + ))); + } else if (widget.address != '') { + return Container( + width: double.infinity, + height: 50, + child: FlatButton( + color: Colors.deepOrange, + onPressed: () { + updateTotal(); + confirmOrder(); + Navigator.pushReplacementNamed(context, '/navigationbar'); + }, + child: Text( + 'Proceed to Pay', + style: GoogleFonts.inter(color: Colors.white), + ))); + } else if (widget.address == null) { + return Container( + width: double.infinity, height: 50, child: SpinKitChasingDots()); + } + } +} + +// class BottomItemView extends StatefulWidget { +// @override +// _BottomItemViewState createState() => _BottomItemViewState(); +// } + +class BottomItemView extends StatelessWidget { + int total; + int qty; + BottomItemView({this.total, this.qty}); + + @override + Widget build(BuildContext context) { + return Container( + width: double.maxFinite, + height: 54, + decoration: BoxDecoration(color: Colors.deepOrange), + child: Padding( + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 20), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + '${qty} ' + ' item ' + '|' + ' ' + '₹ ' + '${total}', + style: + GoogleFonts.inter(color: Colors.white, fontWeight: FontWeight.bold), + ), + InkWell( + onTap: (() => Navigator.pushNamed(context, '/cart')), + child: Text( + 'VIEW CART', + style: + GoogleFonts.inter(color: Colors.white, fontWeight: FontWeight.bold), + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages/CategoryMenuList/Accompaniment_Menu.dart b/lib/pages/CategoryMenuList/Accompaniment_Menu.dart new file mode 100644 index 0000000..76b6c19 --- /dev/null +++ b/lib/pages/CategoryMenuList/Accompaniment_Menu.dart @@ -0,0 +1,238 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/Cart.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; +import 'package:rcapp/pages/storeData.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; + +class Accompaniment_Menu extends StatefulWidget { + @override + _Accompaniment_MenuState createState() => _Accompaniment_MenuState(); +} + +class _Accompaniment_MenuState extends State { + StoreData dataforCart = StoreData(); + int total = 0; + + int qty = 0; + List qtyList = List(); + + @override + Widget build(BuildContext context) { + return StreamProvider>.value( + value: DatabaseService().accompanimentmenu, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Accompaniments'), + actions: [ + IconButton( + icon: Icon( + Icons.shopping_cart, + color: Colors.white, + ), + onPressed: () { + Navigator.pushNamed(context, '/cart'); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: AccompanimentMenuListPage(), + ) + ], + ), + ), + ); + } +} + +class AccompanimentMenuListPage extends StatefulWidget { + @override + _AccompanimentMenuListPageState createState() => + _AccompanimentMenuListPageState(); +} + +class _AccompanimentMenuListPageState extends State { + StoreData storeData = StoreData(); + int total = 0; + bool checked = false; + Map quantityDetail = Map(); + int qty = 0; + List qtyList = List(); + + void updateTotal() { + Map foodDetail = storeData.retrieveFoodDetails(); + Map qtyDetail = storeData.retrieveQtyDetails(); + + total = 0; + + setState(() { + qtyDetail.forEach((key, value) => qtyList.add(value)); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); + }); + } + + void quantityIncreement(String foodName) { + storeData.increaseQty(foodName); + updateTotal(); + } + + void quantityDecreement(String foodName) { + storeData.decreaseQty(foodName); + updateTotal(); + } + + void update() { + Map qtyCart = storeData.retrieveQtyDetails(); + Map foodDetail = storeData.retrieveFoodDetails(); + + setState(() { + qty = 0; + qtyCart.forEach((key, value) { + qty += value; + qtyList.add(value); + }); + foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + }); + } + + void addToCart(AccompanimentMenu post) { + String item = post.item; + int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + print(item); + } + + @override + Widget build(BuildContext context) { + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitDualRing( + color: Colors.deepOrange, + size: 38, + ), + SizedBox(height: 20), + Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) + ]), + ); + } else { + return Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: _menuList.length, + itemBuilder: (_, index) { + return ListTile( + title: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + // IconButton( + // onPressed: () { + // setState(() { + // checked = !checked; + // }); + // addToCart(_menuList[index]); + // }, + // icon: Icon( + // Icons.radio_button_unchecked, + // color: Colors.green, + // ), + // ), + SizedBox(width: 15), + Text( + '${_menuList[index].item}', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold), + ), + ], + ), + Container( + height: 45, + width: 42, + margin: EdgeInsets.only(top: 6), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.deepOrange, + borderRadius: BorderRadius.circular(10)), + child: IconButton( + onPressed: () { + showFlushbar(context); + addToCart(_menuList[index]); + setState(() { + checked = !checked; + }); + }, + icon: Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: new EdgeInsets.symmetric( + vertical: 3, horizontal: 16.0), + child: Text( + '₹' + '${_menuList[index].price}', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ], + ), + Divider( + color: Colors.grey, + height: 2, + thickness: 1, + indent: 5, + endIndent: 5, + ), + ], + ), + ); + })), + ) + ], + ); + } + } +} diff --git a/lib/pages/CategoryMenuList/All_Menu.dart b/lib/pages/CategoryMenuList/All_Menu.dart new file mode 100644 index 0000000..95f1392 --- /dev/null +++ b/lib/pages/CategoryMenuList/All_Menu.dart @@ -0,0 +1,225 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; +import 'package:rcapp/pages/storeData.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; +import 'package:flushbar/flushbar.dart'; + +class AllMenu extends StatefulWidget { + @override + _AllMenuState createState() => _AllMenuState(); +} + +class _AllMenuState extends State { + StoreData dataforCart = StoreData(); + int total = 0; + + int qty = 0; + List qtyList = List(); + + @override + Widget build(BuildContext context) { + return StreamProvider>.value( + value: DatabaseService().allmenu, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('All Menu'), + actions: [ + IconButton( + icon: Icon( + Icons.shopping_cart, + color: Colors.white, + ), + onPressed: () { + Navigator.pushReplacementNamed(context, '/cart'); + // Navigator.popAndPushNamed(context, '/cart'); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: AllMenuListPage(), + ) + ], + ), + ), + ); + } +} + +class AllMenuListPage extends StatefulWidget { + @override + _AllMenuListPageState createState() => _AllMenuListPageState(); +} + +class _AllMenuListPageState extends State { + StoreData storeData = StoreData(); + int total = 0; + bool checked = false; + Map quantityDetail = Map(); + int qty = 0; + List qtyList = List(); + + void updateTotal() { + Map foodDetail = storeData.retrieveFoodDetails(); + Map qtyDetail = storeData.retrieveQtyDetails(); + + total = 0; + + setState(() { + qtyDetail.forEach((key, value) => qtyList.add(value)); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); + }); + } + + void quantityIncreement(String foodName) { + storeData.increaseQty(foodName); + updateTotal(); + } + + void quantityDecreement(String foodName) { + storeData.decreaseQty(foodName); + updateTotal(); + } + + void update() { + Map qtyCart = storeData.retrieveQtyDetails(); + Map foodDetail = storeData.retrieveFoodDetails(); + + setState(() { + qty = 0; + qtyCart.forEach((key, value) { + qty += value; + qtyList.add(value); + }); + foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + }); + } + + void addToCart(Menu post) { + String item = post.item; + int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + print(item); + } + + @override + Widget build(BuildContext context) { + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitDualRing( + color: Colors.deepOrange, + size: 38, + ), + SizedBox(height: 20), + Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) + ]), + ); + } else { + return Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: _menuList.length, + itemBuilder: (_, index) { + return ListTile( + title: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SizedBox(width: 15), + Text( + '${_menuList[index].item}', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold), + ), + ], + ), + Container( + height: 45, + width: 42, + margin: EdgeInsets.only(top: 6), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.deepOrange, + borderRadius: BorderRadius.circular(10)), + child: IconButton( + onPressed: () { + showFlushbar(context); + addToCart(_menuList[index]); + setState(() { + checked = !checked; + }); + }, + icon: Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: new EdgeInsets.symmetric( + vertical: 3, horizontal: 16.0), + child: Text( + '₹' + '${_menuList[index].price}', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ], + ), + Divider( + color: Colors.grey, + height: 2, + thickness: 1, + indent: 5, + endIndent: 5, + ), + ], + ), + ); + })), + ) + ], + ); + } + } +} diff --git a/lib/pages/CategoryMenuList/Biryani_MenuList.dart b/lib/pages/CategoryMenuList/Biryani_MenuList.dart new file mode 100644 index 0000000..f8d13a8 --- /dev/null +++ b/lib/pages/CategoryMenuList/Biryani_MenuList.dart @@ -0,0 +1,229 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; +import 'package:rcapp/pages/storeData.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; + +class Biryani_MenuList extends StatefulWidget { + @override + _Biryani_MenuListState createState() => _Biryani_MenuListState(); +} + +class _Biryani_MenuListState extends State { + StoreData dataforCart = StoreData(); + int total = 0; + + int qty = 0; + List qtyList = List(); + + @override + Widget build(BuildContext context) { + return StreamProvider>.value( + value: DatabaseService().biryani, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Rice and Biryani'), + actions: [ + IconButton( + icon: Icon( + Icons.shopping_cart, + color: Colors.white, + ), + onPressed: () { + Navigator.pushNamed(context, '/cart'); + // Navigator.popAndPushNamed(context, '/cart'); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: BiryaniMenuListListPage(), + ) + ], + ), + ), + ); + } +} + +class BiryaniMenuListListPage extends StatefulWidget { + @override + _BiryaniMenuListListPageState createState() => _BiryaniMenuListListPageState(); +} + +class _BiryaniMenuListListPageState extends State { + StoreData storeData = StoreData(); + int total = 0; + bool checked = false; + Map quantityDetail = Map(); + int qty = 0; + List qtyList = List(); + + void updateTotal() { + Map foodDetail = storeData.retrieveFoodDetails(); + Map qtyDetail = storeData.retrieveQtyDetails(); + + total = 0; + + setState(() { + qtyDetail.forEach((key, value) => qtyList.add(value)); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); + }); + } + + void quantityIncreement(String foodName) { + storeData.increaseQty(foodName); + updateTotal(); + } + + void quantityDecreement(String foodName) { + storeData.decreaseQty(foodName); + updateTotal(); + } + + void update() { + Map qtyCart = storeData.retrieveQtyDetails(); + Map foodDetail = storeData.retrieveFoodDetails(); + + setState(() { + qty = 0; + qtyCart.forEach((key, value) { + qty += value; + qtyList.add(value); + }); + foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + }); + } + + void addToCart(BiryaniMenu post) { + String item = post.item; + int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + print(item); + } + + @override + Widget build(BuildContext context) { + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitDualRing( + color: Colors.deepOrange, + size: 38, + ), + SizedBox(height: 20), + Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) + ]), + ); + } else { + return Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: _menuList.length, + itemBuilder: (_, index) { + return ListTile( + title: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SizedBox(width: 15), + Text( + '${_menuList[index].item}', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold), + ), + ], + ), + InkWell( + onTap: () { + addToCart(_menuList[index]); + }, + child: Container( + height: 45, + width: 43, + margin: EdgeInsets.only(top: 6), + alignment: Alignment.center, + decoration: + BoxDecoration(color: Colors.deepOrange, borderRadius: BorderRadius.circular(10)), + child: IconButton( + onPressed: () { + showFlushbar(context); + addToCart(_menuList[index]); + setState(() { + checked = !checked; + }); + }, + icon: Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: new EdgeInsets.symmetric( + vertical: 3, horizontal: 16.0), + child: Text( + '₹' + '${_menuList[index].price}', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ], + ), + Divider( + color: Colors.grey, + height: 2, + thickness: 1, + indent: 5, + endIndent: 5, + ), + ], + ), + ); + })), + ) + ], + ); + } + } +} diff --git a/lib/pages/CategoryMenuList/Bread_Menu.dart b/lib/pages/CategoryMenuList/Bread_Menu.dart new file mode 100644 index 0000000..bed5043 --- /dev/null +++ b/lib/pages/CategoryMenuList/Bread_Menu.dart @@ -0,0 +1,232 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; +import 'package:rcapp/pages/storeData.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; + +class Bread_MenuList extends StatefulWidget { + @override + _Bread_MenuListState createState() => _Bread_MenuListState(); +} + +class _Bread_MenuListState extends State { + StoreData dataforCart = StoreData(); + int total = 0; + + int qty = 0; + List qtyList = List(); + + @override + Widget build(BuildContext context) { + return StreamProvider>.value( + value: DatabaseService().breadmenu, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Breads'), + actions: [ + IconButton( + icon: Icon( + Icons.shopping_cart, + color: Colors.white, + ), + onPressed: () { + Navigator.pushNamed(context, '/cart'); + // Navigator.popAndPushNamed(context, '/cart'); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: BiryaniMenuListListPage(), + ) + ], + ), + ), + ); + } +} + +class BiryaniMenuListListPage extends StatefulWidget { + @override + _BiryaniMenuListListPageState createState() => + _BiryaniMenuListListPageState(); +} + +class _BiryaniMenuListListPageState extends State { + StoreData storeData = StoreData(); + int total = 0; + bool checked = false; + Map quantityDetail = Map(); + int qty = 0; + List qtyList = List(); + + void updateTotal() { + Map foodDetail = storeData.retrieveFoodDetails(); + Map qtyDetail = storeData.retrieveQtyDetails(); + + total = 0; + + setState(() { + qtyDetail.forEach((key, value) => qtyList.add(value)); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); + }); + } + + void quantityIncreement(String foodName) { + storeData.increaseQty(foodName); + updateTotal(); + } + + void quantityDecreement(String foodName) { + storeData.decreaseQty(foodName); + updateTotal(); + } + + void update() { + Map qtyCart = storeData.retrieveQtyDetails(); + Map foodDetail = storeData.retrieveFoodDetails(); + + setState(() { + qty = 0; + qtyCart.forEach((key, value) { + qty += value; + qtyList.add(value); + }); + foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + }); + } + + void addToCart(BreadMenu post) { + String item = post.item; + int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + print(item); + } + + @override + Widget build(BuildContext context) { + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitDualRing( + color: Colors.deepOrange, + size: 38, + ), + SizedBox(height: 20), + Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) + ]), + ); + } else { + return Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: _menuList.length, + itemBuilder: (_, index) { + return ListTile( + title: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SizedBox(width: 15), + Text( + '${_menuList[index].item}', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold), + ), + ], + ), + InkWell( + onTap: () { + addToCart(_menuList[index]); + }, + child: Container( + height: 45, + width: 43, + margin: EdgeInsets.only(top: 6), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.deepOrange, + borderRadius: + BorderRadius.circular(10)), + child: IconButton( + onPressed: () { + showFlushbar(context); + addToCart(_menuList[index]); + setState(() { + checked = !checked; + }); + }, + icon: Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: new EdgeInsets.symmetric( + vertical: 3, horizontal: 16.0), + child: Text( + '₹' + '${_menuList[index].price}', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ], + ), + Divider( + color: Colors.grey, + height: 2, + thickness: 1, + indent: 5, + endIndent: 5, + ), + ], + ), + ); + })), + ) + ], + ); + } + } +} diff --git a/lib/pages/CategoryMenuList/Breakfast_Menu.dart b/lib/pages/CategoryMenuList/Breakfast_Menu.dart new file mode 100644 index 0000000..380c409 --- /dev/null +++ b/lib/pages/CategoryMenuList/Breakfast_Menu.dart @@ -0,0 +1,231 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; +import 'package:rcapp/pages/storeData.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; + +class Breakfast_MenuList extends StatefulWidget { + @override + _Breakfast_MenuListState createState() => _Breakfast_MenuListState(); +} + +class _Breakfast_MenuListState extends State { + StoreData dataforCart = StoreData(); + int total = 0; + + int qty = 0; + List qtyList = List(); + + @override + Widget build(BuildContext context) { + return StreamProvider>.value( + value: DatabaseService().breadmenu, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Breakfast'), + actions: [ + IconButton( + icon: Icon( + Icons.shopping_cart, + color: Colors.white, + ), + onPressed: () { + Navigator.pushNamed(context, '/cart'); + // Navigator.popAndPushNamed(context, '/cart'); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: BreadMenuListListPage(), + ) + ], + ), + ), + ); + } +} + +class BreadMenuListListPage extends StatefulWidget { + @override + _BreadMenuListListPageState createState() => _BreadMenuListListPageState(); +} + +class _BreadMenuListListPageState extends State { + StoreData storeData = StoreData(); + int total = 0; + bool checked = false; + Map quantityDetail = Map(); + int qty = 0; + List qtyList = List(); + + void updateTotal() { + Map foodDetail = storeData.retrieveFoodDetails(); + Map qtyDetail = storeData.retrieveQtyDetails(); + + total = 0; + + setState(() { + qtyDetail.forEach((key, value) => qtyList.add(value)); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); + }); + } + + void quantityIncreement(String foodName) { + storeData.increaseQty(foodName); + updateTotal(); + } + + void quantityDecreement(String foodName) { + storeData.decreaseQty(foodName); + updateTotal(); + } + + void update() { + Map qtyCart = storeData.retrieveQtyDetails(); + Map foodDetail = storeData.retrieveFoodDetails(); + + setState(() { + qty = 0; + qtyCart.forEach((key, value) { + qty += value; + qtyList.add(value); + }); + foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + }); + } + + void addToCart(BreadMenu post) { + String item = post.item; + int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + print(item); + } + + @override + Widget build(BuildContext context) { + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitDualRing( + color: Colors.deepOrange, + size: 38, + ), + SizedBox(height: 20), + Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) + ]), + ); + } else { + return Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: _menuList.length, + itemBuilder: (_, index) { + return ListTile( + title: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SizedBox(width: 15), + Text( + '${_menuList[index].item}', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold), + ), + ], + ), + InkWell( + onTap: () { + addToCart(_menuList[index]); + }, + child: Container( + height: 45, + width: 43, + margin: EdgeInsets.only(top: 6), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.deepOrange, + borderRadius: + BorderRadius.circular(10)), + child: IconButton( + onPressed: () { + showFlushbar(context); + addToCart(_menuList[index]); + setState(() { + checked = !checked; + }); + }, + icon: Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: new EdgeInsets.symmetric( + vertical: 3, horizontal: 16.0), + child: Text( + '₹' + '${_menuList[index].price}', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ], + ), + Divider( + color: Colors.grey, + height: 2, + thickness: 1, + indent: 5, + endIndent: 5, + ), + ], + ), + ); + })), + ) + ], + ); + } + } +} diff --git a/lib/pages/CategoryMenuList/Burger_Menu.dart b/lib/pages/CategoryMenuList/Burger_Menu.dart new file mode 100644 index 0000000..600646c --- /dev/null +++ b/lib/pages/CategoryMenuList/Burger_Menu.dart @@ -0,0 +1,229 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; +import 'package:rcapp/pages/storeData.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; + +class Burger_MenuList extends StatefulWidget { + @override + _Burger_MenuListState createState() => _Burger_MenuListState(); +} + +class _Burger_MenuListState extends State { + StoreData dataforCart = StoreData(); + int total = 0; + + int qty = 0; + List qtyList = List(); + + @override + Widget build(BuildContext context) { + return StreamProvider>.value( + value: DatabaseService().burgermenu, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Burgers'), + actions: [ + IconButton( + icon: Icon( + Icons.shopping_cart, + color: Colors.white, + ), + onPressed: () { + Navigator.pushNamed(context, '/cart'); + // Navigator.popAndPushNamed(context, '/cart'); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: BurgerMenuListListPage(), + ) + ], + ), + ), + ); + } +} + +class BurgerMenuListListPage extends StatefulWidget { + @override + _BurgerMenuListListPageState createState() => _BurgerMenuListListPageState(); +} + +class _BurgerMenuListListPageState extends State { + StoreData storeData = StoreData(); + int total = 0; + bool checked = false; + Map quantityDetail = Map(); + int qty = 0; + List qtyList = List(); + + void updateTotal() { + Map foodDetail = storeData.retrieveFoodDetails(); + Map qtyDetail = storeData.retrieveQtyDetails(); + + total = 0; + + setState(() { + qtyDetail.forEach((key, value) => qtyList.add(value)); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); + }); + } + + void quantityIncreement(String foodName) { + storeData.increaseQty(foodName); + updateTotal(); + } + + void quantityDecreement(String foodName) { + storeData.decreaseQty(foodName); + updateTotal(); + } + + void update() { + Map qtyCart = storeData.retrieveQtyDetails(); + Map foodDetail = storeData.retrieveFoodDetails(); + + setState(() { + qty = 0; + qtyCart.forEach((key, value) { + qty += value; + qtyList.add(value); + }); + foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + }); + } + + void addToCart(BurgerMenu post) { + String item = post.item; + int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + print(item); + } + + @override + Widget build(BuildContext context) { + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitDualRing( + color: Colors.deepOrange, + size: 38, + ), + SizedBox(height: 20), + Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) + ]), + ); + } else { + return Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: _menuList.length, + itemBuilder: (_, index) { + return ListTile( + title: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SizedBox(width: 15), + Text( + '${_menuList[index].item}', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold), + ), + ], + ), + InkWell( + onTap: () { + addToCart(_menuList[index]); + }, + child: Container( + height: 45, + width: 43, + margin: EdgeInsets.only(top: 6), + alignment: Alignment.center, + decoration: + BoxDecoration(color: Colors.deepOrange, borderRadius: BorderRadius.circular(10)), + child: IconButton( + onPressed: () { + showFlushbar(context); + addToCart(_menuList[index]); + setState(() { + checked = !checked; + }); + }, + icon: Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: new EdgeInsets.symmetric( + vertical: 3, horizontal: 16.0), + child: Text( + '₹' + '${_menuList[index].price}', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ], + ), + Divider( + color: Colors.grey, + height: 2, + thickness: 1, + indent: 5, + endIndent: 5, + ), + ], + ), + ); + })), + ) + ], + ); + } + } +} diff --git a/lib/pages/CategoryMenuList/Chinese_Menu.dart b/lib/pages/CategoryMenuList/Chinese_Menu.dart new file mode 100644 index 0000000..b096949 --- /dev/null +++ b/lib/pages/CategoryMenuList/Chinese_Menu.dart @@ -0,0 +1,224 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; +import 'package:rcapp/pages/storeData.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; + +class ChineseMenuList extends StatefulWidget { + @override + _ChineseMenuListState createState() => _ChineseMenuListState(); +} + +class _ChineseMenuListState extends State { + StoreData dataforCart = StoreData(); + int total = 0; + + int qty = 0; + List qtyList = List(); + + @override + Widget build(BuildContext context) { + return StreamProvider>.value( + value: DatabaseService().chinese, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Chinese'), + actions: [ + IconButton( + icon: Icon( + Icons.shopping_cart, + color: Colors.white, + ), + onPressed: () { + Navigator.pushNamed(context, '/cart'); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: ChineseMenuListPage(), + ) + ], + ), + ), + ); + } +} + +class ChineseMenuListPage extends StatefulWidget { + @override + _ChineseMenuListPageState createState() => _ChineseMenuListPageState(); +} + +class _ChineseMenuListPageState extends State { + StoreData storeData = StoreData(); + int total = 0; + bool checked = false; + Map quantityDetail = Map(); + int qty = 0; + List qtyList = List(); + + void updateTotal() { + Map foodDetail = storeData.retrieveFoodDetails(); + Map qtyDetail = storeData.retrieveQtyDetails(); + + total = 0; + + setState(() { + qtyDetail.forEach((key, value) => qtyList.add(value)); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); + }); + } + + void quantityIncreement(String foodName) { + storeData.increaseQty(foodName); + updateTotal(); + } + + void quantityDecreement(String foodName) { + storeData.decreaseQty(foodName); + updateTotal(); + } + + void update() { + Map qtyCart = storeData.retrieveQtyDetails(); + Map foodDetail = storeData.retrieveFoodDetails(); + + setState(() { + qty = 0; + qtyCart.forEach((key, value) { + qty += value; + qtyList.add(value); + }); + foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + }); + } + + void addToCart(ChineseMenu post) { + String item = post.item; + int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + print(item); + } + + @override + Widget build(BuildContext context) { + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitDualRing( + color: Colors.deepOrange, + size: 38, + ), + SizedBox(height: 20), + Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) + ]), + ); + } else { + return Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: _menuList.length, + itemBuilder: (_, index) { + return ListTile( + title: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SizedBox(width: 15), + Text( + '${_menuList[index].item}', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold), + ), + ], + ), + Container( + height: 45, + width: 43, + margin: EdgeInsets.only(top: 6), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.deepOrange, + borderRadius: BorderRadius.circular(10)), + child: IconButton( + onPressed: () { + showFlushbar(context); + addToCart(_menuList[index]); + setState(() { + checked = !checked; + }); + }, + icon: Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: new EdgeInsets.symmetric( + vertical: 3, horizontal: 16.0), + child: Text( + '₹' + '${_menuList[index].price}', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ], + ), + Divider( + color: Colors.grey, + height: 2, + thickness: 1, + indent: 5, + endIndent: 5, + ), + ], + ), + ); + })), + ) + ], + ); + } + } +} diff --git a/lib/pages/CategoryMenuList/FriedRiceAndNoodles_Menu.dart b/lib/pages/CategoryMenuList/FriedRiceAndNoodles_Menu.dart new file mode 100644 index 0000000..fce8e45 --- /dev/null +++ b/lib/pages/CategoryMenuList/FriedRiceAndNoodles_Menu.dart @@ -0,0 +1,229 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; +import 'package:rcapp/pages/storeData.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; + +class FriedRiceAndNoodles_MenuList extends StatefulWidget { + @override + _FriedRiceAndNoodles_MenuListState createState() => _FriedRiceAndNoodles_MenuListState(); +} + +class _FriedRiceAndNoodles_MenuListState extends State { + StoreData dataforCart = StoreData(); + int total = 0; + + int qty = 0; + List qtyList = List(); + + @override + Widget build(BuildContext context) { + return StreamProvider>.value( + value: DatabaseService().friedriceandmenu, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Fried Rice and Noodles'), + actions: [ + IconButton( + icon: Icon( + Icons.shopping_cart, + color: Colors.white, + ), + onPressed: () { + Navigator.pushNamed(context, '/cart'); + // Navigator.popAndPushNamed(context, '/cart'); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: FriedRiceAndNoodlesMenuListListPage(), + ) + ], + ), + ), + ); + } +} + +class FriedRiceAndNoodlesMenuListListPage extends StatefulWidget { + @override + _FriedRiceAndNoodlesMenuListListPageState createState() => _FriedRiceAndNoodlesMenuListListPageState(); +} + +class _FriedRiceAndNoodlesMenuListListPageState extends State { + StoreData storeData = StoreData(); + int total = 0; + bool checked = false; + Map quantityDetail = Map(); + int qty = 0; + List qtyList = List(); + + void updateTotal() { + Map foodDetail = storeData.retrieveFoodDetails(); + Map qtyDetail = storeData.retrieveQtyDetails(); + + total = 0; + + setState(() { + qtyDetail.forEach((key, value) => qtyList.add(value)); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); + }); + } + + void quantityIncreement(String foodName) { + storeData.increaseQty(foodName); + updateTotal(); + } + + void quantityDecreement(String foodName) { + storeData.decreaseQty(foodName); + updateTotal(); + } + + void update() { + Map qtyCart = storeData.retrieveQtyDetails(); + Map foodDetail = storeData.retrieveFoodDetails(); + + setState(() { + qty = 0; + qtyCart.forEach((key, value) { + qty += value; + qtyList.add(value); + }); + foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + }); + } + + void addToCart(FriedRiceAndNoodlesMenu post) { + String item = post.item; + int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + print(item); + } + + @override + Widget build(BuildContext context) { + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitDualRing( + color: Colors.deepOrange, + size: 38, + ), + SizedBox(height: 20), + Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) + ]), + ); + } else { + return Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: _menuList.length, + itemBuilder: (_, index) { + return ListTile( + title: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SizedBox(width: 15), + Text( + '${_menuList[index].item}', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold), + ), + ], + ), + InkWell( + onTap: () { + addToCart(_menuList[index]); + }, + child: Container( + height: 45, + width: 43, + margin: EdgeInsets.only(top: 6), + alignment: Alignment.center, + decoration: + BoxDecoration(color: Colors.deepOrange, borderRadius: BorderRadius.circular(10)), + child: IconButton( + onPressed: () { + showFlushbar(context); + addToCart(_menuList[index]); + setState(() { + checked = !checked; + }); + }, + icon: Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: new EdgeInsets.symmetric( + vertical: 3, horizontal: 16.0), + child: Text( + '₹' + '${_menuList[index].price}', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ], + ), + Divider( + color: Colors.grey, + height: 2, + thickness: 1, + indent: 5, + endIndent: 5, + ), + ], + ), + ); + })), + ) + ], + ); + } + } +} diff --git a/lib/pages/CategoryMenuList/MainCourse_Menu.dart b/lib/pages/CategoryMenuList/MainCourse_Menu.dart new file mode 100644 index 0000000..7f19ff1 --- /dev/null +++ b/lib/pages/CategoryMenuList/MainCourse_Menu.dart @@ -0,0 +1,233 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; +import 'package:rcapp/pages/storeData.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; + +class MainCourse_MenuList extends StatefulWidget { + @override + _MainCourse_MenuListState createState() => _MainCourse_MenuListState(); +} + +class _MainCourse_MenuListState extends State { + StoreData dataforCart = StoreData(); + int total = 0; + + int qty = 0; + List qtyList = List(); + + @override + Widget build(BuildContext context) { + return StreamProvider>.value( + value: DatabaseService().maincourse, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Main Course'), + actions: [ + IconButton( + icon: Icon( + Icons.shopping_cart, + color: Colors.white, + ), + onPressed: () { + Navigator.pushNamed(context, '/cart'); + // Navigator.popAndPushNamed(context, '/cart'); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: MainCourseMenuListListPage(), + ) + ], + ), + ), + ); + } +} + +class MainCourseMenuListListPage extends StatefulWidget { + @override + _MainCourseMenuListListPageState createState() => + _MainCourseMenuListListPageState(); +} + +class _MainCourseMenuListListPageState + extends State { + StoreData storeData = StoreData(); + int total = 0; + bool checked = false; + Map quantityDetail = Map(); + int qty = 0; + List qtyList = List(); + + void updateTotal() { + Map foodDetail = storeData.retrieveFoodDetails(); + Map qtyDetail = storeData.retrieveQtyDetails(); + + total = 0; + + setState(() { + qtyDetail.forEach((key, value) => qtyList.add(value)); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); + }); + } + + void quantityIncreement(String foodName) { + storeData.increaseQty(foodName); + updateTotal(); + } + + void quantityDecreement(String foodName) { + storeData.decreaseQty(foodName); + updateTotal(); + } + + void update() { + Map qtyCart = storeData.retrieveQtyDetails(); + Map foodDetail = storeData.retrieveFoodDetails(); + + setState(() { + qty = 0; + qtyCart.forEach((key, value) { + qty += value; + qtyList.add(value); + }); + foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + }); + } + + void addToCart(MainCourseMenu post) { + String item = post.item; + int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + print(item); + } + + @override + Widget build(BuildContext context) { + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitDualRing( + color: Colors.deepOrange, + size: 38, + ), + SizedBox(height: 20), + Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) + ]), + ); + } else { + return Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: _menuList.length, + itemBuilder: (_, index) { + return ListTile( + title: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SizedBox(width: 15), + Text( + '${_menuList[index].item}', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold), + ), + ], + ), + InkWell( + onTap: () { + addToCart(_menuList[index]); + }, + child: Container( + height: 45, + width: 43, + margin: EdgeInsets.only(top: 6), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.deepOrange, + borderRadius: + BorderRadius.circular(10)), + child: IconButton( + onPressed: () { + showFlushbar(context); + addToCart(_menuList[index]); + setState(() { + checked = !checked; + }); + }, + icon: Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: new EdgeInsets.symmetric( + vertical: 3, horizontal: 16.0), + child: Text( + '₹' + '${_menuList[index].price}', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ], + ), + Divider( + color: Colors.grey, + height: 2, + thickness: 1, + indent: 5, + endIndent: 5, + ), + ], + ), + ); + })), + ) + ], + ); + } + } +} diff --git a/lib/pages/CategoryMenuList/Pasta_Menu.dart b/lib/pages/CategoryMenuList/Pasta_Menu.dart new file mode 100644 index 0000000..0c6b91e --- /dev/null +++ b/lib/pages/CategoryMenuList/Pasta_Menu.dart @@ -0,0 +1,230 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; +import 'package:rcapp/pages/storeData.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; + +class Pasta_MenuList extends StatefulWidget { + @override + _Pasta_MenuListState createState() => _Pasta_MenuListState(); +} + +class _Pasta_MenuListState extends State { + StoreData dataforCart = StoreData(); + int total = 0; + + int qty = 0; + List qtyList = List(); + + @override + Widget build(BuildContext context) { + return StreamProvider>.value( + value: DatabaseService().pastamenu, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Pasta'), + actions: [ + IconButton( + icon: Icon( + Icons.shopping_cart, + color: Colors.white, + ), + onPressed: () { + Navigator.pushNamed(context, '/cart'); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: PastaMenuListListPage(), + ) + ], + ), + ), + ); + } +} + +class PastaMenuListListPage extends StatefulWidget { + @override + _PastaMenuListListPageState createState() => _PastaMenuListListPageState(); +} + +class _PastaMenuListListPageState extends State { + StoreData storeData = StoreData(); + int total = 0; + bool checked = false; + Map quantityDetail = Map(); + int qty = 0; + List qtyList = List(); + + void updateTotal() { + Map foodDetail = storeData.retrieveFoodDetails(); + Map qtyDetail = storeData.retrieveQtyDetails(); + + total = 0; + + setState(() { + qtyDetail.forEach((key, value) => qtyList.add(value)); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); + }); + } + + void quantityIncreement(String foodName) { + storeData.increaseQty(foodName); + updateTotal(); + } + + void quantityDecreement(String foodName) { + storeData.decreaseQty(foodName); + updateTotal(); + } + + void update() { + Map qtyCart = storeData.retrieveQtyDetails(); + Map foodDetail = storeData.retrieveFoodDetails(); + + setState(() { + qty = 0; + qtyCart.forEach((key, value) { + qty += value; + qtyList.add(value); + }); + foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + }); + } + + void addToCart(PastaMenu post) { + String item = post.item; + int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + print(item); + } + + @override + Widget build(BuildContext context) { + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitDualRing( + color: Colors.deepOrange, + size: 38, + ), + SizedBox(height: 20), + Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) + ]), + ); + } else { + return Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: _menuList.length, + itemBuilder: (_, index) { + return ListTile( + title: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SizedBox(width: 15), + Text( + '${_menuList[index].item}', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold), + ), + ], + ), + InkWell( + onTap: () { + addToCart(_menuList[index]); + }, + child: Container( + height: 45, + width: 43, + margin: EdgeInsets.only(top: 6), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.deepOrange, + borderRadius: + BorderRadius.circular(10)), + child: IconButton( + onPressed: () { + showFlushbar(context); + addToCart(_menuList[index]); + setState(() { + checked = !checked; + }); + }, + icon: Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: new EdgeInsets.symmetric( + vertical: 3, horizontal: 16.0), + child: Text( + '₹' + '${_menuList[index].price}', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ], + ), + Divider( + color: Colors.grey, + height: 2, + thickness: 1, + indent: 5, + endIndent: 5, + ), + ], + ), + ); + })), + ) + ], + ); + } + } +} diff --git a/lib/pages/CategoryMenuList/Pizza_Menu.dart b/lib/pages/CategoryMenuList/Pizza_Menu.dart new file mode 100644 index 0000000..5fa6888 --- /dev/null +++ b/lib/pages/CategoryMenuList/Pizza_Menu.dart @@ -0,0 +1,228 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; +import 'package:rcapp/pages/storeData.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; + +class Pizza_MenuList extends StatefulWidget { + @override + _Pizza_MenuListState createState() => _Pizza_MenuListState(); +} + +class _Pizza_MenuListState extends State { + StoreData dataforCart = StoreData(); + int total = 0; + + int qty = 0; + List qtyList = List(); + + @override + Widget build(BuildContext context) { + return StreamProvider>.value( + value: DatabaseService().pizzamenu, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Pizza'), + actions: [ + IconButton( + icon: Icon( + Icons.shopping_cart, + color: Colors.white, + ), + onPressed: () { + Navigator.pushNamed(context, '/cart'); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: PizzaMenuListListPage(), + ) + ], + ), + ), + ); + } +} + +class PizzaMenuListListPage extends StatefulWidget { + @override + _PizzaMenuListListPageState createState() => _PizzaMenuListListPageState(); +} + +class _PizzaMenuListListPageState extends State { + StoreData storeData = StoreData(); + int total = 0; + bool checked = false; + Map quantityDetail = Map(); + int qty = 0; + List qtyList = List(); + + void updateTotal() { + Map foodDetail = storeData.retrieveFoodDetails(); + Map qtyDetail = storeData.retrieveQtyDetails(); + + total = 0; + + setState(() { + qtyDetail.forEach((key, value) => qtyList.add(value)); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); + }); + } + + void quantityIncreement(String foodName) { + storeData.increaseQty(foodName); + updateTotal(); + } + + void quantityDecreement(String foodName) { + storeData.decreaseQty(foodName); + updateTotal(); + } + + void update() { + Map qtyCart = storeData.retrieveQtyDetails(); + Map foodDetail = storeData.retrieveFoodDetails(); + + setState(() { + qty = 0; + qtyCart.forEach((key, value) { + qty += value; + qtyList.add(value); + }); + foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + }); + } + + void addToCart(PizzaMenu post) { + String item = post.item; + int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + print(item); + } + + @override + Widget build(BuildContext context) { + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitDualRing( + color: Colors.deepOrange, + size: 38, + ), + SizedBox(height: 20), + Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) + ]), + ); + } else { + return Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: _menuList.length, + itemBuilder: (_, index) { + return ListTile( + title: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SizedBox(width: 15), + Text( + '${_menuList[index].item}', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold), + ), + ], + ), + InkWell( + onTap: () { + addToCart(_menuList[index]); + }, + child: Container( + height: 45, + width: 43, + margin: EdgeInsets.only(top: 6), + alignment: Alignment.center, + decoration: + BoxDecoration(color: Colors.deepOrange, borderRadius: BorderRadius.circular(10)), + child: IconButton( + onPressed: () { + showFlushbar(context); + addToCart(_menuList[index]); + setState(() { + checked = !checked; + }); + }, + icon: Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: new EdgeInsets.symmetric( + vertical: 3, horizontal: 16.0), + child: Text( + '₹' + '${_menuList[index].price}', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ], + ), + Divider( + color: Colors.grey, + height: 2, + thickness: 1, + indent: 5, + endIndent: 5, + ), + ], + ), + ); + })), + ) + ], + ); + } + } +} diff --git a/lib/pages/CategoryMenuList/Roll_Menu.dart b/lib/pages/CategoryMenuList/Roll_Menu.dart new file mode 100644 index 0000000..f362b36 --- /dev/null +++ b/lib/pages/CategoryMenuList/Roll_Menu.dart @@ -0,0 +1,228 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; +import 'package:rcapp/pages/storeData.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; + +class Roll_MenuList extends StatefulWidget { + @override + _Roll_MenuListState createState() => _Roll_MenuListState(); +} + +class _Roll_MenuListState extends State { + StoreData dataforCart = StoreData(); + int total = 0; + + int qty = 0; + List qtyList = List(); + + @override + Widget build(BuildContext context) { + return StreamProvider>.value( + value: DatabaseService().rollmenu, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Roll'), + actions: [ + IconButton( + icon: Icon( + Icons.shopping_cart, + color: Colors.white, + ), + onPressed: () { + Navigator.pushNamed(context, '/cart'); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: RollMenuListListPage(), + ) + ], + ), + ), + ); + } +} + +class RollMenuListListPage extends StatefulWidget { + @override + _RollMenuListListPageState createState() => _RollMenuListListPageState(); +} + +class _RollMenuListListPageState extends State { + StoreData storeData = StoreData(); + int total = 0; + bool checked = false; + Map quantityDetail = Map(); + int qty = 0; + List qtyList = List(); + + void updateTotal() { + Map foodDetail = storeData.retrieveFoodDetails(); + Map qtyDetail = storeData.retrieveQtyDetails(); + + total = 0; + + setState(() { + qtyDetail.forEach((key, value) => qtyList.add(value)); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); + }); + } + + void quantityIncreement(String foodName) { + storeData.increaseQty(foodName); + updateTotal(); + } + + void quantityDecreement(String foodName) { + storeData.decreaseQty(foodName); + updateTotal(); + } + + void update() { + Map qtyCart = storeData.retrieveQtyDetails(); + Map foodDetail = storeData.retrieveFoodDetails(); + + setState(() { + qty = 0; + qtyCart.forEach((key, value) { + qty += value; + qtyList.add(value); + }); + foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + }); + } + + void addToCart(RollMenu post) { + String item = post.item; + int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + print(item); + } + + @override + Widget build(BuildContext context) { + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitDualRing( + color: Colors.deepOrange, + size: 38, + ), + SizedBox(height: 20), + Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) + ]), + ); + } else { + return Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: _menuList.length, + itemBuilder: (_, index) { + return ListTile( + title: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SizedBox(width: 15), + Text( + '${_menuList[index].item}', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold), + ), + ], + ), + InkWell( + onTap: () { + addToCart(_menuList[index]); + }, + child: Container( + height: 45, + width: 43, + margin: EdgeInsets.only(top: 6), + alignment: Alignment.center, + decoration: + BoxDecoration(color: Colors.deepOrange, borderRadius: BorderRadius.circular(10)), + child: IconButton( + onPressed: () { + showFlushbar(context); + addToCart(_menuList[index]); + setState(() { + checked = !checked; + }); + }, + icon: Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: new EdgeInsets.symmetric( + vertical: 3, horizontal: 16.0), + child: Text( + '₹' + '${_menuList[index].price}', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ], + ), + Divider( + color: Colors.grey, + height: 2, + thickness: 1, + indent: 5, + endIndent: 5, + ), + ], + ), + ); + })), + ) + ], + ); + } + } +} diff --git a/lib/pages/CategoryMenuList/Sandwich_Menu.dart b/lib/pages/CategoryMenuList/Sandwich_Menu.dart new file mode 100644 index 0000000..6f1e61f --- /dev/null +++ b/lib/pages/CategoryMenuList/Sandwich_Menu.dart @@ -0,0 +1,231 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; +import 'package:rcapp/pages/storeData.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; + +class Sandwich_MenuList extends StatefulWidget { + @override + _Sandwich_MenuListState createState() => _Sandwich_MenuListState(); +} + +class _Sandwich_MenuListState extends State { + StoreData dataforCart = StoreData(); + int total = 0; + + int qty = 0; + List qtyList = List(); + + @override + Widget build(BuildContext context) { + return StreamProvider>.value( + value: DatabaseService().sandwichmenu, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Sandwich'), + actions: [ + IconButton( + icon: Icon( + Icons.shopping_cart, + color: Colors.white, + ), + onPressed: () { + Navigator.pushNamed(context, '/cart'); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: SandwichMenuListListPage(), + ) + ], + ), + ), + ); + } +} + +class SandwichMenuListListPage extends StatefulWidget { + @override + _SandwichMenuListListPageState createState() => + _SandwichMenuListListPageState(); +} + +class _SandwichMenuListListPageState extends State { + StoreData storeData = StoreData(); + int total = 0; + bool checked = false; + Map quantityDetail = Map(); + int qty = 0; + List qtyList = List(); + + void updateTotal() { + Map foodDetail = storeData.retrieveFoodDetails(); + Map qtyDetail = storeData.retrieveQtyDetails(); + + total = 0; + + setState(() { + qtyDetail.forEach((key, value) => qtyList.add(value)); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); + }); + } + + void quantityIncreement(String foodName) { + storeData.increaseQty(foodName); + updateTotal(); + } + + void quantityDecreement(String foodName) { + storeData.decreaseQty(foodName); + updateTotal(); + } + + void update() { + Map qtyCart = storeData.retrieveQtyDetails(); + Map foodDetail = storeData.retrieveFoodDetails(); + + setState(() { + qty = 0; + qtyCart.forEach((key, value) { + qty += value; + qtyList.add(value); + }); + foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + }); + } + + void addToCart(SandwichMenu post) { + String item = post.item; + int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + print(item); + } + + @override + Widget build(BuildContext context) { + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitDualRing( + color: Colors.deepOrange, + size: 38, + ), + SizedBox(height: 20), + Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) + ]), + ); + } else { + return Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: _menuList.length, + itemBuilder: (_, index) { + return ListTile( + title: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SizedBox(width: 15), + Text( + '${_menuList[index].item}', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold), + ), + ], + ), + InkWell( + onTap: () { + addToCart(_menuList[index]); + }, + child: Container( + height: 45, + width: 43, + margin: EdgeInsets.only(top: 6), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.deepOrange, + borderRadius: + BorderRadius.circular(10)), + child: IconButton( + onPressed: () { + showFlushbar(context); + addToCart(_menuList[index]); + setState(() { + checked = !checked; + }); + }, + icon: Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: new EdgeInsets.symmetric( + vertical: 3, horizontal: 16.0), + child: Text( + '₹' + '${_menuList[index].price}', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ], + ), + Divider( + color: Colors.grey, + height: 2, + thickness: 1, + indent: 5, + endIndent: 5, + ), + ], + ), + ); + })), + ) + ], + ); + } + } +} diff --git a/lib/pages/CategoryMenuList/Snacks_Menu.dart b/lib/pages/CategoryMenuList/Snacks_Menu.dart new file mode 100644 index 0000000..657aa55 --- /dev/null +++ b/lib/pages/CategoryMenuList/Snacks_Menu.dart @@ -0,0 +1,230 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; +import 'package:rcapp/pages/storeData.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; + +class Snacks_MenuList extends StatefulWidget { + @override + _Snacks_MenuListState createState() => _Snacks_MenuListState(); +} + +class _Snacks_MenuListState extends State { + StoreData dataforCart = StoreData(); + int total = 0; + + int qty = 0; + List qtyList = List(); + + @override + Widget build(BuildContext context) { + return StreamProvider>.value( + value: DatabaseService().snackmenu, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Snacks'), + actions: [ + IconButton( + icon: Icon( + Icons.shopping_cart, + color: Colors.white, + ), + onPressed: () { + Navigator.pushNamed(context, '/cart'); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: SnacksMenuListListPage(), + ) + ], + ), + ), + ); + } +} + +class SnacksMenuListListPage extends StatefulWidget { + @override + _SnacksMenuListListPageState createState() => _SnacksMenuListListPageState(); +} + +class _SnacksMenuListListPageState extends State { + StoreData storeData = StoreData(); + int total = 0; + bool checked = false; + Map quantityDetail = Map(); + int qty = 0; + List qtyList = List(); + + void updateTotal() { + Map foodDetail = storeData.retrieveFoodDetails(); + Map qtyDetail = storeData.retrieveQtyDetails(); + + total = 0; + + setState(() { + qtyDetail.forEach((key, value) => qtyList.add(value)); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); + }); + } + + void quantityIncreement(String foodName) { + storeData.increaseQty(foodName); + updateTotal(); + } + + void quantityDecreement(String foodName) { + storeData.decreaseQty(foodName); + updateTotal(); + } + + void update() { + Map qtyCart = storeData.retrieveQtyDetails(); + Map foodDetail = storeData.retrieveFoodDetails(); + + setState(() { + qty = 0; + qtyCart.forEach((key, value) { + qty += value; + qtyList.add(value); + }); + foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + }); + } + + void addToCart(SnacksMenu post) { + String item = post.item; + int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + print(item); + } + + @override + Widget build(BuildContext context) { + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitDualRing( + color: Colors.deepOrange, + size: 38, + ), + SizedBox(height: 20), + Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) + ]), + ); + } else { + return Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: _menuList.length, + itemBuilder: (_, index) { + return ListTile( + title: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SizedBox(width: 15), + Text( + '${_menuList[index].item}', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold), + ), + ], + ), + InkWell( + onTap: () { + addToCart(_menuList[index]); + }, + child: Container( + height: 45, + width: 43, + margin: EdgeInsets.only(top: 6), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.deepOrange, + borderRadius: + BorderRadius.circular(10)), + child: IconButton( + onPressed: () { + showFlushbar(context); + addToCart(_menuList[index]); + setState(() { + checked = !checked; + }); + }, + icon: Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: new EdgeInsets.symmetric( + vertical: 3, horizontal: 16.0), + child: Text( + '₹' + '${_menuList[index].price}', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ], + ), + Divider( + color: Colors.grey, + height: 2, + thickness: 1, + indent: 5, + endIndent: 5, + ), + ], + ), + ); + })), + ) + ], + ); + } + } +} diff --git a/lib/pages/CategoryMenuList/Soup_Menu.dart b/lib/pages/CategoryMenuList/Soup_Menu.dart new file mode 100644 index 0000000..526b3b2 --- /dev/null +++ b/lib/pages/CategoryMenuList/Soup_Menu.dart @@ -0,0 +1,229 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; +import 'package:rcapp/pages/storeData.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; + +class Soup_MenuList extends StatefulWidget { + @override + _Soup_MenuListState createState() => _Soup_MenuListState(); +} + +class _Soup_MenuListState extends State { + StoreData dataforCart = StoreData(); + int total = 0; + + int qty = 0; + List qtyList = List(); + + @override + Widget build(BuildContext context) { + return StreamProvider>.value( + value: DatabaseService().soupmenu, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Soup'), + actions: [ + IconButton( + icon: Icon( + Icons.shopping_cart, + color: Colors.white, + ), + onPressed: () { + Navigator.pushNamed(context, '/cart'); + // Navigator.popAndPushNamed(context, '/cart'); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: SoupMenuListListPage(), + ) + ], + ), + ), + ); + } +} + +class SoupMenuListListPage extends StatefulWidget { + @override + _SoupMenuListListPageState createState() => _SoupMenuListListPageState(); +} + +class _SoupMenuListListPageState extends State { + StoreData storeData = StoreData(); + int total = 0; + bool checked = false; + Map quantityDetail = Map(); + int qty = 0; + List qtyList = List(); + + void updateTotal() { + Map foodDetail = storeData.retrieveFoodDetails(); + Map qtyDetail = storeData.retrieveQtyDetails(); + + total = 0; + + setState(() { + qtyDetail.forEach((key, value) => qtyList.add(value)); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); + }); + } + + void quantityIncreement(String foodName) { + storeData.increaseQty(foodName); + updateTotal(); + } + + void quantityDecreement(String foodName) { + storeData.decreaseQty(foodName); + updateTotal(); + } + + void update() { + Map qtyCart = storeData.retrieveQtyDetails(); + Map foodDetail = storeData.retrieveFoodDetails(); + + setState(() { + qty = 0; + qtyCart.forEach((key, value) { + qty += value; + qtyList.add(value); + }); + foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + }); + } + + void addToCart(SoupMenu post) { + String item = post.item; + int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + print(item); + } + + @override + Widget build(BuildContext context) { + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitDualRing( + color: Colors.deepOrange, + size: 38, + ), + SizedBox(height: 20), + Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) + ]), + ); + } else { + return Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: _menuList.length, + itemBuilder: (_, index) { + return ListTile( + title: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SizedBox(width: 15), + Text( + '${_menuList[index].item}', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold), + ), + ], + ), + InkWell( + onTap: () { + addToCart(_menuList[index]); + }, + child: Container( + height: 45, + width: 43, + margin: EdgeInsets.only(top: 6), + alignment: Alignment.center, + decoration: + BoxDecoration(color: Colors.deepOrange, borderRadius: BorderRadius.circular(10)), + child: IconButton( + onPressed: () { + showFlushbar(context); + addToCart(_menuList[index]); + setState(() { + checked = !checked; + }); + }, + icon: Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: new EdgeInsets.symmetric( + vertical: 3, horizontal: 16.0), + child: Text( + '₹' + '${_menuList[index].price}', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ], + ), + Divider( + color: Colors.grey, + height: 2, + thickness: 1, + indent: 5, + endIndent: 5, + ), + ], + ), + ); + })), + ) + ], + ); + } + } +} diff --git a/lib/pages/CategoryMenuList/Starter_Menu.dart b/lib/pages/CategoryMenuList/Starter_Menu.dart new file mode 100644 index 0000000..5a60bd5 --- /dev/null +++ b/lib/pages/CategoryMenuList/Starter_Menu.dart @@ -0,0 +1,228 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; +import 'package:rcapp/pages/storeData.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; + +class StarterMenuList extends StatefulWidget { + @override + _StarterMenuListState createState() => _StarterMenuListState(); +} + +class _StarterMenuListState extends State { + StoreData dataforCart = StoreData(); + int total = 0; + + int qty = 0; + List qtyList = List(); + + @override + Widget build(BuildContext context) { + return StreamProvider>.value( + value: DatabaseService().starter, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Starters'), + actions: [ + IconButton( + icon: Icon( + Icons.shopping_cart, + color: Colors.white, + ), + onPressed: () { + Navigator.pushNamed(context, '/cart'); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: StarterMenuListListPage(), + ) + ], + ), + ), + ); + } +} + +class StarterMenuListListPage extends StatefulWidget { + @override + _StarterMenuListListPageState createState() => + _StarterMenuListListPageState(); +} + +class _StarterMenuListListPageState extends State { + StoreData storeData = StoreData(); + int total = 0; + bool checked = false; + Map quantityDetail = Map(); + int qty = 0; + List qtyList = List(); + + void updateTotal() { + Map foodDetail = storeData.retrieveFoodDetails(); + Map qtyDetail = storeData.retrieveQtyDetails(); + + total = 0; + + setState(() { + qtyDetail.forEach((key, value) => qtyList.add(value)); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); + }); + } + + void quantityIncreement(String foodName) { + storeData.increaseQty(foodName); + updateTotal(); + } + + void quantityDecreement(String foodName) { + storeData.decreaseQty(foodName); + updateTotal(); + } + + void update() { + Map qtyCart = storeData.retrieveQtyDetails(); + Map foodDetail = storeData.retrieveFoodDetails(); + + setState(() { + qty = 0; + qtyCart.forEach((key, value) { + qty += value; + qtyList.add(value); + }); + foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + }); + } + + void addToCart(StarterMenu post) { + String item = post.item; + int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + print(item); + } + + @override + Widget build(BuildContext context) { + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitDualRing( + color: Colors.deepOrange, + size: 38, + ), + SizedBox(height: 20), + Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) + ]), + ); + } else { + return Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: _menuList.length, + itemBuilder: (_, index) { + return ListTile( + title: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SizedBox(width: 15), + Text( + '${_menuList[index].item}', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold), + ), + ], + ), + InkWell( + child: Container( + height: 45, + width: 43, + margin: EdgeInsets.only(top: 6), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.deepOrange, + borderRadius: + BorderRadius.circular(10)), + child: IconButton( + onPressed: () { + showFlushbar(context); + addToCart(_menuList[index]); + setState(() { + checked = !checked; + }); + }, + icon: Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: new EdgeInsets.symmetric( + vertical: 3, horizontal: 16.0), + child: Text( + '₹' + '${_menuList[index].price}', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ], + ), + Divider( + color: Colors.grey, + height: 2, + thickness: 1, + indent: 5, + endIndent: 5, + ), + ], + ), + ); + })), + ) + ], + ); + } + } +} diff --git a/lib/pages/CategoryMenuList/Tandoori_Menu.dart b/lib/pages/CategoryMenuList/Tandoori_Menu.dart new file mode 100644 index 0000000..9e652a3 --- /dev/null +++ b/lib/pages/CategoryMenuList/Tandoori_Menu.dart @@ -0,0 +1,225 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; +import 'package:rcapp/pages/storeData.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; + +class Tandoori_MenuList extends StatefulWidget { + @override + _Tandoori_MenuListState createState() => _Tandoori_MenuListState(); +} + +class _Tandoori_MenuListState extends State { + StoreData dataforCart = StoreData(); + int total = 0; + + int qty = 0; + List qtyList = List(); + + @override + Widget build(BuildContext context) { + return StreamProvider>.value( + value: DatabaseService().tandoorimenu, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Tandoor'), + actions: [ + IconButton( + icon: Icon( + Icons.shopping_cart, + color: Colors.white, + ), + onPressed: () { + Navigator.pushNamed(context, '/cart'); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: TandooriMenuListListPage(), + ) + ], + ), + ), + ); + } +} + +class TandooriMenuListListPage extends StatefulWidget { + @override + _TandooriMenuListListPageState createState() => + _TandooriMenuListListPageState(); +} + +class _TandooriMenuListListPageState extends State { + StoreData storeData = StoreData(); + int total = 0; + bool checked = false; + Map quantityDetail = Map(); + int qty = 0; + List qtyList = List(); + + void updateTotal() { + Map foodDetail = storeData.retrieveFoodDetails(); + Map qtyDetail = storeData.retrieveQtyDetails(); + + total = 0; + + setState(() { + qtyDetail.forEach((key, value) => qtyList.add(value)); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); + }); + } + + void quantityIncreement(String foodName) { + storeData.increaseQty(foodName); + updateTotal(); + } + + void quantityDecreement(String foodName) { + storeData.decreaseQty(foodName); + updateTotal(); + } + + void update() { + Map qtyCart = storeData.retrieveQtyDetails(); + Map foodDetail = storeData.retrieveFoodDetails(); + + setState(() { + qty = 0; + qtyCart.forEach((key, value) { + qty += value; + qtyList.add(value); + }); + foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + }); + } + + void addToCart(TandooriMenu post) { + String item = post.item; + int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + print(item); + } + + @override + Widget build(BuildContext context) { + final _menuList = Provider.of>(context) ?? []; + if (_menuList.length == 0) { + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitDualRing( + color: Colors.deepOrange, + size: 38, + ), + SizedBox(height: 20), + Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) + ]), + ); + } else { + return Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: _menuList.length, + itemBuilder: (_, index) { + return ListTile( + title: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SizedBox(width: 15), + Text( + '${_menuList[index].item}', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold), + ), + ], + ), + Container( + height: 45, + width: 43, + margin: EdgeInsets.only(top: 6), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.deepOrange, + borderRadius: BorderRadius.circular(10)), + child: IconButton( + onPressed: () { + showFlushbar(context); + addToCart(_menuList[index]); + setState(() { + checked = !checked; + }); + }, + icon: Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: new EdgeInsets.symmetric( + vertical: 3, horizontal: 16.0), + child: Text( + '₹' + '${_menuList[index].price}', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ], + ), + Divider( + color: Colors.grey, + height: 2, + thickness: 1, + indent: 5, + endIndent: 5, + ), + ], + ), + ); + })), + ) + ], + ); + } + } +} diff --git a/lib/pages/CategoryMenuList/flushbar.dart b/lib/pages/CategoryMenuList/flushbar.dart new file mode 100644 index 0000000..a11c3d8 --- /dev/null +++ b/lib/pages/CategoryMenuList/flushbar.dart @@ -0,0 +1,38 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; + +void showFlushbar(context) { + Flushbar( + margin: EdgeInsets.all(10), + padding: EdgeInsets.all(10), + borderRadius: 8, + backgroundGradient: LinearGradient( + colors: [Colors.deepOrange, Colors.deepOrange], stops: [0.6, 1]), + boxShadows: [ + BoxShadow(color: Colors.black45, offset: Offset(3, 3), blurRadius: 3), + ], + duration: Duration(seconds: 5), + dismissDirection: FlushbarDismissDirection.HORIZONTAL, + forwardAnimationCurve: Curves.fastLinearToSlowEaseIn, + title: "Item added to the cart", + message: "Tap on the top cart icon to view your item in the cart") + ..show(context); +} + +void showFlushbarBooking(context) { + Flushbar( + margin: EdgeInsets.all(10), + padding: EdgeInsets.all(10), + borderRadius: 8, + backgroundGradient: LinearGradient( + colors: [Colors.deepOrange, Colors.deepOrange], stops: [0.6, 1]), + boxShadows: [ + BoxShadow(color: Colors.black45, offset: Offset(3, 3), blurRadius: 3), + ], + duration: Duration(seconds: 5), + dismissDirection: FlushbarDismissDirection.HORIZONTAL, + forwardAnimationCurve: Curves.fastLinearToSlowEaseIn, + title: "Room already booked for selected date", + message: "Please select another date or different slot") + ..show(context); +} diff --git a/lib/pages/Coluseum.dart b/lib/pages/Coluseum.dart new file mode 100644 index 0000000..9385634 --- /dev/null +++ b/lib/pages/Coluseum.dart @@ -0,0 +1,65 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; + + +class Coluseum extends StatefulWidget { + @override + _ColuseumState createState() => _ColuseumState(); +} + +class _ColuseumState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + elevation: 10.0, + backgroundColor: Colors.deepOrange, + title: Text('Coluseum'), + ), + body: new Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Container( + height: 200.0, + width: double.infinity, + padding: EdgeInsets.symmetric(horizontal: 50, vertical: 30), + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 20), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/15.jpg"), + fit: BoxFit.fill)), + ), + ), + Text( + "Coluseum", + style: GoogleFonts.inter( + color: Colors.blueAccent, + fontSize: 40, + ), + ), + Text( + "The Blue Lounge is a comfortable lounge present in the ground floor of the club. Perfect for small group gatherings like office parties, get togethers amongst friends etc \n \nCapacity : 15 people\n \n \n \n ", + style: GoogleFonts.inter( + fontSize: 20 + ), + ), + SizedBox( + width: double.infinity, + height: 60, + child: ButtonTheme( + child: RaisedButton( + color: Colors.deepOrange, + onPressed: () { + Navigator.pushNamed(context, "/bookingcalendar"); + }, + child: Text('Book', + style: GoogleFonts.inter(color: Colors.white, fontSize: 18))), + )), + ], + ), + ); + } +} diff --git a/lib/pages/Food.dart b/lib/pages/Food.dart index 49564c9..a9f35ea 100644 --- a/lib/pages/Food.dart +++ b/lib/pages/Food.dart @@ -1,26 +1,25 @@ import 'package:flutter/material.dart'; -import 'package:carousel_pro/carousel_pro.dart'; -// import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:google_fonts/google_fonts.dart'; import 'package:rcapp/CustomWidget/foot_category.dart'; -import 'package:rcapp/CustomWidget/menu_category.dart'; import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/Cart.dart'; +import 'package:rcapp/pages/NavigationBar.dart'; import 'package:rcapp/pages/Search.dart'; import 'package:rcapp/pages/storeData.dart'; import 'package:provider/provider.dart'; import 'package:rcapp/services/database.dart'; -var cartList = []; +// var cartList = []; -class Orders { - final String item; - final int price; - final int quantity; +// class Orders { +// final String item; +// final int price; +// final int quantity; - Orders(this.item, this.price, this.quantity); -} +// Orders(this.item, this.price, this.quantity); +// } -Orders newOrder; +// Orders newOrder; class Food extends StatefulWidget { @override @@ -32,19 +31,29 @@ class _FoodState extends State { int total = 0; int qty = 0; + + // @override + // void initState() { + // // TODO: implement initState + // super.initState(); + // updateTotal(); + // } + List qtyList = List(); - void update() { - Map qtyCart = dataforCart.retrieveQtyDetails(); + void updateTotal() { Map foodDetail = dataforCart.retrieveFoodDetails(); + Map qtyDetail = dataforCart.retrieveQtyDetails(); + + total = 0; + qty = 0; setState(() { - qty = 0; - qtyCart.forEach((key, value) { + qtyDetail.forEach((key, value) { qty += value; qtyList.add(value); }); - foodDetail.forEach((k, v) => total = total + v * qtyCart[k]); + foodDetail.forEach((k, v) => total = total + v * qtyDetail[k]); }); } @@ -55,13 +64,14 @@ class _FoodState extends State { void initState() { // TODO: implement initState super.initState(); - update(); + updateTotal(); } @override Widget build(BuildContext context) { - return StreamProvider>.value( - value: DatabaseService().chinese, + updateTotal(); + return StreamProvider>.value( + value: DatabaseService().today_Menu, child: Scaffold( appBar: AppBar( automaticallyImplyLeading: false, @@ -92,7 +102,7 @@ class _FoodState extends State { padding: EdgeInsets.fromLTRB(10, 0, 0, 0), child: Text( "Today's Menu", - style: TextStyle( + style: GoogleFonts.inter( color: Colors.grey, fontSize: 25, fontWeight: FontWeight.bold, @@ -100,61 +110,45 @@ class _FoodState extends State { ), ), SizedBox(height: 10.0), - FoodCategory(), - SizedBox(height: 10.0), Container( - padding: EdgeInsets.fromLTRB(10, 0, 0, 0), - child: Text( - "Categories", - style: TextStyle( - color: Colors.grey, - fontSize: 20, - fontWeight: FontWeight.bold, + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0), + child: FoodCategory(false)), + SizedBox(height: 20.0), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + padding: EdgeInsets.fromLTRB(10, 0, 0, 0), + child: Text( + "Categories: ", + style: GoogleFonts.inter( + color: Colors.grey, + fontSize: 25, + fontWeight: FontWeight.bold, + ), + ), ), - ), - ), - MenuCategories(), - SizedBox(height: 10.0), - Container( - width: double.infinity, - child: Text( - ' Menu: (Tap to add to cart)', - style: TextStyle( - fontSize: 18, - color: Colors.deepOrange, - fontWeight: FontWeight.bold), - ), + FlatButton( + onPressed: () { + Navigator.pushNamed(context, '/allmenu'); + }, + shape: new RoundedRectangleBorder( + borderRadius: new BorderRadius.circular(10.0)), + child: Text('Menu', + style: GoogleFonts.inter( + color: Colors.deepOrange, + fontSize: 20, + fontWeight: FontWeight.bold)), + color: Colors.white, + ), + ], ), - ListPage(update: update), + ListPage(), ], ), ), - Container( - width: double.maxFinite, - height: 54, - decoration: BoxDecoration(color: Colors.deepOrange), - child: Padding( - padding: EdgeInsets.symmetric(vertical: 0, horizontal: 20), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - '$qty ' + ' item ' + '|' + ' ' + '₹ ' + '$total', - style: TextStyle( - color: Colors.white, fontWeight: FontWeight.bold), - ), - InkWell( - onTap: (() => Navigator.pushNamed(context, '/cart')), - child: Text( - 'VIEW CART', - style: TextStyle( - color: Colors.white, fontWeight: FontWeight.bold), - ), - ) - ], - ), - ), - ) + SizedBox(height: 10.0), + BottomItemView(total: total, qty: qty) ]), ), ); @@ -185,18 +179,14 @@ class _QuantityState extends State { child: Container( margin: EdgeInsets.fromLTRB(0, 0, 14, 0), decoration: BoxDecoration( - color: Colors.white, + color: Colors.deepOrange, borderRadius: BorderRadius.circular(4), border: Border.all(color: Colors.grey, width: 0.1), - boxShadow: [ - BoxShadow( - color: Colors.grey, blurRadius: 2.0, offset: Offset(2.1, 2.2)) - ], ), height: 25, width: 62, - child: Center( - child: Text('Add', style: TextStyle(color: Colors.deepOrange))), + child: + Center(child: Text('Add', style: GoogleFonts.inter(color: Colors.white))), ), ); } else { @@ -207,19 +197,14 @@ class _QuantityState extends State { child: Container( margin: EdgeInsets.fromLTRB(0, 0, 14, 0), decoration: BoxDecoration( - color: Colors.white, + color: Colors.deepOrange, borderRadius: BorderRadius.circular(4), border: Border.all(color: Colors.grey, width: 0.1), - boxShadow: [ - BoxShadow( - color: Colors.grey, blurRadius: 2.0, offset: Offset(2.1, 2.2)) - ], ), height: 25, width: 66, child: Center( - child: - Text('Remove', style: TextStyle(color: Colors.deepOrange))), + child: Text('Remove', style: GoogleFonts.inter(color: Colors.white))), ), ); } @@ -228,8 +213,6 @@ class _QuantityState extends State { class ListPage extends StatefulWidget { @override - final update; - ListPage({this.update}); _ListPageState createState() => _ListPageState(); } @@ -251,84 +234,420 @@ class _ListPageState extends State { @override Widget build(BuildContext context) { - final _menuList = Provider.of>(context) ?? []; - if (_menuList.length == 0) { - return Container( - height: 200, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SpinKitDualRing( - color: Colors.deepOrange, - size: 38, + return Container( + margin: const EdgeInsets.symmetric(vertical: 0, horizontal: 10), + height: 400.0, + width: double.infinity, + child: new Column( + children: [ + Expanded( + child: ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + scrollDirection: Axis.horizontal, + children: [ + InkWell( + onTap: () { + Navigator.pushNamed(context, "/maincoursemenu"); + }, + child: Container( + height: 100.0, + width: 100.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Main Course', + style: GoogleFonts.inter(color: Colors.white), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/30.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + InkWell( + onTap: () { + Navigator.pushNamed(context, "/breadmenu"); + }, + child: Container( + height: 100.0, + width: 100.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Breads', + style: GoogleFonts.inter(color: Colors.white), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/40.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + InkWell( + onTap: () { + Navigator.pushNamed(context, "/biryanimenu"); + }, + child: Container( + height: 100.0, + width: 100.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Biryani', + style: GoogleFonts.inter(color: Colors.white), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/28.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + InkWell( + onTap: () { + Navigator.pushNamed(context, "/tandoorimenu"); + }, + child: Container( + height: 100.0, + width: 100.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Tandoori', + style: GoogleFonts.inter(color: Colors.white), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/29.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + ], ), - SizedBox(height: 20), - Text('LOADING', style: TextStyle(fontWeight: FontWeight.w500)) - ]), - ); - } else { - return Container( - child: ListView.builder( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: _menuList.length, - itemBuilder: (_, index) { - return ListTile( - onTap: () { - addToCart(_menuList[index]); - widget.update(); - }, - title: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - IconButton( - onPressed: () { - addToCart(_menuList[index]); - }, - icon: Icon( - Icons.radio_button_unchecked, - color: Colors.green, - ), - ), - Text( - '${_menuList[index].item}', - style: TextStyle( - fontSize: 17, fontWeight: FontWeight.bold), - ), - ], - ), - // Quantity() - ], + ), + SizedBox(height: 20), + Expanded( + child: ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + scrollDirection: Axis.horizontal, + children: [ + InkWell( + onTap: () { + Navigator.pushNamed(context, "/chinesemenu"); + }, + child: Container( + height: 100.0, + width: 100.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Chinese', + style: GoogleFonts.inter(color: Colors.white), + ), ), - Row( - children: [ - Container( - margin: new EdgeInsets.symmetric(horizontal: 50.0), - child: Text( - '₹' + '${_menuList[index].price}', - style: TextStyle( - fontSize: 15, fontWeight: FontWeight.bold), - ), - ), - ], + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/38.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + InkWell( + onTap: () { + Navigator.pushNamed(context, "/friedriceandnoodlesmenu"); + }, + child: Container( + height: 100.0, + width: 100.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Fried Rice and Noodles', + style: GoogleFonts.inter(color: Colors.white), + ), ), - SizedBox(height: 10.0), - const Divider( - color: Colors.grey, - height: 2, - thickness: 1, - indent: 5, - endIndent: 5, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/39.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + InkWell( + onTap: () { + Navigator.pushNamed(context, "/rollmenu"); + }, + child: Container( + height: 100.0, + width: 100.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Main Course', + style: GoogleFonts.inter(color: Colors.white), + ), ), - ], + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/33.jpg"), + fit: BoxFit.fill)), + ), ), - ); - })); - } + SizedBox(width: 20), + InkWell( + onTap: () { + Navigator.pushNamed(context, "/pizzamenu"); + }, + child: Container( + height: 100.0, + width: 100.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Pizza', + style: GoogleFonts.inter(color: Colors.white), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/34.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + ], + ), + ), + SizedBox(height: 20), + Expanded( + child: ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + scrollDirection: Axis.horizontal, + children: [ + InkWell( + onTap: () { + Navigator.pushNamed(context, "/snacksmenu"); + }, + child: Container( + height: 100.0, + width: 100.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Snacks', + style: GoogleFonts.inter(color: Colors.white), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/27.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + InkWell( + onTap: () { + Navigator.pushNamed(context, "/sandwichmenu"); + }, + child: Container( + height: 100.0, + width: 100.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Sandwiches', + style: GoogleFonts.inter(color: Colors.white), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/31.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + InkWell( + onTap: () { + Navigator.pushNamed(context, "/burgermenu"); + }, + child: Container( + height: 100.0, + width: 100.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Burgers', + style: GoogleFonts.inter(color: Colors.white), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/32.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + InkWell( + onTap: () { + Navigator.pushNamed(context, "/pastamenu"); + }, + child: Container( + height: 100.0, + width: 100.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Pasta', + style: GoogleFonts.inter(color: Colors.white), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/35.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + ], + ), + ), + SizedBox(height: 20), + Expanded( + child: ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + scrollDirection: Axis.horizontal, + children: [ + InkWell( + onTap: () { + Navigator.pushNamed(context, "/soupmenu"); + }, + child: Container( + height: 100.0, + width: 100.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Soup', + style: GoogleFonts.inter(color: Colors.white), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/36.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + InkWell( + onTap: () { + Navigator.pushNamed(context, "/accompanimentmenu"); + }, + child: Container( + height: 100.0, + width: 100.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Accompaniment', + style: GoogleFonts.inter(color: Colors.white), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/37.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + InkWell( + onTap: () { + Navigator.pushNamed(context, "/startermenu"); + }, + child: Container( + height: 100.0, + width: 100.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Starters', + style: GoogleFonts.inter(color: Colors.white), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/41.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + InkWell( + onTap: () { + Navigator.pushNamed(context, "/breakfastmenu"); + }, + child: Container( + height: 100.0, + width: 100.0, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'Breakfast', + style: GoogleFonts.inter(color: Colors.white), + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/26.jpg"), + fit: BoxFit.fill)), + ), + ), + SizedBox(width: 20), + ], + ), + ), + ], + )); } -} \ No newline at end of file +} diff --git a/lib/pages/Home.dart b/lib/pages/Home.dart index d273693..05faa65 100644 --- a/lib/pages/Home.dart +++ b/lib/pages/Home.dart @@ -1,10 +1,19 @@ import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; +import 'package:firebase_storage/firebase_storage.dart'; import 'package:flutter/material.dart'; import 'package:carousel_pro/carousel_pro.dart'; +import 'package:flutter_downloader/flutter_downloader.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; -import 'package:rcapp/CustomWidget/todays_menucategory.dart'; +import 'package:path_provider/path_provider.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:rcapp/CustomWidget/foot_category.dart'; +import 'package:rcapp/models/user.dart'; import 'package:rcapp/services/auth.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/services/database.dart'; +import 'package:path/path.dart'; +import 'package:google_fonts/google_fonts.dart'; class Home extends StatefulWidget { @override @@ -14,9 +23,9 @@ class Home extends StatefulWidget { class _HomeState extends State { final AuthService _auth = AuthService(); - bool areYouadmin; - String userName; - String userNumber; + bool areYouadmin = false; + String userName = ""; + String userNumber = ""; Future getAdmin() async { try { @@ -36,6 +45,27 @@ class _HomeState extends State { } } + // void exp() async { + // // var date = 1600288449003; + // // var result = await Firestore.instance + // // .collection('events') + // // .where('slot', isEqualTo: 1) + // // .getDocuments(); + // // result.documents.forEach((element) { + // // print(DateTime.fromMillisecondsSinceEpoch(date)); + // // }); + // DateTime currentPhoneDate = DateTime.now(); + // Timestamp myTimeStamp = Timestamp.fromDate(currentPhoneDate); + // DateTime myDateTime = myTimeStamp.toDate(); + // print("$currentPhoneDate"); + // print("$myDateTime"); + // var result = await Firestore.instance + // .collection('events') + // .where("slot", isEqualTo: 1) + // .getDocuments(); + // print(result.documents[0]["event_date"].toDate()); + // } + @override void initState() { // TODO: implement initState @@ -71,111 +101,173 @@ class _HomeState extends State { indicatorBgPadding: 10.0, )); - return Scaffold( - backgroundColor: Colors.white, - appBar: AppBar( - elevation: 10.0, - backgroundColor: Colors.deepOrange, - leading: Builder(builder: (BuildContext context) { - return IconButton( - icon: const Icon(Icons.account_circle), - onPressed: () { - Scaffold.of(context).openDrawer(); - }, - // tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip, - ); - }), - title: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text('Home'), - ]), - ), - drawer: Drawer( - child: SafeArea( - child: Container( - height: 100, - child: LoadingData(auth: _auth), + return StreamProvider>.value( + value: DatabaseService().today_Menu, + child: Scaffold( + backgroundColor: Colors.white, + appBar: AppBar( + elevation: 10.0, + backgroundColor: Colors.deepOrange, + leading: Builder(builder: (BuildContext context) { + return IconButton( + icon: const Icon(Icons.menu), + onPressed: () { + Scaffold.of(context).openDrawer(); + }, + ); + }), + title: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text('Home', style: GoogleFonts.inter()), + ]), + ), + drawer: Drawer( + child: SafeArea( + child: Container( + height: 100, + child: LoadingData(auth: _auth), + ), ), ), - ), - body: new ListView( - padding: EdgeInsets.symmetric(horizontal: 10, vertical: 0), - children: [ - SizedBox(height: 4), - InkWell( - onTap: () {}, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, + body: new ListView( + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 0), + children: [ + SizedBox(height: 4), + InkWell( + onTap: () async { + final status = await Permission.storage.request(); + + if (status.isGranted) { + final externalDir = await getExternalStorageDirectory(); + + final taskId = await FlutterDownloader.enqueue( + url: + 'https://firebasestorage.googleapis.com/v0/b/rcapp-de25c.appspot.com/o/final.pdf?alt=media&token=64819cfa-3ffd-4875-889e-c50b3dbf935d', + savedDir: externalDir.path, + fileName: 'Rourkela_Club_Menu', + showNotification: true, + openFileFromNotification: true, + ); + } + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Rourkela Club Menu', + style: GoogleFonts.inter( + color: Colors.deepOrange, + fontSize: 14, + decoration: TextDecoration.underline, + ), + ), + IconButton( + padding: EdgeInsets.all(0), + alignment: Alignment.centerLeft, + onPressed: () {}, + icon: Icon(Icons.insert_drive_file), + color: Colors.deepOrange, + iconSize: 14, + ) + ]), + ), + imageCarousel, + SizedBox(height: 20.0), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - 'Rourkela Club Menu', + " Notice Board", + style: GoogleFonts.inter( + color: Colors.grey, + fontSize: 22, + fontWeight: FontWeight.bold, + ), + ), + if (areYouadmin) ...[ + Row(children: [ + Container( + height: 28, + child: FlatButton( + onPressed: () { + Navigator.pushNamed(context, '/uploadPdf'); + }, + shape: new RoundedRectangleBorder( + borderRadius: new BorderRadius.circular(10.0)), + child: Text( + 'Add To List', + style: TextStyle(color: Colors.white), + ), + color: Colors.deepOrange, + ), + ), + SizedBox(width: 10) + ]) + ] + ]), + SizedBox(height: 10.0), + HomeListPage(), + SizedBox(height: 20.0), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + " Today's Menu", style: TextStyle( - color: Colors.deepOrange, - fontSize: 10, - decoration: TextDecoration.underline), + color: Colors.grey, + fontSize: 22, + fontWeight: FontWeight.bold, + ), ), - IconButton( - onPressed: () {}, - icon: Icon(Icons.picture_as_pdf), - ) + if (areYouadmin) ...[ + Row(children: [ + Container( + height: 28, + child: FlatButton( + onPressed: () { + Navigator.pushNamed(context, '/uploadImage'); + }, + shape: new RoundedRectangleBorder( + borderRadius: new BorderRadius.circular(10.0)), + child: Text( + 'Add To List', + style: TextStyle(color: Colors.white), + ), + color: Colors.deepOrange, + ), + ), + SizedBox( + width: 10, + ) + ]) + ] ]), - ), - imageCarousel, - SizedBox(height: 20.0), - Text( - " Notice Board", - style: TextStyle( - color: Colors.grey, - fontSize: 22, - fontWeight: FontWeight.bold, - ), - ), - SizedBox(height: 20.0), - HomeListPage(), - SizedBox(height: 10.0), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - " Today's Menu", - style: TextStyle( - color: Colors.grey, - fontSize: 22, - fontWeight: FontWeight.bold, - ), + SizedBox(height: 7.0), + Container( + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 0), + child: FoodCategory(areYouadmin)), + SizedBox(height: 20.0), + Text( + " Upcoming Events", + style: TextStyle( + color: Colors.grey, + fontSize: 22, + fontWeight: FontWeight.bold, ), - SizedBox(width: 130.0), - /* OutlineButton( - onPressed: () { - Navigator.pushNamed(context, '/address'); - }, - shape: new RoundedRectangleBorder( - borderRadius: new BorderRadius.circular(10.0)), - child: Text('View'), - color: Colors.amber, - ), */ - ], - ), - SizedBox(height: 7.0), - TodaysMenuCategory(), - SizedBox(height: 20.0), - Text( - " Upcoming Events", - style: TextStyle( - color: Colors.grey, - fontSize: 22, - fontWeight: FontWeight.bold, ), - ), - SizedBox(height: 10.0), - Container( - height: 150, - decoration: BoxDecoration(color: Colors.blue[50]), - child: Center(child: Text('No Events')), - ), - SizedBox(height: 50) - ], + SizedBox(height: 10.0), + Container( + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0), + height: 150, + decoration: BoxDecoration( + color: Colors.blue[50], + borderRadius: BorderRadius.circular(10)), + child: Center(child: Text('No Events')), + ), + SizedBox(height: 50) + ], + ), ), ); } @@ -235,7 +327,7 @@ class _HomeListPageState extends State { return Container( margin: EdgeInsets.symmetric(vertical: 1, horizontal: 0), padding: - EdgeInsets.symmetric(horizontal: 10, vertical: 2), + EdgeInsets.symmetric(horizontal: 10, vertical: 2), decoration: BoxDecoration( color: Colors.blue[50], borderRadius: BorderRadius.circular(8), @@ -248,6 +340,7 @@ class _HomeListPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( + width: 140, child: Text( '${snapshot.data[index].data["title"]}', style: TextStyle( @@ -255,15 +348,39 @@ class _HomeListPageState extends State { fontWeight: FontWeight.w600), ), ), - Container( - child: Text( - '${snapshot.data[index].data["subtitle"]}', - style: TextStyle(fontSize: 12), + Row(children: [ + SizedBox( + width: 280, + child: Text( + '${snapshot.data[index].data["subtitle"]}', + style: TextStyle(fontSize: 12), + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.left, + ), ), - ) + ]) ]), IconButton( - onPressed: () {}, + onPressed: () async { + final status = + await Permission.storage.request(); + + if (status.isGranted) { + final externalDir = + await getExternalStorageDirectory(); + + final taskId = + await FlutterDownloader.enqueue( + url: + '${snapshot.data[index].data["downloadLink"]}', + savedDir: externalDir.path, + fileName: + '${snapshot.data[index].data["title"]}', + showNotification: true, + openFileFromNotification: true, + ); + } + }, icon: Icon(Icons.picture_as_pdf), ) ]), @@ -286,25 +403,60 @@ class _AdminOptionState extends State { @override Widget build(BuildContext context) { if (isAdminglobal || widget.areYouadmin == true) { - return Container( - padding: EdgeInsets.fromLTRB(15, 0, 0, 10), - child: InkWell( - onTap: () { - Navigator.pushNamed(context, '/adminorder'); - }, - child: Text( - 'Admin Orders', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 25), + return Column(children: [ + Container( + padding: EdgeInsets.fromLTRB(10, 0, 0, 10), + child: ListTile( + onTap: () { + Navigator.pushNamed(context, '/uploadImage'); + }, + title: Text( + "Upload Today's Menu", + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 25), + ), ), ), - ); + Container( + padding: EdgeInsets.fromLTRB(10, 0, 0, 10), + child: ListTile( + onTap: () { + Navigator.pushNamed(context, '/adminorder'); + }, + title: Text( + 'Admin Orders', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 25), + ), + ), + ), + Container( + padding: EdgeInsets.fromLTRB(10, 0, 0, 10), + child: ListTile( + onTap: () { + Navigator.pushNamed(context, '/adminBooking'); + }, + title: Text( + 'Admin Booking', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 25), + ), + ), + // InkWell( + // onTap: () { + // Navigator.pushNamed(context, '/adminBooking'); + // }, + // child: Text( + // 'Admin Booking', + // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 25), + // ), + // ), + ) + ]); } else if (isAdminglobal == null || isAdminglobal == false) { return Container( padding: EdgeInsets.fromLTRB(15, 0, 0, 10), child: InkWell( onTap: () {}, child: Text( - 'Notification', + ' ', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 25), ), ), @@ -329,12 +481,6 @@ class _LoadingDataState extends State { .collection("userInfo") .document(userkaabba) .get(); - // setState(() { - // areYouadmin = dat.data["isAdmin"]; - // userName = dat.data["name"]; - // userNumber = dat.data["number"]; - // }); - // .then((value) => value.data["IsAdmin"]); } @override @@ -365,7 +511,7 @@ class _LoadingDataState extends State { ), SizedBox(height: 20), Text('LOADING', - style: TextStyle(fontWeight: FontWeight.w500)) + style: GoogleFonts.inter(fontWeight: FontWeight.w500)) ]), ); } else { @@ -373,12 +519,33 @@ class _LoadingDataState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Row(children: [ - CircleAvatar( - radius: 60.0, - backgroundImage: NetworkImage( - 'https://www.pngitem.com/pimgs/m/146-1468479_my-profile-icon-blank-profile-picture-circle-hd.png'), - backgroundColor: Colors.transparent, - ), + if (snapshot.data["avatar"] == "") ...[ + InkWell( + onTap: () { + Navigator.pushNamed( + context, '/uploadAvatarImage'); + }, + child: CircleAvatar( + radius: 60.0, + backgroundImage: NetworkImage( + 'https://www.pngitem.com/pimgs/m/146-1468479_my-profile-icon-blank-profile-picture-circle-hd.png'), + backgroundColor: Colors.transparent, + ), + ), + ] else ...[ + InkWell( + onTap: () { + Navigator.pushNamed( + context, '/uploadAvatarImage'); + }, + child: CircleAvatar( + radius: 60.0, + backgroundImage: + NetworkImage('${snapshot.data["avatar"]}'), + backgroundColor: Colors.transparent, + ), + ), + ], Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -397,7 +564,9 @@ class _LoadingDataState extends State { Container( padding: EdgeInsets.fromLTRB(15, 0, 0, 10), child: InkWell( - onTap: () {}, + onTap: () { + Navigator.pushNamed(context, '/previousBooking'); + }, child: Text( 'My Bookings', style: TextStyle( @@ -408,7 +577,9 @@ class _LoadingDataState extends State { Container( padding: EdgeInsets.fromLTRB(15, 0, 0, 10), child: InkWell( - onTap: () {}, + onTap: () { + Navigator.pushNamed(context, '/previousOrder'); + }, child: Text( 'Previous Orders', style: TextStyle( @@ -416,6 +587,20 @@ class _LoadingDataState extends State { )), ), SizedBox(height: 10), + // Container( + // padding: EdgeInsets.fromLTRB(15, 0, 0, 10), + // child: InkWell( + // onTap: () { + // Navigator.pushNamed(context, '/uploadImage'); + // }, + // child: Text( + // "Upload Today's Menu", + // style: TextStyle( + // fontWeight: FontWeight.bold, fontSize: 25), + // ), + // ), + // ), + SizedBox(height: 10), AdminOption(areYouadmin: snapshot.data["isAdmin"]), SizedBox(height: 10), Container( @@ -434,4 +619,4 @@ class _LoadingDataState extends State { } })); } -} \ No newline at end of file +} diff --git a/lib/pages/Login.dart b/lib/pages/Login.dart index b9b905b..945e153 100644 --- a/lib/pages/Login.dart +++ b/lib/pages/Login.dart @@ -1,4 +1,7 @@ +import 'package:carousel_pro/carousel_pro.dart'; import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:rcapp/pages/loadingspinner.dart'; import 'package:rcapp/services/auth.dart'; class Login extends StatefulWidget { @@ -10,133 +13,169 @@ class Login extends StatefulWidget { } class _LoginState extends State { + List photos = ["assets/delivery-man.png", "assets/login.png"]; + final AuthService _auth = AuthService(); final _formKey = GlobalKey(); - // test field state - String email = ''; + String number = ''; String password = ''; String error = ''; + bool loading = false; @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - backgroundColor: Colors.deepOrange, - title: Text('Sign in'), - elevation: 0.0, - actions: [ - FlatButton.icon( - icon: Icon(Icons.person), - label: Text('Register'), - onPressed: () { - widget.toggleView(); - }, - ) - ]), - body: SingleChildScrollView( - child: Container( - padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 50.0), - child: Form( - key: _formKey, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Image.asset( - 'assets/delivery-man.png', - fit: BoxFit.contain, - ), - SizedBox(height: 8.0), - Text( - 'Food Delivery', - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold, - fontSize: 40), - ), - SizedBox(height: 7.0), - Text( - 'Rourkela club now delivers food at your doorstep', - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.grey, - fontSize: 22, - ), - ), - SizedBox(height: 18.0), - TextFormField( - decoration: InputDecoration( - hintText: 'Email', - fillColor: Colors.white, - filled: true, - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.deepOrange, width: 1.0), - borderRadius: BorderRadius.circular(10)), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.deepOrange, width: 3.0), - borderRadius: BorderRadius.circular(10))), - validator: (val) => - val.isEmpty ? 'Enter an email' : null, - onChanged: (val) { - setState(() => email = val); - }), - SizedBox(height: 20.0), - TextFormField( - decoration: InputDecoration( - hintText: 'Password', - fillColor: Colors.white, - filled: true, - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.deepOrange, width: 1.0), - borderRadius: BorderRadius.circular(10)), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.deepOrange, width: 3.0), - borderRadius: BorderRadius.circular(10))), - validator: (val) => val.length < 6 - ? 'Enter password of 6+ characters' - : null, - obscureText: true, - onChanged: (val) { - setState(() => password = val); - }), - SizedBox(height: 20.0), - RaisedButton( - color: Colors.deepOrange, - padding: const EdgeInsets.symmetric( - horizontal: 40, vertical: 15), - child: Text( - 'Login', - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w400, - fontSize: 25), - ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - onPressed: () async { - if (_formKey.currentState.validate()) { - dynamic result = await _auth - .signInWithEmailAndPassword(email, password); - if (result == null) { - setState(() => error = - 'could not sign in with the credentials'); - } - } - }, - ), - SizedBox(height: 20.0), - Text( - error, - style: TextStyle(color: Colors.red, fontSize: 14.0), - ) - ]), - )), - ), - ); + Widget logincarousel = Container( + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 0), + height: 180.0, + child: new Carousel( + boxFit: BoxFit.contain, + images: [ + AssetImage('assets/login1.PNG'), + AssetImage('assets/login2.PNG'), + AssetImage('assets/login3.PNG'), + ], + autoplay: true, + dotSize: 0, + dotBgColor: Colors.transparent, + animationCurve: Curves.fastOutSlowIn, + animationDuration: Duration(milliseconds: 2000), + borderRadius: true, + indicatorBgPadding: 10.0, + )); + return loading + ? Loading() + : Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Sign in'), + elevation: 0.0, + // actions: [ + // FlatButton.icon( + // icon: Icon(Icons.person), + // label: Text('Register'), + // onPressed: () { + // widget.toggleView(); + // }, + // ) + // ] + ), + body: SingleChildScrollView( + child: Container( + padding: + EdgeInsets.symmetric(vertical: 20.0, horizontal: 50.0), + child: Form( + key: _formKey, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 250.0, + width: 370.0, + child: logincarousel), + SizedBox(height: 18.0), + TextFormField( + decoration: InputDecoration( + hintText: 'Personal Number', + fillColor: Colors.white, + filled: true, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 1.0), + borderRadius: BorderRadius.circular(10)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 3.0), + borderRadius: BorderRadius.circular(10))), + validator: (val) => val.isEmpty + ? 'Enter Your RSP Personal Number' + : null, + onChanged: (val) { + setState(() => number = val); + }), + SizedBox(height: 20.0), + TextFormField( + decoration: InputDecoration( + hintText: 'Password', + fillColor: Colors.white, + filled: true, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 1.0), + borderRadius: BorderRadius.circular(10)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 3.0), + borderRadius: BorderRadius.circular(10))), + validator: (val) => val.length < 6 + ? 'Enter password of 6+ characters' + : null, + obscureText: true, + onChanged: (val) { + setState(() => password = val); + }), + SizedBox(height: 20.0), + RaisedButton( + color: Colors.deepOrange, + padding: const EdgeInsets.symmetric( + horizontal: 40, vertical: 15), + child: Text( + 'Login', + style: GoogleFonts.inter( + color: Colors.white, + fontWeight: FontWeight.w400, + fontSize: 25), + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + onPressed: () async { + if (_formKey.currentState.validate()) { + setState(() { + loading = true; + }); + String numemail = number + "@gmail.com"; + dynamic result = + await _auth.signInWithEmailAndPassword( + numemail, password); + if (result == null) { + setState(() { + error = + 'could not sign in with the credentials'; + loading = false; + }); + } + } + }, + ), + SizedBox(height: 10.0), + Text( + error, + style: GoogleFonts.inter(color: Colors.red, fontSize: 14.0), + ), + SizedBox(height: 15.0), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Or, If you are a new user, ', + style: GoogleFonts.inter( + color: Colors.deepOrange, fontSize: 15), + ), + InkWell( + onTap: () { + widget.toggleView(); + }, + child: Text('Register', + style: GoogleFonts.inter( + color: Colors.blue, + decoration: TextDecoration.underline, + fontSize: 15)), + ) + ]) + ]), + )), + ), + ); } } diff --git a/lib/pages/Milan.dart b/lib/pages/Milan.dart new file mode 100644 index 0000000..461d369 --- /dev/null +++ b/lib/pages/Milan.dart @@ -0,0 +1,64 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; + + +class MilanLounge extends StatefulWidget { + @override + _MilanLoungeState createState() => _MilanLoungeState(); +} + +class _MilanLoungeState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + elevation: 10.0, + backgroundColor: Colors.deepOrange, + title: Text('Blue Lounge'), + ), + body: new Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Container( + height: 200.0, + width: double.infinity, + padding: EdgeInsets.symmetric(horizontal: 50, vertical: 30), + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 20), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/18.jpg"), + fit: BoxFit.fill)), + ), + ), + Text( + "Milan Lounge", + style: GoogleFonts.inter( + color: Colors.blueAccent, + fontSize: 40, + ), + ), + Text( + "The Milan Lounge is a cozy lounge. Perfect for small group gatherings like office parties, get togethers amongst friends etc \n \nCapacity : 15 people\n \n \n \n ", + style: GoogleFonts.inter( + fontSize: 20 + ), + ), + SizedBox( + width: double.infinity, + height: 60, + child: ButtonTheme( + child: RaisedButton( + color: Colors.deepOrange, + onPressed: () { + Navigator.pushNamed(context, "/bookingcalendar"); + }, + child: Text('Book', + style: GoogleFonts.inter(color: Colors.white, fontSize: 18))), + )), + ], + ), + ); } +} diff --git a/lib/pages/MilapL.dart b/lib/pages/MilapL.dart new file mode 100644 index 0000000..29fbbc1 --- /dev/null +++ b/lib/pages/MilapL.dart @@ -0,0 +1,66 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; + + + +class MilapLounge extends StatefulWidget { + @override + _MilapLoungeState createState() => _MilapLoungeState(); +} + +class _MilapLoungeState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + elevation: 10.0, + backgroundColor: Colors.deepOrange, + title: Text('Milap Lounge'), + ), + body: new Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Container( + height: 200.0, + width: double.infinity, + padding: EdgeInsets.symmetric(horizontal: 50, vertical: 30), + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 20), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/17.jpg"), + fit: BoxFit.fill)), + ), + ), + Text( + "Milap Reception Hall", + style: GoogleFonts.inter( + color: Colors.blueAccent, + fontSize: 40, + ), + ), + Text( + "The Milap Reception Hall is a large hall present in the first floor of the club. Perfect for medium group gatherings like office parties, departmental dinners etc \n \nCapacity : 70 people\n \n \n \n ", + style: GoogleFonts.inter( + fontSize: 20 + ), + ), + SizedBox( + width: double.infinity, + height: 60, + child: ButtonTheme( + child: RaisedButton( + color: Colors.deepOrange, + onPressed: () { + Navigator.pushNamed(context, "/bookingcalendar"); + }, + child: Text('Book', + style: GoogleFonts.inter(color: Colors.white, fontSize: 18))), + )), + ], + ), + ); + } +} diff --git a/lib/pages/NavigationBar.dart b/lib/pages/NavigationBar.dart index 029e080..a283f00 100644 --- a/lib/pages/NavigationBar.dart +++ b/lib/pages/NavigationBar.dart @@ -27,22 +27,27 @@ class _NavigationBarState extends State { return Scaffold( body: _children[_currentIndex], bottomNavigationBar: BottomNavigationBar( + unselectedItemColor: Colors.black, + selectedItemColor: Colors.deepOrange, onTap: onTappedBar, currentIndex: _currentIndex, items: [ BottomNavigationBarItem( icon: Icon(Icons.home), title: Text('Home'), - backgroundColor: Colors.black, + backgroundColor: Colors.deepOrange, ), BottomNavigationBarItem( icon: Icon(Icons.fastfood), title: Text('Food'), - backgroundColor: Colors.black), + backgroundColor: Colors.deepOrange, + activeIcon: Icon(Icons.fastfood, color: Colors.deepOrange), + ), BottomNavigationBarItem( icon: Icon(Icons.book), title: Text('Booking'), - backgroundColor: Colors.deepOrange), + backgroundColor: Colors.deepOrange, + ), ], ), ); diff --git a/lib/pages/Register.dart b/lib/pages/Register.dart index 1bc17ac..7bc91eb 100644 --- a/lib/pages/Register.dart +++ b/lib/pages/Register.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:rcapp/pages/loadingspinner.dart'; import 'package:rcapp/services/auth.dart'; class Register extends StatefulWidget { @@ -13,147 +15,143 @@ class _RegisterState extends State { final AuthService _auth = AuthService(); final _formKey = GlobalKey(); + bool loading = false; + // test field state String name = ''; - String email = ''; String password = ''; String error = ''; String number = ''; @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - backgroundColor: Colors.deepOrange, - title: Text('Sign Up'), - elevation: 0.0, - actions: [ - FlatButton.icon( - icon: Icon(Icons.person), - label: Text('Sign In'), - onPressed: () { - widget.toggleView(); - }, - ) - ]), - body: SingleChildScrollView( - child: Container( - padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 50.0), - child: Form( - key: _formKey, - child: Column(children: [ - Image.asset( - 'assets/login.png', - fit: BoxFit.contain, - ), - SizedBox(height: 15.0), - TextFormField( - decoration: InputDecoration( - hintText: 'Name', - fillColor: Colors.white, - filled: true, - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.deepOrange, width: 1.0), - borderRadius: BorderRadius.circular(10)), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.deepOrange, width: 3.0), - borderRadius: BorderRadius.circular(10))), - validator: (val) => val.isEmpty ? 'Enter your Name' : null, - onChanged: (val) { - setState(() => name = val); - }), - SizedBox(height: 18.0), - TextFormField( - decoration: InputDecoration( - hintText: 'Personal No.', - fillColor: Colors.white, - filled: true, - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.deepOrange, width: 1.0), - borderRadius: BorderRadius.circular(10)), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.deepOrange, width: 3.0), - borderRadius: BorderRadius.circular(10))), - validator: (val) => val.isEmpty ? 'Enter your RSP Personal No.' : null, - onChanged: (val) { - setState(() => number = val); - }), - SizedBox(height: 18.0), - TextFormField( - decoration: InputDecoration( - hintText: 'Email', - fillColor: Colors.white, - filled: true, - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.deepOrange, width: 1.0), - borderRadius: BorderRadius.circular(10)), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.deepOrange, width: 3.0), - borderRadius: BorderRadius.circular(10))), - validator: (val) => val.isEmpty ? 'Enter an email' : null, - onChanged: (val) { - setState(() => email = val); - }), - SizedBox(height: 18.0), - TextFormField( - decoration: InputDecoration( - hintText: 'Password', - fillColor: Colors.white, - filled: true, - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.deepOrange, width: 1.0), - borderRadius: BorderRadius.circular(10)), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.deepOrange, width: 3.0), - borderRadius: BorderRadius.circular(10))), - validator: (val) => val.length < 6 - ? 'Enter password of 6+ characters' - : null, - obscureText: true, - onChanged: (val) { - setState(() => password = val); - }), - SizedBox(height: 18.0), - RaisedButton( - color: Colors.deepOrange, + return loading + ? Loading() + : Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Sign Up'), + elevation: 0.0, + actions: [ + FlatButton.icon( + icon: Icon(Icons.person), + label: Text('Sign In'), + onPressed: () { + widget.toggleView(); + }, + ) + ]), + body: SingleChildScrollView( + child: Container( padding: - const EdgeInsets.symmetric(horizontal: 40, vertical: 15), - child: Text( - 'Register', - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w400, - fontSize: 25), - ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - onPressed: () async { - if (_formKey.currentState.validate()) { - dynamic result = await _auth.registerWithEmailAndPassword( - name, false, number, email, password); - if (result == null) { - setState(() => error = 'please supply a valid email'); - } - } - }, - ), - SizedBox(height: 20.0), - Text( - error, - style: TextStyle(color: Colors.red, fontSize: 14.0), - ) - ]), - )), - ), - ); + EdgeInsets.symmetric(vertical: 20.0, horizontal: 50.0), + child: Form( + key: _formKey, + child: Column(children: [ + Image.asset( + 'assets/login.png', + fit: BoxFit.contain, + ), + SizedBox(height: 15.0), + TextFormField( + decoration: InputDecoration( + hintText: 'Name', + fillColor: Colors.white, + filled: true, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 1.0), + borderRadius: BorderRadius.circular(10)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 3.0), + borderRadius: BorderRadius.circular(10))), + validator: (val) => + val.isEmpty ? 'Enter your Name' : null, + onChanged: (val) { + setState(() => name = val); + }), + SizedBox(height: 18.0), + TextFormField( + decoration: InputDecoration( + hintText: 'Personal No.', + fillColor: Colors.white, + filled: true, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 1.0), + borderRadius: BorderRadius.circular(10)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 3.0), + borderRadius: BorderRadius.circular(10))), + validator: (val) => val.isEmpty + ? 'Enter your RSP Personal No.' + : null, + onChanged: (val) { + setState(() => number = val); + }), + SizedBox(height: 18.0), + TextFormField( + decoration: InputDecoration( + hintText: 'Password', + fillColor: Colors.white, + filled: true, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 1.0), + borderRadius: BorderRadius.circular(10)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 3.0), + borderRadius: BorderRadius.circular(10))), + validator: (val) => val.length < 6 + ? 'Enter password of 6+ characters' + : null, + obscureText: true, + onChanged: (val) { + setState(() => password = val); + }), + SizedBox(height: 18.0), + RaisedButton( + color: Colors.deepOrange, + padding: const EdgeInsets.symmetric( + horizontal: 40, vertical: 15), + child: Text( + 'Register', + style: GoogleFonts.inter( + color: Colors.white, + fontWeight: FontWeight.w400, + fontSize: 25), + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + onPressed: () async { + if (_formKey.currentState.validate()) { + setState(() { + loading = true; + }); + dynamic result = + await _auth.registerWithEmailAndPassword( + name, false, number, password); + if (result == null) { + setState(() { + error = 'please supply a valid email'; + loading = false; + }); + } + } + }, + ), + SizedBox(height: 20.0), + Text( + error, + style: GoogleFonts.inter(color: Colors.red, fontSize: 14.0), + ) + ]), + )), + ), + ); } -} \ No newline at end of file +} diff --git a/lib/pages/Search.dart b/lib/pages/Search.dart index b450da9..c00c717 100644 --- a/lib/pages/Search.dart +++ b/lib/pages/Search.dart @@ -1,6 +1,9 @@ import 'package:flutter/material.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; import 'package:rcapp/pages/searchService.dart'; +import 'package:rcapp/pages/storeData.dart'; class Search extends StatefulWidget { @override @@ -10,6 +13,7 @@ class Search extends StatefulWidget { class _SearchState extends State { var queryResultSet = []; var tempSearchStore = []; + var priceStore = []; initiateSearch(value) { if (value.length == 0) { @@ -17,6 +21,7 @@ class _SearchState extends State { queryResultSet = []; tempSearchStore = []; }); + print(tempSearchStore); } var capitalizedValue = @@ -52,16 +57,14 @@ class _SearchState extends State { decoration: InputDecoration( prefixIcon: IconButton( color: Colors.black, - icon: Icon(Icons.arrow_back), + icon: Icon(Icons.search), iconSize: 20.0, - onPressed: () { - Navigator.pushNamed(context, '/food'); - }, + onPressed: () {}, ), contentPadding: EdgeInsets.only(left: 25.0), hintText: 'Search by item name', border: - OutlineInputBorder(borderRadius: BorderRadius.circular(4.0))), + OutlineInputBorder(borderRadius: BorderRadius.circular(4.0))), ), ), SearchList(tempSearchStore: tempSearchStore), @@ -70,6 +73,9 @@ class _SearchState extends State { } class SearchQuantity extends StatefulWidget { + final item; + final price; + SearchQuantity({this.item, this.price}); @override _SearchQuantityState createState() => _SearchQuantityState(); } @@ -77,30 +83,48 @@ class SearchQuantity extends StatefulWidget { class _SearchQuantityState extends State { int FQty = 0; + StoreData storeData = StoreData(); + + void addToCart(String item, int price) { + // String item = post.item; + // int price = post.price; + + Map qtyDetail = storeData.retrieveQtyDetails(); + + int qty = 1; + + qtyDetail.forEach((key, value) { + if (key == item) { + qty = value; + } + }); + + if (qty > 1) { + storeData.StoreFoodDetails(item, price, qty); + } else { + storeData.StoreFoodDetails(item, price, 1); + } + showFlushbar(context); + } + @override Widget build(BuildContext context) { if (FQty == 0) { return InkWell( onTap: () { - setState(() { - FQty++; - }); + addToCart(widget.item, widget.price); }, child: Container( margin: EdgeInsets.fromLTRB(0, 0, 14, 0), decoration: BoxDecoration( - color: Colors.white, + color: Colors.deepOrange, borderRadius: BorderRadius.circular(4), border: Border.all(color: Colors.grey, width: 0.1), - boxShadow: [ - BoxShadow( - color: Colors.grey, blurRadius: 2.0, offset: Offset(2.1, 2.2)) - ], ), height: 25, width: 62, - child: Center( - child: Text('Add', style: TextStyle(color: Colors.deepOrange))), + child: + Center(child: Text('Add', style: GoogleFonts.inter(color: Colors.white))), ), ); } else { @@ -112,12 +136,12 @@ class _SearchQuantityState extends State { color: Colors.deepOrange, borderRadius: BorderRadius.circular(4), border: Border.all(color: Colors.grey, width: 0.1), - boxShadow: [ - BoxShadow( - color: Colors.grey, - blurRadius: 2.0, - offset: Offset(2.1, 2.2)) - ], + // boxShadow: [ + // BoxShadow( + // color: Colors.grey, + // blurRadius: 2.0, + // offset: Offset(2.1, 2.2)) + // ], ), height: 25, width: 30, @@ -154,7 +178,7 @@ class _SearchQuantityState extends State { width: 33, child: Text( '$FQty', - style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold), + style: GoogleFonts.inter(fontSize: 17, fontWeight: FontWeight.bold), ), ), Container( @@ -236,13 +260,15 @@ class _SearchListState extends State { children: [ Text( '${widget.tempSearchStore[index]['item']}', - style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold), + style: GoogleFonts.inter(fontSize: 17, fontWeight: FontWeight.bold), ), - SearchQuantity(), + SearchQuantity( + item: widget.tempSearchStore[index]['item'], + price: widget.tempSearchStore[index]['price']), ], ), ); }), ); } -} \ No newline at end of file +} diff --git a/lib/pages/YellowL.dart b/lib/pages/YellowL.dart new file mode 100644 index 0000000..932beee --- /dev/null +++ b/lib/pages/YellowL.dart @@ -0,0 +1,65 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; + + +class YellowLounge extends StatefulWidget { + @override + _YellowLoungeState createState() => _YellowLoungeState(); +} + +class _YellowLoungeState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + elevation: 10.0, + backgroundColor: Colors.deepOrange, + title: Text('Yellow Lounge'), + ), + body: new Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Container( + height: 200.0, + width: double.infinity, + padding: EdgeInsets.symmetric(horizontal: 50, vertical: 30), + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 20), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/13.jpg"), + fit: BoxFit.fill)), + ), + ), + Text( + "Yellow Lounge", + style: GoogleFonts.inter( + color: Colors.blueAccent, + fontSize: 40, + ), + ), + Text( + "The Yellow Lounge is a large, comfortable lounge in the ground floor of the club. It is decorated with plush sofas and a warm ambience. Perfect for medium gatherings like office gettogethers, birthday parties etc \n \nCapacity : 25 people", + style: GoogleFonts.inter( + fontSize: 20 + ), + ), + SizedBox( + width: double.infinity, + height: 60, + child: ButtonTheme( + child: RaisedButton( + color: Colors.deepOrange, + onPressed: () { + Navigator.pushNamed(context, "/bookingcalendar"); + }, + child: Text('Book', + style: GoogleFonts.inter(color: Colors.white, fontSize: 18))), + )), + ], + ), + ); + } +} diff --git a/lib/pages/add_event.dart b/lib/pages/add_event.dart index de5d6c3..8ceae88 100644 --- a/lib/pages/add_event.dart +++ b/lib/pages/add_event.dart @@ -1,6 +1,14 @@ +import 'dart:io'; + +import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:google_fonts/google_fonts.dart'; import 'package:rcapp/models/event.dart'; import 'package:flutter/material.dart'; +import 'package:rcapp/pages/CategoryMenuList/flushbar.dart'; import 'package:rcapp/res/event_firestore_service.dart'; +import 'package:rcapp/services/database.dart'; class AddEventPage extends StatefulWidget { final EventModel note; @@ -12,152 +20,408 @@ class AddEventPage extends StatefulWidget { } class _AddEventPageState extends State { - TextStyle style = TextStyle(fontFamily: 'Montserrat', fontSize: 20.0); - TextEditingController _name; - TextEditingController _personalno; - TextEditingController _Lounge; - DateTime _eventDate; final _formKey = GlobalKey(); - final _key = GlobalKey(); + final DatabaseService _booking = DatabaseService(); + + String _name = ''; + String _personalno = ''; + int slot = 1; + DateTime _eventDate; + int numberOfPeople = 1; + int _value1 = 1; + int _value2 = 1; + bool exits = false; + + var id; bool processing; + List loungeColor = ['Yellow', 'Red', 'Blue']; + + void initialize() async { + var uid = (await FirebaseAuth.instance.currentUser()).uid; + var data = + await Firestore.instance.collection('userInfo').document(uid).get(); + setState(() { + id = uid; + _name = data.data["name"]; + _personalno = data.data["number"]; + }); + } + + void confirmBooking() async { + String _eventDatestring = '${_eventDate.day}' + + '/' + + '${_eventDate.month}' + + '/' + + '${_eventDate.year}'; + print(_eventDatestring); + var result = await Firestore.instance + .collection('BookingDetails') + .where('date', isEqualTo: _eventDatestring) + .getDocuments(); + result.documents.forEach((element) { + if (loungeColor[_value1 - 1] == element.data["lounge"] && + slot == element.data["slot"]) { + setState(() { + exits = true; + }); + } + }); + if (!exits) { + _booking.bookDetails(id, _name, _personalno, numberOfPeople, + loungeColor[_value1 - 1], slot, _eventDate); + Navigator.pop(context); + } else { + showFlushbarBooking(context); + setState(() { + exits = false; + }); + } + } + @override void initState() { super.initState(); - _name = TextEditingController(text: widget.note != null ? widget.note.name : ""); - _personalno = TextEditingController(text: widget.note != null ? widget.note.personalno : ""); - _Lounge = TextEditingController(text: widget.note != null ? widget.note.Lounge : ""); _eventDate = DateTime.now(); - processing = false; + initialize(); } @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text(widget.note != null ? "Edit Note" : "Booking Details"), - elevation: 10.0, - backgroundColor: Colors.deepOrange, - ), - key: _key, - body: Form( - key: _formKey, - child: Container( - alignment: Alignment.center, - child: ListView( + if (_name == '' && _personalno == '') { + return Scaffold( + appBar: AppBar( + title: Text(widget.note != null ? "Edit Note" : "Booking Details"), + elevation: 10.0, + backgroundColor: Colors.deepOrange, + ), + body: Column( + mainAxisAlignment: MainAxisAlignment.center, children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), - child: TextFormField( - controller: _name, - validator: (value) => - (value.isEmpty) ? "Please Enter Your Name" : null, - style: style, - decoration: InputDecoration( - labelText: "Name", - filled: true, - fillColor: Colors.white, - border: OutlineInputBorder(borderRadius: BorderRadius.circular(10))), - ), - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), - child: TextFormField( - controller: _personalno, - //minLines: 3, - //maxLines: 5, - validator: (value) => - (value.isEmpty) ? "Please Enter Your Personal Number" : null, - style: style, - decoration: InputDecoration( - labelText: "Personal No", - border: OutlineInputBorder(borderRadius: BorderRadius.circular(10))), - ), - ), - const SizedBox(height: 10.0), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), - child: TextFormField( - controller: _Lounge, - validator: (value) => - (value.isEmpty) ? "Please Enter The Lounge you want to book (Yellow/Red/Blue) " : null, - style: style, - decoration: InputDecoration( - labelText: "Lounge to book (Yellow/Red/Blue)", - border: OutlineInputBorder(borderRadius: BorderRadius.circular(10))), - ), - ), - const SizedBox(height: 10.0), - ListTile( - title: Text("Date (YYYY-MM-DD)"), - subtitle: Text("${_eventDate.year} - ${_eventDate.month} - ${_eventDate.day}"), - onTap: ()async{ - DateTime picked = await showDatePicker(context: context, initialDate: _eventDate, firstDate: DateTime(_eventDate.year-5), lastDate: DateTime(_eventDate.year+5)); - if(picked != null) { - setState(() { - _eventDate = picked; - }); - } - }, - ), - - SizedBox(height: 10.0), - processing - ? Center(child: CircularProgressIndicator()) - : Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: Material( - elevation: 5.0, - borderRadius: BorderRadius.circular(30.0), - color: Theme.of(context).primaryColor, - child: MaterialButton( - onPressed: () async { - if (_formKey.currentState.validate()) { + Center( + child: SpinKitCircle(color: Colors.deepOrange), + ) + ]), + ); + } else { + return Scaffold( + appBar: AppBar( + title: Text(widget.note != null ? "Edit Note" : "Booking Details"), + elevation: 10.0, + backgroundColor: Colors.deepOrange, + ), + body: Container( + padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 50.0), + child: Form( + key: _formKey, + child: ListView( + shrinkWrap: false, + children: [ + TextFormField( + initialValue: '$_name', + decoration: InputDecoration( + hintText: 'Name', + fillColor: Colors.white, + filled: true, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 1.0), + borderRadius: BorderRadius.circular(10)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 3.0), + borderRadius: BorderRadius.circular(10))), + validator: (val) => val.isEmpty ? 'Enter your Name' : null, + onChanged: (val) { + setState(() => _name = val); + }), + SizedBox(height: 10), + TextFormField( + initialValue: _personalno, + decoration: InputDecoration( + hintText: 'Personal No.', + fillColor: Colors.white, + filled: true, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 1.0), + borderRadius: BorderRadius.circular(10)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 3.0), + borderRadius: BorderRadius.circular(10))), + validator: (val) => + val.isEmpty ? 'Enter your Personal No.' : null, + onChanged: (val) { + setState(() => _personalno = val); + }), + SizedBox(height: 10), + TextFormField( + decoration: InputDecoration( + hintText: 'Number of People', + fillColor: Colors.white, + filled: true, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 1.0), + borderRadius: BorderRadius.circular(10)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 3.0), + borderRadius: BorderRadius.circular(10))), + validator: (val) => int.tryParse(val) > 200 + ? 'Number of Peoples should be less than 200' + : null, + onChanged: (val) { + setState(() => numberOfPeople = int.tryParse(val)); + }), + const SizedBox(height: 10.0), + Container( + padding: EdgeInsets.all(10), + child: DropdownButton( + value: _value1, + items: [ + DropdownMenuItem( + child: Text("Yellow"), + value: 1, + ), + DropdownMenuItem( + child: Text("Red"), + value: 2, + ), + DropdownMenuItem(child: Text("Blue"), value: 3), + ], + onChanged: (value) { setState(() { - processing = true; + _value1 = value; }); - if(widget.note != null) { - await eventDBS.updateData(widget.note.id,{ - "Name": _name.text, - "personal no": _personalno.text, - "Lounge": _Lounge.text, - "event_date": widget.note.eventDate - }); - }else{ - await eventDBS.createItem(EventModel( - name: _name.text, - personalno: _personalno.text, - Lounge: _Lounge.text, - eventDate: _eventDate - )); - } - Navigator.pop(context); + }), + ), + const SizedBox(height: 10.0), + Container( + padding: EdgeInsets.all(10), + child: DropdownButton( + value: _value2, + items: [ + DropdownMenuItem( + child: Text("Slot 1"), + value: 1, + ), + DropdownMenuItem( + child: Text("Slot 2"), + value: 2, + ), + ], + onChanged: (value) { setState(() { - processing = false; + _value2 = value; + slot = value; }); - } - }, + }), + ), + const SizedBox(height: 10.0), + ListTile( + title: Text("Date (YYYY-MM-DD)"), + subtitle: Text( + "${_eventDate.year} - ${_eventDate.month} - ${_eventDate.day}"), + onTap: () async { + DateTime picked = await showDatePicker( + context: context, + initialDate: _eventDate, + firstDate: DateTime(_eventDate.year - 5), + lastDate: DateTime(_eventDate.year + 5)); + if (picked != null) { + setState(() { + _eventDate = picked; + }); + } + }, + ), + SizedBox(height: 10.0), + RaisedButton( + color: Colors.deepOrange, + padding: const EdgeInsets.symmetric( + horizontal: 40, vertical: 15), child: Text( - "Save", - style: style.copyWith( + 'Book Now', + style: GoogleFonts.inter( color: Colors.white, - fontWeight: FontWeight.bold), + fontWeight: FontWeight.w400, + fontSize: 25), ), - ), - ), - ), - ], + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + onPressed: () { + if (_formKey.currentState.validate()) { + confirmBooking(); + } + }), + ], + ), ), ), - ), - ); + ); + } } +} - @override - void dispose() { - _name.dispose(); - _personalno.dispose(); - _Lounge.dispose(); - super.dispose(); - } -} \ No newline at end of file +// class AddEventPage extends StatefulWidget { +// final EventModel note; + +// const AddEventPage({Key key, this.note}) : super(key: key); + +// @override +// _AddEventPageState createState() => _AddEventPageState(); +// } + +// class _AddEventPageState extends State { +// GoogleFonts.inter style = GoogleFonts.inter(fontFamily: 'Montserrat', fontSize: 20.0); +// TextEditingController _name; +// TextEditingController _personalno; +// TextEditingController _Lounge; +// DateTime _eventDate; +// final _formKey = GlobalKey(); +// final _key = GlobalKey(); +// bool processing; + +// @override +// void initState() { +// super.initState(); +// _name = TextEditingController(text: widget.note != null ? widget.note.name : ""); +// _personalno = TextEditingController(text: widget.note != null ? widget.note.personalno : ""); +// _Lounge = TextEditingController(text: widget.note != null ? widget.note.Lounge : ""); +// _eventDate = DateTime.now(); +// processing = false; +// } + +// @override +// Widget build(BuildContext context) { +// return Scaffold( +// appBar: AppBar( +// title: Text(widget.note != null ? "Edit Note" : "Booking Details"), +// elevation: 10.0, +// backgroundColor: Colors.deepOrange, +// ), +// key: _key, +// body: Form( +// key: _formKey, +// child: Container( +// alignment: Alignment.center, +// child: ListView( +// children: [ +// Padding( +// padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), +// child: TextFormField( +// controller: _name, +// validator: (value) => +// (value.isEmpty) ? "Please Enter Your Name" : null, +// style: style, +// decoration: InputDecoration( +// labelText: "Name", +// filled: true, +// fillColor: Colors.white, +// border: OutlineInputBorder(borderRadius: BorderRadius.circular(10))), +// ), +// ), +// Padding( +// padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), +// child: TextFormField( +// controller: _personalno, +// //minLines: 3, +// //maxLines: 5, +// validator: (value) => +// (value.isEmpty) ? "Please Enter Your Personal Number" : null, +// style: style, +// decoration: InputDecoration( +// labelText: "Personal No", +// border: OutlineInputBorder(borderRadius: BorderRadius.circular(10))), +// ), +// ), +// const SizedBox(height: 10.0), +// Padding( +// padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), +// child: TextFormField( +// controller: _Lounge, +// validator: (value) => +// (value.isEmpty) ? "Please Enter The Lounge you want to book (Yellow/Red/Blue) " : null, +// style: style, +// decoration: InputDecoration( +// labelText: "Lounge to book (Yellow/Red/Blue)", +// border: OutlineInputBorder(borderRadius: BorderRadius.circular(10))), +// ), +// ), +// const SizedBox(height: 10.0), +// ListTile( +// title: Text("Date (YYYY-MM-DD)"), +// subtitle: Text("${_eventDate.year} - ${_eventDate.month} - ${_eventDate.day}"), +// onTap: ()async{ +// DateTime picked = await showDatePicker(context: context, initialDate: _eventDate, firstDate: DateTime(_eventDate.year-5), lastDate: DateTime(_eventDate.year+5)); +// if(picked != null) { +// setState(() { +// _eventDate = picked; +// }); +// } +// }, +// ), + +// SizedBox(height: 10.0), +// processing +// ? Center(child: CircularProgressIndicator()) +// : Padding( +// padding: const EdgeInsets.symmetric(horizontal: 16.0), +// child: Material( +// elevation: 5.0, +// borderRadius: BorderRadius.circular(30.0), +// color: Theme.of(context).primaryColor, +// child: MaterialButton( +// onPressed: () async { +// if (_formKey.currentState.validate()) { +// setState(() { +// processing = true; +// }); +// if(widget.note != null) { +// await eventDBS.updateData(widget.note.id,{ +// "Name": _name.text, +// "personal no": _personalno.text, +// "Lounge": _Lounge.text, +// "event_date": widget.note.eventDate +// }); +// }else{ +// await eventDBS.createItem(EventModel( +// name: _name.text, +// personalno: _personalno.text, +// Lounge: _Lounge.text, +// eventDate: _eventDate +// )); +// } +// Navigator.pop(context); +// setState(() { +// processing = false; +// }); +// } +// }, +// child: Text( +// "Save", +// style: style.copyWith( +// color: Colors.white, +// fontWeight: FontWeight.bold), +// ), +// ), +// ), +// ), +// ], +// ), +// ), +// ), +// ); +// } + +// @override +// void dispose() { +// _name.dispose(); +// _personalno.dispose(); +// _Lounge.dispose(); +// super.dispose(); +// } +// } diff --git a/lib/pages/address.dart b/lib/pages/address.dart index 461b405..57f74ed 100644 --- a/lib/pages/address.dart +++ b/lib/pages/address.dart @@ -1,5 +1,6 @@ import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; import 'package:rcapp/services/database.dart'; class AddressForm extends StatefulWidget { @@ -99,7 +100,7 @@ class _AddressFormState extends State { color: Colors.deepOrange, width: 3.0), borderRadius: BorderRadius.circular(10))), validator: (val) => - val.isEmpty ? 'Please Enter Your Area' : null, + val.isEmpty ? 'Please Enter Your Area' : null, obscureText: false, onChanged: (val) { setState(() => _area = val); @@ -119,7 +120,7 @@ class _AddressFormState extends State { color: Colors.deepOrange, width: 3.0), borderRadius: BorderRadius.circular(10))), validator: (val) => - val.isEmpty ? 'Please Enter Your City' : null, + val.isEmpty ? 'Please Enter Your City' : null, obscureText: false, onChanged: (val) { setState(() => _city = val); @@ -139,7 +140,7 @@ class _AddressFormState extends State { color: Colors.deepOrange, width: 3.0), borderRadius: BorderRadius.circular(10))), validator: (val) => - val.isEmpty ? 'Please Enter Your Pincode' : null, + val.isEmpty ? 'Please Enter Your Pincode' : null, obscureText: false, onChanged: (val) { setState(() => _pincode = val); @@ -151,7 +152,7 @@ class _AddressFormState extends State { horizontal: 40, vertical: 15), child: Text( 'Save', - style: TextStyle( + style: GoogleFonts.inter( color: Colors.white, fontWeight: FontWeight.w400, fontSize: 25), @@ -179,9 +180,9 @@ class _AddressFormState extends State { .updateAddressData(user, _finaladdress); if (result != null) { setState(() => error = - 'could not upload address, please try again'); + 'could not upload address, please try again'); } else { - Navigator.pushNamed(context, '/Home'); + Navigator.popAndPushNamed(context, '/cart'); } } }, @@ -189,11 +190,11 @@ class _AddressFormState extends State { SizedBox(height: 20.0), Text( error, - style: TextStyle(color: Colors.red, fontSize: 14.0), + style: GoogleFonts.inter(color: Colors.red, fontSize: 14.0), ) ]), )), ), ); } -} \ No newline at end of file +} diff --git a/lib/pages/adminBooking.dart b/lib/pages/adminBooking.dart new file mode 100644 index 0000000..f7b8df5 --- /dev/null +++ b/lib/pages/adminBooking.dart @@ -0,0 +1,357 @@ +import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/models/event.dart'; +import 'package:rcapp/models/user.dart'; +import 'package:rcapp/services/database.dart'; +import 'package:rcapp/res/event_firestore_service.dart'; + +class AdminBooking extends StatefulWidget { + final EventModel note; + + const AdminBooking({Key key, this.note}) : super(key: key); + + @override + _AdminBookingState createState() => _AdminBookingState(); +} + +class _AdminBookingState extends State { + List bookings = []; + + String name = ''; + String number = ''; + String lounge = ''; + int slot; + int documentlength = 1; + String status = ''; + + void initialData() async { + var result = await Firestore.instance + .collection('BookingDetails') + .orderBy('_date', descending: true) + .getDocuments(); + setState(() { + documentlength = result.documents.length; + }); + result.documents.forEach((res) { + setState(() { + bookings.add(res.data); + }); + }); + } + + void rejectBookinHistory(int _eventDate, int index) async { + await Firestore.instance + .collection('BookingDetails') + .document('$_eventDate') + .delete(); + setState(() { + bookings.removeAt(index); + }); + } + + void confirmBooking( + String _name, + String _personalno, + String loungeColor, + int _slot, + int numberOfPeople, + int _eventDate, + Timestamp _bookingDate, + int index) async { + await Firestore.instance + .collection('BookingDetails') + .document('$_eventDate') + .updateData({'isConfirmed': true}); + setState(() { + bookings[index]["isConfirmed"] = true; + }); + if (widget.note != null) { + await eventDBS.updateData(widget.note.id, { + "name": _name, + "personal no": _personalno, + "Lounge": loungeColor, + "event_date": _bookingDate.toDate(), + "slot": _slot, + "numberOfPeople": numberOfPeople + }); + } else { + await eventDBS.createItem(EventModel( + name: _name, + personalno: _personalno, + Lounge: loungeColor, + eventDate: _bookingDate.toDate(), + slot: _slot, + numberOfPeople: numberOfPeople)); + } + } + + @override + void initState() { + // TODO: implement initState + super.initState(); + initialData(); + } + + @override + Widget build(BuildContext context) { + int orderNo = 110; + if (bookings.length == 0 && documentlength == 1) { + return Scaffold( + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitCircle(color: Colors.deepOrange, size: 65), + Text('Loading data') + ])), + ); + } else if (documentlength == 0) { + return Scaffold( + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.all_inclusive), + Text('No data') + ])), + ); + } else { + return Scaffold( + appBar: AppBar( + title: Text('Your Booking'), + backgroundColor: Colors.deepOrange, + ), + body: Container( + height: double.infinity, + decoration: BoxDecoration(color: Colors.grey[200]), + child: ListView.builder( + shrinkWrap: true, + itemCount: bookings.length, + itemBuilder: (_, index) { + orderNo = 110; + orderNo += index; + return ListTile( + contentPadding: EdgeInsets.all(10), + title: Column( + children: [ + SizedBox(height: 10.0), + Container( + padding: EdgeInsets.all(10), + height: 240.0, + width: 380.0, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(12.0)), + border: Border.all(color: Colors.grey)), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "#$orderNo", + style: GoogleFonts.inter( + color: Colors.deepOrange, fontSize: 22), + ), + Flexible( + child: Text('${bookings[index]["date"]}')), + ], + ), + SizedBox(height: 8), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + "Name : " + "${bookings[index]["name"]}", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400), + ), + ], + ), + SizedBox(height: 10), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + "Personal No. : " + + "${bookings[index]["number"]}", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400), + ), + ], + ), + SizedBox(height: 10), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + "Lounge : " + + "${bookings[index]["lounge"]}", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400), + ), + ], + ), + SizedBox(height: 10), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + 'Slot: ${bookings[index]["slot"]}', + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400), + ), + Text( + bookings[index]["isConfirmed"] + ? 'Status: Confirmed' + : 'Status: Not Confirmed', + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400)), + SizedBox(width: 30) + ], + ), + SizedBox(height: 10), + ]), + if (!bookings[index]["isConfirmed"]) ...[ + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Row(children: [ + Container( + height: 30, + width: 110, + child: FlatButton( + onPressed: () { + rejectBookinHistory( + bookings[index]["_date"], index); + }, + color: Colors.red[700], + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Icon( + Icons.close, + size: 17, + color: Colors.white, + ), + Text( + 'Reject', + style: GoogleFonts.inter( + color: Colors.white), + ), + ]), + shape: new RoundedRectangleBorder( + borderRadius: + new BorderRadius.circular(8.0)), + ), + ), + SizedBox(width: 5), + Container( + height: 30, + width: 110, + child: FlatButton( + onPressed: () { + confirmBooking( + bookings[index]["name"], + bookings[index]["number"], + bookings[index]["lounge"], + bookings[index]["slot"], + bookings[index]["numberOfPeople"], + bookings[index]["_date"], + bookings[index]["bookingDate"], + index); + }, + color: Colors.deepOrange, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Icon( + Icons.check, + size: 17, + color: Colors.white, + ), + Text( + 'Confirm', + style: GoogleFonts.inter( + color: Colors.white), + ), + ]), + shape: new RoundedRectangleBorder( + borderRadius: + new BorderRadius.circular(8.0)), + ), + ) + ]), + ]), + ] else ...[ + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + height: 30, + width: 100, + child: FlatButton( + onPressed: () { + rejectBookinHistory( + bookings[index]["_date"], index); + }, + color: Colors.red[700], + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Icon( + Icons.delete, + size: 17, + color: Colors.white, + ), + Text( + 'Delete', + style: GoogleFonts.inter( + color: Colors.white), + ), + ]), + shape: new RoundedRectangleBorder( + borderRadius: + new BorderRadius.circular(8.0)), + ), + ) + ]) + ], + SizedBox(height: 10), + ], + ), + ), + ], + ), + ); + }, + ), + ), + ); + } + } +} diff --git a/lib/pages/admin_order_confirm.dart b/lib/pages/admin_order_confirm.dart index 50ec54e..af36aaa 100644 --- a/lib/pages/admin_order_confirm.dart +++ b/lib/pages/admin_order_confirm.dart @@ -1,16 +1,10 @@ -import 'package:flutter/material.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; -import 'package:rcapp/models/user.dart'; -import 'package:rcapp/services/database.dart'; +import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; - -class ConfirmedOrderDetails { - String name; - String number; - int total; - String address; -} +import 'package:rcapp/models/user.dart'; class AdminOrder extends StatefulWidget { @override @@ -18,408 +12,504 @@ class AdminOrder extends StatefulWidget { } class _AdminOrderState extends State { + List orders = []; + List item = []; + List quantity = []; + List total = []; + + void confirmOrder(int index, int date) async { + // var docId = '${orders[index]["id"]}' + '${orders[index]["total"]}'; + await Firestore.instance + .collection('confirmedOrders') + .document('$date') + .updateData({"isConfirmed": true}); + setState(() { + orders[index]["isConfirmed"] = true; + }); + } + + void deleteOrder(int index, int date) async { + await Firestore.instance + .collection('confirmedOrders') + .document('$date') + .delete(); + setState(() { + orders.removeAt(index); + }); + } + + void initialData() async { + var result = await Firestore.instance + .collection('confirmedOrders') + .orderBy('_date', descending: true) + .getDocuments(); + result.documents.forEach((res) { + setState(() { + orders.add(res.data); + item.add(res.data["item"]); + quantity.add(res.data["quantity"]); + total.add(res.data["total"]); + }); + }); + } + + @override + void initState() { + // TODO: implement initState + super.initState(); + initialData(); + } + @override Widget build(BuildContext context) { - return StreamProvider>.value( - value: DatabaseService().orders, - child: Scaffold( + int orderNo = 110; + if (orders.length == 0 && item.length == 0 && quantity.length == 0) { + return Scaffold( + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitCircle(color: Colors.deepOrange, size: 65), + Text('Loading data') + ])), + ); + } else { + return Scaffold( appBar: AppBar( - title: Text('Orders'), + title: Text('Your Orders'), backgroundColor: Colors.deepOrange, ), - body: NewOrderList(), - ), - ); + body: Container( + height: double.infinity, + decoration: BoxDecoration(color: Colors.grey[200]), + child: ListView.builder( + shrinkWrap: true, + itemCount: orders.length, + itemBuilder: (_, index) { + orderNo = 110; + orderNo = orderNo + index; + return ListTile( + contentPadding: EdgeInsets.all(10), + title: Column( + children: [ + SizedBox(height: 10.0), + Container( + padding: EdgeInsets.all(10), + height: 190.0, + width: 370.0, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(12.0)), + border: Border.all(color: Colors.grey)), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Order No: $orderNo", + style: GoogleFonts.inter( + color: Colors.deepOrange, fontSize: 22), + ), + Flexible(child: Text('${orders[index]["date"]}')), + ], + ), + SizedBox(height: 8), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + "Name : " + "${orders[index]["name"]}", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400), + ), + ], + ), + SizedBox(height: 8), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + "Personal No : " + + "${orders[index]["number"]}", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400), + ), + ], + ), + SizedBox(height: 8), + if (orders[index]["isConfirmed"]) ...[ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + "Status: Confirmed", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400), + ), + ], + ), + ] else ...[ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + "Status: Not Confirmed", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400), + ), + ], + ), + ] + ]), + SizedBox(height: 15), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Cost : ₹" + "${orders[index]["total"]} ", + style: GoogleFonts.inter( + color: Colors.black, fontSize: 22), + ), + Row(children: [ + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + AdminOrderDetails( + total: orders[index] + ["total"], + orderNo: orderNo, + name: orders[index] + ["name"], + date: orders[index] + ["date"], + number: orders[index] + ["number"], + address: orders[index] + ["address"], + item: item[index], + quantity: + quantity[index]))); + }, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 5, vertical: 4), + decoration: BoxDecoration( + color: Colors.red[700], + border: + Border.all(color: Colors.black), + borderRadius: + BorderRadius.circular(5)), + child: Text('View', + style: GoogleFonts.inter( + color: Colors.white, + )), + ), + ), + SizedBox(width: 10), + if (!orders[index]["isConfirmed"]) ...[ + InkWell( + onTap: () { + confirmOrder( + index, orders[index]["_date"]); + }, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 5, vertical: 4), + decoration: BoxDecoration( + color: Colors.deepOrange, + border: + Border.all(color: Colors.black), + borderRadius: + BorderRadius.circular(5)), + child: Text('Confirm', + style: GoogleFonts.inter( + color: Colors.white, + )), + ), + ) + ] else ...[ + InkWell( + onTap: () { + deleteOrder( + index, orders[index]["_date"]); + }, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 5, vertical: 4), + decoration: BoxDecoration( + color: Colors.red, + border: + Border.all(color: Colors.black), + borderRadius: + BorderRadius.circular(5)), + child: Text('Delete', + style: GoogleFonts.inter( + color: Colors.white, + )), + ), + ) + ] + ]) + ]), + ], + ), + ), + ], + ), + ); + }, + ), + ), + ); + } } } -// class OrderList extends StatefulWidget { -// @override -// _OrderListState createState() => _OrderListState(); -// } - -// class _OrderListState extends State { -// Future _orderdata; - -// Future getOrders() async { -// var firestore = Firestore.instance; -// QuerySnapshot qn = -// await firestore.collection("confirmedOrders").getDocuments(); -// return qn.documents; -// } - -// @override -// void initState() { -// // TODO: implement initState -// super.initState(); -// _orderdata = getOrders(); -// } - -// changeConfirmation(bool isConfirmed, String number) async { -// try { -// // .getDocuments(); - -// if (isConfirmed) { -// await Firestore.instance -// .collection("confirmedOrders") -// .document(number) -// .delete(); -// } else { -// await Firestore.instance -// .collection("confirmedOrders") -// .document(number) -// .updateData({"isConfirmed": !isConfirmed}); -// } -// Navigator.pushReplacementNamed(context, '/adminorder'); -// } catch (e) { -// print(e.toString()); -// } -// } - -// @override -// Widget build(BuildContext context) { -// int orderNo = 111; -// return FutureBuilder( -// future: _orderdata, -// builder: (_, snapshot) { -// if (snapshot.connectionState == ConnectionState.waiting) { -// return Container( -// height: 600, -// child: Center( -// child: Column( -// mainAxisAlignment: MainAxisAlignment.center, -// children: [ -// Center( -// child: SpinKitCubeGrid( -// color: Colors.deepOrange, -// size: 38, -// ), -// ), -// Center( -// child: Text('LOADING', -// style: TextStyle(fontWeight: FontWeight.w500)), -// ) -// ]), -// ), -// ); -// } else if (snapshot.connectionState == ConnectionState.done) { -// return ListView.builder( -// shrinkWrap: true, -// itemCount: snapshot.data.length, -// itemBuilder: (_, index) { -// orderNo += index; -// var itemsName = snapshot.data[index].data["item"]; -// return ListTile( -// contentPadding: EdgeInsets.all(10), -// title: Column( -// children: [ -// SizedBox(height: 20.0), -// Container( -// alignment: Alignment.topLeft, -// height: 420.0, -// width: 370.0, -// margin: new EdgeInsets.only(left: 20.0, right: 20.0), -// decoration: BoxDecoration( -// color: Colors.tealAccent, -// borderRadius: BorderRadius.all(Radius.circular(20.0)), -// ), -// child: Column( -// children: [ -// Row( -// mainAxisAlignment: MainAxisAlignment.spaceBetween, -// children: [ -// Text( -// "Order Number : " + "$orderNo", -// style: TextStyle( -// color: Colors.deepOrange, fontSize: 22), -// ), -// Text("Aug 4th 2020"), -// ], -// ), -// Column( -// children: [ -// Row( -// mainAxisAlignment: -// MainAxisAlignment.spaceBetween, -// children: [ -// Padding( -// padding: const EdgeInsets.all(10), -// child: Text( -// "Name : " + -// "${snapshot.data[index].data["name"]}", -// style: TextStyle( -// color: Colors.black, fontSize: 15), -// ), -// ), -// ], -// ), -// Row( -// mainAxisAlignment: -// MainAxisAlignment.spaceBetween, -// children: [ -// Padding( -// padding: const EdgeInsets.all(10), -// child: Text( -// "Personal No. : " + -// "${snapshot.data[index].data["number"]}", -// style: TextStyle( -// color: Colors.black, fontSize: 15), -// ), -// ), -// ], -// ), -// Row( -// mainAxisAlignment: -// MainAxisAlignment.spaceBetween, -// children: [ -// Padding( -// padding: const EdgeInsets.all(10), -// child: Text( -// "Address : " + -// "${snapshot.data[index].data["address"]}", -// style: TextStyle( -// color: Colors.black, fontSize: 15), -// ), -// ), -// ], -// ), -// ], -// ), -// SizedBox(height: 30), -// Row( -// mainAxisAlignment: MainAxisAlignment.spaceAround, -// children: [ -// Padding( -// padding: const EdgeInsets.all(10), -// child: Text( -// "Cost : ₹" + -// "${snapshot.data[index].data["item"]}", -// style: TextStyle( -// color: Colors.black, fontSize: 22), -// ), -// ), -// FlatButton( -// onPressed: () { -// Navigator.pushNamed( -// context, '/orderdetails'); -// }, -// shape: new RoundedRectangleBorder( -// borderRadius: -// new BorderRadius.circular(10.0)), -// child: Text('View'), -// color: Colors.white, -// ), -// FlatButton( -// onPressed: () { -// changeConfirmation( -// snapshot -// .data[index].data["isConfirmed"], -// snapshot.data[index].data["number"]); -// }, -// shape: new RoundedRectangleBorder( -// borderRadius: -// new BorderRadius.circular(10.0)), -// child: Text( -// snapshot.data[index].data["isConfirmed"] -// ? 'Confirm' -// : 'Delete'), -// color: Colors.amber, -// ), -// ], -// ), -// ], -// ), -// ), -// ListView.builder( -// itemCount: itemsName.length, -// itemBuilder: (_, counter) { -// return ListTile(title: Text('${itemsName[counter]}')); -// }, -// ) -// ], -// ), -// ); -// }, -// ); -// } else if (snapshot.connectionState == ConnectionState.none) { -// return Column( -// mainAxisAlignment: MainAxisAlignment.center, -// children: [ -// Center( -// child: Icon( -// Icons.assessment, -// size: 50, -// ), -// ), -// Center( -// child: Text( -// 'No orders left...', -// style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), -// ), -// ) -// ], -// ); -// } -// }); -// // ); -// } -// } - -class NewOrderList extends StatefulWidget { +class AdminOrderData extends StatefulWidget { + List item; + List quantity; + AdminOrderData({this.item, this.quantity}); @override - NewOrderListState createState() => NewOrderListState(); + _AdminOrderDataState createState() => _AdminOrderDataState(); } -class NewOrderListState extends State { - changeConfirmation(bool isConfirmed, String number) async { - try { - // .getDocuments(); - - if (isConfirmed) { - await Firestore.instance - .collection("confirmedOrders") - .document(number) - .delete(); - } else { - await Firestore.instance - .collection("confirmedOrders") - .document(number) - .updateData({"isConfirmed": !isConfirmed}); - } - Navigator.pushReplacementNamed(context, '/adminorder'); - } catch (e) { - print(e.toString()); - } +class _AdminOrderDataState extends State { + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.fromLTRB(10, 10, 20, 0), + height: 390, + child: ListView.builder( + itemCount: widget.item.length, + itemBuilder: (_, index) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + child: Row(children: [ + Text('${index + 1}) '), + Text('${widget.item[index]} '), + ])), + Text('${widget.quantity[index]}'), + ], + ); + }), + ); } +} + +class AdminOrderDetails extends StatefulWidget { + final int orderNo; + final int total; + final String address; + final String name; + final String number; + final String date; + final List item; + final List quantity; + AdminOrderDetails({ + this.orderNo, + this.total, + this.address, + this.name, + this.number, + this.date, + this.item, + this.quantity, + }); + @override + _AdminOrderDetailsState createState() => _AdminOrderDetailsState(); +} +class _AdminOrderDetailsState extends State { @override Widget build(BuildContext context) { - final _orderList = Provider.of>(context) ?? []; - return ListView.builder( - shrinkWrap: true, - itemCount: _orderList.length, - itemBuilder: (_, index) { - // orderNo += index; - // var itemsName = _orderList[index].item; - return ListTile( - contentPadding: EdgeInsets.all(10), - title: Column( - children: [ - SizedBox(height: 20.0), - Container( - alignment: Alignment.topLeft, - height: 420.0, - width: 370.0, - margin: new EdgeInsets.only(left: 20.0, right: 20.0), - decoration: BoxDecoration( - color: Colors.tealAccent, - borderRadius: BorderRadius.all(Radius.circular(20.0)), - ), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "Order Number : " + "111", - style: - TextStyle(color: Colors.deepOrange, fontSize: 22), - ), - Text("Aug 4th 2020"), - ], + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Details'), + ), + body: Container( + padding: EdgeInsets.symmetric(vertical: 40, horizontal: 0), + decoration: BoxDecoration(color: Colors.grey[300]), + child: ListTile( + contentPadding: EdgeInsets.all(10), + title: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + border: Border.all(color: Colors.grey)), + child: Column( + children: [ + SizedBox(height: 20.0), + Container( + padding: EdgeInsets.all(10), + height: 500.0, + width: 370.0, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(15.0)), ), - Column( + child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Padding( - padding: const EdgeInsets.all(10), - child: Text( - "Name : " + - "${_orderList[index].name}", - style: TextStyle( - color: Colors.black, fontSize: 15), - ), + Text( + "#${widget.orderNo}", + style: GoogleFonts.inter( + color: Colors.deepOrange, fontSize: 22), ), + Flexible(child: Text('${widget.date}')), ], ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + SizedBox(height: 8), + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.all(10), - child: Text( - "Personal No. : " + - "${_orderList[index].number}", - style: TextStyle( - color: Colors.black, fontSize: 15), - ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "${widget.name}", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 22, + fontWeight: FontWeight.w500), + ), + ], ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Flexible( - child: Text( - "Address : " + - "${_orderList[index].address}", - style: TextStyle( - color: Colors.black, fontSize: 15), + SizedBox(height: 8), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Personal No. :", + style: GoogleFonts.inter( + color: Colors.grey, + fontSize: 18, + fontWeight: FontWeight.w500), ), - ), + SizedBox(height: 5), + Padding( + padding: EdgeInsets.fromLTRB(10, 0, 0, 0), + child: Text( + "${widget.number}", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400), + ), + ), + ], + ), + SizedBox(height: 8), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + "Delivered To : ", + style: GoogleFonts.inter( + color: Colors.grey, + fontSize: 18, + fontWeight: FontWeight.w500), + ), + Container( + width: 300, + child: Padding( + padding: + EdgeInsets.fromLTRB(10, 0, 0, 0), + child: Text( + "${widget.address}", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400), + ), + ), + ) + ]), + ], + ), ], ), - ], - ), - SizedBox(height: 30), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Flexible( - child: Text( - "Cost : ₹" + "${_orderList[index].total} " + "${_orderList[index].item}" + " : " +"${_orderList[index].qty}", - style: TextStyle(color: Colors.black, fontSize: 22), + SizedBox(height: 20), + Container( + alignment: Alignment.centerLeft, + child: Text( + 'Menu :', + style: GoogleFonts.inter( + color: Colors.grey, + fontSize: 18, + fontWeight: FontWeight.w500), + )), + Container( + padding: EdgeInsets.fromLTRB(10, 10, 0, 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text('Item Name', + style: GoogleFonts.inter( + fontSize: 20, + fontWeight: FontWeight.w400, + decoration: TextDecoration.underline)), + Text('Quantity', + style: GoogleFonts.inter( + fontSize: 20, + fontWeight: FontWeight.w400, + decoration: TextDecoration.underline)) + ], ), ), - FlatButton( - onPressed: () { - Navigator.pushNamed(context, '/orderdetails'); - }, - shape: new RoundedRectangleBorder( - borderRadius: new BorderRadius.circular(10.0)), - child: Text('View'), - color: Colors.white, - ), - FlatButton( - onPressed: () { - changeConfirmation( - _orderList[index].isConfirmed, - _orderList[index].number); - }, - shape: new RoundedRectangleBorder( - borderRadius: new BorderRadius.circular(10.0)), - child: Text(_orderList[index].isConfirmed - ? 'Confirm' - : 'Delete'), - color: Colors.amber, + Flexible( + child: AdminOrderData( + item: widget.item, quantity: widget.quantity), ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Cost : ", + style: GoogleFonts.inter( + color: Colors.black, fontSize: 22), + ), + Text( + "₹${widget.total} ", + style: GoogleFonts.inter( + color: Colors.black, fontSize: 22), + ), + ]), + SizedBox(height: 20), ], ), - ], - ), + ), + ], ), - // ListView.builder( - // itemCount: itemsName.length, - // itemBuilder: (_, counter) { - // return ListTile(title: Text('${itemsName[counter]}')); - // }, - // ) - ], + ), ), - ); - }, - ); + )); } -} \ No newline at end of file +} diff --git a/lib/pages/booking_calendar.dart b/lib/pages/booking_calendar.dart index 5056977..d9fa146 100644 --- a/lib/pages/booking_calendar.dart +++ b/lib/pages/booking_calendar.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; import 'package:rcapp/res/event_firestore_service.dart'; import 'package:rcapp/pages/add_event.dart'; import 'package:rcapp/pages/view_event.dart'; @@ -60,12 +61,13 @@ class _CalendarState extends State { children: [ TableCalendar( events: _events, - initialCalendarFormat: CalendarFormat.week, + initialCalendarFormat: CalendarFormat.month, calendarStyle: CalendarStyle( canEventMarkersOverflow: true, todayColor: Colors.orange, selectedColor: Theme.of(context).primaryColor, - todayStyle: TextStyle( + + todayStyle: GoogleFonts.inter( fontWeight: FontWeight.bold, fontSize: 18.0, color: Colors.white)), @@ -75,7 +77,7 @@ class _CalendarState extends State { color: Colors.orange, borderRadius: BorderRadius.circular(20.0), ), - formatButtonTextStyle: TextStyle(color: Colors.white), + formatButtonTextStyle: GoogleFonts.inter(color: Colors.white), formatButtonShowsNext: false, ), startingDayOfWeek: StartingDayOfWeek.monday, @@ -93,7 +95,7 @@ class _CalendarState extends State { borderRadius: BorderRadius.circular(10.0)), child: Text( date.day.toString(), - style: TextStyle(color: Colors.white), + style: GoogleFonts.inter(color: Colors.white), )), todayDayBuilder: (context, date, events) => Container( margin: const EdgeInsets.all(4.0), @@ -103,7 +105,7 @@ class _CalendarState extends State { borderRadius: BorderRadius.circular(10.0)), child: Text( date.day.toString(), - style: TextStyle(color: Colors.white), + style: GoogleFonts.inter(color: Colors.white), )), ), calendarController: _controller, @@ -127,7 +129,7 @@ class _CalendarState extends State { floatingActionButton: FloatingActionButton( backgroundColor: Colors.deepOrange, child: Text('Book', - style: TextStyle( + style: GoogleFonts.inter( color: Colors.white ),), onPressed: () => Navigator.pushNamed(context, '/add_event'), diff --git a/lib/pages/confirmOrder.dart b/lib/pages/confirmOrder.dart index ff65f1f..4a60aad 100644 --- a/lib/pages/confirmOrder.dart +++ b/lib/pages/confirmOrder.dart @@ -1,18 +1,11 @@ import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; -import 'package:flutter/material.dart'; -import 'package:rcapp/pages/Cart.dart'; -import 'package:rcapp/pages/order_cart.dart'; +import 'package:flutter/cupertino.dart'; import 'package:rcapp/pages/storeData.dart'; import 'package:rcapp/services/database.dart'; +import 'package:flutter/material.dart'; -class ConfirmOrder extends StatefulWidget { - @override - _ConfirmOrderState createState() => _ConfirmOrderState(); -} - -class _ConfirmOrderState extends State { - StoreData storeData = StoreData(); +StoreData storeData = StoreData(); int total = 0; int totalquantity = 1; List itemList = List(); @@ -22,19 +15,11 @@ class _ConfirmOrderState extends State { Map foodDetail = storeData.retrieveFoodDetails(); Map foodqtyDetail = storeData.retrieveQtyDetails(); - setState(() { - foodDetail.forEach((k, v) => total = total + v); + + foodDetail.forEach((k, v) => total = total + v * foodqtyDetail[k]); foodDetail.forEach((k, v) => totalquantity = totalquantity + v); foodDetail.forEach((key, value) => itemList.add(key)); foodqtyDetail.forEach((key, value) => quantityList.add(value)); - }); - } - - @override - void initState() { - // TODO: implement initState - super.initState(); - updateTotal(); } void confirmOrder() async { @@ -48,63 +33,109 @@ class _ConfirmOrderState extends State { var number = _dat.data["number"]; var address = _dat.data["address"]; - DatabaseService().confirmOrderofUser( - user.uid, userName, number, address, itemList, quantityList, total, false); + DatabaseService().confirmOrderofUser(user.uid, userName, number, address, + itemList, quantityList, total, false); storeData.resetStore(); updateTotal(); - Navigator.pushReplacementNamed(context, '/navigationbar'); + // Navigator.pushReplacementNamed(context, '/navigationbar'); } - @override - Widget build(BuildContext context) { - Map _foodNamePrice = storeData.retrieveFoodDetails(); - return Scaffold( - appBar: AppBar( - elevation: 10.0, - backgroundColor: Colors.deepOrange, - title: Text('Payment'), - ), - body: Column( - children: [ - SizedBox( - child: Row( - children: [ - IconButton( - icon: Icon(Icons.radio_button_checked), - color: Colors.green, - ), - Text('CASH ON DELIVERY') - ], - )), - /* InkWell( - onTap: () { - Navigator.pushNamed(context, '/wrapper'); - }, - child: SizedBox( - child: Row( - children: [ - IconButton(icon: Icon(Icons.radio_button_checked)), - Text('Sign In') - ], - )), - ), */ - SizedBox(height: 300), - SizedBox( - width: double.infinity, - height: 40, - child:ButtonTheme( - child: RaisedButton( - color: Colors.deepOrange, - onPressed: () { - confirmOrder(); - }, - child: Text('CONFIRM ORDER', style: TextStyle( - color: Colors.white, - ))), - ) - ), - ], - )); - } -} \ No newline at end of file + +// import 'package:cloud_firestore/cloud_firestore.dart'; +// import 'package:firebase_auth/firebase_auth.dart'; +// import 'package:flutter/material.dart'; +// import 'package:rcapp/pages/Cart.dart'; +// import 'package:rcapp/pages/order_cart.dart'; +// import 'package:rcapp/pages/storeData.dart'; +// import 'package:rcapp/services/database.dart'; + +// class ConfirmOrder extends StatefulWidget { +// @override +// _ConfirmOrderState createState() => _ConfirmOrderState(); +// } + +// class _ConfirmOrderState extends State { +// StoreData storeData = StoreData(); +// int total = 0; +// int totalquantity = 1; +// List itemList = List(); +// List quantityList = List(); + +// void updateTotal() { +// Map foodDetail = storeData.retrieveFoodDetails(); +// Map foodqtyDetail = storeData.retrieveQtyDetails(); + +// setState(() { +// foodDetail.forEach((k, v) => total = total + v * foodqtyDetail[k]); +// foodDetail.forEach((k, v) => totalquantity = totalquantity + v); +// foodDetail.forEach((key, value) => itemList.add(key)); +// foodqtyDetail.forEach((key, value) => quantityList.add(value)); +// }); +// } + +// @override +// void initState() { +// // TODO: implement initState +// super.initState(); +// updateTotal(); +// } + +// void confirmOrder() async { +// var user = await FirebaseAuth.instance.currentUser(); +// var _dat = await Firestore.instance +// .collection('userInfo') +// .document(user.uid) +// .get(); + +// var userName = _dat.data["name"]; +// var number = _dat.data["number"]; +// var address = _dat.data["address"]; + +// DatabaseService().confirmOrderofUser(user.uid, userName, number, address, +// itemList, quantityList, total, false); + +// storeData.resetStore(); +// updateTotal(); +// Navigator.pushReplacementNamed(context, '/navigationbar'); +// } + +// @override +// Widget build(BuildContext context) { +// Map _foodNamePrice = storeData.retrieveFoodDetails(); +// return Scaffold( +// appBar: AppBar( +// elevation: 10.0, +// backgroundColor: Colors.deepOrange, +// title: Text('Payment'), +// ), +// body: Column( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// SizedBox( +// child: Row( +// children: [ +// IconButton( +// icon: Icon(Icons.radio_button_checked), +// color: Colors.green, +// ), +// Text('CASH ON DELIVERY') +// ], +// )), +// // SizedBox(height: 300), +// SizedBox( +// width: double.infinity, +// height: 60, +// child: ButtonTheme( +// child: RaisedButton( +// color: Colors.deepOrange, +// onPressed: () { +// confirmOrder(); +// }, +// child: Text('CONFIRM ORDER', +// style: TextStyle(color: Colors.white, fontSize: 18))), +// )), +// ], +// )); +// } +// } diff --git a/lib/pages/loadingspinner.dart b/lib/pages/loadingspinner.dart new file mode 100644 index 0000000..803ee12 --- /dev/null +++ b/lib/pages/loadingspinner.dart @@ -0,0 +1,13 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; + + +class Loading extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + color: Colors.deepOrange[100], + child: Center(child: SpinKitCircle(color: Colors.deepOrange,size: 50),), + ); + } +} \ No newline at end of file diff --git a/lib/pages/mainhall.dart b/lib/pages/mainhall.dart new file mode 100644 index 0000000..201a5ca --- /dev/null +++ b/lib/pages/mainhall.dart @@ -0,0 +1,66 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; + + +class MainHall extends StatefulWidget { + @override + _MainHallState createState() => _MainHallState(); +} + +class _MainHallState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + elevation: 10.0, + backgroundColor: Colors.deepOrange, + title: Text('Main Recption Hall'), + ), + body: new Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Container( + height: 200.0, + width: double.infinity, + padding: EdgeInsets.symmetric(horizontal: 50, vertical: 30), + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 20), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.blue, + image: DecorationImage( + image: new AssetImage("assets/15.jpg"), + fit: BoxFit.fill)), + ), + ), + Text("The Main Banquet Hall", + style: GoogleFonts.inter( + color: Colors.redAccent, + fontSize: 30 + ),), + Container( + padding: EdgeInsets.all(10), + child:Text("Present in front of the entrance, the main Banquet Hall is for major occasion s and for big group gatherings, such as musical events, social gatherings, large office parties, marriage receptions, etc \n \n" + "Capacity - 250 people", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 20 + ),), + ), + SizedBox( + width: double.infinity, + height: 60, + child: ButtonTheme( + child: RaisedButton( + color: Colors.deepOrange, + onPressed: () { + Navigator.pushNamed(context, "/bookingcalendar"); + }, + child: Text('Book', + style: GoogleFonts.inter(color: Colors.white, fontSize: 18))), + )), + ], + ), + ); + } +} diff --git a/lib/pages/order_card.dart b/lib/pages/order_card.dart index 1f7be8e..dfc6b61 100644 --- a/lib/pages/order_card.dart +++ b/lib/pages/order_card.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:google_fonts/google_fonts.dart'; import 'package:rcapp/pages/Food.dart'; @@ -27,11 +28,11 @@ class _OrderCardState extends State { children: [ Text( "Total Amount:", - style: TextStyle(color: Colors.white, fontSize: 22), + style: GoogleFonts.inter(color: Colors.white, fontSize: 22), ), Text( "₹80", - style: TextStyle(color: Colors.white, fontSize: 22), + style: GoogleFonts.inter(color: Colors.white, fontSize: 22), ), ], ), diff --git a/lib/pages/order_cart.dart b/lib/pages/order_cart.dart index cfd48ae..1e3d353 100644 --- a/lib/pages/order_cart.dart +++ b/lib/pages/order_cart.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; class OrderCard extends StatefulWidget { int total; @@ -22,7 +23,7 @@ class _OrderCardState extends State { child: new Center( child: new Text( "Total Amount: " + '${widget.total}', - style: TextStyle(color: Colors.white, fontSize: 22), + style: GoogleFonts.inter(color: Colors.white, fontSize: 22), ))), ); } diff --git a/lib/pages/orderdetails.dart b/lib/pages/orderdetails.dart index b1ee63c..67c003d 100644 --- a/lib/pages/orderdetails.dart +++ b/lib/pages/orderdetails.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:google_fonts/google_fonts.dart'; class OrderDetails extends StatefulWidget { @@ -42,7 +43,7 @@ class _OrderDetailsState extends State { padding: const EdgeInsets.all(10), child: Text( "Order Number : " + "111", - style: TextStyle(color: Colors.deepOrange, fontSize: 22), + style: GoogleFonts.inter(color: Colors.deepOrange, fontSize: 22), ), ), Padding( @@ -60,7 +61,7 @@ class _OrderDetailsState extends State { padding: const EdgeInsets.all(10), child: Text( "Name : " + "Aswin Kumar Raju", - style: TextStyle(color: Colors.black, fontSize: 15), + style: GoogleFonts.inter(color: Colors.black, fontSize: 15), ), ), ], @@ -72,7 +73,7 @@ class _OrderDetailsState extends State { padding: const EdgeInsets.all(10), child: Text( "Personal No. : " + "999999", - style: TextStyle(color: Colors.black, fontSize: 15), + style: GoogleFonts.inter(color: Colors.black, fontSize: 15), ), ), ], diff --git a/lib/pages/previousBooking.dart b/lib/pages/previousBooking.dart new file mode 100644 index 0000000..16dd044 --- /dev/null +++ b/lib/pages/previousBooking.dart @@ -0,0 +1,194 @@ +import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/models/user.dart'; + +class PreviousBooking extends StatefulWidget { + @override + _PreviousBookingState createState() => _PreviousBookingState(); +} + +class _PreviousBookingState extends State { + List bookings = []; + + String name = ''; + String number = ''; + String lounge = ''; + int slot; + int documentlength = 1; + + void initialData() async { + var uid = (await FirebaseAuth.instance.currentUser()).uid; + var result = await Firestore.instance + .collection('BookingDetails') + .where('id', isEqualTo: uid) + .getDocuments(); + setState(() { + documentlength = result.documents.length; + }); + result.documents.forEach((res) { + setState(() { + bookings.add(res.data); + name = res.data["name"]; + number = res.data["number"]; + lounge = res.data["lounge"]; + slot = res.data["slot"]; + }); + }); + } + + @override + void initState() { + // TODO: implement initState + super.initState(); + initialData(); + } + + @override + Widget build(BuildContext context) { + int orderNo = 110; + if (bookings.length == 0 && documentlength == 1) { + return Scaffold( + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitCircle(color: Colors.deepOrange, size: 65), + Text('Loading data') + ])), + ); + } else if (documentlength == 0) { + return Scaffold( + appBar: AppBar( + title: Text('Your Booking', + style: GoogleFonts.inter(color: Colors.white)), + backgroundColor: Colors.deepOrange), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.all_inclusive), + Text('No data') + ])), + ); + } else { + return Scaffold( + appBar: AppBar( + title: Text('Your Booking'), + backgroundColor: Colors.deepOrange, + ), + body: Container( + height: double.infinity, + decoration: BoxDecoration(color: Colors.grey[200]), + child: ListView.builder( + shrinkWrap: true, + itemCount: bookings.length, + itemBuilder: (_, index) { + orderNo = 110; + orderNo += index; + return ListTile( + contentPadding: EdgeInsets.all(10), + title: Column( + children: [ + SizedBox(height: 10.0), + Container( + padding: EdgeInsets.all(10), + height: 220.0, + width: 370.0, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(12.0)), + border: Border.all(color: Colors.grey)), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "#$orderNo", + style: GoogleFonts.inter( + color: Colors.deepOrange, fontSize: 22), + ), + Flexible( + child: Text('${bookings[index]["date"]}')), + ], + ), + SizedBox(height: 8), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + "Name : " + "${bookings[index]["name"]}", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400), + ), + ], + ), + SizedBox(height: 10), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + "Personal No. : " + + "${bookings[index]["number"]}", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400), + ), + ], + ), + SizedBox(height: 10), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + "Lounge : " + + "${bookings[index]["lounge"]}", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400), + ), + ], + ), + SizedBox(height: 10), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + 'Slot: ${bookings[index]["slot"]}', + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400), + ), + ], + ), + ]), + SizedBox(height: 10), + ], + ), + ), + ], + ), + ); + }, + ), + ), + ); + } + } +} diff --git a/lib/pages/previousOrder.dart b/lib/pages/previousOrder.dart new file mode 100644 index 0000000..b3eed43 --- /dev/null +++ b/lib/pages/previousOrder.dart @@ -0,0 +1,427 @@ +import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:provider/provider.dart'; +import 'package:rcapp/models/user.dart'; + +class PreviousOrder extends StatefulWidget { + @override + _PreviousOrderState createState() => _PreviousOrderState(); +} + +class _PreviousOrderState extends State { + List orders = []; + List item = []; + List quantity = []; + List total = []; + var _result = 1; + + void initialData() async { + var uid = (await FirebaseAuth.instance.currentUser()).uid; + print(uid); + var result = await Firestore.instance + .collection('confirmedOrders') + .where('id', isEqualTo: uid) + .getDocuments(); + setState(() { + _result = result.documents.length; + }); + result.documents.forEach((res) { + setState(() { + orders.add(res.data); + item.add(res.data["item"]); + quantity.add(res.data["quantity"]); + total.add(res.data["total"]); + }); + }); + } + + @override + void initState() { + // TODO: implement initState + super.initState(); + initialData(); + } + + @override + Widget build(BuildContext context) { + int orderNo = 110; + if (orders.length == 0 && + item.length == 0 && + quantity.length == 0 && + _result == 1) { + return Scaffold( + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitCircle(color: Colors.deepOrange, size: 65), + Text('Loading data') + ])), + ); + } + if (_result == 0) { + return Scaffold( + appBar: AppBar( + title: Text('Previous Orders'), backgroundColor: Colors.deepOrange), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.add_shopping_cart, size: 40, color: Colors.deepOrange), + Text('No Previous Order Pending', + style: GoogleFonts.inter( + color: Colors.black, fontWeight: FontWeight.bold)) + ])), + ); + } else { + return Scaffold( + appBar: AppBar( + title: Text('Your Orders'), + backgroundColor: Colors.deepOrange, + ), + body: Container( + height: double.infinity, + decoration: BoxDecoration(color: Colors.grey[200]), + child: ListView.builder( + shrinkWrap: true, + itemCount: orders.length, + itemBuilder: (_, index) { + orderNo += index; + return ListTile( + contentPadding: EdgeInsets.all(10), + title: Column( + children: [ + SizedBox(height: 10.0), + Container( + padding: EdgeInsets.all(10), + height: 140.0, + width: 370.0, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(12.0)), + border: Border.all(color: Colors.grey)), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "#$orderNo", + style: GoogleFonts.inter( + color: Colors.deepOrange, fontSize: 22), + ), + Flexible(child: Text('${orders[index]["date"]}')), + ], + ), + SizedBox(height: 8), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + "Name : " + "${orders[index]["name"]}", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400), + ), + ], + ), + SizedBox(height: 8), + ]), + SizedBox(height: 15), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Cost : ₹" + "${orders[index]["total"]} ", + style: GoogleFonts.inter( + color: Colors.black, fontSize: 22), + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + PreviousOrderDetails( + total: orders[index] + ["total"], + orderNo: orderNo, + name: orders[index]["name"], + date: orders[index]["date"], + number: orders[index] + ["number"], + address: orders[index] + ["address"], + item: item[index], + quantity: + quantity[index]))); + }, + child: Container( + child: Text('Know More', + style: GoogleFonts.inter( + color: Colors.deepOrange, + decoration: + TextDecoration.underline)), + ), + ) + ]), + ], + ), + ), + ], + ), + ); + }, + ), + ), + ); + } + } +} + +class OrderData extends StatefulWidget { + List item; + List quantity; + OrderData({this.item, this.quantity}); + @override + _OrderDataState createState() => _OrderDataState(); +} + +class _OrderDataState extends State { + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.fromLTRB(10, 10, 20, 0), + height: 290, + child: ListView.builder( + itemCount: widget.item.length, + itemBuilder: (_, index) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + child: Row(children: [ + Text('${index + 1}) '), + Text('${widget.item[index]} '), + ])), + Text('${widget.quantity[index]}'), + ], + ); + }), + ); + } +} + +class PreviousOrderDetails extends StatefulWidget { + final int orderNo; + final int total; + final String address; + final String name; + final String number; + final String date; + final List item; + final List quantity; + PreviousOrderDetails( + {this.orderNo, + this.total, + this.address, + this.name, + this.number, + this.date, + this.item, + this.quantity}); + @override + _PreviousOrderDetailsState createState() => _PreviousOrderDetailsState(); +} + +class _PreviousOrderDetailsState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Details'), + ), + body: Container( + padding: EdgeInsets.symmetric(vertical: 40, horizontal: 0), + decoration: BoxDecoration(color: Colors.grey[300]), + child: ListTile( + contentPadding: EdgeInsets.all(10), + title: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + border: Border.all(color: Colors.grey)), + child: Column( + children: [ + SizedBox(height: 20.0), + Container( + padding: EdgeInsets.all(10), + height: 500.0, + width: 370.0, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(15.0)), + ), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "#${widget.orderNo}", + style: GoogleFonts.inter( + color: Colors.deepOrange, fontSize: 22), + ), + Flexible(child: Text('${widget.date}')), + ], + ), + SizedBox(height: 8), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "${widget.name}", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 22, + fontWeight: FontWeight.w500), + ), + ], + ), + SizedBox(height: 8), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Personal No. :", + style: GoogleFonts.inter( + color: Colors.grey, + fontSize: 18, + fontWeight: FontWeight.w500), + ), + SizedBox(height: 5), + Padding( + padding: EdgeInsets.fromLTRB(10, 0, 0, 0), + child: Text( + "${widget.number}", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400), + ), + ), + ], + ), + SizedBox(height: 8), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + "Delivered To : ", + style: GoogleFonts.inter( + color: Colors.grey, + fontSize: 18, + fontWeight: FontWeight.w500), + ), + Container( + width: 300, + child: Padding( + padding: + EdgeInsets.fromLTRB(10, 0, 0, 0), + child: Text( + "${widget.address}", + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.w400), + ), + ), + ) + ]), + ], + ), + ], + ), + SizedBox(height: 20), + Container( + alignment: Alignment.centerLeft, + child: Text( + 'Menu :', + style: GoogleFonts.inter( + color: Colors.grey, + fontSize: 18, + fontWeight: FontWeight.w500), + )), + Container( + padding: EdgeInsets.fromLTRB(10, 10, 0, 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text('Item Name', + style: GoogleFonts.inter( + fontSize: 20, + fontWeight: FontWeight.w400, + decoration: TextDecoration.underline)), + Text('Quantity', + style: GoogleFonts.inter( + fontSize: 20, + fontWeight: FontWeight.w400, + decoration: TextDecoration.underline)) + ], + ), + ), + Flexible( + child: OrderData( + item: widget.item, quantity: widget.quantity), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Cost : ₹" + "${widget.total} ", + style: GoogleFonts.inter( + color: Colors.black, fontSize: 22), + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + PreviousOrderDetails())); + }, + child: Container( + child: Text('Know More', + style: GoogleFonts.inter( + color: Colors.deepOrange, + decoration: + TextDecoration.underline)), + ), + ) + ]), + ], + ), + ), + ], + ), + ), + ), + )); + } +} diff --git a/lib/pages/uploadAvatar.dart b/lib/pages/uploadAvatar.dart new file mode 100644 index 0000000..e091180 --- /dev/null +++ b/lib/pages/uploadAvatar.dart @@ -0,0 +1,255 @@ +import 'dart:io'; +import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:firebase_storage/firebase_storage.dart'; +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:path/path.dart'; +import 'package:rcapp/services/database.dart'; + +class UploadAvatar extends StatefulWidget { + @override + _UploadAvatarState createState() => _UploadAvatarState(); +} + +class _UploadAvatarState extends State { + @override + Widget build(BuildContext context) { + return ImageCapture(); + } +} + +class ImageCapture extends StatefulWidget { + @override + _ImageCaptureState createState() => _ImageCaptureState(); +} + +class _ImageCaptureState extends State { + File _pickedImage; + + bool showOptions = false; + + String food = ''; + int price = 0; + + bool exists = false; + var userId = ''; + + void initialize() async { + var uid = (await FirebaseAuth.instance.currentUser()).uid; + var result = + await Firestore.instance.collection('userInfo').document(uid).get(); + var _avatar = result.data["avatar"]; + print(_avatar); + setState(() { + userId = uid; + }); + if (_avatar != "") { + setState(() { + exists = true; + }); + } + } + + void _pickImage(ImageSource source) async { + final pickedImageFile = await ImagePicker.pickImage( + source: source, imageQuality: 100, maxWidth: 350, maxHeight: 280); + setState(() { + _pickedImage = pickedImageFile; + }); + } + + void _clear() { + setState(() => _pickedImage = null); + } + + void toggle() { + setState(() { + showOptions = !showOptions; + }); + } + + @override + void initState() { + // TODO: implement initState + super.initState(); + initialize(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Upload Image'), + ), + bottomNavigationBar: BottomAppBar( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + if (showOptions == true) ...[ + Container( + height: 90, + child: Column(children: [ + IconButton( + iconSize: 40, + color: Colors.deepOrange, + icon: Icon(Icons.photo_library), + onPressed: () => _pickImage(ImageSource.gallery), + ), + Text( + 'File Explorer', + style: GoogleFonts.inter( + color: Colors.black, fontWeight: FontWeight.bold), + ) + ]), + ), + Container( + height: 90, + child: Column(children: [ + IconButton( + iconSize: 40, + color: Colors.deepOrange, + icon: Icon(Icons.camera), + onPressed: () => _pickImage(ImageSource.camera), + ), + Text( + 'Camera', + style: GoogleFonts.inter( + color: Colors.black, fontWeight: FontWeight.bold), + ) + ]), + ) + ] + ], + ), + ), + body: SingleChildScrollView( + child: Container( + padding: EdgeInsets.fromLTRB(40, 10, 40, 0), + child: Column(children: [ + if (_pickedImage == null) ...[ + Center( + child: Container( + width: 320, + height: 250, + decoration: BoxDecoration( + border: + Border.all(color: Colors.deepOrange, width: 2.0), + borderRadius: BorderRadius.circular(10)), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + IconButton( + onPressed: () { + toggle(); + }, + iconSize: 40, + icon: Icon(Icons.image), + ), + SizedBox(height: 5), + Text(exists ? 'Update Profile Pic' : 'Add Profile Pic', + style: GoogleFonts.inter( + fontWeight: FontWeight.w500, fontSize: 20)) + ], + ), + ), + ), + ], + if (_pickedImage != null) ...[ + Image.file(_pickedImage), + SizedBox(height: 10), + Uploader(file: _pickedImage, userId: userId), + SizedBox(height: 20), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + FlatButton( + color: Colors.deepOrange, + child: Icon(Icons.refresh), + onPressed: _clear, + shape: new RoundedRectangleBorder( + borderRadius: new BorderRadius.circular(10.0)), + ), + ]), + ] + ]), + ), + )); + } +} + +class Uploader extends StatefulWidget { + final userId; + final file; + Uploader({this.file, this.userId}); + @override + _UploaderState createState() => _UploaderState(); +} + +class _UploaderState extends State { + final FirebaseStorage _storage = + FirebaseStorage(storageBucket: 'gs://rcapp-de25c.appspot.com'); + // StorageUploadTask _uploadTask; + + var _uploadTask; + + final DatabaseService _todayMenuUploader = DatabaseService(); + + Future _startUpload() async { + try { + final ref = FirebaseStorage.instance + .ref() + .child('userAvatar') + .child('${DateTime.now()}.jpg'); + + setState(() { + _uploadTask = ref.putFile(widget.file); + }); + + await ref.putFile(widget.file).onComplete; + + final url = await ref.getDownloadURL(); + + _todayMenuUploader.updateAvatar(url, widget.userId); + print(url); + } catch (e) { + print(e.toString()); + } + } + + @override + Widget build(BuildContext context) { + if (_uploadTask != null) { + return StreamBuilder( + stream: _uploadTask.events, + builder: (context, snapshot) { + var event = snapshot?.data?.snapshot; + double progressPercent = + event != null ? event.bytesTransferred / event.totalByteCount : 0; + + return Column(children: [ + if (_uploadTask.isComplete) Text("Uploaded To Database"), + LinearProgressIndicator(value: progressPercent), + Text('${(progressPercent * 100).toStringAsFixed(2)} %') + ]); + }, + ); + } else { + return FlatButton.icon( + onPressed: () { + _startUpload(); + }, + icon: Icon(Icons.cloud_upload), + label: Text( + 'Save Data To List', + style: GoogleFonts.inter(fontSize: 17), + ), + shape: new RoundedRectangleBorder( + borderRadius: new BorderRadius.circular(10.0)), + color: Colors.deepOrange, + ); + } + } +} diff --git a/lib/pages/uploadImage.dart b/lib/pages/uploadImage.dart new file mode 100644 index 0000000..6c94830 --- /dev/null +++ b/lib/pages/uploadImage.dart @@ -0,0 +1,298 @@ +import 'dart:io'; +import 'package:firebase_storage/firebase_storage.dart'; +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:path/path.dart'; +import 'package:rcapp/services/database.dart'; + +class UploadImage extends StatefulWidget { + @override + _UploadImageState createState() => _UploadImageState(); +} + +class _UploadImageState extends State { + @override + Widget build(BuildContext context) { + return ImageCapture(); + } +} + +class ImageCapture extends StatefulWidget { + @override + _ImageCaptureState createState() => _ImageCaptureState(); +} + +class _ImageCaptureState extends State { + File _pickedImage; + + bool showOptions = false; + + String food = ''; + int price = 0; + + void _pickImage(ImageSource source) async { + final pickedImageFile = await ImagePicker.pickImage( + source: source, imageQuality: 100, maxWidth: 350, maxHeight: 280); + setState(() { + _pickedImage = pickedImageFile; + }); + } + + void _clear() { + setState(() => _pickedImage = null); + } + + void toggle() { + setState(() { + showOptions = !showOptions; + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Upload Image'), + ), + bottomNavigationBar: BottomAppBar( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + if (showOptions == true) ...[ + Container( + height: 90, + child: Column(children: [ + IconButton( + iconSize: 40, + color: Colors.deepOrange, + icon: Icon(Icons.photo_library), + onPressed: () => _pickImage(ImageSource.gallery), + ), + Text( + 'File Explorer', + style: GoogleFonts.inter( + color: Colors.black, fontWeight: FontWeight.bold), + ) + ]), + ), + Container( + height: 90, + child: Column(children: [ + IconButton( + iconSize: 40, + color: Colors.deepOrange, + icon: Icon(Icons.camera), + onPressed: () => _pickImage(ImageSource.camera), + ), + Text('Camera', + style: GoogleFonts.inter( + color: Colors.black, fontWeight: FontWeight.bold)) + ]), + ) + ] + ], + ), + ), + body: SingleChildScrollView( + child: Container( + padding: EdgeInsets.fromLTRB(40, 10, 40, 0), + child: Column(children: [ + if (_pickedImage == null) ...[ + Center( + child: Container( + width: 320, + height: 250, + decoration: BoxDecoration( + border: + Border.all(color: Colors.deepOrange, width: 2.0), + borderRadius: BorderRadius.circular(10)), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + IconButton( + onPressed: () { + toggle(); + }, + iconSize: 40, + icon: Icon(Icons.image), + ), + SizedBox(height: 5), + Text('ADD AN IMAGE', + style: GoogleFonts.inter( + fontWeight: FontWeight.w500, fontSize: 20)) + ], + ), + ), + ), + SizedBox(height: 10), + TextFormField( + decoration: InputDecoration( + hintText: 'Food Name', + fillColor: Colors.white, + filled: true, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 1.0), + borderRadius: BorderRadius.circular(10)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 3.0), + borderRadius: BorderRadius.circular(10))), + validator: (val) => val.isEmpty ? 'Enter Food Name' : null, + onChanged: (val) { + setState(() => food = val); + }), + SizedBox(height: 10), + TextFormField( + decoration: InputDecoration( + hintText: 'Food Price', + fillColor: Colors.white, + filled: true, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 1.0), + borderRadius: BorderRadius.circular(10)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 3.0), + borderRadius: BorderRadius.circular(10))), + validator: (val) => val.isEmpty ? 'Enter Food Price' : null, + onChanged: (val) { + setState(() => price = int.tryParse(val)); + }) + ], + if (_pickedImage != null) ...[ + Image.file(_pickedImage), + SizedBox(height: 10), + TextFormField( + decoration: InputDecoration( + hintText: 'Food Name', + fillColor: Colors.white, + filled: true, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 1.0), + borderRadius: BorderRadius.circular(10)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 3.0), + borderRadius: BorderRadius.circular(10))), + validator: (val) => val.isEmpty ? 'Enter Food Name' : null, + onChanged: (val) { + setState(() => food = val); + }), + SizedBox(height: 10), + TextFormField( + decoration: InputDecoration( + hintText: 'Food Price', + fillColor: Colors.white, + filled: true, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 1.0), + borderRadius: BorderRadius.circular(10)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 3.0), + borderRadius: BorderRadius.circular(10))), + validator: (val) => val.isEmpty ? 'Enter Food Price' : null, + onChanged: (val) { + setState(() => price = int.tryParse(val)); + }), + SizedBox(height: 10), + Uploader(file: _pickedImage, food: food, price: price), + SizedBox(height: 20), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + FlatButton( + color: Colors.deepOrange, + child: Icon(Icons.refresh), + onPressed: _clear, + shape: new RoundedRectangleBorder( + borderRadius: new BorderRadius.circular(10.0)), + ), + ]), + ] + ]), + ), + )); + } +} + +class Uploader extends StatefulWidget { + final food; + final price; + final file; + Uploader({this.file, this.food, this.price}); + @override + _UploaderState createState() => _UploaderState(); +} + +class _UploaderState extends State { + final FirebaseStorage _storage = + FirebaseStorage(storageBucket: 'gs://rcapp-de25c.appspot.com'); + // StorageUploadTask _uploadTask; + + var _uploadTask; + + final DatabaseService _todayMenuUploader = DatabaseService(); + + Future _startUpload(String food, int price) async { + try { + final ref = FirebaseStorage.instance + .ref() + .child('today_menu') + .child('${DateTime.now()}.jpg'); + + setState(() { + _uploadTask = ref.putFile(widget.file); + }); + + await ref.putFile(widget.file).onComplete; + + final url = await ref.getDownloadURL(); + + _todayMenuUploader.updateTodayMenu(food, price, url); + print(url); + } catch (e) { + print(e.toString()); + } + } + + @override + Widget build(BuildContext context) { + if (_uploadTask != null) { + return StreamBuilder( + stream: _uploadTask.events, + builder: (context, snapshot) { + var event = snapshot?.data?.snapshot; + double progressPercent = + event != null ? event.bytesTransferred / event.totalByteCount : 0; + + return Column(children: [ + if (_uploadTask.isComplete) Text("Uploaded To Database"), + LinearProgressIndicator(value: progressPercent), + Text('${(progressPercent * 100).toStringAsFixed(2)} %') + ]); + }, + ); + } else { + return FlatButton.icon( + onPressed: () { + _startUpload(widget.food, widget.price); + }, + icon: Icon(Icons.cloud_upload), + label: Text( + 'Save Data To List', + style: GoogleFonts.inter(fontSize: 17), + ), + shape: new RoundedRectangleBorder( + borderRadius: new BorderRadius.circular(10.0)), + color: Colors.deepOrange, + ); + } + } +} diff --git a/lib/pages/uploadPdf.dart b/lib/pages/uploadPdf.dart new file mode 100644 index 0000000..82c6bae --- /dev/null +++ b/lib/pages/uploadPdf.dart @@ -0,0 +1,279 @@ +import 'dart:io'; +import 'package:file_picker/file_picker.dart'; +import 'package:firebase_storage/firebase_storage.dart'; +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:path/path.dart'; +import 'package:rcapp/services/database.dart'; + +class UploadPdf extends StatefulWidget { + @override + _UploadPdfState createState() => _UploadPdfState(); +} + +class _UploadPdfState extends State { + @override + Widget build(BuildContext context) { + return PdfCapture(); + } +} + +class PdfCapture extends StatefulWidget { + @override + _PdfCaptureState createState() => _PdfCaptureState(); +} + +class _PdfCaptureState extends State { + File _pickedPdf; + + bool showOptions = false; + + String title = ''; + String subtitle = ''; + + void _pickPdf() async { + File pickedPdfFile = await FilePicker.getFile( + type: FileType.custom, allowedExtensions: ['pdf']); + setState(() { + _pickedPdf = pickedPdfFile; + }); + } + + void _clear() { + setState(() => _pickedPdf = null); + } + + void toggle() { + setState(() { + showOptions = !showOptions; + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange, + title: Text('Upload Pdf'), + ), + bottomNavigationBar: BottomAppBar( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + if (showOptions == true) ...[ + Container( + height: 90, + child: Column(children: [ + IconButton( + iconSize: 40, + color: Colors.deepOrange, + icon: Icon(Icons.photo_library), + onPressed: () => _pickPdf(), + ), + Text('File Explorer', + style: GoogleFonts.inter( + color: Colors.black, fontWeight: FontWeight.bold)) + ]), + ), + ] + ], + ), + ), + body: SingleChildScrollView( + child: Container( + padding: EdgeInsets.fromLTRB(40, 10, 40, 0), + child: Column(children: [ + if (_pickedPdf == null) ...[ + Center( + child: Container( + width: 320, + height: 250, + decoration: BoxDecoration( + border: + Border.all(color: Colors.deepOrange, width: 2.0), + borderRadius: BorderRadius.circular(10)), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + IconButton( + onPressed: () { + toggle(); + }, + iconSize: 40, + icon: Icon(Icons.file_upload), + ), + SizedBox(height: 5), + Text('Click to Add Pdf', + style: GoogleFonts.inter( + fontWeight: FontWeight.w500, fontSize: 20)) + ], + ), + ), + ), + SizedBox(height: 10), + TextFormField( + decoration: InputDecoration( + hintText: 'Title', + fillColor: Colors.white, + filled: true, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 1.0), + borderRadius: BorderRadius.circular(10)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 3.0), + borderRadius: BorderRadius.circular(10))), + validator: (val) => val.isEmpty ? 'Enter Title' : null, + onChanged: (val) { + setState(() => title = val); + }), + SizedBox(height: 10), + TextFormField( + decoration: InputDecoration( + hintText: 'Sub-Title', + fillColor: Colors.white, + filled: true, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 1.0), + borderRadius: BorderRadius.circular(10)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 3.0), + borderRadius: BorderRadius.circular(10))), + validator: (val) => val.isEmpty ? 'Enter subtitle' : null, + onChanged: (val) { + setState(() => subtitle = val); + }) + ], + if (_pickedPdf != null) ...[ + // Image.file(_pickedPdf), + SizedBox(height: 10), + TextFormField( + decoration: InputDecoration( + hintText: 'Title', + fillColor: Colors.white, + filled: true, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 1.0), + borderRadius: BorderRadius.circular(10)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 3.0), + borderRadius: BorderRadius.circular(10))), + validator: (val) => val.isEmpty ? 'Enter Title' : null, + onChanged: (val) { + setState(() => title = val); + }), + SizedBox(height: 10), + TextFormField( + decoration: InputDecoration( + hintText: 'Sub-Title', + fillColor: Colors.white, + filled: true, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 1.0), + borderRadius: BorderRadius.circular(10)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.deepOrange, width: 3.0), + borderRadius: BorderRadius.circular(10))), + validator: (val) => val.isEmpty ? 'Enter Subtitle' : null, + onChanged: (val) { + setState(() => subtitle = val); + }), + SizedBox(height: 10), + Uploader(file: _pickedPdf, title: title, subtitle: subtitle), + SizedBox(height: 20), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + FlatButton( + color: Colors.deepOrange, + child: Icon(Icons.refresh), + onPressed: _clear, + shape: new RoundedRectangleBorder( + borderRadius: new BorderRadius.circular(10.0)), + ), + ]), + ] + ]), + ), + )); + } +} + +class Uploader extends StatefulWidget { + final title; + final subtitle; + final file; + Uploader({this.file, this.title, this.subtitle}); + @override + _UploaderState createState() => _UploaderState(); +} + +class _UploaderState extends State { + var _uploadTask; + + final DatabaseService _pdfUploader = DatabaseService(); + + Future _startUpload(String title, String subtitle) async { + try { + final ref = FirebaseStorage.instance + .ref() + .child('pdf_store') + .child('${DateTime.now()}.pdf'); + + setState(() { + _uploadTask = ref.putFile(widget.file); + }); + + await ref.putFile(widget.file).onComplete; + + final url = await ref.getDownloadURL(); + + _pdfUploader.updatePdf(title, subtitle, url); + print(url); + } catch (e) { + print(e.toString()); + } + } + + @override + Widget build(BuildContext context) { + if (_uploadTask != null) { + return StreamBuilder( + stream: _uploadTask.events, + builder: (context, snapshot) { + var event = snapshot?.data?.snapshot; + double progressPercent = + event != null ? event.bytesTransferred / event.totalByteCount : 0; + + return Column(children: [ + if (_uploadTask.isComplete) Text("Uploaded To Database"), + LinearProgressIndicator(value: progressPercent), + Text('${(progressPercent * 100).toStringAsFixed(2)} %') + ]); + }, + ); + } else { + return FlatButton.icon( + onPressed: () { + _startUpload(widget.title, widget.subtitle); + }, + icon: Icon(Icons.cloud_upload), + label: Text( + 'Save Data To List', + style: GoogleFonts.inter(fontSize: 17), + ), + shape: new RoundedRectangleBorder( + borderRadius: new BorderRadius.circular(10.0)), + color: Colors.deepOrange, + ); + } + } +} diff --git a/lib/pages/view_event.dart b/lib/pages/view_event.dart index 6df9c5f..0df4e1c 100644 --- a/lib/pages/view_event.dart +++ b/lib/pages/view_event.dart @@ -7,7 +7,7 @@ class EventDetailsPage extends StatelessWidget { const EventDetailsPage({Key key, this.event}) : super(key: key); @override - Widget build(BuildContext context){ + Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('My booking'), @@ -18,15 +18,19 @@ class EventDetailsPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text("Room : " + event.Lounge, style: Theme.of(context).textTheme.display1,), + Text( + "Room : " + event.Lounge, + style: Theme.of(context).textTheme.display1, + ), SizedBox(height: 20.0), Text("Booked by : " + event.name), SizedBox(height: 20.0), Text("Personal Number : " + event.personalno), - + SizedBox(height: 20.0), + Text("Slot : " + "${event.slot}"), ], ), ), ); } -} \ No newline at end of file +} diff --git a/lib/pages/welcome.dart b/lib/pages/welcome.dart index 47f713d..aac9167 100644 --- a/lib/pages/welcome.dart +++ b/lib/pages/welcome.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; - +import 'package:google_fonts/google_fonts.dart'; class welcome extends StatefulWidget { @override @@ -9,8 +9,8 @@ class welcome extends StatefulWidget { class _welcomeState extends State { @override Widget build(BuildContext context) { - Future.delayed(Duration(seconds: 3), () { - Navigator.pushNamed(context, '/wrapper'); + Future.delayed(Duration(seconds: 1), () { + Navigator.popAndPushNamed(context, '/wrapper'); }); return Scaffold( backgroundColor: Colors.deepOrange, @@ -18,11 +18,11 @@ class _welcomeState extends State { children: [ Image(image: AssetImage('assets/rclogo.png')), Center( - child:Text( + child: Text( 'ROURKELA CLUB', - style: TextStyle( + style: GoogleFonts.inter( color: Colors.white, - fontSize: 45.0, + fontSize: 40.0, ), ), ), @@ -30,4 +30,4 @@ class _welcomeState extends State { ), ); } -} \ No newline at end of file +} diff --git a/lib/pages/wrapper.dart b/lib/pages/wrapper.dart index c7e6469..62c80c4 100644 --- a/lib/pages/wrapper.dart +++ b/lib/pages/wrapper.dart @@ -1,11 +1,10 @@ import 'package:flutter/material.dart'; import 'package:rcapp/models/user.dart'; +import 'package:rcapp/pages/CategoryMenuList/All_Menu.dart'; import 'package:rcapp/pages/Authenticate.dart'; -import 'package:rcapp/pages/Home.dart'; import 'package:rcapp/pages/NavigationBar.dart'; import 'package:provider/provider.dart'; - class Wrapper extends StatelessWidget { @override Widget build(BuildContext context) { diff --git a/lib/res/event_firestore_service.dart b/lib/res/event_firestore_service.dart index 7cffe5d..8e5399a 100644 --- a/lib/res/event_firestore_service.dart +++ b/lib/res/event_firestore_service.dart @@ -1,4 +1,6 @@ import 'package:firebase_helpers/firebase_helpers.dart'; import '../models/event.dart'; -DatabaseService eventDBS = DatabaseService("events",fromDS: (id,data) => EventModel.fromDS(id, data), toMap:(event) => event.toMap()); +DatabaseService eventDBS = DatabaseService("events", + fromDS: (id, data) => EventModel.fromDS(id, data), + toMap: (event) => event.toMap()); diff --git a/lib/services/auth.dart b/lib/services/auth.dart index bea23b7..9ed8d9d 100644 --- a/lib/services/auth.dart +++ b/lib/services/auth.dart @@ -55,17 +55,17 @@ class AuthService { } //register with email and pass - Future registerWithEmailAndPassword( - String name, bool isAuth, String number, String email, String password) async { + Future registerWithEmailAndPassword(String name, bool isAuth, String number, String password) async { try { + String numemail = number + "@gmail.com"; AuthResult result = await _auth.createUserWithEmailAndPassword( - email: (email), password: (password)); + email: (numemail), password: (password)); FirebaseUser user = result.user; - //create a new document for the user with the uid await DatabaseService(uid: user.uid).updateUserData('chowmin', 100, 10); - await DatabaseService(uid: user.uid).updateUserInfo('$name', isAuth, '$number'); + await DatabaseService(uid: user.uid) + .updateUserInfo('$name', isAuth, '$number'); var userkaabba = user.uid; var dat = await Firestore.instance @@ -76,7 +76,6 @@ class AuthService { isAdminglobal = dat; - return _userFromFirebaseUser(user); } catch (e) { print(e.toString()); @@ -93,4 +92,4 @@ class AuthService { return null; } } -} \ No newline at end of file +} diff --git a/lib/services/database.dart b/lib/services/database.dart index 1a54a96..29949a0 100644 --- a/lib/services/database.dart +++ b/lib/services/database.dart @@ -1,4 +1,5 @@ import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:firebase_auth/firebase_auth.dart'; import 'package:rcapp/models/category.dart'; import 'package:rcapp/models/user.dart'; @@ -8,16 +9,52 @@ class DatabaseService { //collection reference final CollectionReference foodCollection = - Firestore.instance.collection('food'); + Firestore.instance.collection('food'); + //collection reference to different categories of food from firestore + final CollectionReference allmenufoods = + Firestore.instance.collection('All_Menu'); + final CollectionReference breakfastmenufoods = + Firestore.instance.collection('Breakfast'); final CollectionReference chinesefoods = - Firestore.instance.collection('chinese'); + Firestore.instance.collection('Chinese'); + final CollectionReference biryanifoods = + Firestore.instance.collection('Biryani'); + final CollectionReference starterfoods = + Firestore.instance.collection('Starter'); + final CollectionReference maincoursefoods = + Firestore.instance.collection('MainCourse'); + final CollectionReference breadsfoods = + Firestore.instance.collection('Breads'); + final CollectionReference tandoorifoods = + Firestore.instance.collection('Tandoori'); + final CollectionReference friedriceandnoodlesfoods = + Firestore.instance.collection('FriedRice_Noodles'); + final CollectionReference rollfoods = Firestore.instance.collection('Roll'); + final CollectionReference pizzafoods = Firestore.instance.collection('Pizza'); + final CollectionReference snacksfoods = + Firestore.instance.collection('Snacks'); + final CollectionReference sandwichfoods = + Firestore.instance.collection('Sandwich'); + final CollectionReference burgerfoods = + Firestore.instance.collection('Burger'); + final CollectionReference pastafoods = Firestore.instance.collection('Pasta'); + final CollectionReference soupfoods = Firestore.instance.collection('Soup'); + final CollectionReference accompanimentfoods = + Firestore.instance.collection('Accompaniments'); + final CollectionReference today_Menu_Data = + Firestore.instance.collection('Today_Menu_Data'); + final CollectionReference notice_pdfData = + Firestore.instance.collection('noticeBoard'); final CollectionReference userInfo = - Firestore.instance.collection('userInfo'); + Firestore.instance.collection('userInfo'); final CollectionReference confirmedOrders = - Firestore.instance.collection('confirmedOrders'); + Firestore.instance.collection('confirmedOrders'); + + final CollectionReference bookingDetails = + Firestore.instance.collection('BookingDetails'); Future updateUserInfo(String name, bool isAdmin, String number) async { return await userInfo.document(uid).setData({ @@ -25,6 +62,7 @@ class DatabaseService { 'isAdmin': isAdmin, 'number': number, 'address': '', + 'avatar': '', }); } @@ -40,9 +78,44 @@ class DatabaseService { return await userInfo.document(id).updateData({'address': address}); } + Future updateTodayMenu(String food, int price, String url) async { + return await today_Menu_Data + .document() + .setData({'category_menu': food, 'itemprice': price, 'imagepath': url}); + } + + Future updateAvatar(String url, String uid) async { + return await userInfo.document(uid).updateData({'avatar': url}); + } + + Future updatePdf(String title, String subtitle, String url) async { + return await notice_pdfData + .document() + .setData({'title': title, 'subtitle': subtitle, 'downloadLink': url}); + } + + Future bookDetails(String id, String name, String number, int numberOfPeople, + String lounge, int slot, DateTime date) async { + var _date = DateTime.now().toUtc().millisecondsSinceEpoch; + return await bookingDetails.document('$_date').setData({ + '_date': _date, + 'id': id, + 'name': name, + 'isConfirmed': false, + 'number': number, + 'numberOfPeople': numberOfPeople, + 'lounge': lounge, + 'slot': slot, + 'date': '${date.day}' + '/' + '${date.month}' + '/' + '${date.year}', + 'bookingDate': date + }); + } + Future confirmOrderofUser(String id, String name, String number, String address, List item, List qty, int total, bool isConfirmed) async { - return await confirmedOrders.document(number).setData({ + // var docId = '$id' + '$total'; + var _date = DateTime.now().toUtc().millisecondsSinceEpoch; + return await confirmedOrders.document('$_date').setData({ 'id': id, 'name': name, 'number': number, @@ -50,7 +123,13 @@ class DatabaseService { 'item': item, 'quantity': qty, 'total': total, - 'isConfirmed': isConfirmed + 'isConfirmed': isConfirmed, + '_date': _date, + 'date': '${DateTime.now().day}' + + '/' + + '${DateTime.now().month}' + + '/' + + '${DateTime.now().year}' }); } @@ -60,6 +139,8 @@ class DatabaseService { return qn.documents; } + //Database related to categories of food data retrieval form firebase + List _menuListFromSnapshot(QuerySnapshot snapshot) { return snapshot.documents.map((doc) { return Menu( @@ -69,6 +150,172 @@ class DatabaseService { }).toList(); } + List _maincoursemenuListFromSnapshot(QuerySnapshot snapshot) { + return snapshot.documents.map((doc) { + return MainCourseMenu( + item: doc.data["item"] ?? '', + price: doc.data["price"] ?? 0, + searchIndex: doc.data["search_index"] ?? ''); + }).toList(); + } + + List _chinesemenuListFromSnapshot(QuerySnapshot snapshot) { + return snapshot.documents.map((doc) { + return ChineseMenu( + item: doc.data["item"] ?? '', + price: doc.data["price"] ?? 0, + searchIndex: doc.data["search_index"] ?? ''); + }).toList(); + } + + List _startermenuListFromSnapshot(QuerySnapshot snapshot) { + return snapshot.documents.map((doc) { + return StarterMenu( + item: doc.data["item"] ?? '', + price: doc.data["price"] ?? 0, + searchIndex: doc.data["search_index"] ?? ''); + }).toList(); + } + + List _biryanimenuListFromSnapshot(QuerySnapshot snapshot) { + return snapshot.documents.map((doc) { + return BiryaniMenu( + item: doc.data["item"] ?? '', + price: doc.data["price"] ?? 0, + searchIndex: doc.data["search_index"] ?? ''); + }).toList(); + } + + // List _paneermenuListFromSnapshot(QuerySnapshot snapshot) { + // return snapshot.documents.map((doc) { + // return PaneerMenu( + // item: doc.data["item"] ?? '', + // price: doc.data["price"] ?? 0, + // searchIndex: doc.data["search_index"] ?? ''); + // }).toList(); + // } + + List _breadmenuListFromSnapshot(QuerySnapshot snapshot) { + return snapshot.documents.map((doc) { + return BreadMenu( + item: doc.data["item"] ?? '', + price: doc.data["price"] ?? 0, + searchIndex: doc.data["search_index"] ?? ''); + }).toList(); + } + + List _tandoorimenuListFromSnapshot(QuerySnapshot snapshot) { + return snapshot.documents.map((doc) { + return TandooriMenu( + item: doc.data["item"] ?? '', + price: doc.data["price"] ?? 0, + searchIndex: doc.data["search_index"] ?? ''); + }).toList(); + } + + List _firedriceandnoodlesmenuListFromSnapshot( + QuerySnapshot snapshot) { + return snapshot.documents.map((doc) { + return FriedRiceAndNoodlesMenu( + item: doc.data["item"] ?? '', + price: doc.data["price"] ?? 0, + searchIndex: doc.data["search_index"] ?? ''); + }).toList(); + } + + List _rollmenuListFromSnapshot(QuerySnapshot snapshot) { + return snapshot.documents.map((doc) { + return RollMenu( + item: doc.data["item"] ?? '', + price: doc.data["price"] ?? 0, + searchIndex: doc.data["search_index"] ?? ''); + }).toList(); + } + + List _sandwichmenuListFromSnapshot(QuerySnapshot snapshot) { + return snapshot.documents.map((doc) { + return SandwichMenu( + item: doc.data["item"] ?? '', + price: doc.data["price"] ?? 0, + searchIndex: doc.data["search_index"] ?? ''); + }).toList(); + } + + List _pizzamenuListFromSnapshot(QuerySnapshot snapshot) { + return snapshot.documents.map((doc) { + return PizzaMenu( + item: doc.data["item"] ?? '', + price: doc.data["price"] ?? 0, + searchIndex: doc.data["search_index"] ?? ''); + }).toList(); + } + + List _snackmenuListFromSnapshot(QuerySnapshot snapshot) { + return snapshot.documents.map((doc) { + return SnacksMenu( + item: doc.data["item"] ?? '', + price: doc.data["price"] ?? 0, + searchIndex: doc.data["search_index"] ?? ''); + }).toList(); + } + + List _burgermenuListFromSnapshot(QuerySnapshot snapshot) { + return snapshot.documents.map((doc) { + return BurgerMenu( + item: doc.data["item"] ?? '', + price: doc.data["price"] ?? 0, + searchIndex: doc.data["search_index"] ?? ''); + }).toList(); + } + + List _pastamenuListFromSnapshot(QuerySnapshot snapshot) { + return snapshot.documents.map((doc) { + return PastaMenu( + item: doc.data["item"] ?? '', + price: doc.data["price"] ?? 0, + searchIndex: doc.data["search_index"] ?? ''); + }).toList(); + } + + List _soupmenuListFromSnapshot(QuerySnapshot snapshot) { + return snapshot.documents.map((doc) { + return SoupMenu( + item: doc.data["item"] ?? '', + price: doc.data["price"] ?? 0, + searchIndex: doc.data["search_index"] ?? ''); + }).toList(); + } + + List _accompanimentmenuListFromSnapshot( + QuerySnapshot snapshot) { + return snapshot.documents.map((doc) { + return AccompanimentMenu( + item: doc.data["item"] ?? '', + price: doc.data["price"] ?? 0, + searchIndex: doc.data["search_index"] ?? ''); + }).toList(); + } + + List _breakfastmenuListFromSnapshot(QuerySnapshot snapshot) { + return snapshot.documents.map((doc) { + return BreakfastMenu( + item: doc.data["item"] ?? '', + price: doc.data["price"] ?? 0, + searchIndex: doc.data["search_index"] ?? ''); + }).toList(); + } + + List _todaymenuListFromSnapshot(QuerySnapshot snapshot) { + return snapshot.documents.map((doc) { + return Today_Menu( + imagepath: doc.data["imagepath"] ?? '', + price: doc.data["itemprice"] ?? 0, + category_menu: doc.data["category_menu"] ?? ''); + }).toList(); + } + + //Storing order data of customers as confirmedOrders in firesore_database + List _orderListFromSnapshot(QuerySnapshot snapshot) { return snapshot.documents.map((doc) { return Orders( @@ -77,17 +324,91 @@ class DatabaseService { name: doc.data["name"] ?? '', number: doc.data["number"] ?? '', address: doc.data["address"] ?? '', - total: doc.data["total"]?? 0, - isConfirmed: doc.data["isConfirmed"]?? false); + total: doc.data["total"] ?? 0, + isConfirmed: doc.data["isConfirmed"] ?? false); }).toList(); } - Stream> get chinese { - return chinesefoods.snapshots().map(_menuListFromSnapshot); + //Stream provider for different categories of food in widgets + + Stream> get chinese { + return chinesefoods.snapshots().map(_chinesemenuListFromSnapshot); + } + + Stream> get maincourse { + return maincoursefoods.snapshots().map(_maincoursemenuListFromSnapshot); + } + + Stream> get biryani { + return biryanifoods.snapshots().map(_biryanimenuListFromSnapshot); + } + + Stream> get starter { + return starterfoods.snapshots().map(_startermenuListFromSnapshot); + } + + Stream> get allmenu { + return starterfoods.snapshots().map(_menuListFromSnapshot); + } + + Stream> get breadmenu { + return breadsfoods.snapshots().map(_breadmenuListFromSnapshot); + } + + Stream> get tandoorimenu { + return tandoorifoods.snapshots().map(_tandoorimenuListFromSnapshot); + } + + Stream> get friedriceandmenu { + return friedriceandnoodlesfoods + .snapshots() + .map(_firedriceandnoodlesmenuListFromSnapshot); + } + + Stream> get rollmenu { + return rollfoods.snapshots().map(_rollmenuListFromSnapshot); + } + + Stream> get sandwichmenu { + return sandwichfoods.snapshots().map(_sandwichmenuListFromSnapshot); + } + + Stream> get pizzamenu { + return pizzafoods.snapshots().map(_pizzamenuListFromSnapshot); + } + + Stream> get snackmenu { + return snacksfoods.snapshots().map(_snackmenuListFromSnapshot); + } + + Stream> get burgermenu { + return burgerfoods.snapshots().map(_burgermenuListFromSnapshot); + } + + Stream> get pastamenu { + return pastafoods.snapshots().map(_pastamenuListFromSnapshot); + } + + Stream> get soupmenu { + return soupfoods.snapshots().map(_soupmenuListFromSnapshot); + } + + Stream> get accompanimentmenu { + return accompanimentfoods + .snapshots() + .map(_accompanimentmenuListFromSnapshot); + } + + Stream> get breakfastmenu { + return accompanimentfoods.snapshots().map(_breakfastmenuListFromSnapshot); + } + + Stream> get today_Menu { + return today_Menu_Data.snapshots().map(_todaymenuListFromSnapshot); } final CollectionReference menuorders = - Firestore.instance.collection("confirmedOrders"); + Firestore.instance.collection("confirmedOrders"); Stream> get orders { return menuorders.snapshots().map(_orderListFromSnapshot); @@ -100,6 +421,6 @@ Future menu; Future getPosts(numb) async { var firestore = Firestore.instance; QuerySnapshot qn = - await firestore.collection('${menucategories[numb]}').getDocuments(); + await firestore.collection('${menucategories[numb]}').getDocuments(); return qn.documents; -} \ No newline at end of file +} diff --git a/pubspec.lock b/pubspec.lock index 8cdb32a..8953a39 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,13 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + animated_text_kit: + dependency: "direct main" + description: + name: animated_text_kit + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0" async: dependency: transitive description: @@ -78,6 +85,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.14.13" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.5" cupertino_icons: dependency: "direct main" description: @@ -99,6 +120,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "5.2.1" + file_picker: + dependency: "direct main" + description: + name: file_picker + url: "https://pub.dartlang.org" + source: hosted + version: "1.13.3" + file_picker_platform_interface: + dependency: transitive + description: + name: file_picker_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.1" firebase: dependency: transitive description: @@ -156,17 +198,38 @@ packages: source: hosted version: "0.1.11" firebase_storage: - dependency: transitive + dependency: "direct main" description: name: firebase_storage url: "https://pub.dartlang.org" source: hosted version: "3.1.6" + flushbar: + dependency: "direct main" + description: + name: flushbar + url: "https://pub.dartlang.org" + source: hosted + version: "1.10.4" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_downloader: + dependency: "direct main" + description: + name: flutter_downloader + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.0" + flutter_full_pdf_viewer: + dependency: "direct main" + description: + name: flutter_full_pdf_viewer + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.6" flutter_plugin_android_lifecycle: dependency: transitive description: @@ -191,6 +254,13 @@ packages: description: flutter source: sdk version: "0.0.0" + focused_menu: + dependency: "direct main" + description: + name: focused_menu + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" geolocator: dependency: "direct main" description: @@ -205,6 +275,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.4" + google_fonts: + dependency: "direct main" + description: + name: google_fonts + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" google_maps_flutter: dependency: "direct main" description: @@ -220,7 +297,7 @@ packages: source: hosted version: "1.0.4" http: - dependency: transitive + dependency: "direct main" description: name: http url: "https://pub.dartlang.org" @@ -233,6 +310,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.1.4" + image_picker: + dependency: "direct main" + description: + name: image_picker + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.7+7" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" intl: dependency: transitive description: @@ -275,6 +366,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.7.0" + path_provider: + dependency: "direct main" + description: + name: path_provider + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.14" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+2" + path_provider_macos: + dependency: transitive + description: + name: path_provider_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.4+3" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" pedantic: dependency: transitive description: @@ -282,6 +401,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.9.0" + permission_handler: + dependency: "direct main" + description: + name: permission_handler + url: "https://pub.dartlang.org" + source: hosted + version: "5.0.1+1" + permission_handler_platform_interface: + dependency: transitive + description: + name: permission_handler_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" + platform: + dependency: transitive + description: + name: platform + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.1" plugin_platform_interface: dependency: transitive description: @@ -289,6 +429,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.2" + process: + dependency: transitive + description: + name: process + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.13" provider: dependency: "direct dev" description: @@ -385,6 +532,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.8" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.0" sdks: dart: ">=2.9.0-14.0.dev <3.0.0" - flutter: ">=1.16.3 <2.0.0" + flutter: ">=1.17.0 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 1aa4f4a..0fde91d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -32,6 +32,26 @@ dependencies: google_maps_flutter: ^0.5.30 geolocator: ^5.3.2+2 flutter_spinkit: ^4.1.2 + flushbar: ^1.10.4 + http: ^0.12.2 + flutter_full_pdf_viewer: ^1.0.6 + image_picker: ^0.6.7+7 + firebase_storage: ^3.0.7 + focused_menu: ^1.0.1 + file_picker: ^1.13.3 + permission_handler: ^5.0.1+1 + flutter_downloader: ^1.5.0 + path_provider: ^1.6.14 + animated_text_kit: ^2.2.0 + google_fonts: ^1.1.0 + + + + + + + + @@ -43,8 +63,6 @@ dev_dependencies: flutter_test: sdk: flutter provider: ^3.1.0 - firebase_auth: ^0.16.1 - cloud_firestore: ^0.13.7