Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated UI and singleton services #45

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"flutterMode": "release"
},
{
"name": "Flutter (Chrome)",
"name": "dev debug mode",
"program": "lib/main.dart",
"deviceId": "chrome",
"request": "launch",
Expand Down
129 changes: 0 additions & 129 deletions lib/authentication/auth.dart

This file was deleted.

7 changes: 0 additions & 7 deletions lib/authentication/user.dart

This file was deleted.

38 changes: 0 additions & 38 deletions lib/data/item.dart

This file was deleted.

9 changes: 5 additions & 4 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:lost_found_steelhacks/authentication/auth.dart';
import 'package:lost_found_steelhacks/authentication/wrapper.dart';
import 'package:lost_found_steelhacks/pages/home_page.dart';
import 'package:lost_found_steelhacks/services/auth.dart';
import 'package:lost_found_steelhacks/routing/wrapper.dart';
import 'package:lost_found_steelhacks/pages/login_page.dart';
import 'package:lost_found_steelhacks/pages/map_page.dart';
import 'package:lost_found_steelhacks/themes/app_theme.dart';
import 'package:lost_found_steelhacks/themes/theme_manager.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -35,6 +35,7 @@ class MyApp extends StatefulWidget {
}

class _MyAppState extends State<MyApp> {

@override
void dispose() {
themeManager.removeListener(themeListener);
Expand Down Expand Up @@ -66,7 +67,7 @@ class _MyAppState extends State<MyApp> {
debugShowCheckedModeBanner: false,
routes: {
'loginPage': (context) => const LoginPage(),
'mapPage': (context) => const MapPage(),
'mapPage': (context) => const HomePage(),
'/': (context) => const Wrapper()
},
initialRoute: '/',
Expand Down
27 changes: 27 additions & 0 deletions lib/models/app_user.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// ignore_for_file: slash_for_doc_comments

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';


/**
* Data model for User document in Firestore
*/
class AppUser {
final String uid;
final String email;
final String firstName;
final String lastName;
final GeoPoint location;

AppUser(
{required this.uid,
required this.email,
required this.firstName,
required this.lastName,
required this.location});

LatLng getLatLng() {
return LatLng(location.latitude, location.longitude);
}
}
56 changes: 56 additions & 0 deletions lib/models/item.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// ignore_for_file: slash_for_doc_comments

import 'package:cloud_firestore/cloud_firestore.dart';

/**
* Data model for Item document in Firestore
*/
class Item {
String id;
final String userId;
final Timestamp? timeCreated;
final String? itemName;
final String? description;
final num? phone;
final String? picture;
final GeoPoint? location;

Item(
{
this.id = "",
required this.userId,
this.timeCreated,
this.itemName,
this.description,
this.phone,
this.picture,
this.location});

factory Item.fromFirestore(
QueryDocumentSnapshot snapshot,
SnapshotOptions? options,
) {
Map<String, dynamic> data = snapshot.data() as Map<String, dynamic>;

return Item(
id: snapshot.id,
userId: data['userId'],
itemName: data['itemName'],
description: data['description'],
location: data['location'],
phone: data['phone'],
picture: data['picture'] is int ? '' : data['picture']); //because some pictures entries are of numbers
}

Map<String, dynamic> toFirestore() {
return {
'userId': userId,
'timeCreated': timeCreated,
'description': description,
'itemName': itemName,
'location': location,
'phone': phone,
'picture': picture
};
}
}
Loading