gskinnerTeam / flutter-routed-widget-switcher

Declaratively switch child widgets based on the current `Router` location.

Home Page:https://pub.dev/packages/routed_widget_switcher

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

the example doesn't seem to work

csells opened this issue · comments

when I build and run it, I can an error:

image

commented

This is as intended!

This example shows that the SideBar switches between the 3 types of sub-menu. To test, hit the num-keys from 1-9 and you'll see that the side menu changes when it hits certain paths. Your default error screen is enough for me to see the current path, which is all I need for testing. I just use GoRouter for it's go call really, so I can drive location changes with keyboard. I'm assuming that if I set up 9 matching routes that GR would show them :)

It adds a bunch of boilerplate to implement the 9 matching routes, and at that point I'd be testing GoRouter anyways, not the switcher so I figured I'd just leave them out.

commented

Maybe I should at least add some instructions so it's clear how to drive the demo. I wanted to avoid a ton of boilerplate layout or menu code that obfuscates the actual usage.

You intended the dev to run the app and see an error directing them back to the home page, which is what caused the error in the first place? All with no instructions? That's one way to go... : )

I don't understand why there is no home screen with instructions, but perhaps instructions in the error screen at least? go_router makes that pretty easy: https://gorouter.dev/declarative-routing#error-handling : )

commented

I was going to implement my own error screen, but then I just thought I would show off your nice new default error widget and save a bunch of boilerplate :D

Anyways, feedback heard! I tweaked the demo to add some instructions, and in a way that only adds about 15 lines or so to the example:

ZnWrFHA9YO.1.mp4
commented

Well, I went ahead and I got a little carried away with the demo, it now implements 4 different routers to show that it can work with any Nav2 solution:

uynM4qBfGT.mp4