我当前在GridView中显示两行小部件。
但是,我无法限制高度和缩小间距,我想消除额外的差距。
我想消除红色的屁股。我想消除这一领域和显示窗口小部件在底部更高。
但是我做不到,所以我希望你能帮助我。
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: GridView.count(
crossAxisCount: 2,
shrinkWrap: true,
mainAxisSpacing: 0,
crossAxisSpacing: 30,
children: [
//一つ目
Visibility(
visible: numberOfFeatures >= 3,
child: Column(
children: [
TextField(
decoration: InputDecoration(hintText: "ONE"),
onChanged: (value) {
setState(() {
_slider1Text = value;
features[0] = _slider1Text;
});
},
),
Slider(
min: 0,
max: 35,
divisions: 15,
value: _slider1Value.toDouble(),
onChanged: _change1Slider),
],
),
),
//二つ目
Visibility(
visible: numberOfFeatures >= 3,
child: Column(
children: [
TextField(
decoration: InputDecoration(hintText: "TWO"),
onChanged: (value) {
setState(() {
_slider2Text = value;
features[1] = _slider2Text;
});
},
),
Slider(
min: 0,
max: 35,
divisions: 15,
value: _slider2Value.toDouble(),
onChanged: _change2Slider),
],
),
),
//三つ目
Visibility(
visible: numberOfFeatures >= 3,
child: Column(
children: [
TextField(
decoration: InputDecoration(hintText: "THREE"),
onChanged: (value) {
setState(() {
_slider3Text = value;
features[2] = _slider3Text;
});
},
),
Slider(
min: 0,
max: 35,
divisions: 15,
value: _slider3Value.toDouble(),
onChanged: _change3Slider),
],
),
),
//4つ目
Visibility(
visible: numberOfFeatures >= 4,
child: ListTile(
title: TextField(
onChanged: (value) {
setState(() {
_slider4Text = value;
features[3] = _slider4Text;
});
},
),
subtitle: Slider(
min: 0,
max: 35,
divisions: 15,
value: _slider3Value.toDouble(),
onChanged: _change4Slider),
),
),
],
// if (numberOfFeatures >= 4) ...[TextField(), Text('ちんう')],
// if (numberOfFeatures >= 5) TextField(),
// if (numberOfFeatures >= 6) TextField(),
// if (numberOfFeatures >= 7) TextField(),
// if (numberOfFeatures >= 8) TextField(),
),
),
),
2条答案
按热度按时间aiazj4mn1#
通过添加其他参数
到网格视图计数
eqfvzcg82#
尝试将
Column
的mainAxisSize
属性设置为MainAxisSize.min
。