Skip to content

Commit

Permalink
fianl commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafamo7amed committed Sep 17, 2022
1 parent d5afdf7 commit 0d19d6c
Show file tree
Hide file tree
Showing 25 changed files with 399 additions and 126 deletions.
Binary file added assets/images/eight.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/five.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/four.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/image001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/login.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/nine.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/one.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/seven.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/six.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/teen.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/three.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/two.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
212 changes: 134 additions & 78 deletions lib/layout/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
return BlocConsumer<HotelCubit,HotelStates>(
listener: (context, state) { },
return BlocConsumer<HotelCubit, HotelStates>(
listener: (context, state) {},
builder: (context, state) {
HotelCubit cubit = HotelCubit.getCubit(context);
return Scaffold(
Expand All @@ -28,17 +28,19 @@ class HomeScreen extends StatelessWidget {
),
actions: [
InkWell(
onTap: (){
if(cubit.isLoggedIn){
onTap: () {
if (cubit.isLoggedIn) {
cubit.changeLoggedIn();
}else{
} else {
navigateTo(context, LoginScreen());
}
},
child: Padding(
padding: EdgeInsets.all(8.0),
child: Text(
cubit.isLoggedIn? cubit.logout.toString():cubit.login.toString(),
cubit.isLoggedIn
? cubit.logout.toString()
: cubit.login.toString(),
style: TextStyle(
fontFamily: 'Janna',
fontWeight: FontWeight.bold,
Expand All @@ -49,82 +51,136 @@ class HomeScreen extends StatelessWidget {
),
],
),
body: Column(
children: [
Image.asset(
'assets/images/hotel.jpg',
width: double.infinity,
height: 240,
fit: BoxFit.cover,
),
const SizedBox(
height: 30,
),
SizedBox(
width: 250,
child: Center(
child: Container(
height: 45,
width: 250,
padding: const EdgeInsets.only(left: 5, right: 5),
decoration: const ShapeDecoration(
color: Colors.white,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1.0, style: BorderStyle.solid),
borderRadius: BorderRadius.all(Radius.circular(5.0)),
),
),
child: DropdownButtonHideUnderline(
child: DropdownButton(
value: cubit.branchSelected,
items: cubit.branch.map((item) => DropdownMenuItem<String>(
value: item,
child: Text(item,
style: const TextStyle(
fontSize: 18,
),),
),
).toList(),
onChanged:(item) {
cubit.selectedBranch(item!);
body: Container(
padding: const EdgeInsets.all(12),
child: ListView(
children: [
ListView.builder(
itemCount: cubit.branchesData.length,
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, i) {
return InkWell(
onTap: () {
if (cubit.isLoggedIn) {
navigateTo(context, BookingScreen());
cubit.selectedBranch(cubit.branchesData[i]['branch'].toString());
cubit.selectedImageBranch(cubit.branchesData[i]['image'].toString());
} else {
toast(
message: 'You can\'t book a room until login',
data: ToastStates.warning);
}
},
),
),
),
),
),
if (cubit.haveSale)
Text("You have a sale up to 95%",
style: TextStyle(
fontSize: 16,
) ,
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
defaultButton(onPressed: (){
if(cubit.isLoggedIn){
navigateTo(context, RoomScreen());
}else{
toast(message: 'You can\'t view rooms until login', data: ToastStates.warning);
}
}, text: 'Rooms status', height: size.height*0.07),
const SizedBox(width: 10,),
defaultButton(onPressed: (){
if(cubit.isLoggedIn){
navigateTo(context, BookingScreen());
}else{
toast(message: 'You can\'t book a room until login', data: ToastStates.warning);
}
}, text: 'Book a room', height: size.height*0.07),
],
),
),
],
child: Card(
elevation: 5,
child: ListTile(
leading: Image.asset(
'assets/images/${cubit.branchesData[i]['image']}.jpg',
width: 100,
height: 120,
fit: BoxFit.fill,
),
title: Text(
"${cubit.branchesData[i]['branch']}",
style: const TextStyle(
color: Colors.cyan, fontSize: 20),
),
subtitle: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"${cubit.branchesData[i]['rate']}",
style: const TextStyle(
color: Colors.black, fontSize: 16),
),
const Icon(Icons.star, color: Colors.amber),
],
),
),
),
);
})
],
),
),
);
},
);
}

/*Widget oldDesign() => Column(
children: [
Image.asset(
'assets/images/hotel.jpg',
width: double.infinity,
height: 240,
fit: BoxFit.cover,
),
const SizedBox(
height: 30,
),
SizedBox(
width: 250,
child: Center(
child: Container(
height: 45,
width: 250,
padding: const EdgeInsets.only(left: 5, right: 5),
decoration: const ShapeDecoration(
color: Colors.white,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1.0, style: BorderStyle.solid),
borderRadius: BorderRadius.all(Radius.circular(5.0)),
),
),
child: DropdownButtonHideUnderline(
child: DropdownButton(
value: cubit.branchSelected,
items: cubit.branch.map((item) => DropdownMenuItem<String>(
value: item,
child: Text(item,
style: const TextStyle(
fontSize: 18,
),),
),
).toList(),
onChanged:(item) {
cubit.selectedBranch(item!);
},
),
),
),
),
),
if (cubit.haveSale)
Text("You have a sale up to 95%",
style: TextStyle(
fontSize: 16,
) ,
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
defaultButton(onPressed: (){
if(cubit.isLoggedIn){
navigateTo(context, RoomScreen());
}else{
toast(message: 'You can\'t view rooms until login', data: ToastStates.warning);
}
}, text: 'Rooms status', height: size.height*0.07),
const SizedBox(width: 10,),
defaultButton(onPressed: (){
if(cubit.isLoggedIn){
navigateTo(context, BookingScreen());
}else{
toast(message: 'You can\'t book a room until login', data: ToastStates.warning);
}
}, text: 'Book a room', height: size.height*0.07),
],
),
),
],
);*/
}
4 changes: 4 additions & 0 deletions lib/models/booked_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ class BookedRoomData{
double cost;
int databaseId;
Room room;
String from;
String to;
BookedRoomData({
required this.roomType,
required this.guests,
required this.cost,
required this.databaseId,
required this.room,
required this.from,
required this.to,
});
}
6 changes: 3 additions & 3 deletions lib/models/room_type.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class RoomType{
String singleRoom = "single";
String doubleRoom = "double";
String suitRoom = "suit";
String singleRoom = "Single";
String doubleRoom = "Double";
String suitRoom = "Suit";
}
Loading

0 comments on commit 0d19d6c

Please sign in to comment.