11import 'package:flutter/material.dart' ;
22
33class BookingDetails extends StatelessWidget {
4- const BookingDetails (this .date, this .starttime, this .endtime, {Key ? key}) : super (key: key);
4+ BookingDetails (this .date, this .starttime, this .endtime, {Key ? key}) : super (key: key);
55 final String date;
66 final String starttime;
77 final String endtime;
8+ List <String > carpools = ["Ishaan Jalan" , "Rudransh Dixit" , "hewwo" , "manda" , "ramesh" , "mukesh" , "sukesh" , "nilesh" ] ;
89
910 @override
1011 Widget build (BuildContext context) {
@@ -32,7 +33,7 @@ class BookingDetails extends StatelessWidget{
3233 ),
3334 heroTag: "button1" ,
3435 onPressed: (){
35- // TODO: Add Navigator pop
36+ Navigator . pop (context);
3637 },
3738 backgroundColor: Colors .black,
3839 child: Row (
@@ -61,8 +62,98 @@ class BookingDetails extends StatelessWidget{
6162 color: Colors .white,
6263 )
6364 ),
64- // body:
65+ body: ListView (
66+ scrollDirection: Axis .vertical,
67+ shrinkWrap: true ,
68+ padding: EdgeInsets .all (5 ),
69+ children: < Widget > [
70+ const ListTile (
71+ title: Center (
72+ child: Text (
73+ "Details" ,
74+ style: TextStyle (color: Colors .blue, fontFamily: 'Helvetica' , fontSize: 22 , fontWeight: FontWeight .bold),
75+ ),
76+ ),
77+ tileColor: Colors .black,
78+ ),
79+ ListTile (
80+ leading: const Icon (
81+ Icons .calendar_today_sharp,
82+ color: Colors .blue,
83+ size: 22 ,
84+ ),
85+ title: Text (
86+ "Date: $date " ,
87+ style: const TextStyle (color: Colors .white, fontFamily: 'Helvetica' , fontSize: 15 ),
88+ ),
89+ tileColor: Colors .black,
90+ ),
91+ ListTile (
92+ leading: const Icon (
93+ Icons .lock_clock,
94+ color: Colors .blue,
95+ size: 22 ,
96+ ),
97+ title: Text (
98+ "Time Slot: $starttime Hours to $endtime Hours" ,
99+ style: const TextStyle (color: Colors .white, fontFamily: 'Helvetica' , fontSize: 15 ),
100+ ),
101+ tileColor: Colors .black,
102+ ),
103+ const ListTile (
104+ title: Center (
105+ child: Text (
106+ "Available Carpools" ,
107+ style: TextStyle (color: Colors .blue, fontFamily: 'Helvetica' , fontSize: 22 , fontWeight: FontWeight .bold),
108+ ),
109+ ),
110+ tileColor: Colors .black,
111+ ),
112+ avlblcarpools (),
113+ ],
114+ ),
65115 );
66116 }
67-
117+
118+ Widget avlblcarpools (){
119+ Widget temp;
120+ if (carpools.length!= 0 ){
121+ temp = ListView .builder (
122+ scrollDirection: Axis .vertical,
123+ shrinkWrap: true ,
124+ padding: const EdgeInsets .all (5 ),
125+ itemCount: carpools.length,
126+ itemBuilder: (BuildContext context, int index) {
127+ String name = carpools[index];
128+ return ListTile (
129+ leading: const Icon (
130+ Icons .person,
131+ color: Colors .blue,
132+ size: 22 ,
133+ ),
134+ title: Text (
135+ name,
136+ style: const TextStyle (color: Colors .white, fontFamily: 'Helvetica' , fontSize: 15 ),
137+ ),
138+ tileColor: Colors .black,
139+ shape: RoundedRectangleBorder (
140+ borderRadius: BorderRadius .circular (12 ),
141+ ),
142+ );
143+ },
144+ );
145+ }
146+ else {
147+ temp = const ListTile (
148+ title: Center (
149+ child: Text (
150+ "Sorry, there are no carpools available in your time slot" ,
151+ style: TextStyle (color: Colors .white, fontFamily: 'Helvetica' , fontSize: 15 ),
152+ ),
153+ ),
154+ tileColor: Colors .black,
155+ );
156+ }
157+ return temp;
158+ }
68159}
0 commit comments