Flutter: Prevent Margin Clipping
ListView
possess a padding
property for that purpose.
The following code will offset the first element by 8. But that padding won't clip the list content, as opposed to wrapping ListView
inside a Padding
.
ListView.builder( padding: EdgeInsets.only(top: 8.0), itemBuilder: (context, index) { return Container( height: 42.0, color: index % 2 == 0 ? Colors.red : Colors.blue, ); }, ),