CenterBody constructor

const CenterBody({
  1. Key? key,
  2. required IconData icon,
  3. String? message,
  4. String? actionText,
  5. VoidCallback? onActionPressed,
})

Constructs a CenterBody with required icon and optional message/action elements.

  • key: Standard Flutter widget key for identification.
  • icon: Required IconData for the central visual element.
  • message: Optional String for contextual text below the icon.
  • actionText: Optional String label for the action button.
  • onActionPressed: Optional callback for button press handling.

The const constructor ensures efficient widget tree updates. Use named parameters for clarity in Arcane UI compositions, promoting reusable centered content.

Example in a screen:

FillScreen(
  body: CenterBody(
    icon: Icons.search_off,
    message: 'Search for items',
    actionText: 'Clear',
    onActionPressed: clearSearch,
  ),
)

Implementation

const CenterBody(
    {super.key,
    required this.icon,
    this.message,
    this.actionText,
    this.onActionPressed});