Skip to content

Commit 5082fcb

Browse files
Added favicon and edited request page
1 parent d7321d6 commit 5082fcb

File tree

8 files changed

+112
-97
lines changed

8 files changed

+112
-97
lines changed

assets/favicon.png

6.82 KB
Loading

firebase.json

+11-5
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,26 @@
33
"source": "functions"
44
},
55
"hosting": {
6-
"site": "voluntarius",
76
"public": "build/web",
87
"ignore": [
98
"firebase.json",
109
"**/.*",
1110
"**/node_modules/**"
1211
],
13-
"rewrites": [
12+
"headers": [
1413
{
1514
"source": "**",
16-
"destination": "/index.html"
17-
},
15+
"headers": [
16+
{
17+
"key": "Cache-Control",
18+
"value": "no-cache, no-store, must-revalidate"
19+
}
20+
]
21+
}
22+
],
23+
"rewrites": [
1824
{
19-
"source": "/",
25+
"source": "**",
2026
"destination": "/index.html"
2127
}
2228
]

lib/main.dart

+19
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,28 @@ class MyApp extends StatefulWidget {
8282

8383
class _MyAppState extends State<MyApp> {
8484

85+
Location location = Location();
86+
87+
late Stream<LocationData>? locationStream;
88+
89+
@override
90+
initState() {
91+
super.initState();
92+
locationStream = location.onLocationChanged.asBroadcastStream();
93+
location.getLocation();
94+
locationStream!.listen((LocationData? l) {
95+
print("location updated ${l?.latitude} ${l?.longitude}");
96+
});
97+
}
98+
8599
Widget build(BuildContext context) {
86100
return MultiProvider(
87101
providers: [
102+
StreamProvider<LocationData>.value(
103+
initialData: LocationData.fromMap(
104+
{"latitude": 0.0, "longitude": 0.0}),
105+
value: locationStream,
106+
),
88107
StreamProvider<User?>.value(
89108
value: FirebaseAuth.instance.authStateChanges(), initialData: null),
90109
],

lib/pages/home.dart

+2-20
Original file line numberDiff line numberDiff line change
@@ -32,33 +32,20 @@ class _HomePageState extends State<HomePage> {
3232
});
3333
}
3434

35-
Location location = Location();
36-
37-
late Stream<LocationData>? locationStream;
38-
39-
@override
40-
initState() {
41-
super.initState();
42-
locationStream = location.onLocationChanged.asBroadcastStream();
43-
location.getLocation();
44-
locationStream!.listen((LocationData? l) {
45-
print("location updated ${l?.latitude} ${l?.longitude}");
46-
});
47-
}
4835

4936
@override
5037
Widget build(BuildContext context) {
5138
return Builder(builder: (context) {
5239
User? user = Provider.of<User?>(context);
5340
return Scaffold(
54-
appBar: AppBar(
41+
appBar: user != null ? AppBar(
5542
title: const Text("Voluntarius",
5643
style: TextStyle(fontSize: 40, fontWeight: FontWeight.w600)),
5744
leading: new Image(
5845
image: AssetImage('assets/whitetransparentbk.png'),
5946
height: 30,
6047
width: 50),
61-
),
48+
) : null,
6249
body: SafeArea(
6350
child: Builder(
6451
builder: (context) {
@@ -72,11 +59,6 @@ class _HomePageState extends State<HomePage> {
7259
.map((snap) => UserData.fromFirestore(snap));
7360
return MultiProvider(
7461
providers: [
75-
StreamProvider<LocationData>.value(
76-
initialData: LocationData.fromMap(
77-
{"latitude": 0.0, "longitude": 0.0}),
78-
value: locationStream,
79-
),
8062
StreamProvider<UserData>.value(
8163
initialData: UserData(
8264
id: "",

lib/pages/request.dart

+69-64
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,13 @@ class _reqFormState extends State<reqForm> {
5050
int hoursRequired = 0;
5151
int peopleRequired = 0;
5252
Location location = new Location();
53-
LocationData? locationData;
5453
DateTime selectedDate = DateTime.now();
5554
TimeOfDay selectedTime = TimeOfDay.now();
5655
GeoFirePoint? fireloc;
5756
bool dateset = false, locset = false;
5857
init() {
5958
super.initState();
60-
_setPlace(context);
59+
// _setPlace(context);
6160
selectedDate = DateTime.now();
6261
selectedTime = TimeOfDay.fromDateTime(selectedDate);
6362
}
@@ -78,6 +77,7 @@ class _reqFormState extends State<reqForm> {
7877
'December'
7978
];
8079
Widget build(BuildContext context) {
80+
LocationData locationData = Provider.of<LocationData>(context);
8181
return Form(
8282
key: _formKey,
8383
child: ListView(
@@ -91,7 +91,7 @@ class _reqFormState extends State<reqForm> {
9191
),
9292
validator: (String? value) {
9393
if (value == null || value.isEmpty) {
94-
return 'enter text';
94+
return 'Enter text';
9595
}
9696

9797
return null;
@@ -115,7 +115,7 @@ class _reqFormState extends State<reqForm> {
115115
),
116116
validator: (String? value) {
117117
if (value == null || value.isEmpty) {
118-
return 'enter text';
118+
return 'Enter text';
119119
}
120120
return null;
121121
},
@@ -134,11 +134,11 @@ class _reqFormState extends State<reqForm> {
134134
],
135135
decoration: const InputDecoration(
136136
border: OutlineInputBorder(),
137-
hintText: 'hours required',
137+
hintText: 'Hours required',
138138
),
139139
validator: (String? value) {
140140
if (value == null || value.isEmpty) {
141-
return 'enter number';
141+
return 'Enter number';
142142
}
143143
return null;
144144
},
@@ -159,7 +159,7 @@ class _reqFormState extends State<reqForm> {
159159
),
160160
validator: (String? value) {
161161
if (value == null || value.isEmpty) {
162-
return 'enter number';
162+
return 'Enter number';
163163
}
164164
return null;
165165
},
@@ -168,52 +168,58 @@ class _reqFormState extends State<reqForm> {
168168
),
169169
),
170170
Padding(
171-
padding: const EdgeInsets.all(8.0),
171+
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 16),
172172
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),
199205
),
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+
// ])),
217223
Padding(
218224
padding: const EdgeInsets.only(top: 20.0),
219225
child: Column(
@@ -223,9 +229,7 @@ class _reqFormState extends State<reqForm> {
223229
ElevatedButton(
224230
//submit
225231
onPressed: () {
226-
if (_formKey.currentState!.validate() &&
227-
dateset &&
228-
locset) {
232+
if (_formKey.currentState!.validate()) {
229233
_makeJob(context);
230234
ScaffoldMessenger.of(context).showSnackBar(
231235
const SnackBar(content: Text('Processing Data')),
@@ -238,7 +242,7 @@ class _reqFormState extends State<reqForm> {
238242
);
239243
}
240244
},
241-
child: const Text('Submit'),
245+
child: const Text('Submit Request'),
242246
),
243247
])),
244248
],
@@ -278,21 +282,22 @@ class _reqFormState extends State<reqForm> {
278282
}
279283

280284
_setPlace(BuildContext context) async {
281-
final LocationData? loc = await location.getLocation();
285+
// final LocationData? loc = await location.getLocation();
282286

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+
// }
290294
}
291295

292296
_makeJob(BuildContext context) async {
293297
User? user = Provider.of<User?>(context, listen: false);
298+
LocationData locationData = Provider.of<LocationData>(context,listen: false);
294299
final fireloc =
295-
GeoFirePoint(locationData?.latitude ?? 0, locationData?.longitude ?? 0);
300+
GeoFirePoint(locationData.latitude ?? 0, locationData.longitude ?? 0);
296301
final Job rjob = Job(
297302
id: "",
298303
title: title,

lib/pages/sign_in.dart

+2
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ class _SignInPageState extends State<SignInPage> {
104104
image: AssetImage('assets/colortransparentbk.png'),
105105
height: 75,
106106
width: 125),
107+
const Text("Voluntarius",
108+
style: TextStyle(fontSize: 40, fontWeight: FontWeight.w600)),
107109
VoluntariusTextField(
108110
"Email",
109111
controller: emailController,

web/favicon.png

5.92 KB
Loading

web/index.html

+9-8
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,19 @@
2929
<!-- Favicon -->
3030
<link rel="icon" type="image/png" href="favicon.png"/>
3131

32-
<title>voluntarius</title>
32+
<title>Voluntarius</title>
3333
<link rel="manifest" href="manifest.json">
3434
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCNsDYDw56cKNPymyLSQd737RVjR2HxVyM"></script>
3535
</head>
3636
<body>
37+
38+
<script>
39+
if ("serviceWorker" in navigator) {
40+
window.addEventListener("load", function () {
41+
navigator.serviceWorker.register("/firebase-messaging-sw.js");
42+
});
43+
}
44+
</script>
3745
<!-- This script installs service_worker.js to provide PWA functionality to
3846
application. For more information, see:
3947
https://developers.google.com/web/fundamentals/primers/service-workers -->
@@ -101,12 +109,5 @@
101109
loadMainDartJs();
102110
}
103111
</script>
104-
<script>
105-
if ("serviceWorker" in navigator) {
106-
window.addEventListener("load", function () {
107-
navigator.serviceWorker.register("/firebase-messaging-sw.js");
108-
});
109-
}
110-
</script>
111112
</body>
112113
</html>

0 commit comments

Comments
 (0)