Skip to content

AnimatedList with Dividers #48226

Closed
Closed

Description

@couturmi

Just as ListView has a ListView.separated() option to create a ListView with custom dividers, AnimatedList should have a similar option to space out the items.

Activity

  1. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    c: proposalA detailed proposal for a change to Flutter
    on Jan 6, 2020
  2. sanalkv commented on Jun 3, 2020

    @sanalkv
  3. mregnauld commented on Jan 3, 2021

    @mregnauld
  4. carman247 commented on May 18, 2021

    @carman247

    If you can track the length of your list this might be a temporary solution

    
    List<Object> _myList = [];
    
    ...
    
    
    initialItemCount: _myList.length
    itemBuilder: (ctx, index, animation) {
      return Column(
          children: [
              YourItem();
              if(index < _myList.length - 1)
              Divider()
          ],
    );
    
  5. Crdzbird commented on Sep 19, 2021

    @Crdzbird
  6. christianfrid commented on Dec 7, 2021

    @christianfrid
  7. K9RYM commented on Mar 12, 2022

    @K9RYM

    another lightweight solution to add a divider strip to the items:

    return Container( 
                decoration: BoxDecoration( border: Border(bottom: BorderSide( width: _dividerWidth,  color: _dividerColor) ) ),
                padding: const EdgeInsets.all(_somePadding), 
                child: ListTile() // or any other suitable Widget
     );
    
  8. DzonaTheSymbol commented on Aug 23, 2022

    @DzonaTheSymbol
  9. added
    P3Issues that are less important to the Flutter project
    on Nov 29, 2022
  10. Hixie commented on Jul 20, 2023

    @Hixie
    Contributor

    How should the separator builder handle the case of an item being inserted or removed?

    Implementing the separatorBuilder as just an IndexedWidgetBuilder would mean the separator would suddenly appear or disappear when the child next to it started appearing or stopped disappearing, which is rather jarring.

  11. peter-trost commented on Feb 1, 2024

    @peter-trost
    Contributor

    @Hixie could we pass the animation the separator builder as well? That way developers can decide how the separators should behave. I would really like to use an AnimatedList.seperated :)

  12. Hixie commented on Feb 1, 2024

    @Hixie
    Contributor

    Seems plausible.

    If anyone would like help developing a PR for this, feel free to ping me (@Hixie) on the #hackers-new channel on Discord! See the contributing docs for details.

  13. Hixie commented on Jun 7, 2024

    @Hixie
    Contributor

    Thanks to @Peetee06 for fixing this one!

  14. github-actions commented on Jun 21, 2024

    @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.

  15. locked as resolved and limited conversation to collaborators on Jun 21, 2024
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

    P3Issues that are less important to the Flutter projecta: animationAnimation APIsc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions