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 column layout

I have a column with two children ‘text field and grid view’ and have this huge space in between that I can’t get rid of it.

This is the code

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

SafeArea(
  child: Column(
    children: [
      Expanded(
        child: Container(
          constraints: BoxConstraints(
            minWidth: MediaQuery.of(context).size.width,
          ),
          child: TextField(
            readOnly: true,
          ),
        ),
      ),
      Expanded(
        child: GridView.count(
          padding: const EdgeInsets.all(10),
          crossAxisCount: 4,
          crossAxisSpacing: 10,
          mainAxisSpacing: 10,
          children: []

>Solution :

just remove the first Expanded widget and keep it’s children, i.e. the Container

SafeArea(
child: Column(
    children: [
       Container(
          constraints: BoxConstraints(
            minWidth: MediaQuery.of(context).size.width,
          ),
          child: TextField(
            readOnly: true,
          ),
      ),
      Expanded(
        child: GridView.count(
          padding: const EdgeInsets.all(10),
          crossAxisCount: 4,
          crossAxisSpacing: 10,
          mainAxisSpacing: 10,
          children: []
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