Closed leoiacovini closed 4 years ago
Hey @brianegan, tks again for the feedback, we are reflecting upon your feedback and planning to make some changes to make things more explicit and idiomatic :). As soon as we have something I will let you know, just wanted to write an answer here before.
Just to get some inputs: We thought about doing something with extensions but nothing too different came to our minds... (because we would need to add static methods, and I guess extensions do not support it right now). Do you have something different in mind? The furthest I could think of was:
navigator
method on the router to retrieve the RouterNavigator
instanceTutorialRouter.of(context).navigator
I have not tested it, so I may have missed something haha.
Nah I think you're exactly right when it comes to mixins / extension methods -- after making that note I actually tried a quick experiment using both, but ran into the same problem: ya need static methods!
Overall, my goal was to see if I could reduce the number of generated classes to simplify things.
Hey @brianegan, I did some changes to the overall library API based on your feedback, my goal was mainly to simplify the overall complexity of classes/names/abstraction and reduce it to the essentials, also trying to shape up the expected usage without providing too many options to do the same thing (like you pointed out). I tried to make things more explicit and using the same set of names wherever possible. If you can take a look at the changelog changes here:
https://github.com/nubank/nuvigator/pull/20/files#diff-4ac32a78649ca5bdd8e0ba38b7006a1e I think they make a good summary of the changes.
The example was tided up a bit to make easier to understand what is going on. We are going to update this documentation PR after it. The recommended usage is to rely in the arguments provided by the Router method, or if you wish to get it down in you Widget tree, you still can call the Args*.of(context)
, other options were removed. We think this makes things more clear and explicit overall and works out as a good separation of concerns.
We also merged the Navigation*
class with the Router using extension methods, and now, things should be pretty much easier to remember and use.
Let me know if I got your point correctly with those changes =D
@leoiacovini Oh my, so sorry -- somehow missed that last request / github notification. Just left some comments on the other PR.
Woohoo! Great job :) This was much easier to use to get started -- a great improvement overall.
I've just gone through my experiment again using the new docs and took these notes, please let me know if I can provide any more info!
Navigator Documentation Walkthrough
Getting started
navigator
andbuild_runner
to pub spec, will result in error: “Could not find package "build_runner". Did you forget to add a dependency?”watch
builder
instead ofhome
! This actually tripped me up — SinceNuvigator
implements thecall
method, it kinda looks like thebuilder
is taking in any normal child rather than aTransitionBuilder
. This was the cause of a bug on my end -- I was accidentally usinghome
b/c I missed that detail!Route Argument/Parameters
context
into a WidgetinitialArguments
Map
instead ofdynamic
TutorialArgs
class does not provide atoMap
function, meaning I had to program the initialArgs by hand by looking at theparse
method.TutorialArgs
class even necessary? Seeing that you can also pass the data directly into the Widget means there are 3 ways of getting the arguments from the route?More code questions
*Navigation
be*Navigator
? E.g.TutorialNavigator
instead ofTutorialNavigation
? Then it reads likeTutorialNavigator.of(context).toSomeRoute
, which is a bit more likeNavigator.of(context)
.extension
methods or amixin
onTutorialRouter
to reduce the number of necessary classes? (after a brief experiment, this might not work that well)