Skip to content

TabBarView to take a IndexedWidgetBuilder, as alternative to list of children #13416

Closed

Description

@j4k0bk

I want to make an "infinite" TabBarView, but it is impossible with the children attribute (setting childCount unrealistic high could simulate this).

A solution could be to have TabBarView take an IndexedWidgetBuilder as argument as an alternative to the children attribute, and build children when needed.

Activity

  1. Hixie commented on Dec 7, 2017

    @Hixie
    Contributor

    This is probably a use case that is contrary to the material design guidelines, so it's not something I would expect Flutter to support in the near term (if ever).

    However, you can totally implement that in your app if you want. I would recommend starting by cloning the tabs.dart file into your project, so that you can adjust the relevant classes as you desire.

  2. Hixie commented on Dec 7, 2017

    @Hixie
    Contributor

    (Specifically, the material UI guidelines encourage as few tabs as possible.)

  3. j4k0bk commented on Dec 8, 2017

    @j4k0bk
    Author

    A use case for this could be a calendar view, where the user swipes back and forth between weeks/months/years. Or any use case basically where the content is dynamically generated would need an indexed build callback.

    Btw. this has nothing to do with tabs - i am only refering to the TabBarView which, according to Flutters own docs, is only "Typically used in conjunction with a TabBar."

  4. j4k0bk commented on Dec 8, 2017

    @j4k0bk
    Author

    My current hack to achieve this is to extend ListBase and override the [] operator, and within it call an IndexedWidgetBuilder.

  5. Kripner commented on Mar 20, 2018

    @Kripner

    @j4k0bk Neat. I've tried implementing it and it doesn't seem to work. Could you please share your code?

  6. Kripner commented on Mar 20, 2018

    @Kripner

    My best solution involves picking some large number and passing it to the tab controller & tab bar view. Does your solution avoid that?

  7. Hixie commented on Jun 17, 2018

    @Hixie
    Contributor

    I'm going to close this based on my comments above.

  8. github-actions commented on Sep 3, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  9. locked as resolved and limited conversation to collaborators on Sep 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions