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

YaruNavigationPage initialIndex is not forwarded to NavigationRail #456

Closed
Feichtmeier opened this issue Dec 7, 2022 · 6 comments · Fixed by #457
Closed

YaruNavigationPage initialIndex is not forwarded to NavigationRail #456

Feichtmeier opened this issue Dec 7, 2022 · 6 comments · Fixed by #457
Assignees
Labels
bug Something isn't working

Comments

@Feichtmeier
Copy link
Member

Feichtmeier commented Dec 7, 2022

I know we got the controller thing now. But even if this might be an artefact or not but the initialindex is always 0

CC @d-loose @Jupi007

I need this for https://github.com/ubuntu-flutter-community/software/pull/625

@Feichtmeier Feichtmeier added the bug Something isn't working label Dec 7, 2022
@Feichtmeier Feichtmeier self-assigned this Dec 7, 2022
@Feichtmeier
Copy link
Member Author

nvm it works with
YaruPageController(length: pageItems.length, initialIndex: 3),

@Jupi007
Copy link
Member

Jupi007 commented Dec 8, 2022

Nice that it works finally :)
And sorry, because I have forgotten to look at.

@Feichtmeier
Copy link
Member Author

the initialindex can be removed with the controller

@Jupi007
Copy link
Member

Jupi007 commented Dec 8, 2022

Just had a quick look, I think we miss to pass the initialIndex to the default/fallback controller:

https://github.com/ubuntu/yaru_widgets.dart/blob/6928eaf1d6ab3d499a864b5f7605dc7004b30ef2/lib/src/layouts/yaru_navigation_page.dart#L94-L95

Should be:

_pageController = widget.controller ??
  YaruPageController(
     length: widget.length!,
     initialIndex: widget.initialIndex!,
  );

@Feichtmeier
Copy link
Member Author

it works if I do neithe ruse length nor initialIndex directly but only pass a controller which itself has length and initialindex
Maybe we should then just remove the length and initialindex as arguments and instead only use the controller?

@Jupi007
Copy link
Member

Jupi007 commented Dec 8, 2022

Well, have these arguments is really simpler, because pass a controller mean you need to store and dispose it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants