title: DataTable not able to wrap text inside DataCell - Flutter?
body: <p>I am not able to wrap the text inside the DataCell in the DataTable widget in Flutter. Tried putting DataCell into a container and assign width but did not work. Looking for some solution to fix this.</p>
  <p><a href="https://i.stack.imgur.com/mL3wz.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mL3wz.jpg" alt="The text in row 1 should get wrap so the other column don't overlfow" /></a></p>
  <p>The code for the data table is below. This expanded widget is inside a column with some other widgets on top.</p>
  <pre><code> Expanded(
              child: SingleChildScrollView(
                  child: DataTable(
                      columnSpacing: 5,
                      columns: &lt;DataColumn&gt;[
                        DataColumn(
                          label: Container(
                            width: 30,
                            child: Align(
                              alignment: Alignment.center,
                              child: Text(
                                &quot;Itemm&quot;,
                                style: TextStyle(
                                  fontWeight: FontWeight.bold,
                                ),
                              ),
                            ),
                          ),
                        ),
                        DataColumn(
                          label: Container(
                            width: 30,
                            child: Align(
                              alignment: Alignment.center,
                              child: Text(
                                &quot;Price&quot;,
                                style: TextStyle(
                                  fontWeight: FontWeight.bold,
                                ),
                              ),
                            ),
                          ),
                        ),
                        DataColumn(
                          label: Container(
                            width: 30,
                            child: Align(
                              alignment: Alignment.center,
                              child: Text(
                                &quot;Quantity&quot;,
                                style: TextStyle(
                                  fontWeight: FontWeight.bold,
                                ),
                              ),
                            ),
                          ),
                        ),
                        DataColumn(
                          label: Container(
                            width: 30,
                            child: Align(
                              alignment: Alignment.center,
                              child: Text(
                                &quot;Discount %&quot;,
                                style: TextStyle(
                                  fontWeight: FontWeight.bold,
                                ),
                              ),
                            ),
                          ),
                        ),
                        DataColumn(
                          label: Container(
                            width: 30,
                            child: Align(
                              alignment: Alignment.center,
                              child: Text(
                                &quot;Total&quot;,
                                style: TextStyle(
                                  fontWeight: FontWeight.bold,
                                ),
                              ),
                            ),
                          ),
                        ),
                      ],
                      rows: bill
                          .map((element) =&gt; DataRow(
                                cells: &lt;DataCell&gt;[
                                  DataCell(
                                    Align(
                                      alignment: Alignment.center,
                                      child: Text(
                                        element.itemName,
                                      ),
                                    ),
                                  ),
                                  DataCell(
                                    Align(
                                      alignment: Alignment.center,
                                      child: Text(element.price),
                                    ),
                                  ),
                                  DataCell(
                                    Align(
                                      alignment: Alignment.center,
                                      child: Text(element.quantity),
                                    ),
                                  ),
                                  DataCell(
                                    Align(
                                      alignment: Alignment.center,
                                      child: Text(element.discount),
                                    ),
                                  ),
                                  DataCell(
                                    Align(
                                      alignment: Alignment.center,
                                      child: Text(element.total),
                                    ),
                                  ),
                                ],
                              ))
                          .toList())),
            ),
  </code></pre>
  <p>Thanks</p>