Flutter GridView 滚动

Fultter GridView scrolling

我尝试设置物理来启用滚动功能,但它会滚动整个屏幕。
Only red box available to scroll
如何设置另一个 Widget 固定位置,只在 GridView 中启用滚动?
只想在GridView中滚动,请参考照片,这样更容易理解。

child: Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: Text('Sanfield Mobile App'),
        actions: <Widget>[
            IconButton(
              icon: Icon(
                Icons.exit_to_app,
                color: Colors.white,
              ),
              onPressed: () {
                showConfirmLogoutDialog(context,'Confirm logout','Do you want to logout?');
            },
          )
        ],
      ),
      drawer: CustomDrawer(),
        body:SingleChildScrollView(
            physics: new NeverScrollableScrollPhysics(),
            child:Column(
            children: <Widget>[
            Card(
              child: Column(
                mainAxisSize: MainAxisSize.min,
                children: <Widget>[
                  ListTile(
                  leading: 
                  image(),
                  title: Text(updateDate),
                  subtitle: Text(weatherDetails),
                ),
              Row(
                mainAxisAlignment: MainAxisAlignment.end,
                children: <Widget>[
                  RichText(
                    text: TextSpan(
                      style: new TextStyle(
                      fontSize: 24.0,
                      color: Colors.black,
                    ),
                  children: <TextSpan>[
                    TextSpan(text: mintemp.toString()+' C - ', style: new TextStyle(color: Colors.lightBlue)),
                    TextSpan(text: maxtemp.toString()+' C ', style: new TextStyle(color: Colors.red)),
                    TextSpan(text: '       Update:'+updateTime, style: new TextStyle(color: Colors.black,fontSize: 14)),
                ],
              ),
              ), 
              ],
            ),
          ],
        ),
      ),
      Container(
        height: 80,
            child: new ListView.builder(
              itemCount: 6,
              itemBuilder: (context, index){
                return new Card(child: new Container(
                //width: MediaQuery.of(context).size.width,
                 width:320,
                 height: 80,
                 child: new Text('Hello'),alignment: Alignment.center,));
              }, scrollDirection: Axis.horizontal,
            ),
          ), 
          Container(  
            height: 889,
           child:GridView.count(
                    physics: ScrollPhysics(),
                    primary: false,
                    padding: const EdgeInsets.all(10),
                    crossAxisSpacing: 10,
                    mainAxisSpacing: 10,
                    crossAxisCount: 3,
                    children: <Widget>[
                      Container(
                        padding: const EdgeInsets.all(20),
                        decoration: BoxDecoration(
                          image: DecorationImage(
                            image: AssetImage(
                                'images/hkphoto.jpg'),
                            fit: BoxFit.fill,
                          ),
                          shape: BoxShape.circle,
                        ),
                        child: InkWell(
                          /*onTap: () => Navigator.push(
                              context, MaterialPageRoute(builder: (context) =>)
                            ),*/ // handle your onTap here
                        ),
                      ),
                      InkWell(
                          child:Container(
                                    padding: const EdgeInsets.all(8),
                                    child: const Text('phs'),
                                    color: Colors.teal[200],
                          ),
                          /*onTap: () => Navigator.push(
                              context, MaterialPageRoute(builder: (context) => 
                            )
                          ),*/
                      ),
                      InkWell(
                        child:Container(
                          padding: const EdgeInsets.all(8),
                          child: const Text('whs'),
                          color: Colors.teal[200],
                        ),
                        /*onTap: () => Navigator.push(
                            context, MaterialPageRoute(builder: (context) => 
                          ),
                        ),*/
                      ),
                      InkWell(
                        child:Container(
                          padding: const EdgeInsets.all(8),
                          child: const Text('whs'),
                          color: Colors.teal[200],
                        ),
                        /*onTap: () => Navigator.push(
                            context, MaterialPageRoute(builder: (context) => 
                          ),
                        ),*/
                      ),
                      InkWell(
                        child:Container(
                          padding: const EdgeInsets.all(8),
                          child: const Text('whs'),
                          color: Colors.teal[200],
                        ),
                        /*onTap: () => Navigator.push(
                            context, MaterialPageRoute(builder: (context) => 
                          ),
                        ),*/
                      ),
                      InkWell(
                        child:Container(
                          padding: const EdgeInsets.all(8),
                          child: const Text('whs'),
                          color: Colors.teal[200],
                        ),
                        /*onTap: () => Navigator.push(
                            context, MaterialPageRoute(builder: (context) => 
                          ),
                        ),*/
                      ),
                ],
              )
              ),
            ]
          ),
        )
      )

