border method

Widget border(
  1. BuildContext context, {
  2. double radius = 5,
  3. EdgeInsetsGeometry padding = const EdgeInsets.all(5),
  4. Color? borderColor,
})

Wraps this widget in a Container with a border.

Parameters:

  • context: The build context to access theme data
  • radius: Border radius, defaults to 5
  • padding: Padding inside the border, defaults to 5 on all sides
  • borderColor: Border color, defaults to theme's disabled color

Implementation

Widget border(BuildContext context,
    {double radius = 5,
    EdgeInsetsGeometry padding = const EdgeInsets.all(5),
    Color? borderColor}) {
  borderColor ??= Theme.of(context).disabledColor;

  return Container(
      padding: padding,
      decoration: BoxDecoration(
          border: Border.all(
            color: borderColor,
          ),
          borderRadius: BorderRadius.circular(radius)),
      child: this);
}