Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Flutter ExpansionTile – Why Android and Web have different Padding?

I have a list with Expansion Tiles in containers, and on the Web it looks ok, but on Android the same code creates much bigger containers. Can you help with that?

Here how it looks:
Web and Mobile
Here is the code:

body: ListView.builder(
            return Padding(
              padding:
                  const EdgeInsets.only(left: 12, right: 12, top: 6, bottom: 6),
                ),
                child: Container(
                  padding: EdgeInsets.all(0),
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(5),
                  ),
                  child: ExpansionTile(
                    title: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text(
                          thisListName,
                          style: const TextStyle(
                            fontWeight: FontWeight.bold,
                          ),
                        ),
                        IconButton(
                          padding: EdgeInsets.only(left: 10, right: 10),
                          constraints: BoxConstraints(),
                          onPressed: () {},
                          icon: const Icon(Icons.edit),
                          color: Colors.white,
                        )
                      ],
                    ),

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

On Android, ExpansionTile containers can sometimes appear larger than expected due to platform-specific differences in padding or margins. To create a consistent appearance across platforms, you can explicitly set constraints on the Container and make sure there’s no unexpected padding or margin in the ExpansionTile or child widgets

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading