Flutter 功能速查表

1.禁止具有滑動屬性的組件的滑動功能(可滑動組件都有一個physics屬性,比如ListView,GraidView)

physics: new NeverScrollableScrollPhysics(), 

比如:

return GridView.builder(
  physics: NeverScrollableScrollPhysics(),  // 當前gridview 就不能滑動了
  gridDelegate:
      SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: 5, //每行5列
          childAspectRatio: 2.0),
  itemCount: 10,
  itemBuilder: (context, index) {
    return RaisedButton(
      shape: CircleBorder(),
      onPressed: () {
        print(index);
      },
      child: Text(index.toString()),
    );
  },
);

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章