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
Yaru layout index controller #414
Yaru layout index controller #414
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming idea: YaruPageController
🙂
Naming things is always the hardest part :D |
I wish |
Breaking software is not the problem |
Sorry for repeatedly hijacking random PRs. 🙂 Let's continue the discussion here: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my head hearts with all these layouts, indexes, controllers, and listeners but i think it looks good now 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that we always have a controller instance, we could let AnimatedBuilder
take care of rebuilds:
AnimatedBuilder(
animation: _pageController,
builder: (context, child) => YaruFooBarPageOrLayout(
index: _pageController.index
),
),
this way, we could get rid of the manual add/removeListener()
and setState()
calls.
Despite the name, AnimatedBuilder is not limited to Animations. Any subtype of Listenable (such as ChangeNotifier and ValueNotifier) can be used with an AnimatedBuilder to rebuild only certain parts of a widget when the Listenable notifies its listeners. This technique is a performance improvement that allows rebuilding only specific widgets leaving others untouched.
Do we want to keep |
We should be free to change |
Maybe there are situations where you wouldn't want the layout to change, but I guess this can be controlled by setting the breakpoint to zero or infinity. |
Is this good to go as it is now? We could leave using |
Yes, should be good to go - let's do it in a separate PR. There are still some things to consider with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, sounds good! LGTM 👍
Thanks for working on this and sorry it got more laborious than anticipated... :)
Better to do it right than deal with annoying issues later - thanks again for the feedback! |
WIP
Adds
YaruLayoutIndexController
YaruPageController
that controlsYaruMasterDetailPage
YaruLandscapeLayout
YaruPortraitLayout
YaruCompactLayout
Pull request checklist
flutter test --update-goldens
and committed the changes if there were any, or