Skip to content

Commit

Permalink
Merge pull request #101 from praveenkrishna0512/app-icon
Browse files Browse the repository at this point in the history
null error, profile page bugs
  • Loading branch information
summerthia02 authored Jul 26, 2022
2 parents 83bb47c + d66729b commit 6583435
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 40 deletions.
5 changes: 1 addition & 4 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ final navigatorKey = GlobalKey<NavigatorState>();

class MyApp extends StatelessWidget {
MyApp({Key? key}) : super(key: key);
final currUserEmail = FirebaseAuth.instance.currentUser?.email;

@override
Widget build(BuildContext context) {
Expand All @@ -49,9 +48,7 @@ class MyApp extends StatelessWidget {
'/feed': (_) => const FeedPage(),
'/chat': (_) => const ChatPage(),
'/addlisting': (_) => const AddListingPage(),
'/profile': (_) => ProfilePage(
email: currUserEmail,
),

'/favourites': (_) => Favourites(),
'/reviews': (_) => MakeReviewPage(
reviewForId: '',
Expand Down
1 change: 1 addition & 0 deletions lib/models/enlarged_listing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ class _EnlargedScreenState extends State<EnlargedScreen> {
listingId: listingId,
madeOffer: madeOffer,
acceptedOffer: acceptedOffer);

ChatProvider.handleChatRequest(chatItem);
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => ChatItemPage(
Expand Down
8 changes: 0 additions & 8 deletions lib/models/like_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@ import 'dart:ffi';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:justsharelah_v1/firebase/auth_provider.dart';
import 'package:justsharelah_v1/firebase/firestore_methods.dart';
import 'package:justsharelah_v1/models/profile_widget.dart';
import 'package:justsharelah_v1/models/user_data.dart';
import 'package:justsharelah_v1/pages/edit_listing.dart';
import 'package:justsharelah_v1/provider/user_provider.dart';
import 'package:justsharelah_v1/utils/time_helper.dart';
import 'package:justsharelah_v1/widget/like_helper.dart';

import '../pages/profile_page.dart';
import '../utils/const_templates.dart';
Expand Down
13 changes: 7 additions & 6 deletions lib/pages/edit_listing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ import 'package:justsharelah_v1/firebase/user_data_service.dart';
import 'package:justsharelah_v1/models/share_creds.dart';

import 'package:justsharelah_v1/models/user_data.dart';
import 'package:justsharelah_v1/utils/const_templates.dart';
import 'package:justsharelah_v1/pages/profile_page.dart';
import 'package:justsharelah_v1/utils/const_templates.dart';
import 'package:justsharelah_v1/utils/appbar.dart';
import 'package:justsharelah_v1/utils/bottom_nav_bar.dart';
import 'package:justsharelah_v1/utils/image_picker.dart';
import 'package:justsharelah_v1/utils/profile_image.dart';

class EditListingPage extends StatefulWidget {
const EditListingPage({Key? key, required this.snap}) : super(key: key);
Expand Down Expand Up @@ -189,12 +186,16 @@ class _EditListingPageState extends State<EditListingPage> {
),
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
buildButtonField("CANCEL", Colors.red, 20.0, () {
Navigator.pushReplacementNamed(context, "/profile");
Navigator.pop(context);
}),
const SizedBox(width: 60),
buildButtonField("SAVE", Colors.green, 20.0, () {
_editListing(widget.snap["uid"]);
Navigator.pushReplacementNamed(context, "/profile");
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ProfilePage(email: userEmail),
));
}),
]),
]),
Expand Down
7 changes: 1 addition & 6 deletions lib/pages/edit_profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@ import 'dart:typed_data';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/framework.dart';

import 'package:image_picker/image_picker.dart';
import 'package:justsharelah_v1/firebase/storage_methods.dart';
import 'package:justsharelah_v1/firebase/user_data_service.dart';

import 'package:justsharelah_v1/models/user_data.dart';
import 'package:justsharelah_v1/utils/const_templates.dart';
import 'package:justsharelah_v1/pages/profile_page.dart';
import 'package:justsharelah_v1/utils/appbar.dart';
import 'package:justsharelah_v1/utils/bottom_nav_bar.dart';
import 'package:justsharelah_v1/utils/image_picker.dart';
import 'package:justsharelah_v1/utils/profile_image.dart';

