Skip to content

Commit 79ffb59

Browse files
committed
Co-authored-by: ishaanj0412 <[email protected]>
1 parent 6f5b0c6 commit 79ffb59

File tree

3 files changed

+140
-1
lines changed

3 files changed

+140
-1
lines changed

lib/bookingdetails.dart

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import 'package:flutter/material.dart';
2+
3+
class BookingDetails extends StatelessWidget{
4+
const BookingDetails(this.date, this.starttime, this.endtime, {Key? key}) : super(key: key);
5+
final String date;
6+
final String starttime;
7+
final String endtime;
8+
9+
@override
10+
Widget build(BuildContext context) {
11+
return Scaffold(
12+
appBar: AppBar(
13+
title: Column(
14+
mainAxisAlignment: MainAxisAlignment.center,
15+
crossAxisAlignment: CrossAxisAlignment.start,
16+
17+
children: const [
18+
Text(
19+
"ShareCab",
20+
style: TextStyle(color: Colors.white, fontSize: 16.0),
21+
),
22+
Text(
23+
"Booking Details",
24+
style: TextStyle(color: Colors.white, fontSize: 14.0),
25+
)
26+
],
27+
),
28+
leadingWidth: 70,
29+
leading: FloatingActionButton(
30+
shape: RoundedRectangleBorder(
31+
borderRadius: BorderRadius.circular(30),
32+
),
33+
heroTag: "button1",
34+
onPressed: (){
35+
// TODO: Add Navigator pop
36+
},
37+
backgroundColor: Colors.black,
38+
child:Row(
39+
children: <Widget>[
40+
Icon(Icons.arrow_back,
41+
color: Colors.white),
42+
CircleAvatar(
43+
backgroundImage: AssetImage('assets/logo.png'),
44+
backgroundColor: Colors.black,
45+
),
46+
],)),
47+
backgroundColor: Colors.black,
48+
shape: const Border(
49+
bottom: BorderSide(
50+
color: Color(0xFF424242),
51+
)
52+
),
53+
),
54+
backgroundColor: Colors.black,
55+
floatingActionButton: FloatingActionButton(
56+
heroTag: "button2",
57+
onPressed: (){},
58+
backgroundColor: Colors.red,
59+
child: const Icon(
60+
Icons.delete,
61+
color: Colors.white,
62+
)
63+
),
64+
// body:
65+
);
66+
}
67+
68+
}

lib/home.dart

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:carpool/user.dart';
33
import 'package:carpool/LoginForm.dart';
44
import 'package:interval_tree/interval_tree.dart' as a;
55
import 'package:intl/intl.dart';
6+
import 'package:carpool/bookingdetails.dart';
67

78
class Home extends StatefulWidget {
89
Home ({Key? key}) : super(key: key);
@@ -16,6 +17,8 @@ class Home extends StatefulWidget {
1617
}
1718
}
1819

20+
enum Options{ Remove, ShowDetails }
21+
1922
class Homepage extends State<Home>{
2023
Widget presentwidget = Container(
2124
child: const Center(
@@ -27,6 +30,71 @@ class Homepage extends State<Home>{
2730
);
2831
List<a.Interval> userintervals = [a.Interval(2, 3), a.Interval(5, 6)];
2932

33+
34+
35+
Future<void>OpenDialog()async{
36+
switch(await showDialog(
37+
context: context,
38+
builder: (BuildContext context){
39+
return SimpleDialog(
40+
backgroundColor: Color(0xFF212121),
41+
shape: RoundedRectangleBorder(
42+
borderRadius: BorderRadius.circular(10),
43+
),
44+
title: const Text(
45+
"Information about the booking",
46+
style: TextStyle(color: Colors.white, fontSize: 18),
47+
),
48+
children: <Widget>[
49+
SimpleDialogOption(
50+
onPressed: (){Navigator.pop(context,Options.ShowDetails);},
51+
child: const ListTile(
52+
leading: Icon(
53+
Icons.list,
54+
color: Colors.blue,
55+
),
56+
title: Text(
57+
"Show Details",
58+
style: TextStyle(color: Colors.white),
59+
),
60+
tileColor: Color(0xFF303030),
61+
62+
),
63+
),
64+
SimpleDialogOption(
65+
onPressed: (){Navigator.pop(context,Options.Remove);},
66+
child: ListTile(
67+
leading: const Icon(
68+
Icons.delete,
69+
color: Colors.white,
70+
),
71+
title: const Text(
72+
"Cancel Booking",
73+
style: TextStyle(color: Colors.white),
74+
),
75+
tileColor: Colors.red,
76+
shape: RoundedRectangleBorder(
77+
borderRadius: BorderRadius.circular(7),
78+
),
79+
),
80+
),
81+
],
82+
);
83+
}
84+
))
85+
{
86+
case Options.ShowDetails:
87+
// Let's go.
88+
Navigator.push(context, MaterialPageRoute(builder: (context) => const BookingDetails("11-02-2022", "2:00", "3:00")));
89+
print("show details clicked");
90+
break;
91+
case Options.Remove:
92+
// ...
93+
print("remove clicked");
94+
break;
95+
}
96+
}
97+
3098
@override
3199
Widget build(BuildContext context) {
32100
//bookings();
@@ -57,7 +125,9 @@ class Homepage extends State<Home>{
57125
borderRadius: BorderRadius.circular(10),
58126
),
59127
trailing: IconButton(
60-
onPressed: (){},
128+
onPressed: (){
129+
OpenDialog();
130+
},
61131
icon: const Icon(
62132
Icons.more_vert,
63133
color: Colors.white,

lib/landing.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class Landing extends State<TabNavigator>{
4646
backgroundColor: Colors.black,
4747
actions: <Widget>[
4848
IconButton(
49+
4950
icon: const Icon(
5051
Icons.date_range,
5152
color: Colors.blue,

0 commit comments

Comments
 (0)