How to remove top and bottom default padding of Expansion tile for leading widget flutter

264

Try below code add childrenPadding and tilePadding

  ExpansionTile(
      childrenPadding: EdgeInsets.zero,
      tilePadding: EdgeInsets.zero,
   ),

Try to use MediaQuery.removePadding

MediaQuery.removePadding(
      removeTop: true,
      removeBottom: true,
      // removeLeft: true,
      // removeRight: true,
      context: context,
      child: ExpansionTile(
        childrenPadding: EdgeInsets.zero,
        tilePadding: EdgeInsets.zero,
      ),
    ),
Share:
264
gopinath
Author by

gopinath

Updated on January 04, 2023

Comments

  • gopinath
    gopinath over 1 year

    enter image description here

    1. need to remove padding to the list item of expansion tile widget please find the image for actual result . Expected result should remove the top bottom space

    here is the code can anyone help me:

    Theme(
          data: theme,
          child: ListTileTheme(
            contentPadding: EdgeInsets.all(0),
            dense: true,
            child: ExpansionTile(
              title: Row(
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  GFCheckbox(
                    inactiveBgColor: kColorPrimaryDark,
                    inactiveBorderColor: Colors.white,
                    customBgColor: kColorPrimaryDark,
                    size: 15,
                    activeIcon: const Icon(
                      Icons.check,
                      size: 15,
                      color: Colors.white,
                    ),
                    activeBgColor: kColorPrimaryDark,
                    onChanged: (value) {
                      setState(() {
                        isChecked = value;
                      });
                    },
                    value: isChecked,
                    inactiveIcon: null,
                  ),
                  SizedBox(
                    width: 5,
                  ),
                  textWidget(color: Colors.white, size: 12, text: root.title),
                ],
              ),
              key: PageStorageKey<DataList>(root),
              children: root.children.map(_buildTiles).toList(),
            ),
          ),
        );
    
  • gopinath
    gopinath about 2 years
    it is removing only left and right not able to remove top and bottom padding
  • Ravindra S. Patil
    Ravindra S. Patil about 2 years
    @gopinath check my updated answer
  • gopinath
    gopinath about 2 years
    not working do i have any alternative plugin to use this
  • gopinath
    gopinath about 2 years
    no such arugments are showing in below null safety versions