widgetOnColor static method

Widget widgetOnColor(
  1. BuildContext context, {
  2. required Widget widget,
  3. Color? backgroundColor,
  4. EdgeInsetsGeometry? padding,
})

Wraps a widget in a colored rounded container.

Parameters:

  • context: The build context
  • widget: The widget to wrap
  • backgroundColor: Optional background color. Defaults to grey
  • padding: Optional padding. Defaults to 10 on all sides

Implementation

static Widget widgetOnColor(BuildContext context, {required Widget widget, Color? backgroundColor, EdgeInsetsGeometry? padding})
{
  return Container(
      decoration: BoxDecoration(
          color: backgroundColor ?? Colors.grey.shade200,
          borderRadius: BorderRadius.circular(6)
      ),
      padding: padding ?? EdgeInsets.all(10),
      child: widget
  );
}