Take a look at the main.dart file below how I am dealing with the user to keep him / her login. Now to keep the user login and we have used shared preferences by which we save an int number 1 & 0 to check the user is logged in or not, this might be an old fashion trick to keep user login but I like it this way□. The Appbar contains a row of CicularAvatar and a text which displays the username and the image URL received. I have user TabView to divide the screen and display the following and followers of the user logged in. Our home screen contains all the possible information we can show to the end-user, I have made it compact so that there should be no additional screens to display or navigate to a different part. To display the snackbar I have initialized a key for Scaffold you can check out the code below to implement the snackbar. I have provided the code of the function I used to call the provider function and log the user in. Once the user has logged in the shared preferences come in existence to save the username which we will use to check the users state whether logged in or not. Form Class is used to wrap the FormTextField and the OutlineButton, I think it makes us easier to play with the validations messages and I also think it is a clean code symbol □. I have tried to keep it as simple I can so just displaying the logo and the text field to enter the username and a button while will let the end-user login. The use of each dependency will be explained while we are going through the screens and their functionalities. Dependency Usedĭon’t worry folks no need of searching all around I have provided the link to each dependency. I’ll be explaining every part in a detailed manner and also make sure you’ll not get bored while reading. We have only 2 screens third screen is a CustomDialog box which displays the details of the user.
0 Comments
Leave a Reply. |