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

Authentication state #1

Closed
aniltc-rails opened this issue Apr 14, 2019 · 5 comments
Closed

Authentication state #1

aniltc-rails opened this issue Apr 14, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@aniltc-rails
Copy link

Can you publish or explain how to maintain login state through out application/widgets and when we click logout it should be reset (should clear token). Is it possible ?

if we have multiple dynamic text boxes ( let us say (name1 & name 2),
here name 1 is a textbox
and name 2 is a textbox and We will have a button to add more textbox group. if we click another name1 and name2 will be displayed. Its a multiform. How to handle this situation.

Thanks

@frideosapps
Copy link
Owner

Hello @aniltc-rails, for the first question, the simplest solution is to have a singleton class where you store the state of your app, and creating methods ad hoc for login and logout. You could make the instance of this class global or use an InheritedWidget (I think it is a better solution) so that in this way all the widgets on the tree can access to the same source of data. You can find this architecture in my trivia example, where I have an AppState class for the state of the app and a TriviaBloc for the business logic of the game.

For the second question it is not easy to explain without writing a specific example but it's a good argument for writing an article about it, so I think I'll write something as I have a little free time.

@aniltc-rails
Copy link
Author

aniltc-rails commented Apr 18, 2019

Thanks for your reply
The second question, I have done using set state but now I am moving to bloc pattern. You can see my sample code here https://stackoverflow.com/questions/55727876/managing-dynamic-form-using-bloc

@frideosapps
Copy link
Owner

Hello @aniltc-rails, I've just wrote a little example, you can find it in this branch: https://github.com/frideosapps/frideos_examples/tree/dynamic_form_fields.

@aniltc-rails
Copy link
Author

aniltc-rails commented Apr 18, 2019

Great , Will check examples.

---Missing Delete option & submit button. But its looking good

@frideosapps
Copy link
Owner

frideosapps commented Apr 19, 2019

Hello, the submit button is the one the top of the screen showing "Valid" or "Form not valid" text and calling the "someActions" method on the BLoC class, but it does nothing more the showing a print on the debug console. The delete option is missing, check out this repo in the next days cause I'm planning to make a thorough refactoring of the app and I'll add this feature too. I'm going to close this issue and pin it for the other users asking for the same thing. Feel free to reopen it or a new one.

@frideosapps frideosapps pinned this issue Apr 19, 2019
@frideosapps frideosapps added the enhancement New feature or request label Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants