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

url paths? #20

Closed
hansbak opened this issue Jan 1, 2021 · 6 comments
Closed

url paths? #20

hansbak opened this issue Jan 1, 2021 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@hansbak
Copy link

hansbak commented Jan 1, 2021

New navigator has the ability to request certain url paths....how does this work with flow builder?

thanks for the excellent open source contributions!
Regards,
Hans

@felangel
Copy link
Owner

felangel commented Jan 6, 2021

Hi @hansbak 👋
Thanks for opening an issue!

This is something that I am currently in the process of exploring and isn't integrated into flow_builder. If you have any suggestions/ideas regarding the API/implementation I'd love to discuss them 👍

@felangel felangel self-assigned this Jan 6, 2021
@felangel felangel added the enhancement New feature or request label Jan 6, 2021
@felangel felangel added this to To do in flow_builder via automation Jan 6, 2021
@hansbak
Copy link
Author

hansbak commented Jan 13, 2021

You are so much ahead of my knowledge, at the moment i am still working on the best way implementing your Bloc combined with infinite scrolling, authorization and the best number of blocs together with the communication between them....blocs for Authorization, products,categories,orders, leads,customers suppliers etc.....All in my GrowERP project.

So now hoping you can simplify routing because version 2 is too difficult for me and web is important, therefore the paths request....

Keep up the good work, but not make things too difficult.
An example is your infinite scrolling, the doc tutorial explains a much easier to understand implementation than the example implementation.

@LucaDillenburg
Copy link

LucaDillenburg commented Feb 24, 2021

I totally agree with @hansbak . That's really important to have in order to improve the support for the web.

The way I saw other packages implementing this is by incorporating default named routes into the package (for example the vrouter package). This works, but I think it adds unnecessary parser logic and complicates things (especially for apps that are only for iOS and Android).

What I think it's a better solution though would be to add as an optional implementation for those that want either named parameters and/or web support in a way that maintains the context.flow<T>().update or context.flow<T>().complete calls the same and changed only the onGenerateRoute by adding something like a URL parser that returned the flow state data.

For example (extending from the example in the documentation):

FlowBuilder<Profile>(
  state: const Profile(),
  onGeneratePages: (profile, pages) {
    return [
      PathMaterialPage<void>(
        child: NameForm(),
        path: '/',
        stateFromPath: (Map<String, dynamic> arguments) => profile,
      ),
      if (profile.name != null) PathMaterialPage(
        child: AgeForm()
        path: '/profile/:name',
        stateFromPath: (Map<String, dynamic> arguments) => profile.copyWith(name: arguments['name']),
      ),
    ];
  },
);

ps: In this case, PathMaterialPage would extend MaterialPage, and those two attributes (path and stateFromPath) would be added to ensure that the page can be accessed by the user if it goes directly to the URL /profile/Luca for example.

I would love to hear your thoughts and please tell me if there's something I wasn't clear on.

@felangel felangel moved this from To do to In progress in flow_builder Mar 24, 2021
@felangel
Copy link
Owner

Proposal to add routing support can be found at #41.

@hansbak
Copy link
Author

hansbak commented Apr 4, 2021

Excellent @felangel , thank you very much for your good work.....very much appreciated!

@felangel
Copy link
Owner

Closing in favor of #41 👍

flow_builder automation moved this from In progress to Done Jun 29, 2021
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
Development

No branches or pull requests

3 participants