diff --git a/.vscode/settings.json b/.vscode/settings.json
index 3030643..ec4b2f3 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,5 +1,6 @@
{
"cSpell.words": [
"bottomnavbar"
- ]
+ ],
+ "dart.enableCompletionCommitCharacters": true
}
\ No newline at end of file
diff --git a/Backend/go.mod b/Backend/go.mod
index a50abaf..050b34a 100644
--- a/Backend/go.mod
+++ b/Backend/go.mod
@@ -15,6 +15,7 @@ require (
github.com/gobwas/glob v0.2.3 // indirect
github.com/gohugoio/hugo v0.124.1 // indirect
github.com/gorilla/mux v1.8.1 // indirect
+ github.com/gorilla/websocket v1.5.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/hashstructure v1.1.0 // indirect
@@ -23,7 +24,8 @@ require (
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/tdewolff/parse/v2 v2.7.12 // indirect
- golang.org/x/sys v0.18.0 // indirect
+ golang.org/x/net v0.24.0 // indirect
+ golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
)
diff --git a/Backend/go.sum b/Backend/go.sum
index a3410cf..8eb2714 100644
--- a/Backend/go.sum
+++ b/Backend/go.sum
@@ -50,6 +50,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
+github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
+github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
@@ -93,6 +95,8 @@ golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
+golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -103,6 +107,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
+golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
diff --git a/Backend/handlers/bookinghandler.go b/Backend/handlers/bookinghandler.go
new file mode 100644
index 0000000..351538f
--- /dev/null
+++ b/Backend/handlers/bookinghandler.go
@@ -0,0 +1,29 @@
+package handlers
+
+import (
+ "encoding/json"
+ "net/http"
+
+ "github.com/piyushkumar/hotelsystem/models"
+)
+
+// GetBookings returns the list of bookings
+func GetBookings(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+ json.NewEncoder(w).Encode(models.Bookings)
+}
+
+
+
+func CreateBooking(w http.ResponseWriter, r *http.Request) {
+ var newBooking models.Booking
+ err := json.NewDecoder(r.Body).Decode(&newBooking)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusBadRequest)
+ return
+ }
+
+ models.Bookings = append(models.Bookings, newBooking)
+ w.WriteHeader(http.StatusCreated)
+ json.NewEncoder(w).Encode(newBooking)
+}
\ No newline at end of file
diff --git a/Backend/handlers/cityHotelHandler.go b/Backend/handlers/cityHotelHandler.go
new file mode 100644
index 0000000..95afc6e
--- /dev/null
+++ b/Backend/handlers/cityHotelHandler.go
@@ -0,0 +1,23 @@
+package handlers
+
+import (
+ "encoding/json"
+ "net/http"
+
+ "github.com/gorilla/mux"
+ "github.com/piyushkumar/hotelsystem/models"
+)
+
+func GetHotelsByCity(w http.ResponseWriter, r *http.Request) {
+ vars := mux.Vars(r)
+ city := vars["city"]
+
+ hotels, ok := models.Cities[city]
+ if !ok {
+ http.Error(w, "City not found", http.StatusNotFound)
+ return
+ }
+
+ w.Header().Set("Content-Type", "application/json")
+ json.NewEncoder(w).Encode(hotels)
+}
diff --git a/Backend/handlers/getprofileHandler.go b/Backend/handlers/getprofileHandler.go
new file mode 100644
index 0000000..77e4327
--- /dev/null
+++ b/Backend/handlers/getprofileHandler.go
@@ -0,0 +1,17 @@
+package handlers
+
+import (
+ "encoding/json"
+ "net/http"
+
+ "github.com/piyushkumar/hotelsystem/models"
+)
+
+// For simplicity, we're using a package-level variable. In a real application, this could be a database.
+var userProfile = models.Profile{}
+
+// GetProfile sends the user's profile as a JSON response.
+func GetProfile(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+ json.NewEncoder(w).Encode(userProfile)
+}
diff --git a/Backend/handlers/listhotelHandler.go b/Backend/handlers/listhotelHandler.go
index 8acf73f..20dee30 100644
--- a/Backend/handlers/listhotelHandler.go
+++ b/Backend/handlers/listhotelHandler.go
@@ -2,6 +2,7 @@ package handlers
import (
"encoding/json"
+ "log"
"net/http"
"github.com/piyushkumar/hotelsystem/models"
@@ -11,10 +12,75 @@ import (
var hotels = []models.Hotel{
{ID: "1", Name: "Hotel Sunshine", Location: "California", Rating: 5},
{ID: "2", Name: "Grand Plaza", Location: "New York", Rating: 4},
+ {ID: "3", Name: "Hyat Plaza", Location: "Australia", Rating: 3},
+ {ID: "4", Name: "Grinding Plaza", Location: "Hamburg", Rating: 2},
+}
+
+
+var recommendHotels = []models.ReccHotel{
+
+ {ID: "1", Name: "Hotel Ramuplaz", Location: "California", Distance: 5, Rating: 5},
+ {ID: "2", Name: "Plaza", Location: "New York", Distance: 4, Rating: 4},
+ {ID: "3", Name: "Huluk Plaza", Location: "Australia", Distance: 3, Rating: 3},
+ {ID: "4", Name: "Indus Plaza", Location: "Hamburg", Distance: 2, Rating: 2},
+
+
+}
+
+var popullarHotels = []models.PopHotel{
+
+ {Name: "Hotel Oceana", Location: "California", Distance: 5, Price: 5000, Rating: 5},
+ {Name: "Placo", Location: "New York", Distance: 4, Price: 4000, Rating: 4},
+ {Name: "Pizza Put Plaza", Location: "Australia", Distance: 3, Price: 3000, Rating: 3},
+ {Name: "PakLand Plaza", Location: "Hamburg", Distance: 2, Price: 2000, Rating: 2},
+
+
}
// ListHotels sends a list of hotels as a JSON response.
-func ListHotels(w http.ResponseWriter, r *http.Request) {
+func WishListHotels(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(hotels)
}
+
+func RecommendHotels(w http.ResponseWriter, r *http.Request) {
+ log.Println("RecommendHotels handler called")
+ w.Header().Set("Content-Type", "application/json")
+ json.NewEncoder(w).Encode(recommendHotels)
+}
+
+func PopHotels(w http.ResponseWriter, r *http.Request) {
+ log.Println("PopHotels handler called")
+ w.Header().Set("Content-Type", "application/json")
+ json.NewEncoder(w).Encode(popullarHotels)
+}
+
+//! handler for searching hotels by name
+
+func SearchHotels(w http.ResponseWriter, r *http.Request) {
+ log.Println("SearchHotels handler called")
+ w.Header().Set("Content-Type", "application/json")
+ var searchResults []models.Hotel
+ query := r.URL.Query().Get("name")
+ for _, hotel := range hotels {
+ if hotel.Name == query {
+ searchResults = append(searchResults, hotel)
+ }
+ }
+ json.NewEncoder(w).Encode(searchResults)
+}
+
+//! handler for searching hotels by location
+
+func SearchHotelsByLocation(w http.ResponseWriter, r *http.Request) {
+ log.Println("SearchHotelsByLocation handler called")
+ w.Header().Set("Content-Type", "application/json")
+ var searchResults []models.Hotel
+ query := r.URL.Query().Get("location")
+ for _, hotel := range hotels {
+ if hotel.Location == query {
+ searchResults = append(searchResults, hotel)
+ }
+ }
+ json.NewEncoder(w).Encode(searchResults)
+}
\ No newline at end of file
diff --git a/Backend/handlers/liveChatHandler.go b/Backend/handlers/liveChatHandler.go
new file mode 100644
index 0000000..6092eea
--- /dev/null
+++ b/Backend/handlers/liveChatHandler.go
@@ -0,0 +1,26 @@
+package handlers
+
+import (
+ "github.com/piyushkumar/hotelsystem/websocket"
+ "net/http"
+)
+
+type ChatHandler struct {
+ hub *websocket.Hub
+}
+
+func NewChatHandler() *ChatHandler {
+ hub := websocket.NewHub()
+ go hub.Run()
+ return &ChatHandler{hub: hub}
+}
+
+func (c *ChatHandler) HandleConnections(w http.ResponseWriter, r *http.Request) {
+ websocket.ServeWs(c.hub, w, r)
+}
+
+func (c *ChatHandler) HandleMessages() {
+ // Here you would handle incoming messages. This example doesn't implement it.
+
+
+}
diff --git a/Backend/handlers/popHandler.go b/Backend/handlers/popHandler.go
new file mode 100644
index 0000000..98e6dff
--- /dev/null
+++ b/Backend/handlers/popHandler.go
@@ -0,0 +1,19 @@
+package handlers
+
+import (
+ "encoding/json"
+ "net/http"
+
+ "github.com/piyushkumar/hotelsystem/models"
+)
+
+// GetPopularHotels handles the request for retrieving popular hotels
+func GetPopularHotels(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+ popularHotels := []models.PopHotels{
+ {"Hotel California", "Los Angeles", 5.0},
+ {"The Great Northern", "Twin Peaks", 15.0},
+ {"The Overlook Hotel", "Colorado Rockies", 20.0},
+ }
+ json.NewEncoder(w).Encode(popularHotels)
+}
diff --git a/Backend/handlers/searchHandlers.go b/Backend/handlers/searchHandlers.go
new file mode 100644
index 0000000..0257064
--- /dev/null
+++ b/Backend/handlers/searchHandlers.go
@@ -0,0 +1,32 @@
+package handlers
+
+// import (
+// "encoding/json"
+// "net/http"
+
+// "github.com/gorilla/mux"
+// "github.com/piyushkumar/hotelsystem/models"
+
+// )
+
+// func findHotelHandler(w http.ResponseWriter, r *http.Request) {
+
+
+
+// vars := mux.Vars(r)
+
+// city := vars["city"]
+// bedroom := vars["bedroom"]
+// bathroom := vars["bathroom"]
+// services := vars["services"]
+// payment := vars["payment"]
+
+// for _, hotel := range models.SearchHotel {
+// if hotel. == city && hotel.Bedrooms == bedroom && hotel.Bathrooms == bathroom && hotel.Service == services && hotel.Payment == payment {
+// json.NewEncoder(w).Encode(hotel)
+// return
+// }
+// }
+// }
+
+// SearchHotels handler function
diff --git a/Backend/handlers/setprofileHandler.go b/Backend/handlers/setprofileHandler.go
new file mode 100644
index 0000000..a4b2be4
--- /dev/null
+++ b/Backend/handlers/setprofileHandler.go
@@ -0,0 +1,23 @@
+package handlers
+
+import (
+ "encoding/json"
+ "net/http"
+
+ "github.com/piyushkumar/hotelsystem/models"
+)
+
+// SetProfile updates the user's profile.
+func SetProfile(w http.ResponseWriter, r *http.Request) {
+ var profile models.Profile
+ if err := json.NewDecoder(r.Body).Decode(&profile); err != nil {
+ http.Error(w, err.Error(), http.StatusBadRequest)
+ return
+ }
+
+ // Update the global userProfile variable with the new data
+ userProfile = profile
+
+ w.WriteHeader(http.StatusOK)
+ json.NewEncoder(w).Encode(profile)
+}
diff --git a/Backend/handlers/tripHandlers.go b/Backend/handlers/tripHandlers.go
new file mode 100644
index 0000000..f89cb0b
--- /dev/null
+++ b/Backend/handlers/tripHandlers.go
@@ -0,0 +1,19 @@
+package handlers
+
+import (
+ "encoding/json"
+ "net/http"
+
+ "github.com/piyushkumar/hotelsystem/models"
+)
+
+// GetPlaces displays all the places
+func GetPlaces(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+ places := []models.Place{
+ {"Paris", 3000.0, 4.5, 200.0},
+ {"Bali", 12000.0, 4.8, 150.0},
+ {"Tokyo", 8000.0, 4.6, 300.0},
+ }
+ json.NewEncoder(w).Encode(places)
+}
diff --git a/Backend/main.go b/Backend/main.go
index 6aa6bd8..b395a56 100644
--- a/Backend/main.go
+++ b/Backend/main.go
@@ -41,23 +41,54 @@ func main() {
//! Register the OTP checking handler
r.HandleFunc("/checkotp", handlers.CheckOTP).Methods("POST")
-
-
//! Forgot password route
r.HandleFunc("/forgot-password", handlers.ForgotPassword).Methods("POST")
log.Println("Server starting on port 9080...")
- //! hotel apis
+ //! hotel apis
+
+ r.HandleFunc("/hotels", handlers.WishListHotels).Methods("GET")
+ r.HandleFunc("/rechotels", handlers.RecommendHotels).Methods("GET")
+ r.HandleFunc("/pophotels", handlers.PopHotels).Methods("GET")
- r.HandleFunc("/hotels", handlers.ListHotels).Methods("GET")
r.HandleFunc("/hotel", handlers.AddHotel).Methods("POST")
r.HandleFunc("/hotel/{id}", handlers.DeleteHotel).Methods("DELETE")
+
// Start the server
+ //! trip routes
+
+ r.HandleFunc("/places", handlers.GetPlaces).Methods("GET")
+ r.HandleFunc("/popularhotels", handlers.GetPopularHotels).Methods("GET")
+
+ //! hotel by city
+ r.HandleFunc("/city/{city}", handlers.GetHotelsByCity).Methods("GET")
+
+ //! profile routes
+
+ r.HandleFunc("/profile", handlers.GetProfile).Methods("GET")
+ r.HandleFunc("/profile", handlers.SetProfile).Methods("POST")
+
+ //! search hotels by name
+ r.HandleFunc("/search", handlers.SearchHotels).Methods("GET")
+
+
+
+
+
+ //! booking apis
+
+ r.HandleFunc("/bookings", handlers.GetBookings).Methods("GET")
+ r.HandleFunc("/booking", handlers.CreateBooking).Methods("POST")
+
+ //! live chat api
+ r.HandleFunc("/chat", handlers.NewChatHandler().HandleConnections).Methods("GET")
+
log.Fatal(http.ListenAndServe(":9080", r))
//log.Fatal(http.ListenAndServe(":8080", r))
}
+//! frontend port is 9080
// package main
diff --git a/Backend/models/bookingModel.go b/Backend/models/bookingModel.go
new file mode 100644
index 0000000..c5bf22e
--- /dev/null
+++ b/Backend/models/bookingModel.go
@@ -0,0 +1,15 @@
+package models
+
+type Booking struct {
+ RoomType string `json:"roomType"`
+ Status string `json:"status"` // Pending, Confirmed, Completed
+ Price float64 `json:"price"`
+}
+
+// Mocked data for demonstration
+var Bookings = []Booking{
+ {"Single", "Confirmed", 100.0},
+ {"Double", "Pending", 150.0},
+ {"Suite", "Completed", 250.0},
+ {"Dinning Hall", "Pending", 500.0},
+}
diff --git a/Backend/models/cityhotModel.go b/Backend/models/cityhotModel.go
new file mode 100644
index 0000000..34ca48f
--- /dev/null
+++ b/Backend/models/cityhotModel.go
@@ -0,0 +1,17 @@
+package models
+
+type CityHotel struct {
+ Name string `json:"name"`
+ Distance float64 `json:"distance"` // Distance from city center in km
+}
+
+var Cities = map[string][]CityHotel{
+ "Dhaka": {{"Dhaka Delight", 1.5}, {"Capital Stay", 2.0}, {"Urban Retreat", 0.5}, {"City Lights", 1.0}, {"Skyline View", 2.2}},
+ "Chittagong": {{"Chittagong Charm", 1.2}, {"Harbor Haven", 2.1}, {"Seafront Suite", 3.5}, {"Bay Breeze", 1.8}, {"Maritime Luxury", 4.0}},
+ "Rajshahi": {{"Rajshahi Respite", 0.6}, {"Vineyard Vista", 1.5}, {"Silk City Sleep", 1.1}, {"Mango Manor", 2.3}, {"Padma Place", 3.0}},
+ "Dinajpur": {{"Dinajpur Den", 1.4}, {"Ricefield Retreat", 2.6}, {"Historic Hideaway", 1.9}, {"Northern Nook", 2.8}, {"Tea Terrace", 3.1}},
+ "Khulna": {{"Khulna Comfort", 0.8}, {"Sundarban Stay", 3.2}, {"Riverfront Residence", 1.7}, {"Mangrove Hotel", 2.9}, {"Tiger Trail Inn", 4.5}},
+ "Mymensingh": {{"Mymensingh Manor", 0.5}, {"Brahmaputra B&B", 1.6}, {"Garo Hills Getaway", 2.4}, {"Central Cottage", 1.2}, {"Tea Town Terrace", 3.3}},
+ "Barisal": {{"Barisal Bay Inn", 0.7}, {"Delta Delight", 1.3}, {"Floating Hotel", 2.0}, {"Southern Star", 2.5}, {"Venice of the East", 3.6}},
+ "Sylhet": {{"Sylhet Springs", 1.0}, {"Cloud-Covered Lodge", 2.2}, {"Tea Garden Guesthouse", 3.8}, {"Monsoon Magic", 1.7}, {"Hillside Hotel", 2.8}},
+}
diff --git a/Backend/models/livechatModel.go b/Backend/models/livechatModel.go
new file mode 100644
index 0000000..962d117
--- /dev/null
+++ b/Backend/models/livechatModel.go
@@ -0,0 +1,16 @@
+package models
+
+
+type LiveChat struct {
+
+ message string `json:"message"`
+ chatProfile ChatProfile `json:"chatProfile"`
+
+}
+
+
+type ChatProfile struct {
+
+ userid string `json:"userid"`
+ username string `json:"username"`
+}
\ No newline at end of file
diff --git a/Backend/models/popTrip.go b/Backend/models/popTrip.go
new file mode 100644
index 0000000..3e36c51
--- /dev/null
+++ b/Backend/models/popTrip.go
@@ -0,0 +1,8 @@
+package models
+
+// Hotel represents the structure of our hotel resource
+type PopHotels struct {
+ Name string `json:"name"`
+ Place string `json:"place"`
+ Distance float64 `json:"distance"` // in kilometers, from a central point of interest
+}
diff --git a/Backend/models/pophotelModel.go b/Backend/models/pophotelModel.go
new file mode 100644
index 0000000..f6fc56a
--- /dev/null
+++ b/Backend/models/pophotelModel.go
@@ -0,0 +1,10 @@
+package models
+
+// Hotel represents the hotel model.
+type PopHotel struct {
+ Name string `json:"name"`
+ Location string `json:"location"`
+ Distance int `json:"distance"`
+ Price int `json:"price"`
+ Rating int `json:"rating"`
+}
diff --git a/Backend/models/profileModel.go b/Backend/models/profileModel.go
new file mode 100644
index 0000000..e3f9b98
--- /dev/null
+++ b/Backend/models/profileModel.go
@@ -0,0 +1,8 @@
+package models
+
+// Profile represents a user's profile with Name, Email, and Gender.
+type Profile struct {
+ Name string `json:"name"`
+ Email string `json:"email"`
+ Gender string `json:"gender"`
+}
diff --git a/Backend/models/recomhotelModel.go b/Backend/models/recomhotelModel.go
new file mode 100644
index 0000000..0b2b6b0
--- /dev/null
+++ b/Backend/models/recomhotelModel.go
@@ -0,0 +1,10 @@
+package models
+
+// Hotel represents the hotel model.
+type ReccHotel struct {
+ ID string `json:"id"`
+ Name string `json:"name"`
+ Location string `json:"location"`
+ Distance int `json:"distance"`
+ Rating int `json:"rating"`
+}
diff --git a/Backend/models/searchModel.go b/Backend/models/searchModel.go
new file mode 100644
index 0000000..d2d6c3e
--- /dev/null
+++ b/Backend/models/searchModel.go
@@ -0,0 +1,50 @@
+package models
+
+
+type SearchModel struct {
+
+ Bedrooms int `json:"bedrooms"`
+ Bathrooms int `json:"bathrooms"`
+ payment paymentModel `json:"payment"`
+ service serviceModel `json:"service"`
+ city string `json:"city"`
+
+}
+
+//! store dummy data
+var SearchHotel = []SearchModel{
+
+ SearchModel{ Bedrooms: 2, Bathrooms: 2, payment: paymentModel{payathotel: true, payonline: true, advancepayment: true}, service: serviceModel{petsallowed: true, resturant: true, swimmingpool: true, carparking: true, fitnesscentre: true}, city: "Delhi"},
+ SearchModel{ Bedrooms: 3, Bathrooms: 3, payment: paymentModel{payathotel: true, payonline: true, advancepayment: true}, service: serviceModel{petsallowed: true, resturant: true, swimmingpool: true, carparking: true, fitnesscentre: true}, city: "Mumbai"},
+ SearchModel{ Bedrooms: 4, Bathrooms: 4, payment: paymentModel{payathotel: true, payonline: true, advancepayment: true}, service: serviceModel{petsallowed: true, resturant: true, swimmingpool: true, carparking: true, fitnesscentre: true}, city: "Bangalore"},
+ SearchModel{ Bedrooms: 5, Bathrooms: 5, payment: paymentModel{payathotel: true, payonline: true, advancepayment: true}, service: serviceModel{petsallowed: true, resturant: true, swimmingpool: true, carparking: true, fitnesscentre: true}, city: "Chennai"},
+ SearchModel{ Bedrooms: 6, Bathrooms: 6, payment: paymentModel{payathotel: true, payonline: true, advancepayment: true}, service: serviceModel{petsallowed: true, resturant: true, swimmingpool: true, carparking: true, fitnesscentre: true}, city: "Kolkata"},
+ SearchModel{ Bedrooms: 7, Bathrooms: 7, payment: paymentModel{payathotel: true, payonline: true, advancepayment: true}, service: serviceModel{petsallowed: true, resturant: true, swimmingpool: true, carparking: true, fitnesscentre: true}, city: "Hyderabad"},
+ SearchModel{ Bedrooms: 8, Bathrooms: 8, payment: paymentModel{payathotel: true, payonline: true, advancepayment: true}, service: serviceModel{petsallowed: true, resturant: true, swimmingpool: true, carparking: true, fitnesscentre: true}, city: "Pune"},
+ SearchModel{ Bedrooms: 9, Bathrooms: 9, payment: paymentModel{payathotel: true, payonline: true, advancepayment: true}, service: serviceModel{petsallowed: true, resturant: true, swimmingpool: true, carparking: true, fitnesscentre: true}, city: "Jaipur"},
+ SearchModel{ Bedrooms: 10, Bathrooms: 10, payment: paymentModel{payathotel: true, payonline: true, advancepayment: true}, service: serviceModel{petsallowed: true, resturant: true, swimmingpool: true, carparking: true, fitnesscentre: true}, city: "Ahmedabad"},
+ SearchModel{ Bedrooms: 11, Bathrooms: 11, payment: paymentModel{payathotel: true, payonline: true, advancepayment: true}, service: serviceModel{petsallowed: true, resturant: true, swimmingpool: true, carparking: true, fitnesscentre: true}, city: "Lucknow"},
+}
+
+
+type serviceModel struct {
+
+ petsallowed bool `json:"petsallowed"`
+ resturant bool `json:"resturant"`
+ swimmingpool bool `json:"swimmingpool"`
+ carparking bool `json:"carparking"`
+ fitnesscentre bool `json:"fitnesscentre"`
+
+
+}
+
+
+type paymentModel struct {
+
+ payathotel bool `json:"payathotel"`
+ payonline bool `json:"payonline"`
+ advancepayment bool `json:"advancepayment"`
+
+}
+
+
diff --git a/Backend/models/tripModel.go b/Backend/models/tripModel.go
new file mode 100644
index 0000000..defab39
--- /dev/null
+++ b/Backend/models/tripModel.go
@@ -0,0 +1,9 @@
+package models
+
+// Place represents the structure of our resource
+type Place struct {
+ Name string `json:"name"`
+ Distance float64 `json:"distance"` // in kilometers
+ Rating float64 `json:"rating"` // 1 to 5
+ Charges float64 `json:"charges"` // in USD
+}
diff --git a/Backend/tmp/build-errors.log b/Backend/tmp/build-errors.log
index 8cfae36..7ef9e2b 100644
--- a/Backend/tmp/build-errors.log
+++ b/Backend/tmp/build-errors.log
@@ -1 +1 @@
-exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1
\ No newline at end of file
+exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1
\ No newline at end of file
diff --git a/Backend/tmp/main.exe b/Backend/tmp/main.exe
index 714e68a..88d7639 100644
Binary files a/Backend/tmp/main.exe and b/Backend/tmp/main.exe differ
diff --git a/Backend/websocket/client.go b/Backend/websocket/client.go
new file mode 100644
index 0000000..c1e878f
--- /dev/null
+++ b/Backend/websocket/client.go
@@ -0,0 +1,81 @@
+package websocket
+
+import (
+ "log"
+ "net/http"
+
+ "github.com/gorilla/websocket"
+)
+
+type Client struct {
+ Hub *Hub
+ Conn *websocket.Conn
+ Send chan []byte
+}
+
+// NewClient creates a new client
+func NewClient(hub *Hub, conn *websocket.Conn) *Client {
+ return &Client{Hub: hub, Conn: conn, Send: make(chan []byte, 256)}
+}
+
+// writePump pumps messages from the hub to the websocket connection.
+func (c *Client) writePump() {
+ defer func() {
+ c.Conn.Close()
+ }()
+ for {
+ select {
+ case message, ok := <-c.Send:
+ if !ok {
+ // The hub closed the channel.
+ c.Conn.WriteMessage(websocket.CloseMessage, []byte{})
+ return
+ }
+
+ if err := c.Conn.WriteMessage(websocket.TextMessage, message); err != nil {
+ return
+ }
+ }
+ }
+}
+
+// readPump pumps messages from the websocket connection to the hub.
+func (c *Client) readPump() {
+ defer func() {
+ c.Hub.Unregister <- c
+ c.Conn.Close()
+ }()
+ for {
+ _, message, err := c.Conn.ReadMessage()
+ if err != nil {
+ if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {
+ // log the error
+ }
+ break
+ }
+ c.Hub.Broadcast <- message
+ }
+}
+
+// ServeWs handles websocket requests from the peer.
+func ServeWs(hub *Hub, w http.ResponseWriter, r *http.Request) {
+ conn, err := upgrader.Upgrade(w, r, nil) // Use the upgrader to upgrade the connection to a WebSocket.
+ if err != nil {
+ log.Printf("error upgrading HTTP to WebSocket: %v", err)
+ return
+ }
+ client := NewClient(hub, conn)
+ hub.Register <- client
+
+ // Start the read and write pumps.
+ go client.writePump()
+ go client.readPump()
+}
+
+
+var upgrader = websocket.Upgrader{
+ ReadBufferSize: 1024,
+ WriteBufferSize: 1024,
+
+ CheckOrigin: func(r *http.Request) bool { return true },
+}
diff --git a/Backend/websocket/hub.go b/Backend/websocket/hub.go
new file mode 100644
index 0000000..f97ee5c
--- /dev/null
+++ b/Backend/websocket/hub.go
@@ -0,0 +1,49 @@
+package websocket
+
+// Hub maintains the set of active clients and broadcasts messages to the clients.
+type Hub struct {
+ // Registered clients.
+ Clients map[*Client]bool
+
+ // Inbound messages from the clients.
+ Broadcast chan []byte
+
+ // Register requests from the clients.
+ Register chan *Client
+
+ // Unregister requests from clients.
+ Unregister chan *Client
+}
+
+func NewHub() *Hub {
+ return &Hub{
+ Broadcast: make(chan []byte),
+ Register: make(chan *Client),
+ Unregister: make(chan *Client),
+ Clients: make(map[*Client]bool),
+ }
+}
+
+// Run starts the hub to accept new clients and broadcast messages.
+func (h *Hub) Run() {
+ for {
+ select {
+ case client := <-h.Register:
+ h.Clients[client] = true
+ case client := <-h.Unregister:
+ if _, ok := h.Clients[client]; ok {
+ delete(h.Clients, client)
+ close(client.Send)
+ }
+ case message := <-h.Broadcast:
+ for client := range h.Clients {
+ select {
+ case client.Send <- message:
+ default:
+ close(client.Send)
+ delete(h.Clients, client)
+ }
+ }
+ }
+ }
+}
diff --git a/Frontend/android/app/src/main/AndroidManifest.xml b/Frontend/android/app/src/main/AndroidManifest.xml
index 404d3b9..650bb1b 100644
--- a/Frontend/android/app/src/main/AndroidManifest.xml
+++ b/Frontend/android/app/src/main/AndroidManifest.xml
@@ -1,6 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Frontend/lib/GlobalComponents/data_provider.dart b/Frontend/lib/GlobalComponents/data_provider.dart
index d058e99..77fa855 100644
--- a/Frontend/lib/GlobalComponents/data_provider.dart
+++ b/Frontend/lib/GlobalComponents/data_provider.dart
@@ -8,9 +8,23 @@ List maanGetChatList() {
list.add(LMSModel(title: 'Cristin', subTitle: 'About what Course?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.1.jpg"));
list.add(LMSModel(title: 'Chris Hameshorth', subTitle: 'hello', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.3.jpg"));
list.add(LMSModel(title: 'Eliyahou Amoyelle', subTitle: 'How ypu doing?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.4.jpg"));
+ list.add(LMSModel(title: 'Eliyahou Amoyelle', subTitle: 'How ypu doing?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.4.jpg"));
+ list.add(LMSModel(title: 'Eliyahou Amoyelle', subTitle: 'How ypu doing?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.4.jpg"));
+ list.add(LMSModel(title: 'Izzy Sruly', subTitle: 'About what Course?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.6.jpg"));
+ list.add(LMSModel(title: 'Izzy Sruly', subTitle: 'About what Course?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.6.jpg"));
+ list.add(LMSModel(title: 'Izzy Sruly', subTitle: 'About what Course?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.6.jpg"));
list.add(LMSModel(title: 'Izzy Sruly', subTitle: 'About what Course?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.6.jpg"));
list.add(LMSModel(title: 'Tom Holland', subTitle: 'hello', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.5.jpg"));
list.add(LMSModel(title: 'Salma Hayek', subTitle: 'How ypu doing?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.7.jpg"));
+ list.add(LMSModel(title: 'Salma Hayek', subTitle: 'How ypu doing?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.7.jpg"));
+ list.add(LMSModel(title: 'Salma Hayek', subTitle: 'How ypu doing?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.7.jpg"));
+ list.add(LMSModel(title: 'Salma Hayek', subTitle: 'How ypu doing?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.7.jpg"));
+ list.add(LMSModel(title: 'Salma Hayek', subTitle: 'How ypu doing?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.7.jpg"));
+ list.add(LMSModel(title: 'Nora fatehi', subTitle: 'About what Course?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.8.jpg"));
+ list.add(LMSModel(title: 'Nora fatehi', subTitle: 'About what Course?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.8.jpg"));
+ list.add(LMSModel(title: 'Nora fatehi', subTitle: 'About what Course?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.8.jpg"));
+ list.add(LMSModel(title: 'Nora fatehi', subTitle: 'About what Course?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.8.jpg"));
+ list.add(LMSModel(title: 'Nora fatehi', subTitle: 'About what Course?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.8.jpg"));
list.add(LMSModel(title: 'Nora fatehi', subTitle: 'About what Course?', image: "https://assets.iqonic.design/old-themeforest-images/prokit/datingApp/Image.8.jpg"));
return list;
}
diff --git a/Frontend/lib/Livechat/helper/constants.dart b/Frontend/lib/Livechat/helper/constants.dart
new file mode 100644
index 0000000..8bd2495
--- /dev/null
+++ b/Frontend/lib/Livechat/helper/constants.dart
@@ -0,0 +1,5 @@
+
+class Constants{
+
+ static String myName = "";
+}
\ No newline at end of file
diff --git a/Frontend/lib/Livechat/helper/helperfunction.dart b/Frontend/lib/Livechat/helper/helperfunction.dart
new file mode 100644
index 0000000..a613bed
--- /dev/null
+++ b/Frontend/lib/Livechat/helper/helperfunction.dart
@@ -0,0 +1,43 @@
+import 'package:shared_preferences/shared_preferences.dart';
+
+class HelperFunctions{
+
+ static String sharedPreferenceUserLoggedInKey = "ISLOGGEDIN";
+ static String sharedPreferenceUserNameKey = "USERNAMEKEY";
+ static String sharedPreferenceUserEmailKey = "USEREMAILKEY";
+
+ /// saving data to sharedpreference
+ static Future saveUserLoggedInSharedPreference(bool isUserLoggedIn) async{
+
+ SharedPreferences preferences = await SharedPreferences.getInstance();
+ return await preferences.setBool(sharedPreferenceUserLoggedInKey, isUserLoggedIn);
+ }
+
+ static Future saveUserNameSharedPreference(String userName) async{
+ SharedPreferences preferences = await SharedPreferences.getInstance();
+ return await preferences.setString(sharedPreferenceUserNameKey, userName);
+ }
+
+ static Future saveUserEmailSharedPreference(String userEmail) async{
+ SharedPreferences preferences = await SharedPreferences.getInstance();
+ return await preferences.setString(sharedPreferenceUserEmailKey, userEmail);
+ }
+
+ /// fetching data from sharedpreference
+
+ static Future getUserLoggedInSharedPreference() async{
+ SharedPreferences preferences = await SharedPreferences.getInstance();
+ return await preferences.getBool(sharedPreferenceUserLoggedInKey);
+ }
+
+ static Future getUserNameSharedPreference() async{
+ SharedPreferences preferences = await SharedPreferences.getInstance();
+ return await preferences.getString(sharedPreferenceUserNameKey);
+ }
+
+ static Future getUserEmailSharedPreference() async{
+ SharedPreferences preferences = await SharedPreferences.getInstance();
+ return await preferences.getString(sharedPreferenceUserEmailKey);
+ }
+
+}
\ No newline at end of file
diff --git a/Frontend/lib/Livechat/helper/theme.dart b/Frontend/lib/Livechat/helper/theme.dart
new file mode 100644
index 0000000..b413958
--- /dev/null
+++ b/Frontend/lib/Livechat/helper/theme.dart
@@ -0,0 +1,6 @@
+import 'package:flutter/material.dart';
+
+class CustomTheme {
+ static Color colorAccent = Color(0xff007EF4);
+ static Color textColor = Color(0xff071930);
+}
\ No newline at end of file
diff --git a/Frontend/lib/Livechat/model/user.dart b/Frontend/lib/Livechat/model/user.dart
new file mode 100644
index 0000000..b3b9dc4
--- /dev/null
+++ b/Frontend/lib/Livechat/model/user.dart
@@ -0,0 +1,5 @@
+class User {
+ final String uid;
+
+ User({required this.uid});
+}
\ No newline at end of file
diff --git a/Frontend/lib/Livechat/services/database.dart b/Frontend/lib/Livechat/services/database.dart
new file mode 100644
index 0000000..c25a5cb
--- /dev/null
+++ b/Frontend/lib/Livechat/services/database.dart
@@ -0,0 +1,64 @@
+import 'package:cloud_firestore/cloud_firestore.dart';
+
+class DatabaseMethods {
+ final FirebaseFirestore _firestore = FirebaseFirestore.instance;
+
+ Future addUserInfo(Map userData) async {
+ _firestore.collection("users").add(userData).catchError((e) {
+ print(e.toString());
+ });
+ }
+
+ Future getUserInfo(String email) async {
+ return _firestore
+ .collection("users")
+ .where("userEmail", isEqualTo: email)
+ .get()
+ .catchError((e) {
+ print(e.toString());
+ });
+ }
+
+ Future searchByName(String searchField) {
+ return _firestore
+ .collection("users")
+ .where('userName', isEqualTo: searchField)
+ .get();
+ }
+
+ Future addChatRoom(Map chatRoom, String chatRoomId) async {
+ _firestore
+ .collection("chatRoom")
+ .doc(chatRoomId)
+ .set(chatRoom)
+ .catchError((e) {
+ print(e.toString());
+ });
+ }
+
+ Stream getChats(String chatRoomId) {
+ return _firestore
+ .collection("chatRoom")
+ .doc(chatRoomId)
+ .collection("chats")
+ .orderBy('time')
+ .snapshots();
+ }
+
+ Future addMessage(String chatRoomId, Map chatMessageData) async {
+ _firestore.collection("chatRoom")
+ .doc(chatRoomId)
+ .collection("chats")
+ .add(chatMessageData).catchError((e) {
+ print(e.toString());
+ });
+ }
+
+ Stream getUserChats(String itIsMyName) {
+ return _firestore
+ .collection("chatRoom")
+ .where('users', arrayContains: itIsMyName)
+ .snapshots();
+}
+
+}
diff --git a/Frontend/lib/Livechat/view/charroom.dart b/Frontend/lib/Livechat/view/charroom.dart
new file mode 100644
index 0000000..af57330
--- /dev/null
+++ b/Frontend/lib/Livechat/view/charroom.dart
@@ -0,0 +1,142 @@
+
+import 'package:cloud_firestore/cloud_firestore.dart';
+import 'package:flutter/material.dart';
+import 'package:hotel_booking/Livechat/helper/constants.dart';
+import 'package:hotel_booking/Livechat/helper/helperfunction.dart';
+import 'package:hotel_booking/Livechat/helper/theme.dart';
+import 'package:hotel_booking/Livechat/services/database.dart';
+import 'package:hotel_booking/Livechat/view/chat.dart';
+
+class ChatRoom extends StatefulWidget {
+ @override
+ _ChatRoomState createState() => _ChatRoomState();
+}
+
+class _ChatRoomState extends State {
+ //late Stream chatRooms;
+ Stream? chatRooms;
+ Widget chatRoomsList() {
+ return StreamBuilder(
+ stream: chatRooms,
+ builder: (context, AsyncSnapshot snapshot) {
+ if (snapshot.hasData) {
+ return ListView.builder(
+ itemCount: snapshot.data!.docs.length,
+ shrinkWrap: true,
+ itemBuilder: (context, index) {
+ DocumentSnapshot ds = snapshot.data!.docs[index];
+ String chatRoomId = ds["chatRoomId"];
+ String userName = chatRoomId
+ .replaceAll("_", "")
+ .replaceAll(Constants.myName!, ""); // Make sure Constants.myName is not null
+ return ChatRoomsTile(
+ userName: userName,
+ chatRoomId: chatRoomId,
+ );
+ });
+ }
+ return Container();
+ },
+ );
+ }
+
+ @override
+ void initState() {
+ getUserInfogetChats();
+ super.initState();
+ }
+getUserInfogetChats() async {
+ Constants.myName = (await HelperFunctions.getUserNameSharedPreference())!;
+ chatRooms = DatabaseMethods().getUserChats(Constants.myName!); // Ensure Constants.myName is non-null here
+ setState(() {});
+ }
+
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ title: Image.asset(
+ "assets/images/logo.png",
+ height: 40,
+ ),
+ elevation: 0.0,
+ centerTitle: false,
+ actions: [
+ // GestureDetector(
+ // onTap: () {
+ // AuthService().signOut();
+ // Navigator.pushReplacement(context,
+ // MaterialPageRoute(builder: (context) => Authenticate()));
+ // },
+ // child: Container(
+ // padding: EdgeInsets.symmetric(horizontal: 16),
+ // child: Icon(Icons.exit_to_app)),
+ // )
+ ],
+ ),
+ body: Container(
+ child: chatRoomsList(),
+ ),
+ floatingActionButton: FloatingActionButton(
+ child: Icon(Icons.search),
+ onPressed: () {
+ // Navigator.push(
+ // context, MaterialPageRoute(builder: (context) => Search()));
+ },
+ ),
+ );
+ }
+}
+
+class ChatRoomsTile extends StatelessWidget {
+ final String userName;
+ final String chatRoomId;
+
+ ChatRoomsTile({required this.userName,required this.chatRoomId});
+
+ @override
+ Widget build(BuildContext context) {
+ return GestureDetector(
+ onTap: (){
+ Navigator.push(context, MaterialPageRoute(
+ builder: (context) => Chat(
+ chatRoomId: chatRoomId,
+ )
+ ));
+ },
+ child: Container(
+ color: Colors.black26,
+ padding: EdgeInsets.symmetric(horizontal: 24, vertical: 20),
+ child: Row(
+ children: [
+ Container(
+ height: 30,
+ width: 30,
+ decoration: BoxDecoration(
+ color: CustomTheme.colorAccent,
+ borderRadius: BorderRadius.circular(30)),
+ child: Text(userName.substring(0, 1),
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 16,
+ fontFamily: 'OverpassRegular',
+ fontWeight: FontWeight.w300)),
+ ),
+ SizedBox(
+ width: 12,
+ ),
+ Text(userName,
+ textAlign: TextAlign.start,
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 16,
+ fontFamily: 'OverpassRegular',
+ fontWeight: FontWeight.w300))
+ ],
+ ),
+ ),
+ );
+ }
+}
\ No newline at end of file
diff --git a/Frontend/lib/Livechat/view/chat.dart b/Frontend/lib/Livechat/view/chat.dart
new file mode 100644
index 0000000..8f525da
--- /dev/null
+++ b/Frontend/lib/Livechat/view/chat.dart
@@ -0,0 +1,188 @@
+import 'dart:io';
+
+import 'package:cloud_firestore/cloud_firestore.dart';
+import 'package:flutter/material.dart';
+import 'package:hotel_booking/Livechat/helper/constants.dart';
+import 'package:hotel_booking/Livechat/services/database.dart';
+import 'package:hotel_booking/Livechat/widgets/widgets.dart';
+
+class Chat extends StatefulWidget {
+ final String chatRoomId;
+
+ Chat({ required this.chatRoomId});
+
+ @override
+ _ChatState createState() => _ChatState();
+}
+
+class _ChatState extends State {
+
+ late Stream chats;
+ TextEditingController messageEditingController = new TextEditingController();
+
+Widget chatMessages() {
+ return StreamBuilder(
+ stream: chats,
+ builder: (context, AsyncSnapshot snapshot) {
+ if (snapshot.hasData) {
+ return ListView.builder(
+ itemCount: snapshot.data!.docs.length,
+ itemBuilder: (context, index) {
+ var doc = snapshot.data!.docs[index];
+ return MessageTile(
+ message: doc["message"],
+ sendByMe: Constants.myName == doc["sendBy"],
+ );
+ });
+ }
+ return Container();
+ },
+ );
+ }
+
+ addMessage() {
+ if (messageEditingController.text.isNotEmpty) {
+ Map chatMessageMap = {
+ "sendBy": Constants.myName,
+ "message": messageEditingController.text,
+ 'time': DateTime
+ .now()
+ .millisecondsSinceEpoch,
+ };
+
+ DatabaseMethods().addMessage(widget.chatRoomId, chatMessageMap);
+
+ setState(() {
+ messageEditingController.text = "";
+ });
+ }
+ }
+
+ @override
+ void initState() {
+ chats = DatabaseMethods().getChats(widget.chatRoomId);
+ super.initState();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ title: Text("Chat"),
+ ),
+ body: Container(
+ child: Stack(
+ children: [
+ chatMessages(),
+ Container(alignment: Alignment.bottomCenter,
+ width: MediaQuery
+ .of(context)
+ .size
+ .width,
+ child: Container(
+ padding: EdgeInsets.symmetric(horizontal: 24, vertical: 24),
+ color: Color(0x54FFFFFF),
+ child: Row(
+ children: [
+ Expanded(
+ child: TextField(
+ controller: messageEditingController,
+ style: simpleTextStyle(),
+ decoration: InputDecoration(
+ hintText: "Message ...",
+ hintStyle: TextStyle(
+ color: Colors.white,
+ fontSize: 16,
+ ),
+ border: InputBorder.none
+ ),
+ )),
+ SizedBox(width: 16,),
+ GestureDetector(
+ onTap: () {
+ addMessage();
+ },
+ child: Container(
+ height: 40,
+ width: 40,
+ decoration: BoxDecoration(
+ gradient: LinearGradient(
+ colors: [
+ const Color(0x36FFFFFF),
+ const Color(0x0FFFFFFF)
+ ],
+ begin: FractionalOffset.topLeft,
+ end: FractionalOffset.bottomRight
+ ),
+ borderRadius: BorderRadius.circular(40)
+ ),
+ padding: EdgeInsets.all(12),
+ child: Image.asset("assets/images/send.png",
+ height: 25, width: 25,)),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
+}
+
+class MessageTile extends StatelessWidget {
+ final String message;
+ final bool sendByMe;
+
+ MessageTile({required this.message, required this.sendByMe});
+
+
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ padding: EdgeInsets.only(
+ top: 8,
+ bottom: 8,
+ left: sendByMe ? 0 : 24,
+ right: sendByMe ? 24 : 0),
+ alignment: sendByMe ? Alignment.centerRight : Alignment.centerLeft,
+ child: Container(
+ margin: sendByMe
+ ? EdgeInsets.only(left: 30)
+ : EdgeInsets.only(right: 30),
+ padding: EdgeInsets.only(
+ top: 17, bottom: 17, left: 20, right: 20),
+ decoration: BoxDecoration(
+ borderRadius: sendByMe ? BorderRadius.only(
+ topLeft: Radius.circular(23),
+ topRight: Radius.circular(23),
+ bottomLeft: Radius.circular(23)
+ ) :
+ BorderRadius.only(
+ topLeft: Radius.circular(23),
+ topRight: Radius.circular(23),
+ bottomRight: Radius.circular(23)),
+ gradient: LinearGradient(
+ colors: sendByMe ? [
+ const Color(0xff007EF4),
+ const Color(0xff2A75BC)
+ ]
+ : [
+ const Color(0x1AFFFFFF),
+ const Color(0x1AFFFFFF)
+ ],
+ )
+ ),
+ child: Text(message,
+ textAlign: TextAlign.start,
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 16,
+ fontFamily: 'OverpassRegular',
+ fontWeight: FontWeight.w300)),
+ ),
+ );
+ }
+}
diff --git a/Frontend/lib/Livechat/widgets/widgets.dart b/Frontend/lib/Livechat/widgets/widgets.dart
new file mode 100644
index 0000000..bf574f4
--- /dev/null
+++ b/Frontend/lib/Livechat/widgets/widgets.dart
@@ -0,0 +1,30 @@
+import 'package:flutter/material.dart';
+
+Widget appBarMain(BuildContext context) {
+ return AppBar(
+ title: Image.asset(
+ "assets/images/logo.png",
+ height: 40,
+ ),
+ elevation: 0.0,
+ centerTitle: false,
+ );
+}
+
+InputDecoration textFieldInputDecoration(String hintText) {
+ return InputDecoration(
+ hintText: hintText,
+ hintStyle: TextStyle(color: Colors.white54),
+ focusedBorder:
+ UnderlineInputBorder(borderSide: BorderSide(color: Colors.white)),
+ enabledBorder:
+ UnderlineInputBorder(borderSide: BorderSide(color: Colors.white)));
+}
+
+TextStyle simpleTextStyle() {
+ return TextStyle(color: Colors.white, fontSize: 16);
+}
+
+TextStyle biggerTextStyle() {
+ return TextStyle(color: Colors.white, fontSize: 17);
+}
\ No newline at end of file
diff --git a/Frontend/lib/Notification/controller/messagescr.dart b/Frontend/lib/Notification/controller/messagescr.dart
new file mode 100644
index 0000000..a65bece
--- /dev/null
+++ b/Frontend/lib/Notification/controller/messagescr.dart
@@ -0,0 +1,22 @@
+
+
+import 'package:flutter/material.dart';
+
+class MessageScreen extends StatefulWidget {
+ final String id ;
+ const MessageScreen({Key? key , required this.id}) : super(key: key);
+
+ @override
+ State createState() => _MessageScreenState();
+}
+
+class _MessageScreenState extends State {
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ title: Text('Message Screen' +widget.id) ,
+ ),
+ );
+ }
+}
\ No newline at end of file
diff --git a/Frontend/lib/Notification/controller/notificationservice.dart b/Frontend/lib/Notification/controller/notificationservice.dart
new file mode 100644
index 0000000..dd5811c
--- /dev/null
+++ b/Frontend/lib/Notification/controller/notificationservice.dart
@@ -0,0 +1,224 @@
+
+
+//! class for managing notificatin services
+
+
+
+import 'dart:io';
+import 'dart:math';
+
+
+import 'package:firebase_messaging/firebase_messaging.dart';
+import 'package:http/http.dart' as http;
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_local_notifications/flutter_local_notifications.dart';
+import 'package:path_provider/path_provider.dart';
+
+import 'messagescr.dart';
+
+
+class NotificationServices {
+
+ //initialising firebase message plugin
+ FirebaseMessaging messaging = FirebaseMessaging.instance ;
+
+ //initialising firebase message plugin
+ final FlutterLocalNotificationsPlugin _flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
+
+
+
+ //function to initialise flutter local notification plugin to show notifications for android when app is active
+ void initLocalNotifications(BuildContext context, RemoteMessage message)async{
+ var androidInitializationSettings = const AndroidInitializationSettings('@mipmap/ic_launcher');
+ var iosInitializationSettings = const DarwinInitializationSettings();
+
+ var initializationSetting = InitializationSettings(
+ android: androidInitializationSettings ,
+ iOS: iosInitializationSettings
+ );
+
+ await _flutterLocalNotificationsPlugin.initialize(
+ initializationSetting,
+ onDidReceiveNotificationResponse: (payload){
+ // handle interaction when app is active for android
+ handleMessage(context, message);
+ }
+ );
+ }
+
+ void firebaseInit(BuildContext context){
+
+
+
+
+ FirebaseMessaging.onMessage.listen((message) {
+
+ RemoteNotification? notification = message.notification ;
+ AndroidNotification? android = message.notification!.android ;
+
+ if (kDebugMode) {
+ print("notifications title:${notification!.title}");
+ print("notifications body:${notification.body}");
+ print('count:${android!.count}');
+ print('data:${message.data.toString()}');
+ }
+
+ if(Platform.isIOS){
+ forgroundMessage();
+ }
+
+ if(Platform.isAndroid){
+ initLocalNotifications(context, message);
+ showNotification(message);
+ }
+ });
+ }
+
+
+ void requestNotificationPermission() async {
+ NotificationSettings settings = await messaging.requestPermission(
+ alert: true,
+ announcement: true,
+ badge: true,
+ carPlay: true,
+ criticalAlert: true,
+ provisional: true,
+ sound: true ,
+ );
+
+ if (settings.authorizationStatus == AuthorizationStatus.authorized) {
+ if (kDebugMode) {
+ print('user granted permission');
+ }
+ } else if (settings.authorizationStatus ==
+ AuthorizationStatus.provisional) {
+ if (kDebugMode) {
+ print('user granted provisional permission');
+ }
+ } else {
+ //appsetting.AppSettings.openNotificationSettings();
+ if (kDebugMode) {
+ print('user denied permission');
+ }
+ }
+ }
+
+ // function to show visible notification when app is active
+ Future showNotification(RemoteMessage message)async{
+
+ AndroidNotificationChannel channel = AndroidNotificationChannel(
+ message.notification!.android!.channelId.toString(),
+ message.notification!.android!.channelId.toString() ,
+ importance: Importance.max ,
+ showBadge: true ,
+ playSound: true,
+ sound: const RawResourceAndroidNotificationSound('jetsons_doorbell')
+ );
+
+ AndroidNotificationDetails androidNotificationDetails = AndroidNotificationDetails(
+ channel.id.toString(),
+ channel.name.toString() ,
+ channelDescription: 'your channel description',
+ importance: Importance.high,
+ priority: Priority.high ,
+ playSound: true,
+ ticker: 'ticker' ,
+ sound: channel.sound
+ // sound: RawResourceAndroidNotificationSound('jetsons_doorbell')
+ // icon: largeIconPath
+ );
+
+ const DarwinNotificationDetails darwinNotificationDetails = DarwinNotificationDetails(
+ presentAlert: true ,
+ presentBadge: true ,
+ presentSound: true
+ ) ;
+
+ NotificationDetails notificationDetails = NotificationDetails(
+ android: androidNotificationDetails,
+ iOS: darwinNotificationDetails
+ );
+
+ Future.delayed(Duration.zero , (){
+ _flutterLocalNotificationsPlugin.show(
+ 0,
+ message.notification!.title.toString(),
+ message.notification!.body.toString(),
+ notificationDetails ,
+ );
+ });
+
+ }
+
+ //function to get device token on which we will send the notifications
+ Future getDeviceToken() async {
+ String? token = await messaging.getToken();
+ return token!;
+ }
+
+ void isTokenRefresh()async{
+ messaging.onTokenRefresh.listen((event) {
+ event.toString();
+ if (kDebugMode) {
+ print('refresh');
+ }
+ });
+ }
+
+ //handle tap on notification when app is in background or terminated
+ Future setupInteractMessage(BuildContext context)async{
+
+ // when app is terminated
+ RemoteMessage? initialMessage = await FirebaseMessaging.instance.getInitialMessage();
+
+ if(initialMessage != null){
+ handleMessage(context, initialMessage);
+ }
+
+
+ //when app ins background
+ FirebaseMessaging.onMessageOpenedApp.listen((event) {
+ handleMessage(context, event);
+ });
+
+ }
+
+ void handleMessage(BuildContext context, RemoteMessage message) {
+
+ if(message.data['type'] =='msj'){
+ Navigator.push(context,
+ MaterialPageRoute(builder: (context) => MessageScreen(
+ id: message.data['id'] ,
+ )));
+ }
+ }
+
+
+ Future forgroundMessage() async {
+ await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions(
+ alert: true,
+ badge: true,
+ sound: true,
+ );
+ }
+
+ //! Fetching notification coming from firebase
+ Future getNotification() async {
+ await messaging.getInitialMessage();
+
+ //! print all the notification
+ FirebaseMessaging.onMessage.listen((RemoteMessage message) {
+ if (kDebugMode) {
+ print('Got a message whilst in the foreground!');
+ print('Message data: ${message.data}');
+ if (message.notification != null) {
+ print('Message also contained a notification: ${message.notification}');
+ }
+ }
+ });
+ }
+
+
+}
+
diff --git a/Frontend/lib/Notification/notification.dart b/Frontend/lib/Notification/notification.dart
index efb1113..880116f 100644
--- a/Frontend/lib/Notification/notification.dart
+++ b/Frontend/lib/Notification/notification.dart
@@ -1,9 +1,15 @@
+import 'dart:async';
+
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
+import 'package:get/get_connect/http/src/utils/utils.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:nb_utils/nb_utils.dart';
import '../../../constant.dart';
import '../GlobalComponents/data_provider.dart';
import '../GlobalComponents/lms_model.dart';
+import 'controller/notificationservice.dart';
+import 'package:async/async.dart';
class Notificationlist extends StatefulWidget {
const Notificationlist({Key? key}) : super(key: key);
@@ -15,6 +21,63 @@ class Notificationlist extends StatefulWidget {
class _NotificationlistState extends State {
List listData = maanGetChatList(); //! here we have notification display list
bool isChecked = true;
+ final ScrollController _scrollController = ScrollController();
+ double _scrollPosition = 0;
+
+
+ NotificationServices notificationServices = NotificationServices();
+
+ //! here we have notification display list
+
+ //! Fetching notification coming from firebase
+
+ Future getNotification() async {
+ await notificationServices.getNotification();
+ }
+
+ @override
+ void initState() {
+ // TODO: implement initState
+ super.initState();
+ notificationServices.requestNotificationPermission();
+ notificationServices.forgroundMessage();
+ notificationServices.firebaseInit(context);
+ notificationServices.setupInteractMessage(context);
+ notificationServices.isTokenRefresh();
+
+ notificationServices.getDeviceToken().then((value) {
+ if (kDebugMode) {
+ print('device token');
+ print(value);
+ }
+ });
+
+ _scrollController.addListener(() {
+ setState(() {
+ _scrollPosition = _scrollController.offset;
+ });
+ });
+
+ Timer(const Duration(seconds: 4), () {
+ printScrollPosition();
+ });
+ getNotification();
+ }
+
+ //! printing scroll position
+
+ void printScrollPosition() {
+ if (kDebugMode) {
+ print('scroll position: $_scrollPosition');
+ }}
+
+
+
+ @override
+ void dispose() {
+ _scrollController.dispose();
+ super.dispose();
+ }
@override
Widget build(BuildContext context) {
@@ -29,6 +92,7 @@ class _NotificationlistState extends State {
),
),
SingleChildScrollView(
+ controller: _scrollController,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -52,7 +116,7 @@ class _NotificationlistState extends State {
fontSize: 18.0,
fontWeight: FontWeight.bold),
),
- const Spacer(),
+ Spacer(),
PopupMenuButton(
padding: EdgeInsets.zero,
itemBuilder: (BuildContext bc) => [
@@ -120,11 +184,32 @@ class _NotificationlistState extends State {
borderRadius: BorderRadius.circular(5.0),
),
),
- onTap: () {},
+ onTap: () {
+ printScrollPosition();
+ },
);
},
).toList(),
),
+ // ListView.builder(
+
+ // itemCount: listData.length,
+ // itemBuilder: (BuildContext context, int index) {
+ // return ListTile(
+ // title: Text(listData[index].title!),
+ // subtitle: Text(listData[index].subTitle!),
+ // leading: Image.network(listData[index].image!),
+ // trailing: Checkbox(
+ // value: isChecked,
+ // onChanged: (bool? value) {
+ // setState(() {
+ // isChecked = value!;
+ // });
+ // },
+ // ),
+ // );
+ // },
+ // ),
],
),
],
diff --git a/Frontend/lib/Profile/edit_profile.dart b/Frontend/lib/Profile/edit_profile.dart
index 0975a62..82c0d3d 100644
--- a/Frontend/lib/Profile/edit_profile.dart
+++ b/Frontend/lib/Profile/edit_profile.dart
@@ -1,8 +1,11 @@
+import 'dart:convert';
+
import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:hotel_booking/Screen/Home/home.dart';
import 'package:nb_utils/nb_utils.dart';
import '../../../constant.dart';
+import 'package:http/http.dart' as http;
class EditProfile extends StatefulWidget {
const EditProfile({Key? key}) : super(key: key);
@@ -41,6 +44,37 @@ class _EditProfileState extends State {
final dateController = TextEditingController();
+ TextEditingController nameController = TextEditingController();
+ TextEditingController emailController = TextEditingController();
+ TextEditingController genderController = TextEditingController();
+
+ //! post api for update profile
+ //! http://192.168.85.111:9080/profile
+
+ Future profileUpdatepostApi(String name, String email, gender) async {
+ var url = Uri.parse('http://192.168.85.111:9080/profile');
+ var response = await http.post(
+ url,
+ headers: {
+ 'Content-Type': 'application/json; charset=UTF-8',
+ },
+ body: json.encode(
+ {"name": name, "email": email, "gender": gender}),
+ );
+ if (response.statusCode == 200) {
+ print('Response status: ${response.statusCode}');
+ print('Response body: ${response.body}');
+ Navigator.push(
+ context,
+ MaterialPageRoute(builder: (context) => Home()),
+ );
+ } else {
+ print('Response status: ${response.statusCode}');
+ print('Response body: ${response.body}');
+ toast("wrong data");
+ }
+ }
+
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -66,27 +100,33 @@ class _EditProfileState extends State {
),
child: Padding(
padding: const EdgeInsets.all(20.0),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- Container(
- width: context.width(),
- decoration: BoxDecoration(
- borderRadius: BorderRadiusDirectional.circular(30.0),
- color: kMainColor,
- ),
- child: Padding(
- padding: const EdgeInsets.all(15.0),
- child: Center(
- child: Text(
- 'Update',
- style: kTextStyle.copyWith(
- color: Colors.white, fontSize: 18.0),
+ child: InkWell(
+ onTap: () {
+ profileUpdatepostApi(
+ nameController.text, emailController.text, "Male");
+ },
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Container(
+ width: context.width(),
+ decoration: BoxDecoration(
+ borderRadius: BorderRadiusDirectional.circular(30.0),
+ color: kMainColor,
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(15.0),
+ child: Center(
+ child: Text(
+ 'Update',
+ style: kTextStyle.copyWith(
+ color: Colors.white, fontSize: 18.0),
+ ),
),
),
),
- ),
- ],
+ ],
+ ),
),
),
),
@@ -122,6 +162,7 @@ class _EditProfileState extends State {
height: 70.0,
),
AppTextField(
+ controller: nameController,
textFieldType: TextFieldType.NAME,
decoration: kInputDecoration.copyWith(
labelText: 'Full Name',
@@ -132,6 +173,7 @@ class _EditProfileState extends State {
),
const SizedBox(height: 20.0),
AppTextField(
+ controller: emailController,
textFieldType: TextFieldType.EMAIL,
decoration: kInputDecoration.copyWith(
labelText: 'Email Address*',
@@ -210,13 +252,15 @@ class _EditProfileState extends State {
bottom: 3.0,
right: 20.0,
child: Container(
- padding: const EdgeInsets.all(4.0),
+ padding: const EdgeInsets.all(4.0),
decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(10.0),
- border: Border.all(color: kMainColor)
- ),
- child: const Icon(FeatherIcons.camera,size: 12.0,)),
+ color: Colors.white,
+ borderRadius: BorderRadius.circular(10.0),
+ border: Border.all(color: kMainColor)),
+ child: const Icon(
+ FeatherIcons.camera,
+ size: 12.0,
+ )),
),
],
),
diff --git a/Frontend/lib/Profile/profile.dart b/Frontend/lib/Profile/profile.dart
index 1640a6b..a777920 100644
--- a/Frontend/lib/Profile/profile.dart
+++ b/Frontend/lib/Profile/profile.dart
@@ -1,3 +1,5 @@
+import 'dart:convert';
+
import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:hotel_booking/Chat/chat_list.dart';
@@ -10,6 +12,8 @@ import '../../constant.dart';
import '../Notification/notification.dart';
import '../Screen/Home/Payment/payment.dart';
+import 'package:http/http.dart' as http;
+
class Profile extends StatefulWidget {
const Profile({Key? key}) : super(key: key);
@@ -46,6 +50,41 @@ class _ProfileState extends State {
// }
// }
+ @override
+ void initState() {
+ super.initState();
+ getWishListApi();
+ }
+
+ //! http://192.168.85.111:9080/profile
+
+ //! post api for fetching profile data
+
+ //! http://192.168.85.111:9080/profile
+
+ Future