在Flutter中向卡添加新列

时间:2019-04-29 03:53:42

标签: dart flutter flutter-layout

如何在飘动的卡片上添加新列?

当前,我有2列,由于它们位于左侧和右侧,因此无法弄清楚如何在它们之间添加第三列。当我尝试添加“新列”时,它只会在第一列下创建新的一行文本。

到目前为止,这是我的代码:

$conn = oci_connect('PROJECT', 'saadbitar1998', 'localhost/XE');
if (!$conn) {
    $e = oci_error();
    trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}

$stid = oci_parse($conn, 'SELECT ROOMNUM FROM Room');
oci_execute($stid);



//Fetch a row in an associative array
echo "<table border='1'> ";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
    echo "<tr> ";
    foreach ($row as $item) {
        echo "    <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : "&nbsp;") . "</td> ";
    }
    echo "</tr> ";
}
echo "</table> ";

我要3列,以便可以在这张卡的中间添加一张图片。

Current output   Expected output

1 个答案:

答案 0 :(得分:0)

根据您的屏幕截图,找到解决方法。您可以根据需要进行修改。

Widget _buildListItem(BuildContext context) {
  return Card(
    margin: EdgeInsets.all(12),
    elevation: 4,
    color: Color.fromRGBO(64, 75, 96, .9),
    child: Padding(
      padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16),
      child: Row(
        children: <Widget>[
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              Text("Jumping", style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
              SizedBox(height: 4),
              Text("Activations 9", style: TextStyle(color: Colors.white70)),
              Text("03-08-19", style: TextStyle(color: Colors.white70)),
            ],
          ),
          Spacer(),
          CircleAvatar(backgroundColor: Colors.white),
        ],
      ),
    ),
  );
}

输出:

enter image description here