android-layout - 在 Gridview.count 之后放置一个按钮 - Flutter
解决方案
- 在列中插入 GridView.counter
- 将 shrinkWrap 和主要属性设置为 true
- 将您的按钮放在 Column 内部和 gridview 下方,而不是放在按钮内部。
将按钮放在 Center Widget / set crossAxisAlignment: CrossAxisAlignment.center
import 'package:flutter/material.dart'; class Test extends StatefulWidget { @override _TestState createState() => _TestState(); } class _TestState extends State<Test> with SingleTickerProviderStateMixin{ Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Page - 2"), ), body: SafeArea( child: Column( children: <Widget>[ GridView.count( shrinkWrap: true, primary: true, crossAxisCount: 2, children: <Widget>[ Container( color: Colors.red, ), Container( color: Colors.green, ), Container( color: Colors.blue, ), Container( color: Colors.yellow, ), ], ), Divider( color: Colors.grey.shade600, ), Center( child: RaisedButton( child: Text("Button"), onPressed: (){}, ), ) ], ), ), ); } }
推荐阅读
- r - 使 SQL 和 R 单元在 R Notebook 中始终一起运行
- python - 如何摆脱嵌套循环并继续外循环的迭代
- java - RSAPubKey 元素中的模值不匹配
- django - 错误消息“mkvirtualenv 未被识别为内部或外部命令”
- android - Android - 使用数据绑定来分配布局?
- c# - 弹性搜索(使用 NEST)在 MatchAll() 上返回 0 个结果
- r - 无法安装包 'ggpmisc' 不可用(对于 R 版本 3.5.0)
- r - 在 Windows CMD (powershell) 中使用正则表达式从 XML 中删除 CDATA
- labview - 如何通过 Labview 上的热电偶获取温度
- javascript - 在缩短的链接之前添加 URL 的其余部分