Skip to content

Commit 7ca64b6

Browse files
committed
added user class and a database class and did required changes in LoginForm. COmmented(landing page)
1 parent 43882cd commit 7ca64b6

File tree

1 file changed

+72
-66
lines changed

1 file changed

+72
-66
lines changed

lib/bookingdetails.dart

Lines changed: 72 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,65 @@
11
import 'package:flutter/material.dart';
22

33
class BookingDetails extends StatelessWidget{
4-
BookingDetails(this.date, this.starttime, this.endtime, {Key? key}) : super(key: key);
4+
late List<Widget> widgetlist;
5+
6+
BookingDetails(this.date, this.starttime, this.endtime, {Key? key}) : super(key: key){
7+
widgetlist = [
8+
const ListTile(
9+
title: Center(
10+
child: Text(
11+
"Details",
12+
style: TextStyle(color: Colors.blue, fontFamily: 'Helvetica', fontSize: 22, fontWeight: FontWeight.bold),
13+
),
14+
),
15+
tileColor: Colors.black,
16+
),
17+
ListTile(
18+
leading: const Icon(
19+
Icons.calendar_today_sharp,
20+
color: Colors.blue,
21+
size: 22,
22+
),
23+
title: Text(
24+
"Date: $date",
25+
style: const TextStyle(color: Colors.white, fontFamily: 'Helvetica', fontSize: 15),
26+
),
27+
tileColor: Colors.black,
28+
),
29+
ListTile(
30+
leading: const Icon(
31+
Icons.lock_clock,
32+
color: Colors.blue,
33+
size: 22,
34+
),
35+
title: Text(
36+
"Time Slot: $starttime Hours to $endtime Hours",
37+
style: const TextStyle(color: Colors.white, fontFamily: 'Helvetica', fontSize: 15),
38+
),
39+
tileColor: Colors.black,
40+
),
41+
const ListTile(
42+
title: Center(
43+
child: Text(
44+
"Available Carpools",
45+
style: TextStyle(color: Colors.blue, fontFamily: 'Helvetica', fontSize: 22, fontWeight: FontWeight.bold),
46+
),
47+
),
48+
tileColor: Colors.black,
49+
),
50+
];
51+
}
52+
553
final String date;
654
final String starttime;
755
final String endtime;
8-
List<String> carpools = ["Ishaan Jalan", "Rudransh Dixit", "hewwo", "manda", "ramesh", "mukesh", "sukesh", "nilesh"] ;
9-
56+
List<String> carpools = ["Ishaan Jalan", "Rudransh Dixit", "hewwo", "manda", "ramesh", "mukesh", "sukesh", "nilesh"];
57+
58+
59+
1060
@override
1161
Widget build(BuildContext context) {
62+
avlblcarpools();
1263
return Scaffold(
1364
appBar: AppBar(
1465
title: Column(
@@ -62,70 +113,24 @@ class BookingDetails extends StatelessWidget{
62113
color: Colors.white,
63114
)
64115
),
65-
body: ListView(
116+
body: Scrollbar(
117+
child: ListView(
66118
scrollDirection: Axis.vertical,
67119
shrinkWrap: true,
68120
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-
],
121+
children: widgetlist,
114122
),
123+
),
115124
);
116125
}
117126

118-
Widget avlblcarpools(){
119-
Widget temp;
127+
void avlblcarpools(){
120128
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+
for(int i=0; i<carpools.length; i++){
130+
131+
String name = carpools[i];
132+
widgetlist.add(
133+
ListTile(
129134
leading: const Icon(
130135
Icons.person,
131136
color: Colors.blue,
@@ -139,21 +144,22 @@ class BookingDetails extends StatelessWidget{
139144
shape: RoundedRectangleBorder(
140145
borderRadius: BorderRadius.circular(12),
141146
),
142-
);
143-
},
144-
);
147+
),
148+
);
149+
}
145150
}
146151
else{
147-
temp = const ListTile(
148-
title: Center(
149-
child: Text(
152+
widgetlist.add(
153+
const ListTile(
154+
title: Center(
155+
child: Text(
150156
"Sorry, there are no carpools available in your time slot",
151157
style: TextStyle(color: Colors.white, fontFamily: 'Helvetica', fontSize: 15),
152158
),
153159
),
154160
tileColor: Colors.black,
161+
),
155162
);
156163
}
157-
return temp;
158164
}
159165
}

0 commit comments

Comments
 (0)