import 'package:flutter/material.dart';

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

  final List<Color> blue = [
    const Color.fromRGBO(30, 50, 77, 0.8),
    const Color.fromRGBO(30, 50, 77, 0.8),
    const Color.fromRGBO(37, 94, 94, 0.8),
  ];

  final List<Color> green = [
    const Color.fromRGBO(23, 56, 38, 0.8),
    const Color.fromRGBO(23, 56, 38, 0.8),
    const Color.fromRGBO(66, 98, 38, 0.8),
  ];

  final List<Color> red = [
    const Color.fromRGBO(87, 33, 33, 0.8),
    const Color.fromRGBO(87, 33, 33, 0.8),
    const Color.fromRGBO(68, 44, 26, 0.8),
  ];

  final List<Color> yellow = [
    const Color.fromRGBO(156, 156, 59, 1),
    const Color.fromRGBO(156, 156, 59, 1),
    const Color.fromRGBO(104, 156, 59, 1),
  ];

  FormBorderWidget2({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)),
              gradient: LinearGradient(
                colors: _getColorList(color!),
                begin: Alignment.centerLeft,
                end: Alignment.centerRight,
              ),
              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),
    );
  }

  List<Color> _getColorList(String color) {
    switch (color.toLowerCase()) {
      case 'green':
        return green;
      case 'blue':
        return blue;
      case 'red':
        return red;
      case 'yellow':
        return yellow;
      default:
        return [
          const Color.fromRGBO(0, 0, 0, 0.8),
          const Color.fromRGBO(0, 0, 0, 0.8),
          const Color.fromRGBO(133, 133, 133, 0.8),
        ];
    }
  }
}
