Flutter: ListView not scrollable, not bouncing

前端 未结 6 2172
醉梦人生
醉梦人生 2021-02-12 21:49

I have the following example (tested on an iPhone X, iOS 11):

import \'package:flutter/material.dart\';

void main() => runApp(new MyApp());

class MyApp exte         


        
6条回答
  •  不思量自难忘°
    2021-02-12 22:00

    Creates scroll physics using AlwaysScrollableScrollPhysics that always lets the user scroll.

    For scroll with bouncing effect Just supply physics: BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics) to your scroller. That will make it always scrollable, even when there isn't content that overflows

    const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics())
    

    Here is full example

    ListView(
      padding: EdgeInsets.all(8.0),
      physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
      children: _listData.map((i) {
        return ListTile(
          title: Text("Item $i"),
        );
      }).toList(),
    );
    

提交回复
热议问题