你好,,,,,当我点击卡片时,向我显示此错误如何解决此错误

时间:2019-02-25 10:06:26

标签: flutter flutter-dependencies flutter-animation flutter-test

  1. 类型'_InternalLinkedHashMap'不是'BuildContext'类型的子类型

  2. 未处理的异常:'package:flutter / src / widgets / page_view.dart':失败的断言:第97行pos 7:'positions.isNotEmpty':在使用PageView建立它之前,无法访问PageController.page

`返回新的GestureDetector(        onTap :(){         Navigator.push(data,MaterialPageRoute(builder:(context){           返回新的DetailPage(record1,record1); //在这里返回新页面/屏幕,我们在此处发送flat_name作为参数,您可以发送下一页所需的任何数据         }));       },       子卡:             海拔:1.5,             子:新列(               crossAxisAlignment:CrossAxisAlignment.stretch,               mainAxisSize:MainAxisSize.min,               verticalDirection:VerticalDirection.down,               儿童:[                 新的Image.network(record1.img_room),                 新填充(                   填充:EdgeInsets.only(左:10.0),                   子:新列(                     crossAxisAlignment:CrossAxisAlignment.start,                     孩子:[

                  new Text( record1.flat_name),
                  new Text( record1.address),


                ],
              ),

            )
          ],
        ),
  )
      );

} }`

1 个答案:

答案 0 :(得分:0)

ListTile内用GestureDetector包装_buildListItem,即 在致电_buildListitem(document, context);

时也发送上下文
Widget _buildListItem(DcoumentSnapshot document, BuildContext context ){//new argument
  return GestureDetector(
      child: ListTile(
        title: Text(document['flat_name']),
      ),
      onTap: () {
        Navigator.push(context, MaterialPageRoute(builder: (context){
          return new DetailPage(document);//Here is location where we send our data to next page..
        }));
      },
);

}