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

Feature to upload user image #143

Open
infiniteoverflow opened this issue Oct 5, 2021 · 9 comments
Open

Feature to upload user image #143

infiniteoverflow opened this issue Oct 5, 2021 · 9 comments
Labels

Comments

@infiniteoverflow
Copy link
Owner

Wont it be nice if the user can upload their pic in their profile ?

We need an option in the InfoScreen to upload an image, and when submitted, the image should be stored in Firebase Storage and its public URL appended to the user details in Firebase RealtimeDB.

If the user is signing-in using Social Auth, get the image link from the Account as use it as the profile pic.

@adityathakurxd
Copy link
Collaborator

Can I take this up?

@infiniteoverflow
Copy link
Owner Author

yess @adityathakurxd you can !

@adityathakurxd
Copy link
Collaborator

I'll unassign this @infiniteoverflow 😬 This could be a good issue for someone else to take up.

@adityathakurxd adityathakurxd removed their assignment Oct 19, 2021
@Aditya-AJ-19
Copy link

@infiniteoverflow I want to take this issue but I won't find any thing regarding firebase realtime database in your project that how you store your users info in firebase data base ,so can you explain me what I have to do

@adityathakurxd
Copy link
Collaborator

The link to the Google Services Files for Firebase is available in the README: https://drive.google.com/drive/folders/161WwprL9P_mHqdln_S0Zfm2bVnQSI1Dc?usp=sharing

You might not get access to the console.

Right now the project, if you look into the Profile section, uses the first letter of the first name as Avatar for the profile. This comes from the User object by Firebase auth.

CircleAvatar(
                radius: 30,
                child: Text(
                  user.displayName.substring(0, 2).toUpperCase(),
                  style: TextStyle(
                    color: Styles.profileBar,
                  ),
                ),
                backgroundColor: Colors.white,
                //backgroundImage: AssetImage('assets/images/Reading.png'),
              ),

What I believe the steps of action here would be:

  • Add an Edit button on the profile avatar
  • User can click on the edit button to pick a file (an image) from device
  • This picked image can then be uploaded to Firebase storage and a link of it saved in a collection with uid of the user
  • If the uid of the user is available in collection, the profile avatar should display the image otherwise show the first letter of the name.

@adityathakurxd
Copy link
Collaborator

Make sure you also check the conversation on this PR: #146

@Aditya-AJ-19
Copy link

yes I get what are you trying to say. but the thing is ,in this project where's the code that's stores the user info to firebase realtime database . because I want to refer the structure of user collection so that I can make changes to update userProfileUrl. and also in firebase storage where to store image is there any perticular location?

@adityathakurxd
Copy link
Collaborator

As I mentioned, it uses the Firebase User object.

If you look at the Home Screen, you'll find:

  getuser() async { 
     User firebaseUser = _auth.currentUser; 
     await firebaseUser?.reload(); 
     firebaseUser = _auth.currentUser; 
     if (firebaseUser != null) { 
       await setState(() { 
         this.user = firebaseUser; 
         _isLoggedin = true; 
       }); 
     } 
   }

FirebaseAuth.instance.currentUser provides the current user logged into the app and some details such as name, image url, etc.

For both Realtime Database and Storage, you can using code create the required collection or bucket and save data to them.

This is again my approach. Please wait on the repository moderators to provide details.

@alam-shoaib
Copy link

is this issue still open ? i want to work on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants