设置容器高度的问题

Issue in setting container's height

我是 flutter.i 的新手,有设置容器高度的代码。 在这里请检查,如果条件成立它的设置高度 100 否则 60,我想将 60 设置为它的 child 的 height.means 它应该

selectedIndex != null && showExpanded == true ? 100 : (取决于child的身高),

这是我的代码...

                    height: selectedIndex != null && showExpanded == true
                        ? 100
                        : 60,
                    duration: Duration(milliseconds: 300),
                    // Provide an optional curve to make the animation feel smoother.
                    curve: Curves.fastOutSlowIn,
                    decoration: BoxDecoration(
                        border:
                            Border.all(width: 1, color: HexColor("#BCE0FD"))),)

如果你想让容器与其子容器匹配它的高度,只需将它的高度字段设置为空。

height: selectedIndex != null && showExpanded == true
      ? 100
      : null,