class EditProfilePage extends StatefulWidget {
const EditProfilePage({Key? key}) : super(key: key);
Expand Down
14 changes: 12 additions & 2 deletions lib/pages/login_page.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import 'dart:io';

import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:justsharelah_v1/firebase/auth_provider.dart';
import 'package:justsharelah_v1/firebase/auth_service.dart';
import 'package:justsharelah_v1/pages/profile_page.dart';
import 'package:justsharelah_v1/utils/const_templates.dart';
import 'package:justsharelah_v1/main.dart';

Expand Down Expand Up @@ -65,7 +68,7 @@ class _LoginPageState extends State<LoginPage> {
Container(
width: double.infinity,
height: double.infinity,
decoration: BoxDecoration(
decoration: const BoxDecoration(
image: DecorationImage(
image: NetworkImage(
'https://i.pinimg.com/564x/81/68/77/8168774f8b714d65417e7615aac3f361.jpg'),
Expand Down Expand Up @@ -134,7 +137,14 @@ class _LoginPageState extends State<LoginPage> {
? null
: () async {
_signIn();
Navigator.pushReplacementNamed(context, "/feed");
sleep(const Duration(seconds: 2));

Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ProfilePage(
email: _emailController.text),
));
},
child: _isLoading
? const Center(
Expand Down
5 changes: 1 addition & 4 deletions lib/pages/profile_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ import 'package:justsharelah_v1/models/ForBorrowing.dart';
import 'package:justsharelah_v1/models/ForRenting.dart';
import 'package:justsharelah_v1/models/user_data.dart';
import 'package:justsharelah_v1/utils/const_templates.dart';
import 'package:justsharelah_v1/utils/image_picker.dart';
import 'package:justsharelah_v1/utils/profile_image.dart';
import 'sharecredits.dart';

class ProfilePage extends StatefulWidget {
ProfilePage({Key? key, required this.email}) : super(key: key);
Expand Down Expand Up @@ -82,7 +79,7 @@ class _ProfilePageState extends State<ProfilePage> {
try {
var snap = await FirebaseFirestore.instance
.collection("Users")
.doc(currentUser?.uid)
.doc(currentUser!.uid)
.get();
profileData = snap.data()!;
setState(() {});
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/review_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class _MakeReviewPageState extends State<MakeReviewPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppBar()
.buildAppBar(const Text("Leave A Review"), context, '/profile'),
.buildAppBar(const Text("Leave A Review"), context, '/feed'),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
Expand Down
15 changes: 14 additions & 1 deletion lib/pages/sharecredits.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:justsharelah_v1/firebase/firestore_methods.dart';
import 'package:justsharelah_v1/pages/profile_page.dart';
import 'package:justsharelah_v1/utils/appbar.dart';
import 'package:justsharelah_v1/utils/const_templates.dart';

Expand All @@ -28,6 +29,7 @@ class ShareCreditsScreenState extends State<ShareCreditsScreen> {
String currSC = "";
int currIntSC = 0;
String currUserId = FirebaseAuth.instance.currentUser!.uid;
String? currUserEmail = FirebaseAuth.instance.currentUser!.email;
bool hasSCUpdated = false;

// get curr users' sharecredits
Expand Down Expand Up @@ -164,7 +166,12 @@ class ShareCreditsScreenState extends State<ShareCreditsScreen> {
if (hasSCUpdated == false) {
await updateShareCredits();
}
Navigator.pushReplacementNamed(context, "/profile");
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
ProfilePage(email: currUserEmail),
));
})
: buildButtonField(
"I'll EARN IT BACK, Thanks!", Colors.green, 20, () async {
Expand All @@ -174,6 +181,12 @@ class ShareCreditsScreenState extends State<ShareCreditsScreen> {
Navigator.pop(context);
} else {
Navigator.pushReplacementNamed(context, "/profile");
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
ProfilePage(email: currUserEmail),
));
}
})
: Container(),
Expand Down
26 changes: 18 additions & 8 deletions lib/utils/bottom_nav_bar.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:justsharelah_v1/pages/addListing.dart';
import 'package:justsharelah_v1/pages/chat_page.dart';
import 'package:justsharelah_v1/pages/favourites.dart';
import 'package:justsharelah_v1/pages/feed_page.dart';
import 'package:justsharelah_v1/pages/profile_page.dart';

class MyBottomNavBar {
List<String> widgetPages = <String>[
"/feed",
"/chat",
"/addlisting",
"/favourites",
"/profile",
List widgetPages = [
const FeedPage(),
const ChatPage(),
const AddListingPage(),
Favourites(),
ProfilePage(email: FirebaseAuth.instance.currentUser!.email),
];

BottomNavigationBar buildBottomNavBar(BuildContext context) {
Expand Down Expand Up @@ -52,8 +58,12 @@ class MyBottomNavBar {
),
],
onTap: (index) {
String selectedRoute = widgetPages.elementAt(index);
Navigator.of(context).pushNamed(selectedRoute);
dynamic selectedRoute = widgetPages.elementAt(index);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => selectedRoute,
));
},
);
}
Expand Down

0 comments on commit 6583435

Please sign in to comment.