如何在颤动中对齐行和列中的点?

时间:2019-07-03 03:01:04

标签: flutter dart alignment flutter-layout

我想排列图像中所示的点 而且我不知道如何在RowColumn中重复同样的操作 enter image description here

1 个答案:

答案 0 :(得分:5)

enter image description here

有很多方法可以做到,例如TableRowColumn的结合。但是GridView是最简单和推荐的。

@override
Widget build(BuildContext context) {
  return Scaffold(
    appBar: AppBar(),
    body: Container(
      padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 10),
      color: Colors.orange,
      child: GridView.builder(
        itemCount: 25,
        itemBuilder: (context, index) => Container(decoration: BoxDecoration(color: Colors.white70, shape: BoxShape.circle)),
        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: 5,
          mainAxisSpacing: 40,
          crossAxisSpacing: 50,
        ),
      ),
    ),
  );
}