diff --git a/lib/main.dart b/lib/main.dart deleted file mode 100644 index 3c77b2e..0000000 --- a/lib/main.dart +++ /dev/null @@ -1,64 +0,0 @@ -import 'package:firebase_auth/firebase_auth.dart'; -import 'package:firebase_core/firebase_core.dart'; -import 'package:ye_airways/provider/destination_provider.dart'; -import 'package:ye_airways/provider/flight_provider.dart'; -import 'package:ye_airways/route.dart'; -import 'package:ye_airways/shared/components/components.dart'; -import 'package:ye_airways/shared/components/constantes.dart'; -import 'package:ye_airways/shared/network/local/cache_helper.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:ye_airways/view/screen/splash/splash_page.dart'; - -void main(List args) async { - WidgetsFlutterBinding.ensureInitialized(); - CacheHlper.init(); - await Firebase.initializeApp(); - uid = CacheHlper.getData(key: "uid") ?? ""; - print("User = ${uid != "" ? uid : Null} =-=-=-=-=-=-=-=-=-=-"); - - runApp(const MyApp()); -} - -final navigatorKey = GlobalKey(); - -class MyApp extends StatelessWidget { - const MyApp({super.key}); - - // This widget is the root of the application. - @override - Widget build(BuildContext context) { - return MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (context) => DestinationProvider(), - ), - ChangeNotifierProvider(create: (context) => FlightProvider()), - ], - child: MaterialApp( - navigatorKey: navigatorKey, - home: StreamBuilder( - stream: FirebaseAuth.instance.authStateChanges(), - builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { - return const Center( - child: CircularProgressIndicator( - color: Colors.white, - )); - } else if (snapshot.hasError) { - return showSnackBar(context, "Something went wrong"); - } else if (!snapshot.hasData && uid == "") { - // return VerifyEmailPage(); - return const SplashHome(); // home() OR verify email - } else { - return const SplashHome(); - } - }, - ), - debugShowCheckedModeBanner: false, - title: 'YEMENAI Reservation System', - routes: routes, - ), - ); - } -} diff --git a/lib/model/des_argument.dart b/lib/model/des_argument.dart deleted file mode 100644 index be9d018..0000000 --- a/lib/model/des_argument.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:ye_airways/model/des_model.dart'; - -class DestinationArgument { - HN_DestinatioModel destinationArg; - DestinationArgument(this.destinationArg); -} diff --git a/lib/model/des_model.dart b/lib/model/des_model.dart deleted file mode 100644 index aacc9a4..0000000 --- a/lib/model/des_model.dart +++ /dev/null @@ -1,109 +0,0 @@ -import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:ye_airways/model/des_seats.dart'; - -class HN_DestinatioModel { - String? desId; - String? from; - String? placename; - String? to; - String? description; - double? rating; - dynamic desImage; - List? desOtherImages = []; - String? desType; -// flights & tickets - double? ticketPrice; - String? date; - String? time; - String? duration; - String? flightNumber; - List? seats = []; - List? userSeats = []; - - // - - HN_DestinatioModel( - {this.desId, - this.to, - this.placename, - this.from, - this.description, - this.rating = 3.5, - this.ticketPrice, - this.desImage, - this.desOtherImages, - this.desType, - this.date, - this.time, - this.duration, - this.flightNumber, - this.seats, - this.userSeats}); - - HN_DestinatioModel.fromJson(Map json) { - desId = json["desId"]; - to = json["to"]; - placename = json["placename"]; - from = json["from"]; - description = json["description"]; - rating = json["rating"]; - ticketPrice = json["ticketPrice"]; - desImage = json["desImage"]; - desOtherImages = json["desOtherImages"] ?? []; - desType = json["desType"]; - date = json["date"]; - time = json["time"]; - duration = json["duration"]; - flightNumber = json["flightNumber"]; - if (json["seats"] != null) { - seats = []; - json["seats"].forEach((seat) { - seats!.add(SeatModel.fromJson(seat)); - }); - } - } - HN_DestinatioModel.fromDocument(DocumentSnapshot doc) { - final data = doc.data()! as Map; - desId = data["desId"]; - to = data["to"]; - placename = data["placename"]; - from = data["from"]; - description = data["description"]; - rating = data["rating"]; - ticketPrice = data["ticketPrice"]; - desImage = data["desImage"]; - desOtherImages = data["desOtherImages"] ?? []; - - desType = data["desType"]; - date = data["date"]; - time = data["time"]; - duration = data["duration"]; - flightNumber = data["flightNumber"]; - if (data["seats"] != null) { - seats = []; - data["seats"].forEach((seat) { - seats!.add(SeatModel.fromJson(seat)); - }); - } - } - - Map toJson() { - return { - "desId": desId, - "to": to, - "placename": placename, - "from": from, - "description": description, - "rating": rating, - 'ticketPrice': ticketPrice, - "desImage": desImage, - "desOtherImages": desOtherImages ?? [], - "desType": desType, - "date": date, - "time": time, - "duration": duration, - "flightNumber": flightNumber, - "seats": seats != null ? seats!.map((e) => e.toJson()).toList() : [] - }; - } -} diff --git a/lib/model/des_seats.dart b/lib/model/des_seats.dart deleted file mode 100644 index 0185118..0000000 --- a/lib/model/des_seats.dart +++ /dev/null @@ -1,23 +0,0 @@ -class SeatModel { - String? desId; - String? column; - String? userId; - String? state; - - SeatModel({this.desId, this.column, this.userId, this.state}); - - SeatModel.fromJson(Map json) { - desId = json["desId"] ?? ""; - column = json["column"] ?? ""; - userId = json["userId"] ?? ""; - state = json["state"] ?? "0"; - } - Map toJson() { - return { - "desId": desId ?? "", - "column": column ?? "", - "userId": userId ?? "", - "state": state ?? "0" - }; - } -} diff --git a/lib/model/hn_user_model.dart b/lib/model/hn_user_model.dart deleted file mode 100644 index 922c466..0000000 --- a/lib/model/hn_user_model.dart +++ /dev/null @@ -1,73 +0,0 @@ -import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:ye_airways/model/ticket_ye_model.dart'; - -class HN_UserModel { - String? id; - String? userName; - String? email; - String? pass; - String? phone; - String? imgPath; - - double? balance; - - HN_UserModel({ - this.id, - this.userName, - this.email, - this.pass, - this.phone, - this.imgPath, - // this.usersCart, - // this.quantityCart, - this.balance, - // this.location, - // this.mytickets, - }); - - HN_UserModel.fromJson(Map json) { - id = json["id"]; - userName = json["userName"]; - email = json["email"]; - pass = json["pass"]; - phone = json["phone"]; - imgPath = json["imgPath"]; - // usersCart = json["usersCart"] ?? []; - // quantityCart = json["quantityCart"]; - // - balance = json["balance"]; - // location = json["location"]; - // mytickets = json["mytickets"] ?? []; - } - HN_UserModel.fromDocument(DocumentSnapshot doc) { - final data = doc.data()! as Map; - id = data["id"]; - userName = data["userName"]; - email = data["email"]; - pass = data["pass"]; - phone = data["phone"]; - imgPath = data["imgPath"]; - // usersCart = data["usersCart"] ?? []; - // quantityCart = data["quantityCart"]; - // - balance = data["balance"]; - // location = data["location"]; - // mytickets = data["mytickets"] ?? []; - } - - Map toJson() { - return { - "id": id, - "userName": userName, - "email": email, - "pass": pass, - 'phone': phone, - "imgPath": imgPath, - "balance": balance, - // "usersCart": usersCart ?? [], - // "quantityCart": quantityCart, - // "location": location, - // "mytickets": mytickets ?? [], - }; - } -} diff --git a/lib/model/ticket_ye_model.dart b/lib/model/ticket_ye_model.dart deleted file mode 100644 index 90a7ec0..0000000 --- a/lib/model/ticket_ye_model.dart +++ /dev/null @@ -1,187 +0,0 @@ -import 'package:cloud_firestore/cloud_firestore.dart'; - -class Ticket_YE_Model { - String? userId; - String? userName; - String? ticketNumber; - String? from; - // - dynamic desImage; - String? placename; - double? rating; -// - String? to; - String? date; - String? travelers; - String? time; - String? duration; - String? flightNumber; - String? desType; - List? ticketSeats = []; - dynamic totalprice; - - Ticket_YE_Model({ - this.userId, - this.userName, - this.ticketNumber, - this.from, - this.to, - // - this.desImage, - this.placename, - // - this.date, - this.travelers, - this.time, - this.duration, - this.desType, - this.flightNumber, - this.ticketSeats, - this.totalprice, - }); - - Ticket_YE_Model.fromJson(Map json) { - userId = json["userId"]; - userName = json["userName"]; - ticketNumber = json["ticketNumber"]; - from = json["from"]; - to = json["to"]; - date = json["date"]; - travelers = json["travelers"]; - time = json["time"]; - duration = json["duration"]; - desType = json["desType"]; - flightNumber = json["flightNumber"]; - ticketSeats = json["ticketSeats"] ?? []; - totalprice = json["totalprice"]; - } - - Ticket_YE_Model.fromDocument(DocumentSnapshot doc) { - final data = doc.data()! as Map; - - userId = data["userId"]; - userName = data["userName"]; - ticketNumber = data["ticketNumber"]; - from = data["from"]; - to = data["to"]; - date = data["date"]; - travelers = data["travelers"]; - time = data["time"]; - duration = data["duration"]; - desType = data["desType"]; - flightNumber = data["flightNumber"]; - ticketSeats = data["ticketSeats"] ?? []; - totalprice = data["totalprice"]; - } - - Map toJson() { - return { - "userId": userId, - "userName": userName, - "ticketNumber": ticketNumber, - "from": from, - "to": to, - "date": date, - 'travelers': travelers, - "time": time, - "duration": duration, - "desType": desType, - "flightNumber": flightNumber, - "ticketSeats": ticketSeats ?? [], - "totalprice": totalprice, - }; - } -} - -/* -import 'package:cloud_firestore/cloud_firestore.dart'; - -class Ticket_YE_Model { - String? ticketNumber; - String? from; - String? placename; - - String? to; - String? date; - String? travelers; - // String? bookingClass; - String? time; - String? duration; - String? flightNumber; - List? ticketSeats = []; - dynamic totalprice; - // String? gateNumber; - // String? user; - - Ticket_YE_Model({ - this.ticketNumber, - this.from, - this.to, - this.date, - // this.returnDate, - this.travelers, - // this.bookingClass, - this.time, - this.duration, - this.flightNumber, - this.ticketSeats, - this.totalprice, - // this.gateNumber, - // this.user - // this.mytickets, - }); - - Ticket_YE_Model.fromJson(Map json) { - ticketNumber = json["ticketNumber"]; - - from = json["from"]; - to = json["to"]; - date = json["date"]; - // returnDate = json["returnDate"]?? ""; - travelers = json["travelers"]; - // bookingClass = json["time"]?? ""; - duration = json["duration"]; - flightNumber = json["flightNumber"]; - ticketSeats = json["ticketSeats"] ?? []; - totalprice = json["totalprice"]; - // gateNumber = json["gateNumber"]?? ""; - // user = json["user"]; - // mytickets = json["mytickets"] ?? []; - } - Ticket_YE_Model.fromDocument(DocumentSnapshot doc) { - final data = doc.data()! as Map; - ticketNumber = data["ticketNumber"]; - - from = data["from"]; - to = data["to"]; - date = data["date"]; - travelers = data["travelers"]; - // bookingClass = data["time"]?? ""; - duration = data["duration"]; - flightNumber = data["flightNumber"]; - ticketSeats = data["ticketSeats"] ?? []; - totalprice = data["price"]; - // gateNumber = data["gateNumber"]?? ""; - // user = data["user"]; - // mytickets = data["mytickets"] ?? []; - } - - Map toJson() { - return { - "ticketNumber": ticketNumber, - "from": from, - "to": to, - "date": date, - 'travelers': travelers, - // "bookingClass": bookingClass?? "", - "duration": duration, - "flightNumber": flightNumber, - "ticketSeats": ticketSeats ?? [], - "totalprice": totalprice, - // "gateNumber": gateNumber?? "", - // "user": user - }; - } -} - -*/ diff --git a/lib/model/user_seats_model.dart b/lib/model/user_seats_model.dart deleted file mode 100644 index 0ad6954..0000000 --- a/lib/model/user_seats_model.dart +++ /dev/null @@ -1,12 +0,0 @@ -class UserSeateModel { - String? seatNo; - - UserSeateModel({this.seatNo}); - - UserSeateModel.fromJson(Map json) { - seatNo = json["seatNo"] ?? ""; - } - Map toJson() { - return {"column": seatNo ?? ""}; - } -} diff --git a/lib/provider/destination_provider.dart b/lib/provider/destination_provider.dart deleted file mode 100644 index 7d15162..0000000 --- a/lib/provider/destination_provider.dart +++ /dev/null @@ -1,148 +0,0 @@ -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:ye_airways/model/des_model.dart'; -import 'package:ye_airways/model/des_seats.dart'; -import 'package:ye_airways/model/ticket_ye_model.dart'; -import 'package:flutter/material.dart'; - -// h - -class DestinationProvider with ChangeNotifier { - CollectionReference destinationRef = - FirebaseFirestore.instance.collection("destinations"); - CollectionReference UsersCollection = - FirebaseFirestore.instance.collection("users"); - CollectionReference ticketDesRef = - FirebaseFirestore.instance.collection("userTickets"); - - final storageRef = FirebaseStorage.instance.ref(); - - getUserSeats(HN_DestinatioModel desSeats, String userID) { - List showTicketSeats = []; - var usr = FirebaseAuth.instance.currentUser; - if (usr!.uid == userID) { - for (int index = 0; index < desSeats.seats!.length; index++) { - if (!showTicketSeats.contains(desSeats.seats![index].column) && - desSeats.seats![index].userId == userID && - desSeats.seats![index].state == "1") { - showTicketSeats.add(desSeats.seats![index].column!); - } else if (showTicketSeats.contains(desSeats.seats![index].column) && - desSeats.seats![index].userId != userID && - desSeats.seats![index].state == "0") { - showTicketSeats.remove(desSeats.seats![index].column!); - } - } - return showTicketSeats; - } - } - - getDestinaion(String destId) { - return destinationRef.where("desId", isEqualTo: destId).snapshots(); - } - - getAllDestinations() { - return destinationRef.snapshots(); - } - - getPopularDestinations() { - return destinationRef - .where("desType", - isEqualTo: "Popular") // .orderBy("desId", descending: true) - .snapshots(); - } - - getLocalDestinations() { - return destinationRef.where("desType", isEqualTo: "Local").snapshots(); - } - - getNewDestinations() { - return destinationRef.where("desType", isEqualTo: "New").snapshots(); - } - - Future uploadImage(File file, String id, int indexImage) async { - final mountainsRef = storageRef.child("desImage"); - final desImages = mountainsRef.child(id); - - await desImages.child("${id + indexImage.toString()}.jpg").putFile(file); - return await desImages - .child("${id + indexImage.toString()}.jpg") - .getDownloadURL(); - } - - Future uploadOthersImage( - File file, String id, int indexImage) async { - final mountainsRef = storageRef.child("desImage"); - final desImages = mountainsRef.child(id); - - await desImages.child("$id.jpg").putFile(file); - return await desImages.child("$id.jpg").getDownloadURL(); - } - - String getColumn(int col) { - if (col == 1) { - return "A"; - } else if (col == 2) { - return "B"; - } else if (col == 3) { - return "C"; - } else { - return "D"; - } - } - - addDestination(HN_DestinatioModel dest) async { - String id = destinationRef.doc().id; - dest.desId = id; - for (int col = 1; col < 5; col++) { - for (int row = 1; row < 9; row++) { - SeatModel seatModel = SeatModel(); - seatModel.desId = dest.desId; - seatModel.column = getColumn(col) + row.toString(); - dest.seats!.add(seatModel); - } - } - if (dest.desImage != null) { - List listimages = []; - dest.desImage = await uploadImage( - dest.desImage, dest.desId!, dest.desOtherImages!.length); - for (int i = 0; i < dest.desOtherImages!.length; i++) { - listimages - .add(await uploadImage(dest.desOtherImages![i], dest.desId!, i)); - } - dest.desOtherImages = listimages; - // destination.image = 'default'; - return await destinationRef.doc(id).set(dest.toJson()); - } else { - dest.desImage = 'default'; - for (int i = 0; i < dest.desOtherImages!.length; i++) { - dest.desOtherImages![i] = - await uploadImage(dest.desOtherImages![i], dest.desId!, i); - } - return await destinationRef.doc(id).set(dest.toJson()); - } - } - - updateDestination(HN_DestinatioModel dest) async { - await destinationRef.doc(dest.desId).set(dest.toJson()); - } - - deleteDestination(String id) async { - await destinationRef.doc(id).delete(); - } - - addUserTickets(Ticket_YE_Model objTicket, String desID) async { - User? user2 = FirebaseAuth.instance.currentUser; - - CollectionReference ticketDesRef = FirebaseFirestore.instance - .collection("userTickets") - .doc(user2!.uid) - .collection("${user2.email}"); - return await ticketDesRef.doc(desID).set(objTicket.toJson()); - } - - updateDestinationToCart(HN_DestinatioModel dest) async { - await destinationRef.doc(dest.desId).set(dest.toJson()); - } -} diff --git a/lib/provider/flight_provider.dart b/lib/provider/flight_provider.dart deleted file mode 100644 index 9739c5a..0000000 --- a/lib/provider/flight_provider.dart +++ /dev/null @@ -1,108 +0,0 @@ -import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:firebase_auth/firebase_auth.dart'; -import 'package:firebase_storage/firebase_storage.dart'; -import 'package:ye_airways/model/ticket_ye_model.dart'; -import 'package:ye_airways/shared/components/constantes.dart'; -import 'package:flutter/material.dart'; - -// h -class FlightProvider with ChangeNotifier { - User? user = FirebaseAuth.instance.currentUser; - CollectionReference ticketsRef = - FirebaseFirestore.instance.collection("userTickets"); - // .doc(userFireData.uid) - // .collection("${user.email}"); - - // CollectionReference ticketsRef = - // FirebaseFirestore.instance.collection("userTickets"); - - // CollectionReference ticketsRef = - // FirebaseFirestore.instance.collection("userTickets"); - - final storageRef = FirebaseStorage.instance.ref(); - // double alltotalPrice = 0; - // double get totalPrice => alltotalPrice; - - getAllUserTicekts() { - User? user3 = FirebaseAuth.instance.currentUser; - - if (user3!.uid == uid) { - CollectionReference ticketDesRef = FirebaseFirestore.instance - .collection("userTickets") - .doc(uid) - .collection(user3.email!); - - return ticketDesRef.snapshots(); - } else { - return const AlertDialog( - // actions: [], - title: Text("There is an Error!"), - content: Text("Try Again Later"), - ); - } - } - - // getAllTickets() { - // return ticketsRef.doc(user!.uid).collection(user!.email!).snapshots(); - // } - - getAllTicketsCart() { - User? user = FirebaseAuth.instance.currentUser; - return ticketsRef - .where( - "usersCart", - arrayContains: user!.uid, - ) - .snapshots(); - } - - addUserTickets(Ticket_YE_Model objTicket, String desID) async { - User? user2 = FirebaseAuth.instance.currentUser; - CollectionReference destinationRef = - FirebaseFirestore.instance.collection("destinations"); - objTicket.userId = user2!.uid; - objTicket.userName = user2.displayName; - - CollectionReference ticketsRef = FirebaseFirestore.instance - .collection("userTickets") - .doc(user2.uid) - .collection("${user2.email}"); - await destinationRef - .doc(desID) - .collection("destTickets") - .doc(objTicket.ticketNumber) - .set(objTicket.toJson()); - - return await ticketsRef.doc(desID).set(objTicket.toJson()); - } - - chechTicketNumber(Ticket_YE_Model ticket, String desID) async { - User? user2 = FirebaseAuth.instance.currentUser; - CollectionReference ticketsRef = FirebaseFirestore.instance - .collection("userTickets") - .doc(user2!.uid) - .collection("${user2.email}"); - if (ticketsRef.doc(desID) == desID) {} - await ticketsRef.doc(ticket.ticketNumber).set(ticket.toJson()); - } - - deleteTicket(String id) async { - await ticketsRef.doc(id).delete(); - } - - updateTicketinationToCart(Ticket_YE_Model ticket) async { - await ticketsRef.doc(ticket.ticketNumber).set(ticket.toJson()); - } - - // setTotalPriceCart(double value) { - // alltotalPrice = value; - - // // notifyListeners(); - // } - - // getTotalPrice() { - // return totalPrice; - - // // notifyListeners(); - // } -} diff --git a/lib/provider/login_Provider.dart b/lib/provider/login_Provider.dart deleted file mode 100644 index cf0abc3..0000000 --- a/lib/provider/login_Provider.dart +++ /dev/null @@ -1,49 +0,0 @@ -import 'package:firebase_auth/firebase_auth.dart'; -import 'package:ye_airways/shared/components/rsponse.dart'; -import 'package:flutter/material.dart'; - -class LoginProvider with ChangeNotifier { - Future regester( - {required String email, required String password}) async { - try { - // code used to create an account using email and password - await FirebaseAuth.instance - .createUserWithEmailAndPassword(email: email, password: password); - } on FirebaseAuthException catch (e) { - if (e.code == 'weak-password') { - return AuthResponse( - messag: "weak-password", - ); - } else if (e.code == 'email-already-in-use') { - return AuthResponse(messag: "email-already-in-use"); - } - } catch (e) { - return AuthResponse(messag: "$e"); - } - var user = - FirebaseAuth.instance.currentUser; // code used to get the current user - return AuthResponse(messag: "sucess", user: user); - } - - Future signIn( - {required String email, required String password}) async { - try { - // code used to login an account using email and password - await FirebaseAuth.instance - .signInWithEmailAndPassword(email: email, password: password); - } on FirebaseAuthException catch (e) { - if (e.code == 'user-not-found') { - return AuthResponse(messag: "user-not-found"); - } else if (e.code == 'wrong-password') { - return AuthResponse(messag: "wrong-password"); - } - } catch (e) { - return AuthResponse(messag: "$e"); - } - -// if successfully authenticated then it we return the user with success messag - var user = - FirebaseAuth.instance.currentUser; // code used to get the currentUser - return AuthResponse(messag: "sucess", user: user); - } -} diff --git a/lib/route.dart b/lib/route.dart deleted file mode 100644 index c9493d8..0000000 --- a/lib/route.dart +++ /dev/null @@ -1,26 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:ye_airways/view/screen/admin/add_destination.dart'; -import 'package:ye_airways/view/screen/destination/des_details_page.dart'; -import 'package:ye_airways/view/screen/destination/destination_home.dart'; -import 'package:ye_airways/view/screen/main_ye_screen.dart'; -import 'package:ye_airways/view/screen/splash/get_started.dart'; -import 'package:ye_airways/view/screen/splash/introductionScreen.dart'; -import 'package:ye_airways/view/screen/splash/splash_page.dart'; -import 'package:ye_airways/view/screen/user/login_ye_screen.dart'; -import 'package:ye_airways/view/screen/user/profile_page.dart'; -import 'package:ye_airways/view/screen/user/signup_ye_screen.dart'; -import 'package:ye_airways/view/screen/user/user_tickets.dart'; - -Map routes = { - SplashHome.id: (context) => const SplashHome(), - GetStartedPage.id: (context) => const GetStartedPage(), - OnBoardingScreen.id: (context) => const OnBoardingScreen(), - LoginYEScreen.id: (context) => const LoginYEScreen(), - SignUp_YE_Screen.id: (context) => const SignUp_YE_Screen(), - Main_YE_Screen.id: (context) => Main_YE_Screen(), - Profile_YE_Screen.id: (context) => const Profile_YE_Screen(), - Destination_Home.id: (context) => const Destination_Home(), - DesDetailPage.id: (context) => const DesDetailPage(), - AddDestinationPage.id: (context) => const AddDestinationPage(), - UserTickets.id: (context) => const UserTickets(), -}; diff --git a/lib/shared/components/components.dart b/lib/shared/components/components.dart deleted file mode 100644 index 64be186..0000000 --- a/lib/shared/components/components.dart +++ /dev/null @@ -1,166 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; - -void showToastMsg({required String txt, required ToastTypes type}) { - Fluttertoast.showToast( - msg: txt, - toastLength: Toast.LENGTH_SHORT, - gravity: ToastGravity.CENTER, - timeInSecForIosWeb: 1, - backgroundColor: ChangeColor(type), - textColor: Colors.white, - fontSize: 16.0); -} - -Color ChangeColor(ToastTypes type) { - if (type == ToastTypes.SUCSSEFUL) { - return Colors.green; - } else if (type == ToastTypes.ERROR) - return Colors.red; - else if (type == ToastTypes.WARNING) return Colors.orange; - - return Colors.grey; -} - -enum ToastTypes { - SUCSSEFUL, - ERROR, - WARNING, -} - -Widget defaultFormField({ - @required TextEditingController? controller, - @required TextInputType? type, - ValueChanged? onSubmit, - ValueChanged? onChange, - Function()? onTap, - bool isPassword = false, - FormFieldValidator? validate, - @required String? label, - @required IconData? prefix, - IconData? suffix, - Function()? suffixPressed, - bool isClickable = true, -}) => - TextFormField( - controller: controller, - keyboardType: type, - obscureText: isPassword, - enabled: isClickable, - onFieldSubmitted: onSubmit, - onChanged: onChange, - onTap: onTap, - validator: validate, - decoration: InputDecoration( - labelText: label, - prefixIcon: Icon( - prefix, - ), - suffixIcon: suffix != null - ? IconButton( - onPressed: suffixPressed, - icon: Icon( - suffix, - ), - ) - : null, - border: const OutlineInputBorder(), - ), - ); - -Widget defaultButtn({ - @required String? title, - double width = double.infinity, - EdgeInsets margin = EdgeInsets.zero, - @required Function()? onPressed, -}) => - Container( - margin: margin, - width: width, - height: 55, - child: TextButton( - style: TextButton.styleFrom( - backgroundColor: kRedColor, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(17))), - onPressed: onPressed, - child: Text( - "$title", - style: whiteTextStyle.copyWith(fontSize: 20, fontWeight: medium), - )), - ); - -Widget myDivider() => Padding( - padding: const EdgeInsetsDirectional.only( - start: 20.0, - ), - child: Container( - width: double.infinity, - height: 1.0, - color: Colors.grey[300], - ), - ); - -showSnackBar(BuildContext context, String text) { - return ScaffoldMessenger.of(context).showSnackBar(SnackBar( - duration: const Duration(days: 1), - content: Text(text), - action: SnackBarAction(label: "close", onPressed: () {}), - )); -} - -class InactiveInfoCustomText extends StatelessWidget { - const InactiveInfoCustomText({super.key, @required required this.text}); - - final String? text; - - @override - Widget build(BuildContext context) { - return Text( - text!, - style: TextStyle( - color: kBlackColor, - fontWeight: FontWeight.w500, - ), - ); - } -} - -class ActiveInfoCustomText extends StatelessWidget { - const ActiveInfoCustomText({super.key, @required required this.text}); - - final String? text; - // final Color? color; - - @override - Widget build(BuildContext context) { - return Text( - textAlign: TextAlign.center, - text!, - style: const TextStyle( - fontSize: 15, - color: kPrimaryColor, - fontWeight: FontWeight.bold, - ), - ); - } -} - -class AcronymCustomText extends StatelessWidget { - const AcronymCustomText({super.key, @required required this.text}); - - final String? text; - - @override - Widget build(BuildContext context) { - return Text( - text!, - style: TextStyle( - color: kPrimaryColor, - fontSize: 30.0, - fontWeight: medium, - ), - ); - } -} diff --git a/lib/shared/components/constantes.dart b/lib/shared/components/constantes.dart deleted file mode 100644 index c13a202..0000000 --- a/lib/shared/components/constantes.dart +++ /dev/null @@ -1,34 +0,0 @@ -// import 'package:flutter/cupertino.dart'; -// import 'package:ye_airways/model/model_hn/user.dart'; -import 'package:ye_airways/model/hn_user_model.dart'; -import 'package:flutter/material.dart'; - -String keyIsDark = "isdark"; -String keyToken = "token"; -String token = ""; - -String uid = ""; -// UserModle? userModel; -navigateTo(context, widget) { - Navigator.push( - context, - PageRouteBuilder( - pageBuilder: (context, animation, secondaryAnimation) => widget, - )); -} - -navigateToandFinish(context, widget) { - Navigator.pushReplacement( - context, - PageRouteBuilder( - pageBuilder: (context, animation, secondaryAnimation) => widget, - )); -} - -const kbackgroundColor = Color(0xFFF1EFF1); -// final kprimaryColor = Color(0xFF7D2BE1); -const ksecondaryColor = Color(0xFFfcca46); -const ktextColor = Color(0xFF023047); -const ktextlightColor = Color(0xFF747474); -const kblackColor = Color(0xFF58CFE8); -HN_UserModel? usermodel; diff --git a/lib/shared/components/rsponse.dart b/lib/shared/components/rsponse.dart deleted file mode 100644 index 6ab7d6f..0000000 --- a/lib/shared/components/rsponse.dart +++ /dev/null @@ -1,7 +0,0 @@ -import 'package:firebase_auth/firebase_auth.dart'; - -class AuthResponse { - User? user; - String messag; - AuthResponse({this.user, required this.messag}); -} diff --git a/lib/shared/components/snackbar.dart b/lib/shared/components/snackbar.dart deleted file mode 100644 index 89d2290..0000000 --- a/lib/shared/components/snackbar.dart +++ /dev/null @@ -1,13 +0,0 @@ - - import 'package:flutter/material.dart'; - - - - - showSnackBar(BuildContext context, String text) { - return ScaffoldMessenger.of(context).showSnackBar(SnackBar( - duration: const Duration(days: 1), - content: Text(text), - action: SnackBarAction(label: "close", onPressed: () {}), - )); - } \ No newline at end of file diff --git a/lib/shared/network/local/cache_helper.dart b/lib/shared/network/local/cache_helper.dart deleted file mode 100644 index 0a415da..0000000 --- a/lib/shared/network/local/cache_helper.dart +++ /dev/null @@ -1,40 +0,0 @@ - -import 'package:shared_preferences/shared_preferences.dart'; - -class CacheHlper{ - - static late SharedPreferences sharedPreferences; - -static init() async{ - sharedPreferences= await SharedPreferences.getInstance(); -} - -static Future putData( - { - required String key, - required dynamic value, - } -){ -if(value is bool) return sharedPreferences.setBool(key, value); -else if(value is double) return sharedPreferences.setDouble(key,double.parse(value.toString())); -else if(value is int) return sharedPreferences.setInt(key, value); -else return sharedPreferences.setString(key, value.toString()); -} - -static dynamic getData( - { - required String key, - } -) -{ - return sharedPreferences.get(key); -} - - -static Future removeData({ - required String key, - }) async - { - return await sharedPreferences.remove(key); - } -} \ No newline at end of file diff --git a/lib/shared/network/remote/dio_helper.dart b/lib/shared/network/remote/dio_helper.dart deleted file mode 100644 index c5ad99f..0000000 --- a/lib/shared/network/remote/dio_helper.dart +++ /dev/null @@ -1,30 +0,0 @@ -import 'package:dio/dio.dart'; - -class DioHelper { - static late Dio dio; - - static init() { - dio = Dio(BaseOptions( - baseUrl: "https://student.valuxapps.com/api/", - receiveDataWhenStatusError: true, - headers: {"Content-Type": "application/json"})); - } - - static Future getData( - {required String path, Map? query,String? token,String lang="en"}) async { - dio.options.headers = {"lang": lang, - "Authorization":token, - "Content-Type": "application/json"}; - return await dio.get(path, queryParameters: query); - } - - static Future getPost( - {required String path, - Map? query, - required Map data,String? token,String lang="ar"}) async { - dio.options.headers = {"lang": lang, - "Authorization":token, - "Content-Type": "application/json"}; - return await dio.post(path, queryParameters: query, data: data); - } -} diff --git a/lib/shared/network/remote/dio_helper_fcm.dart b/lib/shared/network/remote/dio_helper_fcm.dart deleted file mode 100644 index b2a08f3..0000000 --- a/lib/shared/network/remote/dio_helper_fcm.dart +++ /dev/null @@ -1,31 +0,0 @@ -import 'package:dio/dio.dart'; - -class DioHelperFCM { - static late Dio dio; - - static init() { - dio = Dio(BaseOptions( - baseUrl: "https://fcm.googleapis.com/fcm/", - receiveDataWhenStatusError: true, - headers: {"Content-Type": "application/json", - "Authorization":"key=AAAArH4lHZ4:APA91bGiNHQUEQeKrL7d9fLKn6YSmERmkL6-otiv104_EQu570GZwUozk2SJM7Od3CSdpHgLU10AxMzIvHFWnih8wgzohWtXVZrceKh24B5uM14Qq2uNIHSKPN8Ho7TSXjG_fYkOn8YW"})); - } - - - static Future sendNotification( - {required String to, - required String body, - required String title, - } - ) async { - return await dio.post("send", data: { - "to" : to, - "notification" : { - "body" : body, - "title": title, - "sound": "default" - } - -}); - } -} diff --git a/lib/shared/styles/colors.dart b/lib/shared/styles/colors.dart deleted file mode 100644 index 6ecc140..0000000 --- a/lib/shared/styles/colors.dart +++ /dev/null @@ -1,83 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:google_fonts/google_fonts.dart'; - -//Main theme colors -const kPrimaryColor = Color.fromARGB(255, 1, 13, 100); -const kAccentColor = Color(0xFFFFCDA3); - -//Color for horizontal and vertical lines. -const kLinesColor = Color(0xFFA4BDBC); //A1BAB8 - -//Colors for Primary Color Background Container for Myflight Screen -const kActiveTextColor = Color(0xFFA3BEBC); -const kInactiveTextColor = Color(0xFF78909c); - -//Login Button Text Color -const kLoginTextColor = Color(0xFF495A52); - -//Color for the Container behind the picture. -const kUpperContainerColor = Color(0xFFcfd8dc); //it's look good. - -//Colors for White Background Container for flight Screen -const Color kActiveColor = Color(0xFF435C59); -// const Color kInactiveColor = Color(0xFFA3A9A9); -const Color kDateTimeAndCitesColor = Color(0xFF738483); - -//white theme color for background. -const Color kWhiteColor = Color(0xFFFFFFFF); - -/////////////////////////////////////////////////////// -const Color bckColor = Color.fromRGBO(245, 247, 251, 1); -const Color mainColor = Color(0xFF64befd); -const Color secondColor = Color(0xFF78d9fd); - -// *************** hn flight colors ************* - -double defaultMargin = 24.0; -// double defaultRadius = - -// Color kPrimaryColor = Color.fromARGB(255, 16, 0, 78); -Color kBlackColor = const Color(0xff1F1449); -Color kGreyColor = const Color(0xff9698A9); -Color kGreenColor = const Color(0xff0EC3AE); -Color kRedColor = const Color(0xffEB70A5); -Color kBackgroundColor = const Color(0xffFAFAFA); -Color kInactiveColor = const Color(0xffDBD7EC); -Color kTransparentColor = Colors.transparent; -Color kAvailableColor = const Color(0xffE0D9FF); -Color kUnavailableColor = const Color(0xffEBECF1); - -Color get primaryTextColor => const Color(0xFF262626); -Color get secondaryTextColor => const Color(0xFFADADAD); - -TextStyle blackTextStyle = GoogleFonts.poppins( - color: kPrimaryColor, -); - -TextStyle whiteTextStyle = GoogleFonts.poppins( - color: kWhiteColor, -); - -TextStyle greyTextStyle = GoogleFonts.poppins( - color: kGreyColor, -); - -TextStyle greenTextStyle = GoogleFonts.poppins( - color: kGreenColor, -); - -TextStyle redTextStyle = GoogleFonts.poppins( - color: kRedColor, -); - -TextStyle purpleTextStyle = GoogleFonts.poppins( - color: kPrimaryColor, -); - -FontWeight light = FontWeight.w300; -FontWeight regular = FontWeight.w400; -FontWeight medium = FontWeight.w500; -FontWeight semiBold = FontWeight.w600; -FontWeight bold = FontWeight.w700; -FontWeight extraBold = FontWeight.w800; -FontWeight black = FontWeight.w900; diff --git a/lib/shared/styles/theams.dart b/lib/shared/styles/theams.dart deleted file mode 100644 index 9c7b4d3..0000000 --- a/lib/shared/styles/theams.dart +++ /dev/null @@ -1,63 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; - -ThemeData lightTheme = ThemeData( - fontFamily: "Cairo", - primaryColor: mainColor, - primarySwatch: Colors.blue, - scaffoldBackgroundColor: bckColor, - appBarTheme: const AppBarTheme( - centerTitle: true, - iconTheme: IconThemeData(color: Colors.black), - backgroundColor: bckColor, - systemOverlayStyle: SystemUiOverlayStyle( - statusBarColor: Colors.black, - statusBarBrightness: Brightness.light), - titleSpacing: 20, - elevation: 0, - titleTextStyle: TextStyle( - color: Colors.black, fontSize: 20, fontWeight: FontWeight.bold)), - floatingActionButtonTheme: - const FloatingActionButtonThemeData(backgroundColor: mainColor), - bottomNavigationBarTheme: const BottomNavigationBarThemeData( - backgroundColor: Colors.white, - elevation: 20, - selectedItemColor: mainColor, - unselectedItemColor: Colors.grey), - textTheme: const TextTheme( - bodyLarge: TextStyle( - color: Colors.black, fontSize: 20, fontWeight: FontWeight.bold), - bodyMedium: TextStyle( - color: Colors.grey, fontSize: 14, fontWeight: FontWeight.normal), - )); - -ThemeData darkTheme = ThemeData( - fontFamily: "Cairo", - primaryColor: Colors.pink, - primarySwatch: Colors.pink, - scaffoldBackgroundColor: Colors.black54, - appBarTheme: const AppBarTheme( - iconTheme: IconThemeData(color: Colors.white), - backgroundColor: Colors.black54, - systemOverlayStyle: SystemUiOverlayStyle( - statusBarColor: Colors.white, statusBarBrightness: Brightness.dark), - titleSpacing: 20, - elevation: 0, - titleTextStyle: TextStyle( - color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold)), - floatingActionButtonTheme: - const FloatingActionButtonThemeData(backgroundColor: Colors.pink), - bottomNavigationBarTheme: const BottomNavigationBarThemeData( - backgroundColor: Colors.black, - elevation: 20, - selectedItemColor: Colors.pink, - unselectedItemColor: Colors.grey), - textTheme: TextTheme( - bodyLarge: const TextStyle( - color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold), - bodyMedium: TextStyle( - color: Colors.grey.shade100, - fontSize: 14, - fontWeight: FontWeight.normal), - )); diff --git a/lib/view/screen/admin/add_destination.dart b/lib/view/screen/admin/add_destination.dart deleted file mode 100644 index adbbe35..0000000 --- a/lib/view/screen/admin/add_destination.dart +++ /dev/null @@ -1,657 +0,0 @@ -import 'dart:io'; - -import 'package:ye_airways/model/des_model.dart'; -import 'package:ye_airways/provider/destination_provider.dart'; -import 'package:ye_airways/shared/components/components.dart'; -import 'package:ye_airways/view/widgets/custom_button.dart'; -import 'package:flutter/material.dart'; -import 'package:google_fonts/google_fonts.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:image_picker/image_picker.dart'; -import 'package:intl/intl.dart'; -import 'package:provider/provider.dart'; - -class AddDestinationPage extends StatefulWidget { - static const String id = 'AddDestinationPage'; - - const AddDestinationPage({super.key}); - - @override - State createState() => _AddDestinationPageState(); -} - -class _AddDestinationPageState extends State { - late TextEditingController toController; - late TextEditingController fromController; - late TextEditingController citynameController; - late TextEditingController descriptionController; - late TextEditingController ratingController; -// Flight Tools - late TextEditingController flightNumberController; - late TextEditingController ticketPriceController; - TextEditingController? _dateController; - TextEditingController? _timeController; - late TextEditingController durationController; - - final _formKey = GlobalKey(); - File? priam_imageFile; - - final _picker = ImagePicker(); - String? date; - String? time; - var destinationType = ['Popular', 'Local', 'New']; - String? destTypeSelected; - List imageFileList = []; - bool isLoading = false; - @override - void initState() { - fromController = TextEditingController(text: ""); - toController = TextEditingController(text: ""); - descriptionController = TextEditingController(text: ""); - citynameController = TextEditingController(text: ""); - ratingController = TextEditingController(text: "4"); - flightNumberController = TextEditingController(text: ""); - ticketPriceController = TextEditingController(text: "300"); - _dateController = TextEditingController(); - _timeController = TextEditingController(); - durationController = TextEditingController(text: ""); - - super.initState(); - } - - @override - void dispose() { - super.dispose(); - _dateController!.dispose(); - _timeController!.dispose(); - } - - @override - Widget build(BuildContext context) { - void selectImages() async { - final selectedImages = await _picker.pickMultiImage(imageQuality: 50); - if (selectedImages.isNotEmpty) { - imageFileList = []; - for (var image in selectedImages) { - imageFileList.add(File(image.path)); - } - } - print("Image List Length:${imageFileList.length}"); - setState(() {}); - } - - Future _pickImageFromGallery() async { - final pickedFile = await _picker.pickImage( - source: ImageSource.gallery, - // imageQuality: 100, - // maxHeight: 400, - // maxWidth: 400, - ); - if (pickedFile != null) { - setState(() { - priam_imageFile = File(pickedFile.path); - }); - } - } - - Future _pickImageFromCamera() async { - final pickedFile = await _picker.pickImage( - source: ImageSource.camera, - imageQuality: 25, - maxHeight: 200, - maxWidth: 200, - ); - if (pickedFile != null) { - setState(() { - priam_imageFile = File(pickedFile.path); - }); - } - } - - DestinationProvider destinationProvider = - Provider.of(context); - - return Scaffold( - backgroundColor: kBackgroundColor, - body: SafeArea( - child: Form( - key: _formKey, - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - //=================== Add Destination Image =================== - ListView( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - children: [ - ButtonBar( - children: [ - Text( - 'Add New Destination', - style: GoogleFonts.robotoCondensed( - color: kPrimaryColor, - fontWeight: FontWeight.bold, - fontSize: 18, - ), - ), - const SizedBox( - width: 80, - ), - IconButton( - color: kPrimaryColor, - icon: const Icon(Icons.photo_camera), - onPressed: () async => _pickImageFromCamera(), - tooltip: 'Shoot picture', - ), - IconButton( - color: kPrimaryColor, - icon: const Icon(Icons.photo), - onPressed: () async { - _pickImageFromGallery(); - }, - tooltip: 'Pick from gallery', - ), - ], - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: InkWell( - onTap: () async { - _pickImageFromGallery(); - }, - child: SizedBox( - width: 300, - height: 300, - child: (priam_imageFile != null) - ? Image.file(priam_imageFile!) - : const Placeholder( - fallbackHeight: 300, - fallbackWidth: 300, - ), - ), - ), - ) - ], - ), - const SizedBox(height: 30), - - // insert others Destination Images - IconButton( - color: kPrimaryColor, - icon: const Icon(Icons.photo), - onPressed: () async { - selectImages(); - }, - tooltip: 'Pick from gallery', - ), - Row( - // crossAxisAlignment: CrossAxisAlignment.center - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - for (final image in imageFileList) - SizedBox( - height: 100, - width: 100, - // ignore: unnecessary_null_comparison - child: (image != null) - ? Image.file(image) - - // Image.file(_1st_des_imageFile!) - : InkWell( - onTap: () async { - _pickImageFromGallery(); - }, - child: const Placeholder( - fallbackHeight: 100, - fallbackWidth: 100, - ), - ), - ), - ], - ), - const SizedBox(height: 30), - //=================== From =================== - Padding( - padding: const EdgeInsets.symmetric(horizontal: 25), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: TextFormField( - controller: fromController, - validator: ((value) { - if (value != null && value.isNotEmpty) { - return null; - } else { - return "This field is Required"; - } - }), - decoration: const InputDecoration( - border: InputBorder.none, - hintText: "From", - ), - ), - ), - ), - ), - const SizedBox( - height: 16, - ), - //=================== Destination Name =================== - Padding( - padding: const EdgeInsets.symmetric(horizontal: 25), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: TextFormField( - controller: toController, - validator: ((value) { - if (value != null && value.isNotEmpty) { - return null; - } else { - return "Destination Name is Required"; - } - }), - decoration: const InputDecoration( - border: InputBorder.none, - hintText: "Destination Name", - ), - ), - ), - ), - ), - const SizedBox( - height: 16, - ), - //=================== City =================== - Padding( - padding: const EdgeInsets.symmetric(horizontal: 25), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: TextFormField( - controller: citynameController, - validator: ((value) { - if (value != null && value.isNotEmpty) { - return null; - } else { - return "Destination City is Required"; - } - }), - decoration: const InputDecoration( - border: InputBorder.none, - hintText: "Destination City", - // helperText: "required", - )), - ), - ), - ), - const SizedBox( - height: 16, - ), - //=================== Description =================== - Padding( - padding: const EdgeInsets.symmetric(horizontal: 25), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: TextFormField( - controller: descriptionController, - validator: ((value) { - if (value != null && value.isNotEmpty) { - return null; - } else { - return "description is Required"; - } - }), - decoration: const InputDecoration( - border: InputBorder.none, - hintText: "write description", - // helperText: "required", - )), - ), - ), - ), - - const SizedBox( - height: 16, - ), - - //=================== Destination Type =================== - - Padding( - padding: const EdgeInsets.symmetric(horizontal: 25), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: DropdownButton( - icon: const Icon(Icons.arrow_drop_down_circle_outlined), - underline: const SizedBox(), - dropdownColor: kWhiteColor, - hint: const SizedBox( - width: 260, - child: Text( - 'Destination Type ', - style: TextStyle( - color: kInactiveTextColor, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ), - ), - items: destinationType.map((String dropDownItem) { - return DropdownMenuItem( - value: dropDownItem, - child: Text( - dropDownItem, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - color: kPrimaryColor, - ), - ), - ); - }).toList(), - onChanged: (newValue) { - setState(() { - destTypeSelected = newValue; - }); - }, - value: destTypeSelected, - ), - ), - ), - ), - - const SizedBox( - height: 16, - ), - //=================== Rating =================== - Padding( - padding: const EdgeInsets.symmetric(horizontal: 25), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: TextFormField( - validator: ((value) { - if (value != null && value.isNotEmpty) { - return null; - } else { - return "your rating is Required"; - } - }), - // keyboardType: TextInputType.number, - controller: ratingController, - decoration: const InputDecoration( - border: InputBorder.none, - hintText: "your rating", - ), - ), - ), - ), - ), - const SizedBox( - height: 30, - ), - // ================================ Flight Information ================================ - - Padding( - padding: const EdgeInsets.symmetric(horizontal: 25), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: TextFormField( - controller: flightNumberController, - validator: ((value) { - if (value != null && value.isNotEmpty) { - return null; - } else { - return "Flight Number is Required"; - } - }), - decoration: const InputDecoration( - border: InputBorder.none, - hintText: "Flight Number", - ), - ), - ), - ), - ), - const SizedBox( - height: 16, - ), - //=================== Flight Date =================== - Padding( - padding: const EdgeInsets.symmetric(horizontal: 15), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: defaultFormField( - // type: TextInputType.datetime, - suffix: Icons.date_range, - controller: _dateController!, - label: 'DATE', - onTap: () { - FocusScope.of(context).unfocus(); - showDatePicker( - context: context, - initialDate: DateTime.now(), - firstDate: DateTime.now(), - lastDate: DateTime(DateTime.now().year + 1), - ).then((date) { - this.date = DateFormat('yyyy MMM d').format(date!); - setState(() { - _dateController!.text = this.date!; - }); - }); - }, - ), - ), - ), - ), - const SizedBox( - height: 16, - ), - //=================== Flight Time =================== - Padding( - padding: const EdgeInsets.symmetric(horizontal: 15), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: AbsorbPointer( - absorbing: false, - ignoringSemantics: false, - child: defaultFormField( - suffix: Icons.access_time_outlined, - controller: _timeController!, - label: 'Flight Time', - type: TextInputType.datetime, - onTap: () { - FocusScope.of(context).unfocus(); - showTimePicker( - context: context, - initialTime: TimeOfDay.now(), - ).then((time) { - this.time = time!.format(context); - - setState(() { - _timeController!.text = this.time!; - }); - }); - }, - ), - ), - ), - ), - ), - const SizedBox( - height: 16, - ), - // Description - //=================== Flight Duration =================== - Padding( - padding: const EdgeInsets.symmetric(horizontal: 25), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: TextFormField( - controller: durationController, - validator: ((value) { - if (value != null && value.isNotEmpty) { - return null; - } else { - return "Flight Duration is Required"; - } - }), - decoration: const InputDecoration( - border: InputBorder.none, - hintText: "Flight Duration", - // helperText: "required", - )), - ), - ), - ), - - const SizedBox( - height: 16, - ), - //=================== Price =================== - Padding( - padding: const EdgeInsets.symmetric(horizontal: 25), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: TextFormField( - validator: ((value) { - if (value != null && value.isNotEmpty) { - return null; - } else { - return "Price is Required"; - } - }), - controller: ticketPriceController, - decoration: const InputDecoration( - border: InputBorder.none, - hintText: "Ticket price", - ), - ), - ), - ), - ), - const SizedBox( - height: 16, - ), - //=================== Button Add Destination =================== - isLoading - ? const Center(child: CircularProgressIndicator()) - : Padding( - padding: const EdgeInsets.all(10.0), - child: CustomButton( - title: "Add", - onPressed: () async { - if (_formKey.currentState!.validate() && - priam_imageFile != null) { - setState(() { - isLoading = true; - }); - await destinationProvider - .addDestination(HN_DestinatioModel( - // urldesImages: imageFileList, - from: fromController.text, - desImage: priam_imageFile, - desOtherImages: imageFileList, - placename: toController.text, - to: citynameController.text, - description: descriptionController.text, - rating: ratingController.text != "" - ? double.parse(ratingController.text) - : 0, - flightNumber: - "IY${flightNumberController.text}", - date: _dateController!.text, - time: _timeController!.text, - ticketPrice: ticketPriceController.text != "" - ? double.parse(ticketPriceController.text) - : 0, - duration: durationController.text, - desType: destTypeSelected, - seats: [], - )); - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text("Added Successfully"))); - Navigator.pop(context); - } else { - isLoading = false; - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar(content: Text("Error"))); - } - }, - ), - ), - const SizedBox( - height: 16, - ), - ], - ), - ), - ), - ), - ); - } -} diff --git a/lib/view/screen/checkout/checkout_page.dart b/lib/view/screen/checkout/checkout_page.dart deleted file mode 100644 index c96f9f3..0000000 --- a/lib/view/screen/checkout/checkout_page.dart +++ /dev/null @@ -1,428 +0,0 @@ -import 'package:ye_airways/model/des_model.dart'; -import 'package:ye_airways/model/ticket_ye_model.dart'; -import 'package:ye_airways/provider/flight_provider.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:ye_airways/view/screen/checkout/success_checkout_page.dart'; -import 'package:ye_airways/view/widgets/booking_details_item.dart'; -import 'package:ye_airways/view/widgets/custom_button.dart'; - -// ignore: must_be_immutable -class CheckoutPage extends StatefulWidget { - CheckoutPage( - {Key? key, - required this.destination, - required this.getTotalSeats, - required this.ticketNumber}) - : super(key: key); - final HN_DestinatioModel destination; - final List? getTotalSeats; - String ticketNumber; - - @override - State createState() => _CheckoutPageState(); -} - -class _CheckoutPageState extends State { - @override - Widget build(BuildContext context) { - FlightProvider flightProvider = Provider.of(context); - Ticket_YE_Model ticketModel; - - String getSeat(List listSeat) { - String strr = ""; - for (int i = 0; i < listSeat.length; i++) { - String str = listSeat[i]; - if (i == listSeat.length - 1) { - strr += str; - } else { - strr += "$str, "; - } - } - - return strr; - } - - dynamic getTotalPrice; - int getTravelers; - Widget route() { - return Container( - margin: const EdgeInsets.only(top: 40), - child: Column( - children: [ - const Image(image: AssetImage('assets/sm_YE_logo.png')), - const SizedBox( - height: 20, - ), - Container( - width: 291, - height: 65, - margin: const EdgeInsets.only(bottom: 10), - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/image_checkout.png'))), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '${widget.destination.from}', - style: blackTextStyle.copyWith( - fontSize: 24, fontWeight: semiBold), - ), - Text( - '${widget.destination.from}', - style: greyTextStyle.copyWith(fontWeight: light), - ) - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - '${widget.destination.to}', - style: blackTextStyle.copyWith( - fontSize: 24, fontWeight: semiBold), - ), - Text( - '${widget.destination.to}', - style: greyTextStyle.copyWith(fontWeight: light), - ) - ], - ) - ], - ) - ], - ), - ); - } - - bool seatsOver = false; - if (widget.getTotalSeats!.length <= 9) { - seatsOver = false; - } else { - seatsOver = true; - } - - Widget bookingDetails() { - // getTotalSeats = widget.destination.userSeats; - getTotalPrice = - widget.destination.ticketPrice! * widget.getTotalSeats!.length; - getTravelers = widget.getTotalSeats!.length; - return Container( - margin: const EdgeInsets.only(top: 20), - padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 30), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(18), color: kWhiteColor), - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - //NOTE : DESTINATION TILE - Row( - children: [ - Container( - width: 70, - height: 70, - margin: const EdgeInsets.only(right: 16), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(18), - image: DecorationImage( - fit: BoxFit.cover, - image: NetworkImage(widget.destination.desImage)), - ), - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '${widget.destination.placename}', - style: blackTextStyle.copyWith( - fontSize: 18, - fontWeight: medium, - ), - ), - const SizedBox(height: 5), - Text('${widget.destination.to}', - style: greyTextStyle.copyWith(fontWeight: light)) - ], - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 20, - height: 20, - margin: const EdgeInsets.only(right: 2), - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/icon_star.png'), - ), - ), - ), - Text( - '${widget.destination.rating}', - style: blackTextStyle.copyWith( - fontWeight: medium, - ), - ) - ], - ), - ], - ), - - //NOTE : BOOKING DETAIL LIST - Container( - margin: const EdgeInsets.only(top: 20), - child: Text( - 'Booking Details', - style: blackTextStyle.copyWith( - fontSize: 16, - fontWeight: semiBold, - ), - ), - ), - - //NOTE : BOOKING DETAILS ITEM - BookingDetailsItem( - title: 'Ticket No', - valueText: widget.ticketNumber, - valueColor: kBlackColor), - BookingDetailsItem( - title: 'Traveler', - valueText: '${getTravelers.toString()} person', - valueColor: kBlackColor), - BookingDetailsItem( - title: "Date", - valueText: '${widget.destination.date}', - valueColor: kBlackColor), - BookingDetailsItem( - title: "Take Off", - valueText: ' ${widget.destination.time}', - valueColor: kBlackColor), - - seatsOver - ? Container( - // decoration: BoxDecoration( - // color: Colors.white, - // borderRadius: BorderRadius.circular( - // 15, - // )), - child: DropdownButton( - icon: const Icon(Icons.arrow_drop_down_circle_outlined), - // underline: SizedBox(), - dropdownColor: kWhiteColor, - hint: Row(children: [ - Container( - width: 16, - height: 16, - margin: const EdgeInsets.only(right: 6), - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/icon_check.png')), - ), - ), - Text( - "Seats ", - style: blackTextStyle), - // Spacer(), - Text( - "", - style: blackTextStyle.copyWith( - fontWeight: semiBold, color: kBlackColor), - ) - ]), - items: widget.getTotalSeats!.map((String dropDownItem) { - return DropdownMenuItem( - value: dropDownItem, - child: Text( - dropDownItem, - style: blackTextStyle.copyWith( - fontWeight: semiBold, color: kBlackColor), - ), - ); - }).toList(), - onChanged: (newValue) { - // setState(() { - // this.destTypeSelected = newValue; - // }); - }, - // value: destTypeSelected, - ), - ) - : BookingDetailsItem( - title: 'Seats', - valueText: getSeat(widget.getTotalSeats!), - valueColor: kBlackColor), - BookingDetailsItem( - title: 'Insurance', valueText: 'YES', valueColor: kGreenColor), - BookingDetailsItem( - title: 'Refundable', valueText: 'NO', valueColor: kRedColor), - // BookingDetailsItem( - // title: 'VAT', valueText: '10%', valueColor: kBlackColor), - - BookingDetailsItem( - title: 'Total Price', - valueText: '\$ $getTotalPrice', - valueColor: kBlackColor), - // BookingDetailsItem( - // title: 'Grand Total', - // valueText: '\$ ${widget.destination.ticketPrice! * 0.1}', - // valueColor: kPrimaryColor), - ]), - ); - } - - Widget paymentDetails() { - return Container( - margin: const EdgeInsets.only(top: 30), - padding: const EdgeInsets.symmetric( - horizontal: 20, - vertical: 30, - ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(18), color: kWhiteColor), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Payment Details', - style: blackTextStyle.copyWith( - fontSize: 16, - fontWeight: semiBold, - ), - ), - Container( - margin: const EdgeInsets.only(top: 16), - child: Row( - children: [ - Container( - width: 100, - height: 70, - margin: const EdgeInsets.only(right: 16), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(18), - image: const DecorationImage( - fit: BoxFit.cover, - image: AssetImage('assets/image_card.png')), - ), - child: Center( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - width: 24, - height: 24, - margin: const EdgeInsets.only(right: 6), - decoration: const BoxDecoration( - image: DecorationImage( - image: - AssetImage('assets/icon_plane.png'))), - ), - Text( - 'Pay', - style: whiteTextStyle.copyWith( - fontSize: 16, fontWeight: medium), - ) - ], - ), - ), - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '\$ ', - style: blackTextStyle.copyWith( - fontSize: 18, - fontWeight: medium, - ), - overflow: TextOverflow.ellipsis, - ), - const SizedBox( - height: 5, - ), - Text( - 'Current Balance', - style: greyTextStyle.copyWith(fontWeight: light), - ) - ], - ), - ), - ], - ), - ) - ], - ), - ); - } - - Widget payNowButton() { - return CustomButton( - title: 'Pay Now', - onPressed: () async { - ticketModel = Ticket_YE_Model( - ticketNumber: widget.ticketNumber, - from: widget.destination.from, - to: widget.destination.to, - date: widget.destination.date, - travelers: widget.getTotalSeats!.length.toString(), - time: widget.destination.time, - duration: widget.destination.duration, - desType: widget.destination.desType, - flightNumber: widget.destination.flightNumber, - ticketSeats: widget.getTotalSeats, - totalprice: getTotalPrice, - ); - await flightProvider.addUserTickets( - ticketModel, widget.destination.desId!); - - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const SuccessCheckoutPage())); - }, - // margin: EdgeInsets.only(top: 30), - ); - } - - Widget tacButton() { - return Container( - alignment: Alignment.center, - margin: const EdgeInsets.only( - top: 30, - bottom: 30, - ), - child: Text( - 'Tearms and Conditions', - style: greyTextStyle.copyWith( - fontSize: 16, - fontWeight: light, - decoration: TextDecoration.underline), - )); - } - - return Scaffold( - backgroundColor: kBackgroundColor, - body: SafeArea( - child: ListView( - padding: EdgeInsets.symmetric( - horizontal: defaultMargin, - ), - children: [ - route(), - bookingDetails(), - paymentDetails(), - payNowButton(), - tacButton() - ], - ), - ), - ); - } -} diff --git a/lib/view/screen/checkout/success_checkout_page.dart b/lib/view/screen/checkout/success_checkout_page.dart deleted file mode 100644 index fd5a682..0000000 --- a/lib/view/screen/checkout/success_checkout_page.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:ye_airways/shared/components/constantes.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:ye_airways/view/screen/main_ye_screen.dart'; -import 'package:ye_airways/view/widgets/custom_button.dart'; -import 'package:flutter/material.dart'; - -class SuccessCheckoutPage extends StatelessWidget { - const SuccessCheckoutPage({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: kBackgroundColor, - body: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - width: 300, - height: 150, - margin: const EdgeInsets.only(bottom: 80), - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/image_success.png'))), - ), - Text( - 'Well Booked 😍', - style: blackTextStyle.copyWith( - fontSize: 32, - fontWeight: semiBold, - ), - ), - Text( - 'Are you ready to explore the new\n world of experiences?', - style: greyTextStyle.copyWith(fontSize: 16, fontWeight: light), - textAlign: TextAlign.center, - ), - CustomButton( - title: 'Home', - onPressed: () { - navigateToandFinish(context, Main_YE_Screen()); - - // Navigator.pushNamedAndRemoveUntil( - // context, Main_YE_Screen.id, (route) => false); - }, - width: 220, - margin: const EdgeInsets.only(top: 50), - ) - ], - ), - ), - ); - } -} diff --git a/lib/view/screen/destination/choose_seat_page.dart b/lib/view/screen/destination/choose_seat_page.dart deleted file mode 100644 index adf47cc..0000000 --- a/lib/view/screen/destination/choose_seat_page.dart +++ /dev/null @@ -1,1446 +0,0 @@ -import 'dart:math'; - -import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:firebase_auth/firebase_auth.dart'; -import 'package:ye_airways/model/des_model.dart'; -import 'package:ye_airways/model/ticket_ye_model.dart'; -import 'package:ye_airways/provider/destination_provider.dart'; -import 'package:ye_airways/provider/flight_provider.dart'; -import 'package:ye_airways/shared/components/constantes.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:ye_airways/view/screen/checkout/checkout_page.dart'; -import 'package:ye_airways/view/widgets/custom_button.dart'; -import 'package:ye_airways/view/widgets/myalert.dart'; -import 'package:ye_airways/view/widgets/seat_item.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class ChooseSeatPage extends StatefulWidget { - const ChooseSeatPage({super.key, required this.destination}); - final HN_DestinatioModel destination; - - @override - State createState() => _ChooseSeatPageState(); -} - -class _ChooseSeatPageState extends State { - List? getTotalSeats; - double? getTotalPrice; - // User? user; - @override - void initState() { - getTotalSeats = []; - print("User = ${uid != "" ? uid : Null} =-=-=-=-=-=-=-=-=-=-"); - - super.initState(); - } - - @override - Widget build(BuildContext context) { - // int statusSeat = 0; - DestinationProvider destinationProvider = - Provider.of(context); - FlightProvider flightProvider = Provider.of(context); - HN_DestinatioModel? objDestinatiomModel; - Widget title() { - return Container( - margin: const EdgeInsets.only(top: 30), - child: Text( - 'Select Your\nFavorite Seat', - style: blackTextStyle.copyWith(fontSize: 24, fontWeight: semiBold), - ), - ); - } - - Widget seatStatus() { - return Container( - margin: const EdgeInsets.only(top: 20), - child: Row(children: [ - //AVAILABLE - Container( - width: 16, - height: 16, - margin: const EdgeInsets.only(right: 6), - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/icon_available.png'))), - ), - Text( - 'Available', - style: blackTextStyle, - ), - - //SELECTED - Container( - width: 16, - height: 16, - margin: const EdgeInsets.only(left: 10, right: 6), - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/icon_selected.png'))), - ), - Text( - 'Selected', - style: blackTextStyle, - ), - - //UNAVAILABLE - Container( - width: 16, - height: 16, - margin: const EdgeInsets.only(left: 10, right: 6), - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/icon_unavailable.png'))), - ), - Text( - 'Unavailable', - style: blackTextStyle, - ) - ]), - ); - } - - void changestatus( - HN_DestinatioModel seatsDestination, int status, int index) { - if (status == 0) { - seatsDestination.seats![index].state = "1"; - seatsDestination.seats![index].userId = uid; - destinationProvider.updateDestination(seatsDestination); - } else if (status == 1 && seatsDestination.seats![index].userId == uid) { - seatsDestination.seats![index].state = "0"; - seatsDestination.seats![index].userId = ""; - destinationProvider.updateDestination(seatsDestination); - } else { - MyAlert.errorAlert(context, desc: "This seat is not available!"); - } - } - - Widget selectSeat() { - return StreamBuilder( - stream: destinationProvider.getDestinaion(widget.destination.desId!), - builder: (context, snapshot) { - if (snapshot.hasData) { - HN_DestinatioModel destination = HN_DestinatioModel(); - - for (final doc in snapshot.data!.docs) { - HN_DestinatioModel dest = HN_DestinatioModel.fromDocument(doc); - if (widget.destination.desId == dest.desId) { - destination = dest; - objDestinatiomModel = dest; - } - } - - getTotalSeats = destinationProvider.getUserSeats(destination, uid); - getTotalSeats!.sort((a, b) => a.length.compareTo(b.length)); - widget.destination.userSeats = getTotalSeats; - getTotalPrice = destination.ticketPrice! * getTotalSeats!.length; - destinationProvider.updateDestination(destination); - - return Column( - children: [ - Container( - width: double.infinity, - margin: const EdgeInsets.only(top: 20), - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(18), - color: kWhiteColor), - child: Column( - children: [ - //SEAT INDICATORS - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - SizedBox( - width: 48, - height: 48, - child: Center( - child: Text( - 'A', - style: greyTextStyle.copyWith(fontSize: 25), - ), - )), - SizedBox( - width: 48, - height: 48, - child: Center( - child: Text( - 'B', - style: greyTextStyle.copyWith(fontSize: 25), - ), - )), - SizedBox( - width: 48, - height: 48, - child: Center( - child: Text( - '', - style: greyTextStyle.copyWith(fontSize: 16), - ), - )), - SizedBox( - width: 48, - height: 48, - child: Center( - child: Text( - 'C', - style: greyTextStyle.copyWith(fontSize: 25), - ), - )), - SizedBox( - width: 48, - height: 48, - child: Center( - child: Text( - 'D', - style: greyTextStyle.copyWith(fontSize: 25), - ), - )), - ], - ), - //NOTE SEAT 1 - Container( - margin: const EdgeInsets.only(top: 16), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: List.generate(5, (index) { - if (index == 0) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("A1")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else if (index == 1) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("B1")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else if (index == 2) { - return SizedBox( - width: 48, - height: 48, - child: Center( - child: Text( - '1', - style: - greyTextStyle.copyWith(fontSize: 16), - ), - ), - ); - } else if (index == 3) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("C1")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("D1")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } - })), - ), - - //NOTE SEAT 2 - Container( - margin: const EdgeInsets.only(top: 16), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: List.generate(5, (index) { - if (index == 0) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("A2")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else if (index == 1) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("B2")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else if (index == 2) { - return SizedBox( - width: 48, - height: 48, - child: Center( - child: Text( - '2', - style: - greyTextStyle.copyWith(fontSize: 16), - ), - ), - ); - } else if (index == 3) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("C2")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("D2")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } - })), - ), - - //NOTE SEAT 3 - Container( - margin: const EdgeInsets.only(top: 16), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: List.generate(5, (index) { - if (index == 0) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("A3")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else if (index == 1) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("B3")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else if (index == 2) { - return SizedBox( - width: 48, - height: 48, - child: Center( - child: Text( - '3', - style: - greyTextStyle.copyWith(fontSize: 16), - ), - ), - ); - } else if (index == 3) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("C3")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("D3")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } - })), - ), - - //NOTE SEAT 4 - Container( - margin: const EdgeInsets.only(top: 16), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: List.generate(5, (index) { - if (index == 0) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("A4")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else if (index == 1) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("B4")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else if (index == 2) { - return SizedBox( - width: 48, - height: 48, - child: Center( - child: Text( - '4', - style: - greyTextStyle.copyWith(fontSize: 16), - ), - ), - ); - } else if (index == 3) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("C4")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("D4")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } - })), - ), - - //NOTE SEAT 5 - Container( - margin: const EdgeInsets.only(top: 16), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: List.generate(5, (index) { - if (index == 0) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("A5")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else if (index == 1) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("B5")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else if (index == 2) { - return SizedBox( - width: 48, - height: 48, - child: Center( - child: Text( - '5', - style: - greyTextStyle.copyWith(fontSize: 16), - ), - ), - ); - } else if (index == 3) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("C5")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("D5")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } - })), - ), - - //NOTE SEAT 6 - Container( - margin: const EdgeInsets.only(top: 16), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: List.generate(5, (index) { - if (index == 0) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("A6")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else if (index == 1) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("B6")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else if (index == 2) { - return SizedBox( - width: 48, - height: 48, - child: Center( - child: Text( - '6', - style: - greyTextStyle.copyWith(fontSize: 16), - ), - ), - ); - } else if (index == 3) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("C6")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("D6")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } - })), - ), - - //NOTE SEAT 7 - Container( - margin: const EdgeInsets.only(top: 16), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: List.generate(5, (index) { - if (index == 0) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("A7")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else if (index == 1) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("B7")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else if (index == 2) { - return SizedBox( - width: 48, - height: 48, - child: Center( - child: Text( - '7', - style: - greyTextStyle.copyWith(fontSize: 16), - ), - ), - ); - } else if (index == 3) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("C7")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("D7")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } - })), - ), - - //NOTE SEAT 8 - Container( - margin: const EdgeInsets.only(top: 16), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: List.generate(5, (index) { - if (index == 0) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("A8")); - // print("indexseat $indexseat ==================="); - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else if (index == 1) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("B8")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else if (index == 2) { - return SizedBox( - width: 48, - height: 48, - child: Center( - child: Text( - '8', - style: - greyTextStyle.copyWith(fontSize: 16), - ), - ), - ); - } else if (index == 3) { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("C8")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } else { - int indexseat = destination.seats!.indexWhere( - (element) => - element.column!.startsWith("D8")); - - return SeatItem( - onTap: () { - changestatus( - destination, - int.parse(destination - .seats![indexseat].state!), - indexseat); - }, - status: (destination - .seats![indexseat].state! == - "1" && - destination - .seats![indexseat].userId! == - uid) - ? 1 - : (destination.seats![indexseat].state! == - "1" && - destination.seats![indexseat] - .userId! != - uid) - ? 2 - : 0, - ); - } - })), - ), - - //NOTE : YOUR SEAT - - Container( - margin: const EdgeInsets.only(top: 30), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - // Text( - // 'Your seat:', - // style: greyTextStyle.copyWith( - // fontWeight: light, - // ), - // ), - Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: DropdownButton( - icon: const Icon( - Icons.arrow_drop_down_circle_outlined), - underline: const SizedBox(), - dropdownColor: kWhiteColor, - hint: SizedBox( - width: 300, - child: Text('Yor Seats', - style: greyTextStyle.copyWith( - fontWeight: light)), - ), - items: - getTotalSeats!.map((String dropDownItem) { - return DropdownMenuItem( - value: dropDownItem, - child: Text( - dropDownItem, - style: blackTextStyle.copyWith( - fontSize: 16, - fontWeight: medium, - color: kPrimaryColor, - ), - ), - ); - }).toList(), - onChanged: (newValue) { - // setState(() { - // this.destTypeSelected = newValue; - // }); - }, - // value: destTypeSelected, - ), - ), - ], - ), - ), - - //NOTE : TOTAL - Container( - margin: const EdgeInsets.only(top: 16), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Total Price', - style: greyTextStyle.copyWith( - fontWeight: light, - ), - ), - Text( - '\$ $getTotalPrice', - style: purpleTextStyle.copyWith( - fontSize: 16, fontWeight: semiBold), - ) - ], - ), - ), - ], - ), - ), - Container( - color: kBackgroundColor, - child: CustomButton( - title: 'Continue to Checkout', - onPressed: () async { - await Navigator.push(context, - MaterialPageRoute(builder: (context) { - User? user3 = FirebaseAuth.instance.currentUser; - return FutureBuilder( - future: FirebaseFirestore.instance - .collection("userTickets") - .doc(uid) - .collection(user3!.email!) - .doc(widget.destination.desId) - .get(), - builder: (context, snapshot) { - if (snapshot.hasData) { - if (snapshot.data!.exists) { - Ticket_YE_Model ticketYeModel = - Ticket_YE_Model.fromDocument( - snapshot.data!); - return CheckoutPage( - ticketNumber: ticketYeModel.ticketNumber!, - destination: destination, - getTotalSeats: getTotalSeats, - ); - } else { - int random = Random().nextInt(50) + 4; - String userTicketNo = "YT6682$random"; - - return CheckoutPage( - ticketNumber: random.toString(), - destination: destination, - getTotalSeats: getTotalSeats, - ); - } - } else { - return Container( - color: kWhiteColor, - child: const Center( - child: CircularProgressIndicator( - color: kPrimaryColor), - ), - ); - } - }); - })); - }, - margin: const EdgeInsets.only(top: 30, bottom: 46), - ), - ) - ], - ); - } else { - return Container(); - } - }, - ); - } - -/* - Widget checkoutButton() { - return CustomButton( - title: 'Continue to Checkout', - onPressed: () async { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => CheckoutPage( - destination: widget.destination, - getTotalSeats: getTotalSeats, - ))); - }, - margin: EdgeInsets.only(top: 30, bottom: 46), - ); - } -*/ - return Scaffold( - backgroundColor: kBackgroundColor, - body: SafeArea( - child: ListView( - padding: const EdgeInsets.symmetric(horizontal: 24), - children: [ - title(), seatStatus(), selectSeat() - // , checkoutButton() - ], - ), - ), - ); - } -} diff --git a/lib/view/screen/destination/des_details_body.dart b/lib/view/screen/destination/des_details_body.dart deleted file mode 100644 index b31090f..0000000 --- a/lib/view/screen/destination/des_details_body.dart +++ /dev/null @@ -1,300 +0,0 @@ -import 'package:firebase_auth/firebase_auth.dart'; -import 'package:ye_airways/model/des_argument.dart'; -import 'package:ye_airways/model/des_model.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:ye_airways/view/screen/destination/choose_seat_page.dart'; -import 'package:ye_airways/view/widgets/custom_button.dart'; -import 'package:ye_airways/view/widgets/interest_item.dart'; -import 'package:ye_airways/view/widgets/photo_item.dart'; -import 'package:flutter/material.dart'; - -class Destination_Details_Body extends StatefulWidget { - const Destination_Details_Body( - {super.key, required this.image, required this.destination}); - final HN_DestinatioModel destination; - final String image; - - @override - State createState() => - _Destination_Details_BodyState(); -} - -class _Destination_Details_BodyState extends State { - User? user = FirebaseAuth.instance.currentUser; - - bool isOrder = false; - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - Size size = MediaQuery.of(context).size; - DestinationArgument desArgument = - ModalRoute.of(context)!.settings.arguments as DestinationArgument; - - return SingleChildScrollView( - child: Stack( - children: [ - //=========================== backgroundImage =========================== - Container( - width: double.infinity, - height: 450, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.cover, - image: NetworkImage(widget.destination.desImage!))), - ), - //=========================== customShadow =========================== - Container( - width: double.infinity, - height: 214, - margin: const EdgeInsets.only(top: 236), - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - kWhiteColor.withOpacity(0), - Colors.black.withOpacity(0.95) - ]), - ), - ), - //=========================== content =========================== - Container( - width: double.infinity, - margin: const EdgeInsets.only(top: 30, left: 24, right: 24), - child: Column(children: [ - Container( - width: 108, - height: 24, - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage( - 'assets/icon_emblem.png', - ), - )), - ), - - // NOTE: title - Container( - margin: const EdgeInsets.only(top: 256), - child: Row(children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.destination.placename!, - style: whiteTextStyle.copyWith( - fontSize: 24, fontWeight: semiBold), - overflow: TextOverflow.ellipsis, - ), - Text( - widget.destination.to!, - style: whiteTextStyle.copyWith( - fontSize: 16, fontWeight: light), - ) - ], - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 20, - height: 20, - margin: const EdgeInsets.only(right: 2), - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/icon_star.png'), - ), - ), - ), - Text( - '${widget.destination.rating}', - style: whiteTextStyle.copyWith( - fontWeight: medium, - ), - ) - ], - ), - ]), - ), - - //NOTE: Descripstion - Container( - width: double.infinity, - margin: const EdgeInsets.only(top: 30), - padding: const EdgeInsets.symmetric( - horizontal: 20, - vertical: 30, - ), - decoration: BoxDecoration( - color: kWhiteColor, - borderRadius: BorderRadius.circular(18)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - // Text( - // '${widget.destination.from}', - // style: blackTextStyle.copyWith( - // fontSize: 25, fontWeight: semiBold), - // ), - // SizedBox( - // width: 50, - // ), - // Icon( - // Icons.flight_takeoff_sharp, - // size: 40, - // ), - // Text( - // '${widget.destination.to}', - // style: blackTextStyle.copyWith( - // fontSize: 25, fontWeight: semiBold), - // ), - ], - ), - const SizedBox( - height: 6, - ), - - Text( - 'About', - style: blackTextStyle.copyWith( - fontSize: 16, fontWeight: semiBold), - ), - const SizedBox( - height: 6, - ), - Text( - widget.destination.description!, - style: blackTextStyle.copyWith(height: 2), - ), - //NOTE: Photos - const SizedBox( - height: 20, - ), - Text( - 'Photos', - style: blackTextStyle.copyWith( - fontSize: 16, - fontWeight: semiBold, - ), - ), - const SizedBox( - height: 6, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.start, - children: [ - for (final image in widget.destination.desOtherImages!) - PhotoItem( - imageUrl: image, - ), - ], - ), - //Note: Interest - const SizedBox( - height: 20, - ), - Text( - 'Interests', - style: blackTextStyle.copyWith( - fontSize: 16, - fontWeight: semiBold, - ), - ), - const SizedBox(height: 6), - const Row( - children: [ - InterestItem( - text: 'Kids Park', - ), - InterestItem( - text: 'Honor Bridge', - ) - ], - ), - const SizedBox( - height: 10, - ), - const Row( - children: [ - InterestItem( - text: 'City Museum', - ), - InterestItem( - text: 'Central Mall', - ) - ], - ), - ], - ), - ), - - //NOTE: PRICE & BOOK BUTTON - Container( - width: double.infinity, - margin: const EdgeInsets.symmetric(vertical: 30), - child: Row( - children: [ - //NOTE: PRICE - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '\$ ${widget.destination.ticketPrice} ', - style: blackTextStyle.copyWith( - fontSize: 20, fontWeight: medium), - ), - const SizedBox( - height: 5, - ), - Text( - 'per orang', - style: greyTextStyle.copyWith( - fontWeight: light, fontSize: 16), - ), - ], - ), - ), - - //NOTE: BOOK BUTTON - CustomButton( - title: 'Book Now', - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ChooseSeatPage( - destination: widget.destination, - ), - )); - - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => MyFlights_YE(), - // )); - - // Navigator.push(context, HomePage_HN()); - }, - width: 200, - ), - ], - ), - ) - ]), - ) - ], - ), - ); - } -} diff --git a/lib/view/screen/destination/des_details_page.dart b/lib/view/screen/destination/des_details_page.dart deleted file mode 100644 index 0f6086e..0000000 --- a/lib/view/screen/destination/des_details_page.dart +++ /dev/null @@ -1,27 +0,0 @@ -import 'package:ye_airways/model/des_argument.dart'; -import 'package:flutter/material.dart'; -import 'package:ye_airways/view/screen/destination/des_details_body.dart'; - -class DesDetailPage extends StatefulWidget { - static const String id = 'DesDetailPage'; - - const DesDetailPage({super.key}); - - @override - State createState() => _DesDetailPageState(); -} - -class _DesDetailPageState extends State { - @override - Widget build(BuildContext context) { - DestinationArgument desArgument = - ModalRoute.of(context)!.settings.arguments as DestinationArgument; - - return Scaffold( - body: SafeArea( - child: Destination_Details_Body( - image: desArgument.destinationArg.desImage, - destination: desArgument.destinationArg), - )); - } -} diff --git a/lib/view/screen/destination/destination_home.dart b/lib/view/screen/destination/destination_home.dart deleted file mode 100644 index 4f1b30a..0000000 --- a/lib/view/screen/destination/destination_home.dart +++ /dev/null @@ -1,202 +0,0 @@ -import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:ye_airways/model/des_argument.dart'; -import 'package:ye_airways/model/des_model.dart'; -import 'package:ye_airways/provider/destination_provider.dart'; -import 'package:ye_airways/view/screen/destination/des_details_page.dart'; -import 'package:ye_airways/view/widgets/destination_card.dart'; -import 'package:ye_airways/view/widgets/destination_tile.dart'; -import 'package:flutter/material.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:provider/provider.dart'; - -class Destination_Home extends StatefulWidget { - static const String id = 'Destination_Home'; - - const Destination_Home({super.key}); - - @override - State createState() => _Destination_HomeState(); -} - -class _Destination_HomeState extends State { - @override - Widget build(BuildContext context) { - DestinationProvider destinationProvider = - Provider.of(context); - // final credential = FirebaseAuth.instance.currentUser; - - return Scaffold( - body: SafeArea( - child: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.only(top: 8.0, bottom: 8.0), - child: Column( - children: [ - // Header - Container( - margin: const EdgeInsets.only(left: 24, right: 24, top: 10), - child: Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Fly Freely and Comfortably ', - // ${credential!.displayName} ', - - style: blackTextStyle.copyWith( - fontSize: 22, fontWeight: semiBold), - overflow: TextOverflow.ellipsis, - ), - const SizedBox( - height: 6, - ), - Text( - 'Where to fly today ?', - style: greyTextStyle.copyWith( - fontSize: 16, - fontWeight: light, - ), - ), - ], - ), - ), - ], - ), - ), - - //popular Destinations - Container( - margin: const EdgeInsets.only(top: 30), - height: 323, - child: StreamBuilder( - stream: destinationProvider.getPopularDestinations(), - builder: (context, AsyncSnapshot snapshot) { - return snapshot.hasData - ? ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: snapshot.data!.docs.length, // error - itemBuilder: (BuildContext context, int index) { - DocumentSnapshot ds = - snapshot.data!.docs[index]; // error - HN_DestinatioModel destination = - HN_DestinatioModel.fromDocument(ds); - // print(destination.toJson()); - return DestinationCard( - index: index, - destinatioModel: destination, - press: () { - Navigator.pushNamed( - context, DesDetailPage.id, - arguments: - DestinationArgument(destination)); - }); - }, - ) - : const Center(); - }, - ), - ), - - //New Destinations - Container( - height: 27, - margin: const EdgeInsets.only(top: 20, left: 24, right: 24), - alignment: Alignment.centerLeft, - child: Text( - 'New This Year', - style: blackTextStyle.copyWith( - fontSize: 18, - fontWeight: semiBold, - ), - ), - ), - Container( - margin: const EdgeInsets.only(top: 30), - height: 323, - child: StreamBuilder( - stream: destinationProvider.getNewDestinations(), - builder: (context, AsyncSnapshot snapshot) { - return snapshot.hasData - ? ListView.builder( - scrollDirection: Axis.horizontal, - // padding: - // const EdgeInsets.only(bottom: 10, top: 10), - itemCount: snapshot.data!.docs.length, // error - itemBuilder: (BuildContext context, int index) { - DocumentSnapshot ds = - snapshot.data!.docs[index]; // error - HN_DestinatioModel destination = - HN_DestinatioModel.fromDocument(ds); - return DestinationCard( - index: index, - destinatioModel: destination, - press: () { - Navigator.pushNamed( - context, DesDetailPage.id, - arguments: - DestinationArgument(destination)); - }); - }, - ) - : const Center(); - }, - ), - ), - - //Local Destinations - Container( - height: 27, - margin: const EdgeInsets.only(top: 20, left: 24, right: 24), - alignment: Alignment.centerLeft, - child: Text( - 'Best Local Destinations', - style: blackTextStyle.copyWith( - fontSize: 18, - fontWeight: semiBold, - ), - ), - ), - - Container( - margin: const EdgeInsets.only( - top: 5, left: 24, right: 24, bottom: 20), - // height: , - child: StreamBuilder( - stream: destinationProvider.getLocalDestinations(), - builder: (context, AsyncSnapshot snapshot) { - return snapshot.hasData - ? ListView.builder( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - scrollDirection: Axis.vertical, - itemCount: snapshot.data!.docs.length, // error - itemBuilder: (BuildContext context, int index) { - DocumentSnapshot ds = - snapshot.data!.docs[index]; // error - HN_DestinatioModel destination = - HN_DestinatioModel.fromDocument(ds); - return DestinationTile( - index: index, - destinatioModel: destination, - press: () { - Navigator.pushNamed( - context, DesDetailPage.id, - arguments: - DestinationArgument(destination)); - }); - }, - ) - : const Center(); - }, - ), - ), - ], - ), - ), - ), - ), - ); - } -} diff --git a/lib/view/screen/main_ye_screen.dart b/lib/view/screen/main_ye_screen.dart deleted file mode 100644 index 03098f2..0000000 --- a/lib/view/screen/main_ye_screen.dart +++ /dev/null @@ -1,163 +0,0 @@ -import 'package:firebase_auth/firebase_auth.dart'; -import 'package:ye_airways/shared/components/constantes.dart'; -import 'package:ye_airways/shared/network/local/cache_helper.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:ye_airways/view/screen/admin/add_destination.dart'; -import 'package:ye_airways/view/screen/destination/destination_home.dart'; -import 'package:ye_airways/view/screen/user/flight_states.dart'; -import 'package:ye_airways/view/screen/user/login_ye_screen.dart'; -import 'package:ye_airways/view/screen/user/profile_page.dart'; -import 'package:ye_airways/view/screen/user/user_tickets.dart'; -import 'package:ye_airways/view/widgets/Image_user_from_fire.dart'; -import 'package:ye_airways/view/widgets/name_user_from_fire.dart'; -import 'package:ye_airways/view/widgets/user_email_from_fire.dart'; -import 'package:flutter/material.dart'; - -// ignore: camel_case_types -class Main_YE_Screen extends StatelessWidget { - static const String id = 'Main_YE_Screen'; - - final GlobalKey scaffoldKey = GlobalKey(); - - Main_YE_Screen({super.key}); - - @override - Widget build(BuildContext context) { - User? user2 = FirebaseAuth.instance.currentUser; - - return Scaffold( - key: scaffoldKey, - appBar: AppBar( - backgroundColor: kPrimaryColor, - title: const Text('YEMENIA AIRWAYS'), - centerTitle: true, - leading: IconButton( - iconSize: 30, - onPressed: (() { - scaffoldKey.currentState!.openDrawer(); - }), - icon: const Icon(Icons.menu), - ), - ), - drawer: Drawer( - child: ListView( - // Important: Remove any padding from the ListView. - padding: EdgeInsets.zero, - children: [ - SizedBox( - height: 280, - child: DrawerHeader( - decoration: const BoxDecoration( - color: kPrimaryColor, - ), - child: Column( - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - ), - child: const ImgUser(), - ), - const SizedBox(height: 10.0), - const Center(child: UserName()), - const SizedBox(height: 10.0), - const Center(child: EmailUser()), - const SizedBox(height: 5.0), - ], - ), - ), - ), - ListTile( - leading: const Icon( - Icons.person, - color: kPrimaryColor, - ), - title: const Text( - 'Profile', - style: TextStyle(fontSize: 18, color: kPrimaryColor), - ), - onTap: () { - Navigator.pushNamed(context, Profile_YE_Screen.id); - }, - ), - ListTile( - title: const Text( - "My Tickets", - style: TextStyle(fontSize: 18, color: kPrimaryColor), - ), - leading: const Icon( - Icons.airplane_ticket_outlined, - color: kPrimaryColor, - ), - onTap: () { - Navigator.pushNamed(context, UserTickets.id); - }), - - // ListTile( - // leading: Icon( - // Icons.settings, - // color: kPrimaryColor, - // ), - // title: Text( - // 'Settings', - // style: TextStyle(fontSize: 18, color: kPrimaryColor), - // ), - // onTap: () { - // Navigator.pop(context); - // }, - // ), - user2!.email == '7usam.pro@gmail.com' - ? ListTile( - title: const Text( - "Add Destination", - style: TextStyle(fontSize: 18, color: kPrimaryColor), - ), - leading: const Icon( - Icons.add_home_work_outlined, - color: kPrimaryColor, - ), - onTap: () { - navigateTo(context, const AddDestinationPage()); - // Navigator.pushNamed(context, AddDestinationPage.id); - }) - : Container(), - - user2.email == '7usam.pro@gmail.com' - ? ListTile( - title: const Text( - "Flight States", - style: TextStyle(fontSize: 18, color: kPrimaryColor), - ), - leading: const Icon( - Icons.check_box_outlined, - color: kPrimaryColor, - ), - onTap: () { - navigateTo(context, const Flight_States()); - - // Navigator.pushNamed(context, GetStartedPage.id); - }) - : Container(), - ListTile( - leading: const Icon( - Icons.arrow_back, - color: kPrimaryColor, - ), - title: const Text( - 'Logout', - style: TextStyle(fontSize: 18, color: kPrimaryColor), - ), - onTap: () async { - await FirebaseAuth.instance.signOut(); - CacheHlper.removeData(key: "uid"); - - navigateToandFinish(context, const LoginYEScreen()); - }, - ), - ], - ), - ), - body: const Destination_Home(), - ); - } -} diff --git a/lib/view/screen/splash/get_started.dart b/lib/view/screen/splash/get_started.dart deleted file mode 100644 index 673ece6..0000000 --- a/lib/view/screen/splash/get_started.dart +++ /dev/null @@ -1,67 +0,0 @@ -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:ye_airways/view/screen/splash/introductionScreen.dart'; -import 'package:ye_airways/view/widgets/custom_button.dart'; -import 'package:flutter/material.dart'; - -class GetStartedPage extends StatelessWidget { - static const String id = 'GetStartedPage'; - - const GetStartedPage({super.key}); - - @override - Widget build(BuildContext context) { - return Scaffold( - body: Stack( - children: [ - Container( - width: double.infinity, - height: double.infinity, - decoration: const BoxDecoration( - image: DecorationImage( - fit: BoxFit.cover, - image: AssetImage('assets/image_get_started.png'))), - ), - Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - 'Fly Like a Bird', - style: whiteTextStyle.copyWith( - fontSize: 32, fontWeight: semiBold), - ), - const SizedBox( - height: 10, - ), - - Text( - 'Explore new world with us and let\nyourself get an amazing experiences', - style: - whiteTextStyle.copyWith(fontSize: 16, fontWeight: light), - textAlign: TextAlign.center, - ), - // Text( - // "The National Carrier of Yemen", - // style: whiteTextStyle.copyWith( - // fontSize: 25, fontWeight: semiBold), - // ), - - Padding( - padding: EdgeInsets.symmetric(horizontal: defaultMargin), - child: CustomButton( - title: 'Get Started', - // width: 220, - margin: const EdgeInsets.only(top: 50, bottom: 80), - onPressed: () { - Navigator.pushNamed(context, OnBoardingScreen.id); - // Navigator.pushNamed(context, SignUp_YE_Screen.id); - }), - ) - ], - ), - ) - ], - ), - ); - } -} diff --git a/lib/view/screen/splash/introductionScreen.dart b/lib/view/screen/splash/introductionScreen.dart deleted file mode 100644 index a9d4367..0000000 --- a/lib/view/screen/splash/introductionScreen.dart +++ /dev/null @@ -1,127 +0,0 @@ -import 'dart:async'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:ye_airways/view/screen/user/login_ye_screen.dart'; -import 'package:ye_airways/view/screen/user/signup_ye_screen.dart'; -import 'package:ye_airways/view/widgets/custom_button.dart'; -import 'package:ye_airways/view/widgets/page_pop_view.dart'; -import 'package:flutter/material.dart'; -import 'package:smooth_page_indicator/smooth_page_indicator.dart'; - -class OnBoardingScreen extends StatefulWidget { - static const String id = 'OnBoardingScreen'; - - const OnBoardingScreen({super.key}); - - @override - _OnBoardingScreenState createState() => _OnBoardingScreenState(); -} - -class _OnBoardingScreenState extends State { - var pageController = PageController(initialPage: 0); - List pageViewModelData = []; - - late Timer sliderTimer; - var currentShowIndex = 0; - - @override - void initState() { - pageViewModelData.add(PageViewData( - titleText: 'Plan your trips', - subText: 'book one of your unique ticket to\nescape the ordinary', - assetsImage: 'assets/introduction1.png', - )); - - pageViewModelData.add(PageViewData( - titleText: 'Find best deals', - subText: - 'Find deals for any season from cosy\ncountry homes to city flats', - assetsImage: 'assets/introduction2.png', - )); - - pageViewModelData.add(PageViewData( - titleText: 'Best travelling all time', - subText: - 'Find deals for any season from cosy\ncountry homes to city flats', - assetsImage: 'assets/introduction3.png', - )); - - sliderTimer = Timer.periodic(const Duration(seconds: 4), (timer) { - if (currentShowIndex == 0) { - pageController.animateTo(MediaQuery.of(context).size.width, - duration: const Duration(seconds: 1), curve: Curves.fastOutSlowIn); - } else if (currentShowIndex == 1) { - pageController.animateTo(MediaQuery.of(context).size.width * 2, - duration: const Duration(seconds: 1), curve: Curves.fastOutSlowIn); - } else if (currentShowIndex == 2) { - pageController.animateTo(0, - duration: const Duration(seconds: 1), curve: Curves.fastOutSlowIn); - } - }); - super.initState(); - } - - @override - void dispose() { - sliderTimer.cancel(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - body: Padding( - padding: EdgeInsets.symmetric(horizontal: defaultMargin), - child: Column( - children: [ - SizedBox( - height: MediaQuery.of(context).padding.top, - ), - Expanded( - child: PageView( - controller: pageController, - pageSnapping: true, - onPageChanged: (index) { - currentShowIndex = index; - }, - scrollDirection: Axis.horizontal, - children: [ - PagePopup(imageData: pageViewModelData[0]), - PagePopup(imageData: pageViewModelData[1]), - PagePopup(imageData: pageViewModelData[2]), - ], - ), - ), - SmoothPageIndicator( - controller: pageController, // PageController - count: 3, - effect: WormEffect( - activeDotColor: kPrimaryColor, - dotColor: Theme.of(context).dividerColor, - dotHeight: 10.0, - dotWidth: 10.0, - spacing: 5.0), // your preferred effect - onDotClicked: (index) {}, - ), - CustomButton( - margin: const EdgeInsets.only(top: 40, bottom: 10), - title: "Sign In", - onPressed: () { - Navigator.pushNamed(context, LoginYEScreen.id); - }, - ), - CustomButton( - margin: const EdgeInsets.only(top: 10, bottom: 46), - title: "Sign Up", - onPressed: () { - Navigator.pushNamed(context, SignUp_YE_Screen.id); - }, - ), - SizedBox( - height: MediaQuery.of(context).padding.bottom, - ) - ], - ), - ), - ); - } -} diff --git a/lib/view/screen/splash/splash_page.dart b/lib/view/screen/splash/splash_page.dart deleted file mode 100644 index d534017..0000000 --- a/lib/view/screen/splash/splash_page.dart +++ /dev/null @@ -1,34 +0,0 @@ -import 'package:animated_splash_screen/animated_splash_screen.dart'; -import 'package:ye_airways/shared/components/constantes.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:flutter/material.dart'; -import 'package:ye_airways/view/screen/main_ye_screen.dart'; -import 'package:ye_airways/view/screen/splash/get_started.dart'; - -class SplashHome extends StatelessWidget { - static const String id = 'splash_YE_Screen'; - - const SplashHome({super.key}); - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: kPrimaryColor, - body: SafeArea( - child: Container( - child: AnimatedSplashScreen( - centered: true, - splashIconSize: 300, - duration: 300, - splash: Container( - child: Image.asset("assets/icon_plane.png"), - ), - nextScreen: uid != "" ? Main_YE_Screen() : const GetStartedPage(), - splashTransition: SplashTransition.rotationTransition, - // pageTransitionType: PageTransitionType.hashCode, - backgroundColor: kPrimaryColor), - ), - ), - ); - } -} diff --git a/lib/view/screen/user/bonus_page.dart b/lib/view/screen/user/bonus_page.dart deleted file mode 100644 index cdcaef3..0000000 --- a/lib/view/screen/user/bonus_page.dart +++ /dev/null @@ -1,145 +0,0 @@ -import 'package:ye_airways/model/hn_user_model.dart'; -import 'package:ye_airways/shared/components/constantes.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:ye_airways/view/screen/main_ye_screen.dart'; -import 'package:ye_airways/view/widgets/custom_button.dart'; -import 'package:flutter/material.dart'; - -class BonusPage extends StatelessWidget { - const BonusPage({Key? key, required this.user}) : super(key: key); - final HN_UserModel user; - @override - Widget build(BuildContext context) { - Widget bonusCard() { - return Container( - width: 300, - height: 211, - padding: const EdgeInsets.all(24), - decoration: BoxDecoration( - image: const DecorationImage( - image: AssetImage('assets/image_card.png')), - boxShadow: [ - BoxShadow( - color: kPrimaryColor.withOpacity(0.5), - blurRadius: 50, - offset: const Offset(0, 10), - ) - ]), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "", - // user.userName!, - style: whiteTextStyle.copyWith(fontWeight: light), - ), - Text( - user.userName!, - // state.user.name, - style: whiteTextStyle.copyWith( - fontSize: 20, fontWeight: medium), - overflow: TextOverflow.ellipsis, - ) - ], - ), - ), - Container( - width: 24, - height: 24, - margin: const EdgeInsets.only(right: 6), - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage( - 'assets/icon_plane.png', - ))), - ), - Text( - 'Pay', - style: - whiteTextStyle.copyWith(fontSize: 16, fontWeight: medium), - ) - ], - ), - const SizedBox( - height: 41, - ), - Text( - 'Balance', - style: whiteTextStyle.copyWith( - fontWeight: light, - ), - ), - Text( - '\$ ${user.balance}', - style: whiteTextStyle.copyWith( - fontSize: 26, - fontWeight: medium, - ), - ) - ], - ), - ); - } - - Widget title() { - return Container( - margin: const EdgeInsets.only(top: 80), - child: Text( - 'Big Bonus 🎉', - style: blackTextStyle.copyWith( - fontSize: 32, - fontWeight: semiBold, - ), - ), - ); - } - - Widget subtitle() { - return Container( - margin: const EdgeInsets.only(top: 10), - child: Text( - 'We give you early credit so that\nyou can buy a flight ticket', - style: greyTextStyle.copyWith( - fontSize: 16, - fontWeight: light, - ), - textAlign: TextAlign.center, - ), - ); - } - - Widget startButton() { - return CustomButton( - title: 'Start Fly Now', - margin: const EdgeInsets.only(top: 50), - width: 220, - onPressed: () { - navigateToandFinish(context, Main_YE_Screen()); - - // Navigator.pushNamedAndRemoveUntil( - // context, '/main', (route) => false); - }); - } - - return Scaffold( - backgroundColor: kBackgroundColor, - body: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - bonusCard(), - title(), - subtitle(), - startButton(), - ], - ), - ), - ); - } -} diff --git a/lib/view/screen/user/flight_states.dart b/lib/view/screen/user/flight_states.dart deleted file mode 100644 index bfd10ff..0000000 --- a/lib/view/screen/user/flight_states.dart +++ /dev/null @@ -1,18 +0,0 @@ -import 'package:ye_airways/shared/components/constantes.dart'; -import 'package:flutter/material.dart'; - -class Flight_States extends StatelessWidget { - const Flight_States({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return const Scaffold( - backgroundColor: kbackgroundColor, - body: SafeArea( - child: Center( - child: Text('Flight States'), - ), - ), - ); - } -} diff --git a/lib/view/screen/user/login_ye_screen.dart b/lib/view/screen/user/login_ye_screen.dart deleted file mode 100644 index 1209ad4..0000000 --- a/lib/view/screen/user/login_ye_screen.dart +++ /dev/null @@ -1,202 +0,0 @@ -import 'package:firebase_auth/firebase_auth.dart'; -import 'package:ye_airways/shared/components/constantes.dart'; -import 'package:ye_airways/shared/network/local/cache_helper.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:ye_airways/view/screen/main_ye_screen.dart'; -import 'package:ye_airways/view/screen/user/signup_ye_screen.dart'; -import 'package:ye_airways/view/widgets/custom_button.dart'; -import 'package:ye_airways/view/widgets/myalert.dart'; -import 'package:flutter/material.dart'; -import 'package:google_fonts/google_fonts.dart'; - -class LoginYEScreen extends StatefulWidget { - static const String id = 'login_YE_screen'; - - const LoginYEScreen({super.key}); - @override - State createState() => _LoginYEScreenState(); -} - -class _LoginYEScreenState extends State { - var emailController = TextEditingController(); - bool isVisable = true; - - var passwordController = TextEditingController(); - var keyForm = GlobalKey(); - bool isLoading = false; - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: kBackgroundColor, - body: SafeArea( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: SingleChildScrollView( - child: Form( - key: keyForm, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const SizedBox( - height: 80, - ), - const SizedBox( - height: 250.0, - width: 250.0, - child: Image( - image: AssetImage('assets/logo-ye.png'), - ), - ), - const SizedBox( - height: 40, - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 25, - ), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 20, - ), - child: TextFormField( - controller: emailController, - validator: ((value) { - if (value!.isEmpty) return "Cannot be Empty"; - - return null; - }), - decoration: const InputDecoration( - border: InputBorder.none, - hintText: 'Email', - ), - ), - ), - ), - ), - const SizedBox( - height: 30, - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 25, - ), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 20, - ), - child: TextFormField( - controller: passwordController, - validator: ((value) { - if (value!.isEmpty) return "Cannot be Empty"; - - return null; - }), - obscureText: isVisable ? true : false, - decoration: InputDecoration( - border: InputBorder.none, - hintText: 'Password', - suffixIcon: IconButton( - onPressed: () { - setState(() { - isVisable = !isVisable; - }); - }, - icon: isVisable - ? const Icon(Icons.visibility) - : const Icon(Icons.visibility_off), - ), - ), - ), - )), - ), - const SizedBox( - height: 30, - ), - isLoading - ? const Center(child: CircularProgressIndicator()) - : CustomButton( - title: 'Sign In', - onPressed: () async { - if (keyForm.currentState!.validate()) { - setState(() { - isLoading = true; - }); - - await FirebaseAuth.instance - .signInWithEmailAndPassword( - email: emailController.text, - password: passwordController.text) - .then((value) { - if (value.user != null) { - uid = value.user!.uid.toString(); - CacheHlper.putData( - key: "uid", value: value.user!.uid); - navigateToandFinish( - context, Main_YE_Screen()); - } - }).catchError((error) { - MyAlert.errorAlert(context, - desc: "There is an Error!"); - setState(() { - isLoading = false; - }); - - print(error.toString()); - }); - } else { - setState(() { - isLoading = false; - }); - } - }), - const SizedBox( - height: 25, - ), - Center( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - 'Not yet a member? ', - style: GoogleFonts.robotoCondensed( - fontWeight: FontWeight.bold, - ), - ), - InkWell( - onTap: () { - navigateToandFinish( - context, const SignUp_YE_Screen()); - }, - child: Text( - 'Sign up now', - style: GoogleFonts.robotoCondensed( - color: ksecondaryColor, - fontWeight: FontWeight.bold, - ), - ), - ) - ], - ), - ), - ], - ), - ), - ), - ), - ), - ); - } -} diff --git a/lib/view/screen/user/profile_page.dart b/lib/view/screen/user/profile_page.dart deleted file mode 100644 index 92d6229..0000000 --- a/lib/view/screen/user/profile_page.dart +++ /dev/null @@ -1,179 +0,0 @@ -import 'dart:io'; -import 'dart:math'; -import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:firebase_auth/firebase_auth.dart'; -import 'package:firebase_storage/firebase_storage.dart'; -import 'package:ye_airways/shared/components/constantes.dart'; -import 'package:ye_airways/shared/network/local/cache_helper.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:ye_airways/view/screen/user/login_ye_screen.dart'; -import 'package:ye_airways/view/widgets/Image_user_from_fire.dart'; -import 'package:ye_airways/view/widgets/data_from_firestore.dart'; -import 'package:google_fonts/google_fonts.dart'; -import 'package:image_picker/image_picker.dart'; -import 'package:flutter/material.dart'; -import 'package:path/path.dart' show basename; - -class Profile_YE_Screen extends StatefulWidget { - static const String id = 'profile_YE_screen'; - - const Profile_YE_Screen({super.key}); - - @override - State createState() => _Profile_YE_ScreenState(); -} - -class _Profile_YE_ScreenState extends State { - final credential = FirebaseAuth.instance.currentUser; - File? imgPath; - String? imgName; - CollectionReference users = FirebaseFirestore.instance.collection('users'); - get kprimaryColor => null; - - uploadImage2Screen() async { - final pickedImg = - await ImagePicker().pickImage(source: ImageSource.gallery); - try { - if (pickedImg != null) { - setState(() { - imgPath = File(pickedImg.path); - imgName = basename(pickedImg.path); - int random = Random().nextInt(9999999); - imgName = "$random$imgName"; - }); - } else { - print("NO img selected"); - } - } catch (e) { - print("Error => $e"); - } - } - - @override - void initState() { - // TODO: implement initState - super.initState(); - const ImgUser(); - } - - bool Function(Route)? predicate; - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - // backgroundColor: Colors.deepPurple, - backgroundColor: kPrimaryColor, - actions: [ - TextButton.icon( - onPressed: () async { - await FirebaseAuth.instance.signOut(); - CacheHlper.removeData(key: "uid"); - print("User = ${uid != "" ? uid : Null} =-=-=-=-=-=-=-=-=-=-"); - - navigateToandFinish(context, const LoginYEScreen()); - - // Navigator.pushNamedAndRemoveUntil(context, - // MaterialPageRoute(builder: (BuildContext context) { - // return LoginYEScreen.id; - // }), (r) { - // return false; - // }); - }, - label: const Text( - "logout", - style: TextStyle( - color: Colors.white, - ), - ), - icon: const Icon( - Icons.logout, - color: Colors.white, - ), - ) - ], - title: const Text("Profile Page"), - ), - body: Padding( - padding: const EdgeInsets.all(22.0), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const SizedBox( - height: 30, - ), - Center( - child: Container( - padding: const EdgeInsets.all(5), - decoration: const BoxDecoration( - shape: BoxShape.circle, - color: Color.fromARGB(124, 255, 255, 255), - ), - child: Stack( - children: [ - imgPath == null - ? const ImgUser() - : ClipOval( - child: Image.file( - imgPath!, - width: 145, - height: 145, - fit: BoxFit.cover, - ), - ), - Positioned( - left: 103, - bottom: -10, - child: IconButton( - onPressed: () async { - await uploadImage2Screen(); - - if (imgPath != null) { - // Upload image to firebase storage - final storageRef = FirebaseStorage.instance - .ref("users-imgs/$imgName"); - await storageRef.putFile(imgPath!); - // Get img url - String urlll = await storageRef.getDownloadURL(); - - users.doc(credential!.uid).update({ - "imgPath": urlll, - }); - } - }, - icon: const Icon(Icons.add_a_photo), - color: const Color.fromARGB(255, 94, 115, 128), - ), - ), - ], - ), - ), - ), - const SizedBox( - height: 33, - ), - const SizedBox( - height: 22, - ), - Center( - child: Container( - padding: const EdgeInsets.all(1), - decoration: BoxDecoration( - color: kprimaryColor, - borderRadius: BorderRadius.circular(11)), - child: Text( - "User Data", - style: GoogleFonts.robotoCondensed( - fontSize: 26, fontWeight: FontWeight.bold), - ))), - GetDataFromFirestore( - documentId: credential!.uid, - ), - ], - ), - ), - ), - ); - } -} diff --git a/lib/view/screen/user/select_ticket.dart b/lib/view/screen/user/select_ticket.dart deleted file mode 100644 index 5a1ef8e..0000000 --- a/lib/view/screen/user/select_ticket.dart +++ /dev/null @@ -1,435 +0,0 @@ -// import 'dart:math'; - -// import 'package:ye_airways/model/des_model.dart'; -// import 'package:ye_airways/view/screen/checkout_page.dart'; -// import 'package:ye_airways/shared/components/components.dart'; -// import 'package:ye_airways/shared/styles/colors.dart'; -// import 'package:ye_airways/view/widgets/custom_horizontal_divider.dart'; -// import 'package:flutter/material.dart'; - -// class SelectTickets extends StatefulWidget { -// static const String id = 'SelectTickets'; - -// @override -// State createState() => _SelectTicketsState(); -// } - -// class _SelectTicketsState extends State { -// int? random; -// @override -// Widget build(BuildContext context) { -// return Scaffold( -// backgroundColor: kPrimaryColor, -// body: SafeArea( -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.center, -// children: [ -// SizedBox(height: 40.0), -// // Avaliable Flight Tickets -// Padding( -// padding: EdgeInsets.only(left: 25.0, right: 25.0), -// child: Text( -// "Your tickets", -// // '$randomNumber Yemenia flights avaliable from ${widget.destination.from!.substring(0, 3).toUpperCase()} to ${widget.destination.to!.substring(0, 3).toUpperCase()}', -// style: TextStyle( -// color: Colors.white, -// fontSize: 16, -// fontWeight: FontWeight.bold, -// ), -// ), -// ), -// SizedBox(height: 20.0), -// Container( -// child: Padding( -// padding: EdgeInsets.only(left: 25.0, right: 25.0), -// child: ListView.builder( -// itemBuilder: (context, index) { -// return GestureDetector( -// onTap: () { -// // Navigator.push( -// // context, -// // MaterialPageRoute( -// // builder: (context) => CheckoutPage( -// // destination: widget.destination, -// // ))); -// // Navigator.pushNamed(context, Seat_YE_Screen.id); -// }, -// child: Column( -// children: [ -// Container( -// decoration: BoxDecoration( -// color: Colors.white, -// borderRadius: BorderRadius.only( -// topLeft: Radius.circular(15.0), -// topRight: Radius.circular(15.0), -// bottomLeft: Radius.circular(15.0), -// bottomRight: Radius.circular(15.0), -// ), -// ), -// child: Column( -// children: [ -// Container( -// padding: EdgeInsets.only( -// left: 20.0, -// right: 20.0, -// top: 20.0, -// bottom: 30.0, -// ), -// child: Row( -// mainAxisAlignment: -// MainAxisAlignment.spaceBetween, -// children: [ -// Column( -// crossAxisAlignment: -// CrossAxisAlignment.start, -// children: [ -// SizedBox(height: 5.0), -// AcronymCustomText(text: "Nasr" -// // widget.destination.from! -// // .substring(0, 3) -// // .toUpperCase() -// ), -// SizedBox(height: 5.0), -// ActiveInfoCustomText( -// text: "Taiz", -// // widget.destination.from, -// color: kDateTimeAndCitesColor, -// ), -// SizedBox(height: 30.0), -// InactiveInfoCustomText(text: 'DATE'), -// SizedBox(height: 5.0), -// ActiveInfoCustomText( -// text: "Husam", -// color: kActiveColor, -// ), -// ], -// ), -// Column( -// children: [ -// Container( -// height: 118.0, -// width: 160.0, -// child: Image( -// image: AssetImage( -// 'assets/logo3.png')), -// ), -// ActiveInfoCustomText( -// text: "Abdo", -// // '${widget.destination.duration}, ${widget.destination.time}', -// color: kDateTimeAndCitesColor, -// ), -// ], -// ), -// Column( -// crossAxisAlignment: -// CrossAxisAlignment.end, -// children: [ -// SizedBox(height: 5.0), -// AcronymCustomText( -// text: "Husam", - -// // text: widget.destination.to! -// // .substring(0, 3) -// // .toUpperCase(), -// ), -// SizedBox(height: 5.0), -// ActiveInfoCustomText( -// text: "Husam", - -// // text: widget.destination.to, -// color: kDateTimeAndCitesColor, -// ), -// SizedBox(height: 30.0), -// InactiveInfoCustomText( -// text: 'FLIGHT NO', -// ), -// SizedBox(height: 5.0), -// ActiveInfoCustomText( -// text: "", -// // '${widget.destination.flightNumber}', -// color: kActiveColor, -// ), -// ], -// ), -// ], -// ), -// ), -// CustomHorizontalDivider(), -// Container( -// padding: EdgeInsets.all(20.0), -// child: Row( -// mainAxisAlignment: -// MainAxisAlignment.spaceBetween, -// children: [ -// Container( -// height: 30.0, -// width: 70.0, -// child: Image( -// image: AssetImage( -// 'assets/bottom_logos.png'), -// ), -// ), -// Container( -// child: Row( -// crossAxisAlignment: -// CrossAxisAlignment.end, -// children: [ -// Text( -// 'Ticket Price', -// style: TextStyle( -// color: kPrimaryColor, -// fontWeight: FontWeight.bold), -// ), -// SizedBox(width: 10.0), -// Text( -// "320", -// // '\$ ${widget.destination.ticketPrice}', -// style: TextStyle( -// fontSize: 25.0, -// color: kActiveColor, -// ), -// ), -// ], -// ), -// ), -// ], -// ), -// ), -// ], -// ), -// ), -// SizedBox(height: 20.0), -// ], -// ), -// ); -// }, -// itemCount: 3, -// ), -// ), -// ) -// ], -// ), -// ), -// ); -// } -// } - -// /* -// class FlightData { -// String? flightNo; -// String? flightDuration; -// String? flightTime; -// dynamic price; - -// FlightData({this.flightNo, this.flightDuration, this.flightTime, this.price}); -// } -// */ -// /* -// class DayAndDateRow extends StatelessWidget { -// @override -// Widget build(BuildContext context) { -// return Container( -// height: 74.0, -// child: ListView( -// scrollDirection: Axis.horizontal, -// children: [ -// SizedBox(width: 20.0), -// DayAndDateContainer(day: 'MON', date: '15', check: false), -// SizedBox(width: 20.0), -// DayAndDateContainer(day: 'TUE', date: '16', check: false), -// SizedBox(width: 20.0), -// DayAndDateContainer(day: 'WED', date: '17', check: false), -// SizedBox(width: 20.0), -// DayAndDateContainer(day: 'THU', date: '18', check: false), -// SizedBox(width: 20.0), -// DayAndDateContainer(day: 'FRI', date: '19', check: true), -// SizedBox(width: 20.0), -// DayAndDateContainer(day: 'SAT', date: '20', check: false), -// SizedBox(width: 20.0), -// DayAndDateContainer(day: 'SUN', date: '21', check: false), -// SizedBox(width: 20.0), -// ], -// ), -// ); -// } -// } -// */ -// /* -// class DayAndDateContainer extends StatelessWidget { -// DayAndDateContainer({@required this.date, @required this.day, this.check}); -// final String? day; -// final String? date; -// final bool? check; - -// @override -// Widget build(BuildContext context) { -// return Container( -// padding: EdgeInsets.only(left: 10.0, right: 10.0, top: 15.0), -// decoration: BoxDecoration( -// color: check! ? Color(0xFF3E5858) : kPrimaryColor, -// border: Border.all( -// color: check! ? Color(0xFF3E5858) : kInactiveTextColor, -// ), -// borderRadius: BorderRadius.circular(10.0), -// ), -// child: Column( -// mainAxisSize: MainAxisSize.min, -// children: [ -// Text( -// day!, -// style: TextStyle( -// color: check! ? kAccentColor : kLinesColor, -// fontWeight: FontWeight.bold, -// ), -// ), -// Text( -// date!, -// style: TextStyle( -// color: check! ? kAccentColor : Colors.white, -// fontSize: check! ? 30.0 : 20.0, -// ), -// ), -// ], -// ), -// ); -// } -// } -// */ - -// // class InactiveInfoCustomText extends StatelessWidget { -// // InactiveInfoCustomText({@required this.text}); - -// // final String? text; - -// // @override -// // Widget build(BuildContext context) { -// // return Text( -// // text!, -// // style: TextStyle( -// // color: kPrimaryColor, -// // fontWeight: FontWeight.w500, -// // ), -// // ); -// // } -// // } - -// // class ActiveInfoCustomText extends StatelessWidget { -// // ActiveInfoCustomText({@required this.text, this.color}); - -// // final String? text; -// // final Color? color; - -// // @override -// // Widget build(BuildContext context) { -// // return Text( -// // text!, -// // style: TextStyle( -// // color: kPrimaryColor, -// // fontWeight: FontWeight.bold, -// // ), -// // ); -// // } -// // } - -// // class AcronymCustomText extends StatelessWidget { -// // AcronymCustomText({@required this.text}); - -// // final String? text; - -// // @override -// // Widget build(BuildContext context) { -// // return Text( -// // text!, -// // style: TextStyle( -// // color: kPrimaryColor, -// // fontSize: 35.0, -// // fontWeight: FontWeight.w300, -// // ), -// // ); -// // } -// // } - - -// // var ticket = Provider.of(context); - -// // String? flightNo; -// // String? flightDuration; -// // String? flightTime; -// // dynamic price; -// // // List list = []; - -// // void generateFlightNo() { -// // /* -// // this will generate two character randomly. like Kb or aS. -// // And UpperCase method will convert that into Capital letters. -// // */ -// // // String twoCharacters = randomAlpha(2).toUpperCase(); -// // /* -// // this will generate two integer numbers between 10 and 99. -// // because we need two characters and two interger numbers for flightInfo. -// // Ex: KB70 or HD39. -// // */ -// // int twoNumbers = randomBetween(600, 650); -// // flightNo = 'IY$twoNumbers'; -// // } - -// /* -// Both tickDuration and ticketsTime are built on same logic only minor difference -// but we need time and duration different that's why we created seperate method. -// */ -// // void generateFlightDuration() { -// // //this will generate random number that we will count as a minutes. -// // int timeInMinutes = randomBetween(250, 400); -// // //here seperate the total hours in random time divide by 60 and convert into integer. -// // int hours = (timeInMinutes ~/ 60).toInt(); -// // //here after seperating the hours and seperate the remaining minutes from random total minutes. -// // int minutes = timeInMinutes - (hours * 60); - -// // /* -// // we need minutes in two digit form -// // so we check here if minutes are between 0 and 9, -// // convert them to two digit form by adding zero in fornt of it -// // like 0 equals to 00 and 9 equals to 09. -// // */ -// // String mints = '$minutes'; -// // if (minutes >= 0 && minutes < 10) { -// // mints = '0$minutes'; -// // } - -// // flightDuration = '$hours h $mints m'; -// // } - -// // void generateFlightTime() { -// // //this will generate random number that we will count as a minutes. -// // int timeInMinutes = randomBetween(0, 1440); -// // //here seperate the total hours in random time divide by 60 and convert into integer. -// // int hours = (timeInMinutes ~/ 60).toInt(); -// // //here after seperating the hours and seperate the remaining minutes from random total minutes. -// // int minutes = timeInMinutes - (hours * 60); -// // String timePeriod = 'AM'; -// // /* -// // we need minutes in two digit form -// // so we check here if minutes are between 0 and 9, -// // convert them to two digit form by adding zero in fornt of it -// // like 0 equals to 00 and 9 equals to 09. -// // */ -// // String mints = '$minutes'; -// // if (minutes >= 0 && minutes < 10) { -// // mints = '0$minutes'; -// // } - -// // /* -// // check if the hours are greater then 11 it means it is the second part of the day means PM. -// // by default we set to AM, in case of hour equal to or less than 11. -// // */ -// // if (hours > 11) { -// // hours = hours - 12; -// // timePeriod = 'PM'; -// // } - -// // flightTime = '$hours:$mints $timePeriod'; -// // } - -// // void generateFlightPrice() { -// // price = widget.destination.ticketPrice; -// // } diff --git a/lib/view/screen/user/signup_ye_screen.dart b/lib/view/screen/user/signup_ye_screen.dart deleted file mode 100644 index 45d0b2e..0000000 --- a/lib/view/screen/user/signup_ye_screen.dart +++ /dev/null @@ -1,507 +0,0 @@ -import 'dart:io'; -import 'dart:math'; -import 'package:ye_airways/model/hn_user_model.dart'; -import 'package:ye_airways/shared/components/constantes.dart'; -import 'package:ye_airways/shared/network/local/cache_helper.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:ye_airways/view/screen/user/bonus_page.dart'; -import 'package:ye_airways/view/screen/user/login_ye_screen.dart'; -import 'package:ye_airways/view/widgets/custom_button.dart'; -import 'package:ye_airways/view/widgets/myalert.dart'; -import 'package:path/path.dart' show basename; -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:image_picker/image_picker.dart'; - -class SignUp_YE_Screen extends StatefulWidget { - static const String id = 'signup_YE_screen'; - - const SignUp_YE_Screen({super.key}); - @override - State createState() => _SignUp_YE_ScreenState(); -} - -class _SignUp_YE_ScreenState extends State { - bool isVisable = true; - File? imgPath; - String? image; - var keyForm = GlobalKey(); - - bool isLoading = false; - final emailController = TextEditingController(); - final passwordController = TextEditingController(); - final usernameController = TextEditingController(); - final phoneController = TextEditingController(); - // final locationController = TextEditingController(); - - uploadImage2Screen(ImageSource source) async { - final pickedImg = await ImagePicker().pickImage(source: source); - try { - if (pickedImg != null) { - setState(() { - imgPath = File(pickedImg.path); - image = basename(pickedImg.path); - int random = Random().nextInt(9999999); - image = "$uid$image"; - print(image); - }); - } else { - print("NO img selected"); - } - } catch (e) { - print("Error => $e"); - } - - if (!mounted) return; - Navigator.pop(context); - } - - showmodel() { - return showModalBottomSheet( - context: context, - builder: (BuildContext context) { - return Container( - padding: const EdgeInsets.all(22), - height: 170, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - GestureDetector( - onTap: () async { - await uploadImage2Screen(ImageSource.camera); - }, - child: const Row( - children: [ - Icon( - Icons.camera, - size: 30, - ), - SizedBox( - width: 11, - ), - Text( - "From Camera", - style: TextStyle(fontSize: 20), - ) - ], - ), - ), - const SizedBox( - height: 22, - ), - GestureDetector( - onTap: () { - uploadImage2Screen(ImageSource.gallery); - }, - child: const Row( - children: [ - Icon( - Icons.photo_outlined, - size: 30, - ), - SizedBox( - width: 11, - ), - Text( - "From Gallery", - style: TextStyle(fontSize: 20), - ) - ], - ), - ), - ], - ), - ); - }, - ); - } - -/* - register(HN_UserModel userc) async { - setState(() { - isLoading = true; - }); - - try { - final credential = - await FirebaseAuth.instance.createUserWithEmailAndPassword( - email: emailController.text, - password: passwordController.text, - ); - userc.id = credential.user!.uid; -// Upload image to firebase storage - final storageRef = FirebaseStorage.instance.ref("users-imgs/$image"); - await storageRef.putFile(imgPath!); - String urll = await storageRef.getDownloadURL(); - userc.imgPath = urll; - print(credential.user!.uid); - CollectionReference users = - FirebaseFirestore.instance.collection('users'); - users.doc(credential.user!.uid).set(userc.toJson()).then((value) { - usermodel = userc; - print("User Added"); - Navigator.pushNamed(context, Main_YE_Screen.id); - }).catchError((error) => print("Failed to add user: $error")); - } on FirebaseAuthException catch (e) { - if (e.code == 'weak-password') { - showSnackBar(context, "The password provided is too weak."); - } else if (e.code == 'email-already-in-use') { - showSnackBar(context, "The account already exists for that email."); - } else { - showSnackBar(context, "ERROR - Please try again late"); - } - } catch (err) { - showSnackBar(context, err.toString()); - } - - setState(() { - isLoading = false; - }); - } -*/ - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: const Color.fromARGB(255, 247, 247, 247), - body: SafeArea( - child: Center( - child: Padding( - padding: const EdgeInsets.all(20.0), - child: SingleChildScrollView( - child: Form( - key: keyForm, - child: Column( - children: [ - Container( - margin: const EdgeInsets.only(top: 20, bottom: 30), - child: Text( - 'Join us and get\nyour next journey', - style: blackTextStyle.copyWith( - fontSize: 24, fontWeight: semiBold), - ), - ), - InkWell( - child: Container( - padding: const EdgeInsets.all(5), - decoration: const BoxDecoration( - shape: BoxShape.circle, - color: Color.fromARGB(125, 78, 91, 110), - ), - child: Stack( - children: [ - imgPath == null - ? const CircleAvatar( - backgroundColor: - Color.fromARGB(255, 225, 225, 225), - radius: 71, - backgroundImage: - AssetImage("assets/account_user.png"), - ) - : ClipOval( - child: Image.file( - imgPath!, - width: 145, - height: 145, - fit: BoxFit.cover, - errorBuilder: (context, error, - stackTrace) => - const Center( - child: - CircularProgressIndicator()), - ), - ), - Positioned( - left: 99, - bottom: -10, - child: IconButton( - onPressed: () { - showmodel(); - }, - icon: const Icon(Icons.add_a_photo), - color: const Color.fromARGB(255, 94, 115, 128), - ), - ), - ], - ), - ), - onTap: () { - showmodel(); - }, - ), - const SizedBox( - height: 33, - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 5, - ), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, - ), - child: TextField( - controller: usernameController, - decoration: const InputDecoration( - border: InputBorder.none, - hintText: 'Enter Your Name', - suffixIcon: - Icon(Icons.person, color: Colors.grey)), - ), - )), - ), - const SizedBox( - height: 22, - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 5, - ), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, - ), - child: TextField( - controller: phoneController, - keyboardType: TextInputType.number, - obscureText: false, - decoration: const InputDecoration( - border: InputBorder.none, - hintText: 'Enter Your Phone', - suffixIcon: Icon(Icons.phone)), - ), - )), - ), - const SizedBox( - height: 22, - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 5, - ), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, - ), - child: TextFormField( - validator: (email) { - return email!.contains(RegExp( - r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")) - ? null - : "Enter a valid email"; - }, - autovalidateMode: - AutovalidateMode.onUserInteraction, - controller: emailController, - keyboardType: TextInputType.emailAddress, - obscureText: false, - decoration: const InputDecoration( - hintText: "Enter Your email : ", - suffixIcon: Icon(Icons.email), - border: InputBorder.none, - ), - ), - ))), - const SizedBox( - height: 22, - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 5, - ), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular( - 15, - )), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, - ), - child: TextFormField( - onChanged: (password) {}, - // we return "null" when something is valid - validator: (value) { - return value!.length < 8 - ? "Enter at least 8 characters" - : null; - }, - autovalidateMode: - AutovalidateMode.onUserInteraction, - controller: passwordController, - keyboardType: TextInputType.text, - obscureText: isVisable ? true : false, - decoration: InputDecoration( - hintText: "Enter Your Password : ", - border: InputBorder.none, - suffixIcon: IconButton( - onPressed: () { - setState(() { - isVisable = !isVisable; - }); - }, - icon: isVisable - ? const Icon(Icons.visibility) - : const Icon(Icons.visibility_off), - ), - ), - ), - ))), - // const SizedBox( - // height: 22, - // ), - // Padding( - // padding: const EdgeInsets.symmetric( - // horizontal: 5, - // ), - // child: Container( - // decoration: BoxDecoration( - // color: Colors.white, - // borderRadius: BorderRadius.circular( - // 15, - // )), - // child: Padding( - // padding: const EdgeInsets.symmetric( - // horizontal: 10, - // ), - // child: TextFormField( - // validator: (location) { - // return - // // location!.contains(RegExp( - // // r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")) - // // ? - // null; - // // : "Enter a valid location"; - // }, - // autovalidateMode: - // AutovalidateMode.onUserInteraction, - // controller: locationController, - // keyboardType: TextInputType.streetAddress, - // obscureText: false, - // decoration: const InputDecoration( - // hintText: "Enter Your Location : ", - // suffixIcon: - // const Icon(Icons.location_on_outlined), - // border: InputBorder.none, - // ), - // ), - // ))), - - const SizedBox( - height: 20, - ), - isLoading - ? const Center(child: CircularProgressIndicator()) - : CustomButton( - title: 'Get Started', - onPressed: () async { - if (keyForm.currentState!.validate() && - image != null && - imgPath != null) { - setState(() { - isLoading = true; - }); - - FirebaseAuth.instance - .createUserWithEmailAndPassword( - email: emailController.text, - password: passwordController.text) - .then((value) async { - if (value.user != null) { - HN_UserModel usr = HN_UserModel( - email: emailController.text, - userName: usernameController.text, - pass: passwordController.text, - phone: phoneController.text, - id: value.user!.uid, - balance: 200.0); - value.user!.updateDisplayName( - usernameController.text); - // Upload image to firebase storage - final storageRef = FirebaseStorage.instance - .ref("users-imgs/$image"); - await storageRef.putFile(imgPath!); - String urll = - await storageRef.getDownloadURL(); - usr.imgPath = urll; - - FirebaseFirestore.instance - .collection("users") - .doc(value.user!.uid) - .set(usr.toJson()) - .then((user1) { - uid = value.user!.uid.toString(); - CacheHlper.putData( - key: "uid", value: value.user!.uid); - navigateToandFinish( - context, BonusPage(user: usr)); - }).catchError((error) { - MyAlert.errorAlert(context, - desc: "There is an Error!"); - - setState(() { - isLoading = true; - }); - - print(error.toString()); - }); - } - }).catchError((error) { - print(error.toString()); - }); -// - } else { - setState(() { - isLoading = false; - }); - - MyAlert.errorAlert(context, - desc: "Please Enter All Data!"); - } - }), - const SizedBox( - height: 20, - ), - - TextButton( - onPressed: () { - navigateToandFinish(context, const LoginYEScreen()); - }, - child: Text( - 'You Already have account? Sign In', - style: greyTextStyle.copyWith( - fontSize: 16, - fontWeight: light, - decoration: TextDecoration.underline), - ), - ), - ], - ), - ), - ), - ), - ), - ), - ); - } -} diff --git a/lib/view/screen/user/user_tickets.dart b/lib/view/screen/user/user_tickets.dart deleted file mode 100644 index 58d3ac7..0000000 --- a/lib/view/screen/user/user_tickets.dart +++ /dev/null @@ -1,119 +0,0 @@ -import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:ye_airways/model/ticket_ye_model.dart'; -import 'package:ye_airways/provider/flight_provider.dart'; -import 'package:ye_airways/shared/components/constantes.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:ye_airways/view/widgets/ticket_card.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class UserTickets extends StatefulWidget { - static const String id = 'UserTickets'; - - const UserTickets({super.key}); - - @override - State createState() => _UserTicketsState(); -} - -class _UserTicketsState extends State { - int? totalTicets; - // int? seats; - @override - void initState() { - // TODO: implement initState - super.initState(); - // totalTicets = seats; - } - - @override - Widget build(BuildContext context) { - FlightProvider flightProvider = Provider.of(context); - return Scaffold( - appBar: AppBar( - backgroundColor: kPrimaryColor, - title: Text( - 'Your Tickets', - style: whiteTextStyle.copyWith(fontSize: 22, fontWeight: semiBold), - overflow: TextOverflow.ellipsis, - ), - centerTitle: true, - actions: [ - Container( - padding: const EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - totalTicets.toString(), - style: whiteTextStyle.copyWith( - fontSize: 18, fontWeight: semiBold), - ), - const SizedBox( - width: 10, - ), - const Icon( - Icons.airplane_ticket, - size: 35, - ), - ], - ), - ), - ], - ), - backgroundColor: kbackgroundColor, - body: SafeArea( - child: Column( - children: [ - Expanded( - child: Stack(children: [ - Container( - margin: const EdgeInsets.only(top: 20.0), - decoration: const BoxDecoration( - // color: kbackgroundColor, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(20), - topRight: Radius.circular(20), - ), - ), - ), - StreamBuilder( - stream: flightProvider.getAllUserTicekts(), - builder: (context, AsyncSnapshot snapshot) { - totalTicets = snapshot.data.docs.length; - // totalTicets = snapshot.data!.docs.length; - // totalTicets = seats; - return snapshot.hasData - ? Padding( - padding: - const EdgeInsets.only(left: 20.0, right: 20.0), - child: ListView.builder( - padding: - const EdgeInsets.only(bottom: 20, top: 30), - itemCount: snapshot.data!.docs.length, // error - itemBuilder: (BuildContext context, int index) { - DocumentSnapshot ds = - snapshot.data!.docs[index]; // error - Ticket_YE_Model ticket = - Ticket_YE_Model.fromDocument(ds); - // print(ticket.toJson()); - // isOrder = product.usersCart.contains() - return TicketCard( - index: index, - ticket_model: ticket, - press: () {}, - ); - }, - ), - ) - : const Center(); - }, - ), - ]), - ), - ], - ), - ), - ); - } -} diff --git a/lib/view/screen/user/wallet_page.dart b/lib/view/screen/user/wallet_page.dart deleted file mode 100644 index efb63f5..0000000 --- a/lib/view/screen/user/wallet_page.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:flutter/material.dart'; - -class WalletPage extends StatelessWidget { - const WalletPage({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Center( - child: Text('Wallet Page'), - ); - } -} diff --git a/lib/view/widgets/Image_user_from_fire.dart b/lib/view/widgets/Image_user_from_fire.dart deleted file mode 100644 index 1e25097..0000000 --- a/lib/view/widgets/Image_user_from_fire.dart +++ /dev/null @@ -1,46 +0,0 @@ -import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:firebase_auth/firebase_auth.dart'; -import 'package:ye_airways/model/hn_user_model.dart'; -import 'package:ye_airways/shared/components/constantes.dart'; -import 'package:flutter/material.dart'; - -class ImgUser extends StatefulWidget { - const ImgUser({Key? key}) : super(key: key); - - @override - State createState() => _IState(); -} - -class _IState extends State { - @override - final credential = FirebaseAuth.instance.currentUser; - CollectionReference users = FirebaseFirestore.instance.collection('users'); - - @override - Widget build(BuildContext context) { - CollectionReference users = FirebaseFirestore.instance.collection('users'); - - return FutureBuilder( - future: users.doc(credential!.uid).get(), - builder: - (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.hasError) { - return const Text("Something went wrong"); - } - if (snapshot.hasData && !snapshot.data!.exists) { - return const Text("Document does not exist"); - } - if (snapshot.connectionState == ConnectionState.done) { - Map data = - snapshot.data!.data() as Map; - usermodel = HN_UserModel.fromJson(data); - return CircleAvatar( - backgroundImage: NetworkImage(data["imgPath"]), - radius: 71, - ); - } - return const Center(child: CircularProgressIndicator()); - }, - ); - } -} diff --git a/lib/view/widgets/booking_details_item.dart b/lib/view/widgets/booking_details_item.dart deleted file mode 100644 index 0f2a66e..0000000 --- a/lib/view/widgets/booking_details_item.dart +++ /dev/null @@ -1,39 +0,0 @@ -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:flutter/material.dart'; - -class BookingDetailsItem extends StatelessWidget { - final String title; - final String valueText; - final Color valueColor; - - const BookingDetailsItem({ - Key? key, - required this.title, - required this.valueText, - required this.valueColor, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - return Container( - margin: const EdgeInsets.only(top: 16), - child: Row(children: [ - Container( - width: 16, - height: 16, - margin: const EdgeInsets.only(right: 6), - decoration: const BoxDecoration( - image: DecorationImage(image: AssetImage('assets/icon_check.png')), - ), - ), - Text(title, style: blackTextStyle), - const Spacer(), - Text( - valueText, - style: - blackTextStyle.copyWith(fontWeight: semiBold, color: valueColor), - ) - ]), - ); - } -} diff --git a/lib/view/widgets/custom_button.dart b/lib/view/widgets/custom_button.dart deleted file mode 100644 index cb20e07..0000000 --- a/lib/view/widgets/custom_button.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'package:ye_airways/view/widgets/tap_effect.dart'; -import 'package:flutter/material.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; - -class CustomButton extends StatelessWidget { - final String title; - final double width; - final EdgeInsets margin; - final Function() onPressed; - - const CustomButton({ - Key? key, - required this.title, - this.width = double.infinity, - required this.onPressed, - this.margin = EdgeInsets.zero, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - return Container( - margin: margin, - width: width, - height: 50, - child: TapEffect( - onClick: onPressed, - child: TextButton( - style: TextButton.styleFrom( - backgroundColor: kPrimaryColor, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(17))), - onPressed: onPressed, - child: Text( - title, - style: - whiteTextStyle.copyWith(fontSize: 20, fontWeight: semiBold), - )), - ), - ); - } -} diff --git a/lib/view/widgets/custom_horizontal_divider.dart b/lib/view/widgets/custom_horizontal_divider.dart deleted file mode 100644 index f3b8c9f..0000000 --- a/lib/view/widgets/custom_horizontal_divider.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; - -class CustomHorizontalDivider extends StatelessWidget { - const CustomHorizontalDivider({super.key}); - - @override - Widget build(BuildContext context) { - return const Divider( - height: 0.0, - thickness: 1.5, - color: kLinesColor, - ); - } -} diff --git a/lib/view/widgets/data_from_firestore.dart b/lib/view/widgets/data_from_firestore.dart deleted file mode 100644 index 6c7f243..0000000 --- a/lib/view/widgets/data_from_firestore.dart +++ /dev/null @@ -1,222 +0,0 @@ -import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:firebase_auth/firebase_auth.dart'; -import 'package:ye_airways/model/des_model.dart'; -import 'package:ye_airways/model/hn_user_model.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:flutter/material.dart'; - -class GetDataFromFirestore extends StatefulWidget { - final String documentId; - - const GetDataFromFirestore({Key? key, required this.documentId}) - : super(key: key); - - @override - State createState() => _GetDataFromFirestoreState(); -} - -class _GetDataFromFirestoreState extends State { - final dialogUsernameController = TextEditingController(); - final credential = FirebaseAuth.instance.currentUser; - CollectionReference users = FirebaseFirestore.instance.collection('users'); - - myDialog(Map data, dynamic mykey) { - return showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - shape: - RoundedRectangleBorder(borderRadius: BorderRadius.circular(11)), - child: Container( - padding: const EdgeInsets.all(22), - height: 200, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - TextField( - controller: dialogUsernameController, - maxLength: 20, - keyboardType: TextInputType.name, - decoration: InputDecoration( - hintText: " ${data[mykey]} ", - // labelText: "User Name", - border: const OutlineInputBorder(), - ), - ), - const SizedBox( - height: 5, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - TextButton( - onPressed: () { - users - .doc(credential!.uid) - .update({mykey: dialogUsernameController.text}); - - setState(() { - Navigator.pop(context); - }); - }, - child: const Text( - "Edit", - style: TextStyle(fontSize: 17, color: kPrimaryColor), - )), - TextButton( - onPressed: () { - // addnewtask(); - Navigator.pop(context); - }, - child: const Text( - "Cancel", - style: TextStyle(fontSize: 17, color: kPrimaryColor), - )), - ], - ), - ], - ), - ), - ); - }, - ); - } - - @override - Widget build(BuildContext context) { - // CollectionReference users = FirebaseFirestore.instance.collection('users'); - - return FutureBuilder( - future: users.doc(widget.documentId).get(), - builder: - (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.hasError) { - return const Text("Something went wrong"); - } - - if (snapshot.hasData && !snapshot.data!.exists) { - return const Text("Document does not exist"); - } - - if (snapshot.connectionState == ConnectionState.done) { - HN_UserModel user = HN_UserModel.fromDocument(snapshot.data!); - - Map data = - snapshot.data!.data() as Map; - return Padding( - padding: const EdgeInsets.all(10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const SizedBox( - height: 9, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - // Text( - // user.balance.toString(), - // // "UserName: ${data['userName']}", - // style: const TextStyle( - // fontSize: 17, - // ), - // ), - Text( - "Name: ${data['userName']}", - style: const TextStyle( - fontSize: 17, - ), - ), - IconButton( - onPressed: () { - myDialog(data, 'userName'); - }, - icon: const Icon(Icons.edit)) - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "Email: ${data['email']}", - style: const TextStyle( - fontSize: 17, - ), - ), - IconButton( - onPressed: () { - myDialog(data, 'email'); - }, - icon: const Icon(Icons.edit)) - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "Password: ${data['pass']}", - style: const TextStyle( - fontSize: 17, - ), - ), - IconButton( - onPressed: () { - myDialog(data, 'pass'); - }, - icon: const Icon(Icons.edit)) - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "Phone: ${data['phone']} ", - style: const TextStyle( - fontSize: 17, - ), - ), - IconButton( - onPressed: () { - myDialog(data, 'phone'); - }, - icon: const Icon(Icons.edit)) - ], - ), - const Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - // Text( - // "Balance: \$${data['balance']} ", - // style: const TextStyle( - // fontSize: 17, - // ), - // ), - SizedBox( - height: 50, - ) - ], - ), - const SizedBox( - height: 10, - ), - // Center( - // child: TextButton( - // onPressed: () { - // // credential!.delete(); - // // Navigator.pushReplacementNamed(context, LoginYEScreen.id); - // }, - // child: const Text( - // "Delete User", - // style: TextStyle(fontSize: 18, color: Colors.black87), - // )), - // ), - ], - ), - ); - } - - return const Text("loading"); - }, - ); - } -} diff --git a/lib/view/widgets/destination_card.dart b/lib/view/widgets/destination_card.dart deleted file mode 100644 index 53d8b36..0000000 --- a/lib/view/widgets/destination_card.dart +++ /dev/null @@ -1,116 +0,0 @@ -import 'package:ye_airways/model/des_model.dart'; -import 'package:ye_airways/provider/destination_provider.dart'; -import 'package:flutter/material.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:provider/provider.dart'; - -class DestinationCard extends StatelessWidget { - final int index; - final HN_DestinatioModel destinatioModel; - final Function()? press; - - const DestinationCard( - {super.key, - required this.index, - required this.destinatioModel, - required this.press}); - - @override - Widget build(BuildContext context) { - DestinationProvider destinationProvider = - Provider.of(context); - - Size size = MediaQuery.of(context).size; - - return GestureDetector( - onTap: press, - child: Container( - width: 200, - height: 323, - margin: const EdgeInsets.only(left: 24), - padding: const EdgeInsets.all(10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(18), color: kWhiteColor), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 180, - height: 220, - margin: const EdgeInsets.only(bottom: 20), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(18), - image: DecorationImage( - image: NetworkImage(destinatioModel.desImage!) - // Image.network(src), - // Image( - // image: Image.network( - // destinatioModel.desImage!, - // )) - )), - child: Align( - alignment: Alignment.topRight, - child: Container( - width: 55, - height: 30, - decoration: const BoxDecoration( - color: kWhiteColor, - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(18), - ), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 20, - height: 20, - margin: const EdgeInsets.only(right: 2), - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/icon_star.png'), - ), - ), - ), - Text( - destinatioModel.rating.toString(), - style: blackTextStyle.copyWith( - fontWeight: medium, - ), - ) - ], - ), - ), - ), - ), - Container( - margin: const EdgeInsets.only(left: 10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - destinatioModel.placename!, - style: blackTextStyle.copyWith( - fontSize: 18, - fontWeight: medium, - ), - ), - const SizedBox( - height: 5, - ), - Text( - destinatioModel.to!, - style: greyTextStyle.copyWith( - fontWeight: light, - ), - ) - ], - ), - ) - ], - ), - ), - ); - } -} diff --git a/lib/view/widgets/destination_tile.dart b/lib/view/widgets/destination_tile.dart deleted file mode 100644 index 20c81af..0000000 --- a/lib/view/widgets/destination_tile.dart +++ /dev/null @@ -1,96 +0,0 @@ -import 'package:ye_airways/model/des_model.dart'; -import 'package:ye_airways/provider/destination_provider.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class DestinationTile extends StatelessWidget { - final int index; - final HN_DestinatioModel destinatioModel; - final Function()? press; - - const DestinationTile( - {super.key, - required this.index, - required this.destinatioModel, - required this.press}); - - @override - Widget build(BuildContext context) { - DestinationProvider destinationProvider = - Provider.of(context); - /* - DestinationArgument desArgument = - ModalRoute.of(context)!.settings.arguments as DestinationArgument; - */ - // Size size = MediaQuery.of(context).size; - - return GestureDetector( - onTap: press, - child: Container( - // width: 72, - height: 72, - margin: const EdgeInsets.only(top: 16), - // padding: EdgeInsets.all(10), - decoration: BoxDecoration( - color: kWhiteColor, - borderRadius: BorderRadius.circular(18), - ), - child: Row( - children: [ - Container( - width: 70, - height: 70, - margin: const EdgeInsets.only(right: 16), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(18), - image: DecorationImage( - fit: BoxFit.cover, - image: NetworkImage(destinatioModel.desImage!), - ), - ), - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - destinatioModel.placename!, - style: blackTextStyle.copyWith( - fontSize: 18, - fontWeight: medium, - ), - ), - const SizedBox(height: 5), - Text(destinatioModel.to!, - style: greyTextStyle.copyWith(fontWeight: light)) - ], - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 20, - height: 20, - margin: const EdgeInsets.only(right: 2), - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/icon_star.png'), - ), - ), - ), - Text( - destinatioModel.rating.toString(), - style: blackTextStyle.copyWith( - fontWeight: medium, - ), - ) - ], - ), - ], - )), - ); - } -} diff --git a/lib/view/widgets/interest_item.dart b/lib/view/widgets/interest_item.dart deleted file mode 100644 index e698fbb..0000000 --- a/lib/view/widgets/interest_item.dart +++ /dev/null @@ -1,31 +0,0 @@ -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:flutter/material.dart'; - -class InterestItem extends StatelessWidget { - final String text; - - const InterestItem({Key? key, required this.text}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Expanded( - child: Row( - children: [ - Container( - width: 16, - height: 16, - margin: const EdgeInsets.only(right: 6), - decoration: const BoxDecoration( - image: DecorationImage( - fit: BoxFit.cover, - image: AssetImage('assets/icon_check.png'))), - ), - Text( - text, - style: blackTextStyle, - ), - ], - ), - ); - } -} diff --git a/lib/view/widgets/myalert.dart b/lib/view/widgets/myalert.dart deleted file mode 100644 index 4b4d30e..0000000 --- a/lib/view/widgets/myalert.dart +++ /dev/null @@ -1,65 +0,0 @@ -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:flutter/material.dart'; -import 'package:rflutter_alert/rflutter_alert.dart'; - -class MyAlert { - static Future errorAlert(BuildContext context, {String? desc}) { - return Alert( - context: context, - style: const AlertStyle( - descStyle: TextStyle(color: kPrimaryColor), - // backgroundColor: kPrimaryColor, - titleStyle: TextStyle( - color: Colors.red, - ), - ), - type: AlertType.error, - title: "ERROR!", - desc: desc, - buttons: [ - DialogButton( - color: kPrimaryColor, - onPressed: () { - Navigator.pop(context); - }, - child: const Text( - "CANCEL", - style: TextStyle( - color: kWhiteColor, - fontSize: 20, - ), - ), - ) - ]).show(); - } - - static Alert noSeatsAlert(BuildContext context, {String? bookingClass}) { - return Alert( - context: context, - style: const AlertStyle( - descStyle: TextStyle(color: Colors.white), - backgroundColor: kPrimaryColor, - titleStyle: TextStyle( - color: kAccentColor, - ), - ), - type: AlertType.error, - title: "ERROR!", - desc: "There is no any seat available in $bookingClass class", - buttons: [ - DialogButton( - color: kAccentColor, - onPressed: () { - Navigator.pop(context); - }, - child: const Text( - "CANCEL", - style: TextStyle( - color: kPrimaryColor, - fontSize: 20, - ), - ), - ) - ]); - } -} diff --git a/lib/view/widgets/name_user_from_fire.dart b/lib/view/widgets/name_user_from_fire.dart deleted file mode 100644 index 53ac1dd..0000000 --- a/lib/view/widgets/name_user_from_fire.dart +++ /dev/null @@ -1,49 +0,0 @@ -import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:firebase_auth/firebase_auth.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:flutter/material.dart'; - -class UserName extends StatefulWidget { - const UserName({Key? key}) : super(key: key); - - @override - State createState() => _UserNameState(); -} - -class _UserNameState extends State { - @override - final credential = FirebaseAuth.instance.currentUser; - // CollectionReference users = FirebaseFirestore.instance.collection('users'); - - @override - Widget build(BuildContext context) { - CollectionReference users = FirebaseFirestore.instance.collection('users'); - - return FutureBuilder( - future: users.doc(credential!.uid).get(), - builder: - (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.hasError) { - return const Text("Something went wrong"); - } - - if (snapshot.hasData && !snapshot.data!.exists) { - return const Text("Document does not exist"); - } - - if (snapshot.connectionState == ConnectionState.done) { - Map data = - snapshot.data!.data() as Map; - - // ${data['title']} - return Container( - child: Text(data["userName"], - style: const TextStyle(color: kWhiteColor, fontSize: 30)), - ); - } - - return const Text("loading"); - }, - ); - } -} diff --git a/lib/view/widgets/page_pop_view.dart b/lib/view/widgets/page_pop_view.dart deleted file mode 100644 index aa63b6e..0000000 --- a/lib/view/widgets/page_pop_view.dart +++ /dev/null @@ -1,71 +0,0 @@ -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:flutter/material.dart'; - -class PagePopup extends StatelessWidget { - final PageViewData imageData; - - const PagePopup({Key? key, required this.imageData}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Expanded( - flex: 8, - child: Center( - child: SizedBox( - width: MediaQuery.of(context).size.width - 120, - child: AspectRatio( - aspectRatio: 1, - child: Image.asset( - imageData.assetsImage, - fit: BoxFit.cover, - ), - ), - ), - ), - ), - Expanded( - flex: 1, - child: Container( - child: Text( - imageData.titleText, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 24, color: primaryTextColor, - // TextStyles(context).getTitleStyle().copyWith( - fontWeight: FontWeight.bold, - ), - ), - ), - ), - Expanded( - flex: 1, - child: Container( - child: Text(imageData.subText, - textAlign: TextAlign.center, - style: TextStyle(color: primaryTextColor) - // TextStyles(context).getDescriptionStyle(), - ), - ), - ), - const Expanded( - flex: 1, - child: SizedBox(), - ), - ], - ); - } -} - -class PageViewData { - final String titleText; - final String subText; - final String assetsImage; - - PageViewData({ - required this.titleText, - required this.subText, - required this.assetsImage, - }); -} diff --git a/lib/view/widgets/photo_item.dart b/lib/view/widgets/photo_item.dart deleted file mode 100644 index 1b859b1..0000000 --- a/lib/view/widgets/photo_item.dart +++ /dev/null @@ -1,21 +0,0 @@ -import 'package:flutter/material.dart'; - -class PhotoItem extends StatelessWidget { - final String imageUrl; - - const PhotoItem({Key? key, required this.imageUrl}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Container( - width: 70, - height: 70, - margin: EdgeInsets.only(right: 16), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(18), - image: DecorationImage( - fit: BoxFit.cover, - image: NetworkImage(imageUrl), - ))); - } -} diff --git a/lib/view/widgets/seat_item.dart b/lib/view/widgets/seat_item.dart deleted file mode 100644 index c57c16a..0000000 --- a/lib/view/widgets/seat_item.dart +++ /dev/null @@ -1,80 +0,0 @@ -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:flutter/material.dart'; - -class SeatItem extends StatefulWidget { - int status; - Function() onTap; - - SeatItem({Key? key, required this.status, required this.onTap}) - : super(key: key); - - @override - State createState() => _SeatItemState(); -} - -class _SeatItemState extends State { - @override - void initState() { - // TODO: implement initState - super.initState(); - } - - @override - Widget build(BuildContext context) { - backgroundColor() { - switch (widget.status) { - case 0: - return kAvailableColor; - case 1: - return kPrimaryColor; - case 2: - return kUnavailableColor; - default: - return kUnavailableColor; - } - } - - borderColor() { - switch (widget.status) { - case 0: - return kPrimaryColor; - case 1: - return kPrimaryColor; - case 2: - return kUnavailableColor; - default: - return kUnavailableColor; - } - } - - child() { - switch (widget.status) { - case 0: - return const SizedBox(); - case 1: - return Center( - child: Text( - 'You', - style: whiteTextStyle.copyWith(fontWeight: semiBold), - ), - ); - case 2: - return const SizedBox(); - default: - return const SizedBox(); - } - } - - return InkWell( - onTap: widget.onTap, - child: Container( - width: 48, - height: 48, - decoration: BoxDecoration( - color: backgroundColor(), - borderRadius: BorderRadius.circular(15), - border: Border.all(color: borderColor(), width: 2)), - child: child()), - ); - } -} diff --git a/lib/view/widgets/tap_effect.dart b/lib/view/widgets/tap_effect.dart deleted file mode 100644 index 3dd5e7d..0000000 --- a/lib/view/widgets/tap_effect.dart +++ /dev/null @@ -1,103 +0,0 @@ -import 'package:flutter/material.dart'; - -class TapEffect extends StatefulWidget { - const TapEffect( - {Key? key, - this.isClickable = true, - required this.onClick, - required this.child}) - : super(key: key); - - final bool isClickable; - final VoidCallback onClick; - final Widget child; - - @override - _TapEffectState createState() => _TapEffectState(); -} - -class _TapEffectState extends State - with SingleTickerProviderStateMixin { - AnimationController? animationController; - DateTime tapTime = DateTime.now(); - bool isProgress = false; - - @override - void initState() { - animationController = AnimationController( - vsync: this, duration: const Duration(milliseconds: 800)); - animationController!.animateTo(1.0, - duration: const Duration(milliseconds: 0), curve: Curves.fastOutSlowIn); - super.initState(); - } - - @override - void dispose() { - animationController?.dispose(); - super.dispose(); - } - - Future onTapCancel() async { - if (widget.isClickable) { - await _onDelayed(); - animationController!.animateTo(1.0, - duration: const Duration(milliseconds: 240), - curve: Curves.fastOutSlowIn); - } - isProgress = false; - } - - Future _onDelayed() async { - if (widget.isClickable) { - //this logic creator like more press experience with some delay - final int tapDuration = DateTime.now().millisecondsSinceEpoch - - tapTime.millisecondsSinceEpoch; - if (tapDuration < 120) { - await Future.delayed( - Duration(milliseconds: 120 - tapDuration)); - } - } - } - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: () async { - if (widget.isClickable) { - await Future.delayed(const Duration(milliseconds: 280)); - try { - if (!isProgress) { - widget.onClick(); - isProgress = true; - } - } catch (_) {} - } - }, - onTapDown: (TapDownDetails details) { - if (widget.isClickable) { - tapTime = DateTime.now(); - animationController!.animateTo(0.9, - duration: const Duration(milliseconds: 120), - curve: Curves.fastOutSlowIn); - } - isProgress = true; - }, - onTapUp: (TapUpDetails details) { - onTapCancel(); - }, - onTapCancel: () { - onTapCancel(); - }, - child: AnimatedBuilder( - animation: animationController!, - builder: (BuildContext context, Widget? child) { - return Transform.scale( - scale: animationController!.value, - origin: const Offset(0.0, 0.0), - child: widget.child, - ); - }, - ), - ); - } -} diff --git a/lib/view/widgets/ticket_card.dart b/lib/view/widgets/ticket_card.dart deleted file mode 100644 index 6fb47cb..0000000 --- a/lib/view/widgets/ticket_card.dart +++ /dev/null @@ -1,203 +0,0 @@ -import 'package:ye_airways/model/ticket_ye_model.dart'; -import 'package:ye_airways/shared/components/components.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:ye_airways/view/widgets/custom_horizontal_divider.dart'; -import 'package:flutter/material.dart'; - -class TicketCard extends StatelessWidget { - final int index; - final Ticket_YE_Model ticket_model; - final Function()? press; - - const TicketCard( - {super.key, - required this.index, - required this.ticket_model, - required this.press}); - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: () { - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => CheckoutPage( - // destination: ticket_model, - // ))); - // Navigator.pushNamed(context, Seat_YE_Screen.id); - }, - child: Column( - children: [ - // route(), - Container( - decoration: const BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(15.0), - topRight: Radius.circular(15.0), - bottomLeft: Radius.circular(15.0), - bottomRight: Radius.circular(15.0), - ), - ), - child: Column( - children: [ - Container( - padding: const EdgeInsets.only( - left: 20.0, - right: 20.0, - top: 10.0, - bottom: 20.0, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const SizedBox(height: 5.0), - AcronymCustomText( - text: ticket_model.from! - .substring(0, 3) - .toUpperCase()), - const SizedBox(height: 5.0), - ActiveInfoCustomText( - text: ticket_model.from, - // color: kPrimaryColor, - ), - const SizedBox(height: 20.0), - const InactiveInfoCustomText( - text: 'FLIGHT NO', - ), - const SizedBox(height: 5.0), - ActiveInfoCustomText( - text: ticket_model.flightNumber, - // '${ticket_model.flightNumber}', - // color: kPrimaryColor, - ), - const SizedBox(height: 10.0), - const InactiveInfoCustomText(text: 'DATE'), - const SizedBox(height: 5.0), - ActiveInfoCustomText( - text: ticket_model.date, - // color: secondaryTextColor, - ), - ], - ), - Column( - children: [ - const SizedBox( - height: 80.0, - width: 120.0, - child: - Image(image: AssetImage('assets/logo-ye.png')), - ), - const InactiveInfoCustomText(text: 'Travelers'), - const SizedBox(height: 5.0), - ActiveInfoCustomText( - text: ticket_model.travelers, - ), - const SizedBox(height: 10.0), - const InactiveInfoCustomText(text: 'Duration'), - const SizedBox(height: 5.0), - ActiveInfoCustomText( - text: ticket_model.duration, - ), - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - const SizedBox(height: 5.0), - AcronymCustomText( - text: - ticket_model.to!.substring(0, 3).toUpperCase(), - ), - const SizedBox(height: 5.0), - ActiveInfoCustomText( - text: ticket_model.to, - - // text: ticket_model.to, - // color: kDateTimeAndCitesColor, - ), - const SizedBox(height: 20.0), - const InactiveInfoCustomText( - text: 'TICKET NO', - ), - const SizedBox(height: 5.0), - ActiveInfoCustomText( - text: ticket_model.ticketNumber, - // '${ticket_model.flightNumber}', - // color: kActiveColor, - ), - const SizedBox(height: 10.0), - const InactiveInfoCustomText(text: 'TIME'), - const SizedBox(height: 5), - ActiveInfoCustomText( - text: ticket_model.time, - // color: kActiveColor, - ), - ], - ), - ], - ), - ), - const CustomHorizontalDivider(), - Container( - padding: const EdgeInsets.only( - left: 20.0, - right: 20.0, - top: 8.0, - bottom: 10.0, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const SizedBox( - height: 30.0, - width: 100.0, - child: Image( - // width: 150, - image: AssetImage( - 'assets/barcode.png', - ), - // image: AssetImage('assets/bottom_logos.png'), - ), - ), - Container( - child: Row( - children: [ - Text( - 'PRICE:', - style: TextStyle( - fontSize: 15, - color: kBlackColor, - fontWeight: FontWeight.w500), - ), - const SizedBox( - width: 5, - ), - Text( - "\$${ticket_model.totalprice}", - // '\$ ${ticket_model.ticketPrice}', - style: const TextStyle( - fontSize: 18, - color: kPrimaryColor, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - ], - ), - ), - ], - ), - ), - const SizedBox(height: 20.0), - ], - ), - ); - } -} diff --git a/lib/view/widgets/user_email_from_fire.dart b/lib/view/widgets/user_email_from_fire.dart deleted file mode 100644 index ebcc96d..0000000 --- a/lib/view/widgets/user_email_from_fire.dart +++ /dev/null @@ -1,47 +0,0 @@ -import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:firebase_auth/firebase_auth.dart'; -import 'package:ye_airways/shared/styles/colors.dart'; -import 'package:flutter/material.dart'; - -class EmailUser extends StatefulWidget { - const EmailUser({Key? key}) : super(key: key); - - @override - State createState() => _EmailUserState(); -} - -class _EmailUserState extends State { - final credential = FirebaseAuth.instance.currentUser; - CollectionReference users = FirebaseFirestore.instance.collection('users'); - @override - Widget build(BuildContext context) { - CollectionReference users = FirebaseFirestore.instance.collection('users'); - - return FutureBuilder( - future: users.doc(credential!.uid).get(), - builder: - (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.hasError) { - return const Text("Something went wrong"); - } - - if (snapshot.hasData && !snapshot.data!.exists) { - return const Text("Document does not exist"); - } - - if (snapshot.connectionState == ConnectionState.done) { - Map data = - snapshot.data!.data() as Map; - - // ${data['title']} - return Container( - child: - Text(data["email"], style: const TextStyle(color: kWhiteColor)), - ); - } - - return const Text("loading"); - }, - ); - } -} diff --git a/lib/view/widgets/yemenia_logo.dart b/lib/view/widgets/yemenia_logo.dart deleted file mode 100644 index dce26a9..0000000 --- a/lib/view/widgets/yemenia_logo.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:flutter/material.dart'; - -class YemeniaLogo extends StatelessWidget { - const YemeniaLogo({super.key}); - - @override - Widget build(BuildContext context) { - return const SizedBox( - height: 50.0, - width: 50.0, - child: Image( - image: AssetImage('assets/logo-ye.png'), - ), - ); - } -}