import 'package:flutter/material.dart';

class FormBorderWidget extends StatelessWidget {
  final Widget child;
  final String? color;

  final Color green = const Color.fromRGBO(58, 236, 27, 0.1);
  final Color blue = const Color.fromRGBO(27, 90, 236, 0.1);
  final Color red = const Color.fromRGBO(236, 27, 27, 0.2);
  final Color yellow = const Color.fromRGBO(236, 232, 27, 0.2);
  final Color teal = const Color.fromRGBO(27, 236, 229, 0.2);

  const FormBorderWidget({super.key, required this.child, this.color});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.only(left: 32, right: 32),
      child: Container(
          padding: const EdgeInsets.fromLTRB(32, 32, 32, 40),
          decoration: BoxDecoration(
              color: _getColor(color ?? ''),
              borderRadius: const BorderRadius.all(Radius.circular(16)),
              boxShadow: [
                const BoxShadow(
                  color: Color.fromRGBO(0, 0, 0, 0.2), // Subtle shadow to give depth
                  spreadRadius: 0,
                  blurRadius: 4,
                  offset: Offset(0, 2),
                )
              ]),
          child: child),
    );
  }

  Color _getColor(String color) {
    switch (color.toLowerCase()) {
      case 'green':
        return green;
      case 'blue':
        return blue;
      case 'red':
        return red;
      case 'yellow':
        return yellow;
      case 'teal':
        return teal;
      default:
        return const Color.fromRGBO(57, 38, 62, 0.6); // Default to transparent if color is not recognized
    }
  }
}
