Flutter 不渲染ListView的颤振步进器
我正在使用一个步进器,其中一个步骤中有一个ListView.builder,如下所示:Flutter 不渲染ListView的颤振步进器,flutter,flutter-layout,Flutter,Flutter Layout,我正在使用一个步进器,其中一个步骤中有一个ListView.builder,如下所示: steps: <Step>[ new Step( title: new Text('Select Ingredients'), content: _buildPantryStep(), isActive: _currentStep >= 0, state: _currentSt
steps: <Step>[
new Step(
title: new Text('Select Ingredients'),
content: _buildPantryStep(),
isActive: _currentStep >= 0,
state: _currentStep >= 0 ? StepState.complete : StepState.disabled,
)
_buildPantryStep() {
return Column(children: <Widget>[
FutureBuilder(
future: _pantryMemoizer.future,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.hasData) {
return Expanded(
child: PantryIngredients(ingredientList: ingredientList));
} else if (snapshot.hasError) {
return new Text('An error occurred retrieving your pantry');
} else {
return Center(child: CircularProgressIndicator());
}
},
)
]);
}
我可以看到它进入getList()函数的位置,ingredientList中填充了一些项。但是,调试器从未将其放入实际的itemBuilder函数中,步骤内容以CircularProgressIndicator的形式开始,但在将来完成后,内容只是空白
如果我改变主意
return Expanded(child: PantryIngredients(ingredientList: ingredientList))
像
return Container(height: 500, width: 500, child: PantryIngredients(ingredientList: ingredientList))
然后它确实渲染了。因此,这似乎是一个扩展了的步骤内部没有抖动的东西,或者我只是在做一些非常愚蠢的事情。您的问题似乎是大小和布局。以下是一些我不必实际尝试的评论:
扩展的
通常直接进入列
。中间有一个FutureBuilder
。尝试将列
移动到FutureBuilder
中,以便展开的
的父列是列
Step
s需要给出自己的尺寸。您试图对列
/扩展的
执行的操作是说“请使用所有可用大小”。然而,Step
可能期望从其子级获得该大小。您应该决定列的大小,并用SizedBox
将其包装起来您的问题似乎与大小和布局有关。以下是一些我不必实际尝试的评论:
扩展的
通常直接进入列
。中间有一个FutureBuilder
。尝试将列
移动到FutureBuilder
中,以便展开的
的父列是列
Step
s需要给出自己的尺寸。您试图对列
/扩展的
执行的操作是说“请使用所有可用大小”。然而,Step
可能期望从其子级获得该大小。您应该决定列的大小,并用SizedBox
将其包装起来return Container(height: 500, width: 500, child: PantryIngredients(ingredientList: ingredientList))