Daniel-Ioannou / flutter_group_list_view

A Flutter ListView in which items can be grouped into sections.
https://pub.dev/packages/group_list_view
MIT License
78 stars 17 forks source link

How to remove default horizontal padding? #17

Closed TangSirOnGit closed 1 year ago

TangSirOnGit commented 2 years ago

How to remove default horizontal padding?

I config the padding as:

child: GroupListView(
          // padding: EdgeInsets.zero,
          padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 4),

but it doesn't work.

image
Daniel-Ioannou commented 2 years ago

@TangSirOnGit Package dose not defined a default horizontal padding. Maybe you have defined a horizontal padding in itemBuilder or the father widget of the GroupListView has a padding.

In the package padding example code padding is defined in each row at itemBuilder.

Or the following code does not have horizontal padding:

  Map<String, List> _elements = {
    'Team A': ['Klay Lewis', 'Ehsan Woodard', 'River Bains'],
    'Team B': ['Toyah Downs', 'Tyla Kane'],
  };

GroupListView(
    sectionsCount: _elements.keys.toList().length,
    countOfItemInSection: (int section) {
        return _elements.values.toList()[section].length;
    },
    itemBuilder: (BuildContext context, IndexPath index) {
        return Text(
            _elements.values.toList()[index.section][index.index],
            style: TextStyle(fontSize: 16, fontWeight: FontWeight.w400),
        );
    },
    groupHeaderBuilder: (BuildContext context, int section) {
        return Text(
            _elements.keys.toList()[section],
            style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
        );
    },
    separatorBuilder: (context, index) => SizedBox(height: 10),
    sectionSeparatorBuilder: (context, section) => SizedBox(height: 10),
);
TangSirOnGit commented 1 year ago

@Daniel-Ioannou Thank you for your reply.