删除正文顶层的SingleChildScrollView,并将GridViewscrollPhysics设置为AlwaysScrollableScrollPhysics()

尝试像这样删除 SingleChildScrollView:

Column(
        children: <Widget>[
        Card(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              ListTile(
              leading: 
              image(),
              title: Text(updateDate),
              subtitle: Text(weatherDetails),
            ),
          Row(
            mainAxisAlignment: MainAxisAlignment.end,
            children: <Widget>[
              RichText(
                text: TextSpan(
                  style: new TextStyle(
                  fontSize: 24.0,
                  color: Colors.black,
                ),
              children: <TextSpan>[
                TextSpan(text: mintemp.toString()+' C - ', style: new TextStyle(color: Colors.lightBlue)),
                TextSpan(text: maxtemp.toString()+' C ', style: new TextStyle(color: Colors.red)),
                TextSpan(text: '       Update:'+updateTime, style: new TextStyle(color: Colors.black,fontSize: 14)),
            ],
          ),
          ), 
          ],
        ),
      ],
    ),
  ),
  Container(
    height: 80,
        child: new ListView.builder(
          itemCount: 6,
          itemBuilder: (context, index){
            return new Card(child: new Container(
            //width: MediaQuery.of(context).size.width,
             width:320,
             height: 80,
             child: new Text('Hello'),alignment: Alignment.center,));
          }, scrollDirection: Axis.horizontal,
        ),
      ), 
      Container(  
        height: 889,
       child:GridView.count(
                physics: ScrollPhysics(),
                primary: false,
                padding: const EdgeInsets.all(10),
                crossAxisSpacing: 10,
                mainAxisSpacing: 10,
                crossAxisCount: 3,
                children: <Widget>[
                  Container(
                    padding: const EdgeInsets.all(20),
                    decoration: BoxDecoration(
                      image: DecorationImage(
                        image: AssetImage(
                            'images/hkphoto.jpg'),
                        fit: BoxFit.fill,
                      ),
                      shape: BoxShape.circle,
                    ),
                    child: InkWell(
                      /*onTap: () => Navigator.push(
                          context, MaterialPageRoute(builder: (context) =>)
                        ),*/ // handle your onTap here
                    ),
                  ),
                  InkWell(
                      child:Container(
                                padding: const EdgeInsets.all(8),
                                child: const Text('phs'),
                                color: Colors.teal[200],
                      ),
                      /*onTap: () => Navigator.push(
                          context, MaterialPageRoute(builder: (context) => 
                        )
                      ),*/
                  ),
                  InkWell(
                    child:Container(
                      padding: const EdgeInsets.all(8),
                      child: const Text('whs'),
                      color: Colors.teal[200],
                    ),
                    /*onTap: () => Navigator.push(
                        context, MaterialPageRoute(builder: (context) => 
                      ),
                    ),*/
                  ),
                  InkWell(
                    child:Container(
                      padding: const EdgeInsets.all(8),
                      child: const Text('whs'),
                      color: Colors.teal[200],
                    ),
                    /*onTap: () => Navigator.push(
                        context, MaterialPageRoute(builder: (context) => 
                      ),
                    ),*/
                  ),
                  InkWell(
                    child:Container(
                      padding: const EdgeInsets.all(8),
                      child: const Text('whs'),
                      color: Colors.teal[200],
                    ),
                    /*onTap: () => Navigator.push(
                        context, MaterialPageRoute(builder: (context) => 
                      ),
                    ),*/
                  ),
                  InkWell(
                    child:Container(
                      padding: const EdgeInsets.all(8),
                      child: const Text('whs'),
                      color: Colors.teal[200],
                    ),
                    /*onTap: () => Navigator.push(
                        context, MaterialPageRoute(builder: (context) => 
                      ),
                    ),*/
                  ),
            ],
          )

如果它不起作用请告诉我