如何在flutter中创建可滚动的行

Pra*_*nay 5 layout flutter

我尝试在 flutter 中创建可滚动行

但在尝试了多种方法后,我面临着高度被固定或列表不滚动的问题

发布我尝试过的代码之一。

期待一种可以连续滚动并且不需要固定小部件高度的方法。

new Column(
    children: [
     new Container(
         height: 100.0,
         child: ListView(
            scrollDirection: Axis.horizontal,
              children: <Widget>[
                new Text("text 1"),
                new Text("text 2"),
                new Text("text 3"),
          ],
       ),
      ),
   ],
  ),
Run Code Online (Sandbox Code Playgroud)

Vic*_*khe 11

我已经回答了一些相关的问题,您不需要为小部件提供固定高度,并且您的小部件可以水平滚动

你可以在这里查看

/sf/answers/3635635601/

提示:使用SingleChildScrollView小部件

SingleChildScrollView(
  scrollDirection: Axis.horizontal,
  child: Row(
   children: <Widget>[
     Text('hi'),
     Text('hi'),
     Text('hi'),
   ]
  )
)
Run Code Online (Sandbox Code Playgroud)