@@ -50,14 +50,13 @@ class _reqFormState extends State<reqForm> {
50
50
int hoursRequired = 0 ;
51
51
int peopleRequired = 0 ;
52
52
Location location = new Location ();
53
- LocationData ? locationData;
54
53
DateTime selectedDate = DateTime .now ();
55
54
TimeOfDay selectedTime = TimeOfDay .now ();
56
55
GeoFirePoint ? fireloc;
57
56
bool dateset = false , locset = false ;
58
57
init () {
59
58
super .initState ();
60
- _setPlace (context);
59
+ // _setPlace(context);
61
60
selectedDate = DateTime .now ();
62
61
selectedTime = TimeOfDay .fromDateTime (selectedDate);
63
62
}
@@ -78,6 +77,7 @@ class _reqFormState extends State<reqForm> {
78
77
'December'
79
78
];
80
79
Widget build (BuildContext context) {
80
+ LocationData locationData = Provider .of <LocationData >(context);
81
81
return Form (
82
82
key: _formKey,
83
83
child: ListView (
@@ -91,7 +91,7 @@ class _reqFormState extends State<reqForm> {
91
91
),
92
92
validator: (String ? value) {
93
93
if (value == null || value.isEmpty) {
94
- return 'enter text' ;
94
+ return 'Enter text' ;
95
95
}
96
96
97
97
return null ;
@@ -115,7 +115,7 @@ class _reqFormState extends State<reqForm> {
115
115
),
116
116
validator: (String ? value) {
117
117
if (value == null || value.isEmpty) {
118
- return 'enter text' ;
118
+ return 'Enter text' ;
119
119
}
120
120
return null ;
121
121
},
@@ -134,11 +134,11 @@ class _reqFormState extends State<reqForm> {
134
134
],
135
135
decoration: const InputDecoration (
136
136
border: OutlineInputBorder (),
137
- hintText: 'hours required' ,
137
+ hintText: 'Hours required' ,
138
138
),
139
139
validator: (String ? value) {
140
140
if (value == null || value.isEmpty) {
141
- return 'enter number' ;
141
+ return 'Enter number' ;
142
142
}
143
143
return null ;
144
144
},
@@ -159,7 +159,7 @@ class _reqFormState extends State<reqForm> {
159
159
),
160
160
validator: (String ? value) {
161
161
if (value == null || value.isEmpty) {
162
- return 'enter number' ;
162
+ return 'Enter number' ;
163
163
}
164
164
return null ;
165
165
},
@@ -168,52 +168,58 @@ class _reqFormState extends State<reqForm> {
168
168
),
169
169
),
170
170
Padding (
171
- padding: const EdgeInsets .all ( 8.0 ),
171
+ padding: const EdgeInsets .symmetric (horizontal : 8 , vertical : 16 ),
172
172
child: Column (
173
- mainAxisSize: MainAxisSize .min,
174
- crossAxisAlignment: CrossAxisAlignment .start,
175
- children: [
176
- Row (children: [
177
- Text ("Event Date: " ),
178
- SizedBox (
179
- width: 150 ,
180
- child: InkWell (
181
- child: Center (
182
- child: Text (
183
- '${DateFormat .yMMMMd ('en_US' ).format (selectedDate )}' ),
184
- ),
185
- onTap: () => _selectDate (context),
186
- ),
187
- ),
188
- SizedBox (
189
- width: 100 ,
190
- child: InkWell (
191
- child: Center (
192
- child: Text (
193
- '${DateFormat .jm ().format (selectedDate )}' )),
194
- onTap: () => _selectTime (context),
195
- ),
196
- ),
197
- ], mainAxisAlignment: MainAxisAlignment .center),
198
- ]),
173
+ crossAxisAlignment: CrossAxisAlignment .start,
174
+ children: [
175
+ Text ("Approx. Date and Time: " , style: TextStyle (fontSize: 18 ),),
176
+ Row (children: [
177
+ Container (
178
+ decoration: BoxDecoration (
179
+ border: Border .all (color: Colors .grey, width: 1.0 ),
180
+ borderRadius: BorderRadius .circular (5.0 ),
181
+ ),
182
+ padding: const EdgeInsets .symmetric (horizontal: 10 , vertical: 16 ),
183
+ child: InkWell (
184
+ child: Text (
185
+ '${DateFormat .yMMMMd ('en_US' ).format (selectedDate )}' , style: TextStyle (fontSize: 18 ),),
186
+ onTap: () => _selectDate (context),
187
+ ),
188
+ ),
189
+ Container (width: 30 ),
190
+ Container (
191
+ decoration: BoxDecoration (
192
+ border: Border .all (color: Colors .grey, width: 1.0 ),
193
+ borderRadius: BorderRadius .circular (5.0 ),
194
+ ),
195
+ padding: const EdgeInsets .symmetric (horizontal: 10 , vertical: 16 ),
196
+ child: InkWell (
197
+ child: Center (
198
+ child: Text (
199
+ '${DateFormat .jm ().format (selectedDate )}' , style: TextStyle (fontSize: 18 ),)),
200
+ onTap: () => _selectTime (context),
201
+ ),
202
+ ),
203
+ ],)
204
+ ], mainAxisAlignment: MainAxisAlignment .center),
199
205
),
200
- Padding (
201
- padding: const EdgeInsets .only (top: 20.0 ),
202
- child: Column (
203
- mainAxisSize: MainAxisSize .min,
204
- crossAxisAlignment: CrossAxisAlignment .center,
205
- children: [
206
- ElevatedButton (
207
- onPressed: () {
208
- //in the future set location with map view
209
- _setPlace (context);
210
- print ("set loc" );
211
- },
212
- child: Text ("set location" ),
213
- ),
214
- Text (
215
- "location: ${locationData ?.longitude ?? 0 },${locationData ?.latitude ?? 0 }!" ),
216
- ])),
206
+ // Padding(
207
+ // padding: const EdgeInsets.only(top: 20.0),
208
+ // child: Column(
209
+ // mainAxisSize: MainAxisSize.min,
210
+ // crossAxisAlignment: CrossAxisAlignment.center,
211
+ // children: [
212
+ // ElevatedButton(
213
+ // onPressed: () {
214
+ // //in the future set location with map view
215
+ // _setPlace(context);
216
+ // print("set loc");
217
+ // },
218
+ // child: Text("set location"),
219
+ // ),
220
+ // Text(
221
+ // "location: ${locationData?.longitude ?? 0},${locationData?.latitude ?? 0}!"),
222
+ // ])),
217
223
Padding (
218
224
padding: const EdgeInsets .only (top: 20.0 ),
219
225
child: Column (
@@ -223,9 +229,7 @@ class _reqFormState extends State<reqForm> {
223
229
ElevatedButton (
224
230
//submit
225
231
onPressed: () {
226
- if (_formKey.currentState! .validate () &&
227
- dateset &&
228
- locset) {
232
+ if (_formKey.currentState! .validate ()) {
229
233
_makeJob (context);
230
234
ScaffoldMessenger .of (context).showSnackBar (
231
235
const SnackBar (content: Text ('Processing Data' )),
@@ -238,7 +242,7 @@ class _reqFormState extends State<reqForm> {
238
242
);
239
243
}
240
244
},
241
- child: const Text ('Submit' ),
245
+ child: const Text ('Submit Request ' ),
242
246
),
243
247
])),
244
248
],
@@ -278,21 +282,22 @@ class _reqFormState extends State<reqForm> {
278
282
}
279
283
280
284
_setPlace (BuildContext context) async {
281
- final LocationData ? loc = await location.getLocation ();
285
+ // final LocationData? loc = await location.getLocation();
282
286
283
- print ('longitude:${loc !.longitude }' );
284
- if (loc != null && locationData != loc) {
285
- setState (() {
286
- locationData = loc;
287
- locset = true ;
288
- });
289
- }
287
+ // print('longitude:${loc!.longitude}');
288
+ // if (loc != null && locationData != loc) {
289
+ // setState(() {
290
+ // locationData = loc;
291
+ // locset = true;
292
+ // });
293
+ // }
290
294
}
291
295
292
296
_makeJob (BuildContext context) async {
293
297
User ? user = Provider .of <User ?>(context, listen: false );
298
+ LocationData locationData = Provider .of <LocationData >(context,listen: false );
294
299
final fireloc =
295
- GeoFirePoint (locationData? .latitude ?? 0 , locationData? .longitude ?? 0 );
300
+ GeoFirePoint (locationData.latitude ?? 0 , locationData.longitude ?? 0 );
296
301
final Job rjob = Job (
297
302
id: "" ,
298
303
title: title,
0 commit comments