Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Edson Bueno
    @EdsonBueno
    I tried to explain that here
    It's below the code block
    In your case, as you have several items above the paginated list, maybe it'll be easier to use a SliverList instead of multiple Columns
    Abhinav Marwaha
    @abhinavmarwaha
    How to initialize something before the items are fetched for the first time ? I have to initialize the API object.
    Edson Bueno
    @EdsonBueno

    If I understood you correctly, you have at least two options:

    1. Initialize it inside your DataSource's constructor

      DataSource() : super(0) {
       // Initialize API object.
      }
    2. You can receive it from the enclosing class

      DataSource(APIObject api) : super(0) {
      }
    Flo Garibal
    @flo.garibal_gitlab

    I am really sorry to ask for help again but I cannot figure how to get PageSliverList running correctly
    I tried to replace my Columns by sliver list to have a widget tree like the following one:

    CustomScrollView
            - SliverToBoxAdapter(X)
            - SliverToBoxAdapter(Y)
            - SliverList
                 - SliverChildListDelegate
                      - X
                      - Y
                     - Column
                          - X
                          - Y
                          - PagedListView

    I tried to replace the last instance of Column but it gets even worse
    And I get the following error, I do not have any padding thus I do not understand this problem

    The following assertion was thrown building PagedSliverBuilder<int, Transfer>(state:
    _PagedSliverBuilderState<int, Transfer>#f734f):
    A RenderConstrainedBox expected a child of type RenderBox but received a child of type
    RenderSliverPadding.
    RenderObjects expect specific types of children because they coordinate with their children during
    layout and paint. For example, a RenderSliver cannot be the child of a RenderBox because a
    RenderSliver does not understand the RenderBox layout protocol.
    The RenderConstrainedBox that expected a RenderBox child was created by:
      ConstrainedBox ← Container ← Column ← PiggyBankHistory ← RepaintBoundary ← IndexedSemantics ←
      NotificationListener<KeepAliveNotification> ← KeepAlive ← AutomaticKeepAlive ← KeyedSubtree ←
      SliverList ← Viewport ← ⋯
    The RenderSliverPadding that did not match the expected child type was created by:
      SliverPadding ← PagedSliverBuilder<int, Transfer> ← PagedSliverList<int, Transfer> ←
      ConstrainedBox ← Container ← Column ← PiggyBankHistory ← RepaintBoundary ← IndexedSemantics ←
      NotificationListener<KeepAliveNotification> ← KeepAlive ← AutomaticKeepAlive ← ⋯
    The relevant error-causing widget was:
      PagedSliverList<int, Transfer>
    Edson Bueno
    @EdsonBueno
    You shouldn't use PagedListView
    You should be using PagedSliverlist
    It's another class from the package
    Flo Garibal
    @flo.garibal_gitlab
    Yes that's a msitake in explaining my problem
    I used PagedSliverList
    Edson Bueno
    @EdsonBueno
    Can you move the PagedSliverList out of the SliverList?
    I mean, using your PagedSliverList as a direct child of CustomScrollView
    Flo Garibal
    @flo.garibal_gitlab
    I might be able
    I will try now!
    Thanks again a lot !
    In fact no I can't as just several items were paginated
    Edson Bueno
    @EdsonBueno
    I'm sorry, I didn't understand your last sentence, can you clarify?
    Flo Garibal
    @flo.garibal_gitlab
    Here are the ideal view
    I just want to have the transactions history that is paginated
    The upper part of the design will not be paginated
    Edson Bueno
    @EdsonBueno
    I can't see why you can't have your PagedSliverList as a direct child of your CustomScrollView
    If you could reproduce the layout on a toy project and give me access to it, I'll be glad to help!
    Flo Garibal
    @flo.garibal_gitlab
    Mhhh ok I will try to do it
    Yes if it does not work I will try on a toy project !
    Flo Garibal
    @flo.garibal_gitlab
    I finally get it working by moving, as you said, the PageSliverList as a direct child of my CustomScrollView.
    However, doing this, I could not separate my widget in a "logic" way anymore.
    For example I would like to have a file that contains the whole page and then several files that contain some widget of the page like the paginated list and the associated filter and I could not figure a way to do this. Because if I separate them, I will need to nest the PageSliverList in a widget and it will not work anymore
    Flo Garibal
    @flo.garibal_gitlab
    In fact I am looking for something, some Widget that will allow me to put several Widget in it and could be used as a Sliver (i.e extends Sliver)
    I tested to create a SliverList with a SliverChildListDelegate but my PagedSliverList do not work anymore
    Edson Bueno
    @EdsonBueno
    Awesome it ended up working for you! If you could re-create it on a toy project, I'll be glad to help you structuring it differently.
    Flo Garibal
    @flo.garibal_gitlab
    Thanks!
    Here is the toy project I made to illustrate my problem
    I added comments to explain what I wanted to do
    The main idea is to have both the subtitle and the infinite list in a same widget and this widget should be in a custom scroll view
    Edson Bueno
    @EdsonBueno

    Hi, I took a brief look at the code. I'm not sure you can do that, although I think you probably do.
    Either way, maybe you're too attached to what "logically grouped widgets" mean. I think they're fine just the way they are! That's a price you had to pay because of your "complex" layout requiring you to use Slivers.

    I opened a Merge Request for your project where I upgraded it to the new version of the package released this weekend. Now you don't have to subclass anything anymore. It ended up being closer to Flutter. Your code is shorter now. Take a look when you have the time! Thank you so much!

    Flo Garibal
    @flo.garibal_gitlab
    Ok :(
    The main point to "logically groupes widget" is to be able to put the whole widget elsewhere easily
    For example I would like another page with the same infinite list and same way to filter/sort the list, I will not need to recreate the filters separately
    I will have a look at your MR :D Thanks again!
    It seems, indeed, way closer to Flutter :D Thanks for this improvement
    Edson Bueno
    @EdsonBueno
    I truly believe there must be some kind of Fluter's SliverXYZ widget that will allow you to join them, I just don't know what it is
    thank you for the feedback
    Flo Garibal
    @flo.garibal_gitlab
    Yes that is what I though but I cannot find this famous Widget! :'(
    Edson Bueno
    @EdsonBueno

    @flo.garibal_gitlab I couldn't rest until I solve your problem!

    I went pretty deep on it and found out that this is a feature the Flutter team ended up deprioritizing.
    But then a guy decided to make a package out of it, and the result is a MultiSliver widget that does exactly what you need! Make good use of it! ;)

    Flo Garibal
    @flo.garibal_gitlab
    Oh my saviour!
    I did not find any issue about it, do you have the link where you found that Flutter deprioritized it?
    I will give it a try tomorrow morning and tell you the result!
    Edson Bueno
    @EdsonBueno
    Here it is: flutter/flutter#33138
    Flo Garibal
    @flo.garibal_gitlab
    thanks a lot
    Flo Garibal
    @flo.garibal_gitlab

    Just a quick remark about your MR
    I think you can write this:

        _pagingController.addPageRequestListener(bloc.fetch);

    instead of

        _pagingController.addPageRequestListener((pageKey) {
          bloc.fetch(pageKey);
        });
    Everything else seems great
    And MultiSliver works as expected! What a relief!
    Edson Bueno
    @EdsonBueno
    Yes, you definitely can! I just prefer to do the other way whenever I'm instructing to make it more readable.
    Awesome!
    Flo Garibal
    @flo.garibal_gitlab
    Yes that's right!
    Yes that is as you said AWESOME! haha
    heshesh2010
    @heshesh2010
    Hi @EdsonBueno
    my ListView has item's in it i can send screen shot now
    Screen Shot 2020-10-22 at 7.00.34 PM.png
    heshesh2010
    @heshesh2010
    and i don't have RestaurantController.foods code in my project