Flutter 颤振可滚动、可流动网格?
我试着在颤振中布置一个屏幕,但比我想象的要难;这正是我想要的(在纵向模式下;在横向或平板电脑中,我希望在部分的底部2列创建网格: (呃…所以没有光照;你们用什么把图像放在这里) 我试过使用flatter\u layout\u grid,但没有取得太大进展(文本从未填满整个单元格),而且它似乎没有达到我想要的那种“分区分组” 问题:Flutter 颤振可滚动、可流动网格?,flutter,responsive,Flutter,Responsive,我试着在颤振中布置一个屏幕,但比我想象的要难;这正是我想要的(在纵向模式下;在横向或平板电脑中,我希望在部分的底部2列创建网格: (呃…所以没有光照;你们用什么把图像放在这里) 我试过使用flatter\u layout\u grid,但没有取得太大进展(文本从未填满整个单元格),而且它似乎没有达到我想要的那种“分区分组” 问题: 最好的方法是什么?我是否应该制作一个“组小部件”的模板,并将多个实例放入一个可滚动的列中…然后如何根据分辨率告诉该列允许每行1或2个 如果您执行上述操作,如何使列在
---所以我有一个方法---
Widget-groupColumn(int-ncol、int-column、List-props){
int itemcount=(props.length/ncols.floor();
if(列
看起来这是一种复杂的方式来做一些应该“放在盒子里的某处”的事情…而且大小的盒子需要离开 有什么建议吗
Widget groupColumn(int ncols, int column, List<_Bleproperty> props) {
int itemcount = (props.length / ncols).floor();
if (column < props.length - itemcount * ncols) itemcount++;
return ListView.builder(
itemCount: itemcount,
itemBuilder: (BuildContext context, index) {
final idx = index * ncols + column;
final prop = props[idx];
return Container(
height: 50,
child: Row(
//mainAxisSize: MainAxisSize.max,
children: [
prop.icon,
Column(
children: [Text(prop.name), Text(prop.val.toString())],
)
],
),
);
},
);
}
Widget groupBox(String title, int ncols, List<_Bleproperty> props) {
/// Makes a [ncols] column box of data with a Title
return Column(
//mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Row(
//This row is important otherwise the text gets centered in column
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(title, style: TextStyle(fontWeight: FontWeight.bold)),
],
),
Row(mainAxisAlignment: MainAxisAlignment.start, children: [
SizedBox(
//An Indent
height: 200.0,
width: 10,
),
SizedBox(
height: 200.0, width: 150, child: groupColumn(ncols, 0, props)),
SizedBox(
height: 200.0, width: 150, child: groupColumn(ncols, 1, props)),
]),
]
);
}