我正在尝试使Container
的内容可滚动,并且我认为我可能滥用了SingleChildScrollView
小部件。
因为我希望其内容可滚动,所以可以将其放在Container
(作为其子级)的内部吗?
谢谢。
Hero(
tag: this.widget.id,
child: Material(
type: MaterialType.transparency,
child: Center(
child: Container(
margin: EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.25),
height: MediaQuery.of(context).size.height * 0.75,
width: MediaQuery.of(context).size.width * 0.95,
decoration: cardDecoration,
child: SingleChildScrollView(
child: ContentTripExtract(this.widget.i, false) // a column of texts and containers
),
),
),
),
),
答案 0 :(得分:1)
您需要指定 SingleChildScrollView 仅具有一个孩子,如下所示:
child: SingleChildScrollView(
child: Container(
也不要在子视图中使用flex。 就您而言,我认为它可行
child: SingleChildScrollView(
child: Container(
child: ContentTripExtract(this.widget.i, false) // a column of texts and containers
),