Skip to main content

🧩 SectionBody Widget

A flexible content container designed for use inside a [Section] or any other layout, providing customizable padding, background color, border radius, and default text color.

The SectionBody widget is ideal for wrapping a block of content with styling applied consistently across your app.


🧱 Parameters:​

  • [child] – The widget to display inside the body (required).
  • [padding] – Padding around the child. Defaults to EdgeInsets.all(12).
  • [backgroundColor] – Optional background color. If null, no background is applied.
  • [textColor] – Text color applied via DefaultTextStyle. Defaults to Colors.white.
  • [borderRadius] – Border radius for the container. Defaults to Radius.circular(8).

🎯 Usage Example:​

SectionBody(
backgroundColor: Colors.black,
textColor: Colors.white,
padding: EdgeInsets.all(16),
borderRadius: BorderRadius.circular(12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("This is the section content"),
SizedBox(height: 8),
Text("It inherits the text color automatically."),
],
),
)

📌 Notes:​

  • Text inside the body automatically inherits the [textColor] unless overridden.
  • Can be nested inside a Section or used standalone as a content wrapper.