insetBorder method

Border insetBorder({
  1. required bool focused,
  2. bool hasError = false,
})

Inset border used by neumorphic text fields.

Implementation

Border insetBorder({required bool focused, bool hasError = false}) {
  if (hasError) {
    return Border.all(color: errorOutlineColor, width: errorOutlineWidth);
  }

  final darkColor = focused ? focusedOutlineColor : insetShadowColor!;
  final lightColor = insetHighlightColor!;
  final width = focused ? focusedOutlineWidth : outlineWidth;

  return Border(
    top: BorderSide(color: darkColor, width: width),
    left: BorderSide(color: darkColor, width: width),
    bottom: BorderSide(color: lightColor, width: width),
    right: BorderSide(color: lightColor, width: width),
  );
}