You don’t need a column for your Search Field widget, just use directly. Remove from your parent ListView the shrinkWrap. Add shrinkWrap to your GridView and also specify the physics :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | new ListView(children: <Widget>[ new GestureDetector( child: new Container( color: Colors.grey[300], child: new Padding( padding: const EdgeInsets.all(8.0), child: new Card( margin: const EdgeInsets.fromLTRB(4.0, 0.0, 4.0, 0.0), child: new ListTile( leading: new Icon(Icons.search), title: new Text('Search', style: new TextStyle(color: Colors.grey[600])), ), ), ), ), onTap: () { print('tapped'); }, ), GridView.builder( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemCount: items.length, gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2), itemBuilder: (BuildContext context, int index) { return new GestureDetector( child: new Card( elevation: 5.0, child: new Container( decoration: new BoxDecoration( image: new DecorationImage( fit: BoxFit.cover, image: NetworkImage( 'https://images.unsplash.com/photo-1533514114760-4389f572ae26?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=4ada6181447db788f0fc94d5d2e35c63&auto=format&fit=crop&w=500&q=60'), ), ), ), ), onTap: () { showDialog( barrierDismissible: false, context: context, child: new AlertDialog( title: new Column( children: <Widget>[ new Text("GridView"), new Icon( Icons.favorite, color: Colors.green, ), ], ), content: new Text("Selected Item $index"), actions: <Widget>[ new FlatButton( onPressed: () { Navigator.of(context).pop(); }, child: new Text("OK")) ], ), ); }, ); }, ) ] ) |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.