@@ -3,6 +3,7 @@ import 'package:carpool/user.dart';
33import 'package:carpool/LoginForm.dart' ;
44import 'package:interval_tree/interval_tree.dart' as a;
55import 'package:intl/intl.dart' ;
6+ import 'package:carpool/bookingdetails.dart' ;
67
78class 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+
1922class 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,
0 commit comments