import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:payment_plugin/themes/light_theme.dart';

class ComwellErrorWidget extends StatelessWidget {
  final String title;
  final String subtitle;
  final bool border;
  final bool small;
  const ComwellErrorWidget(
      {super.key,
      required this.title,
      required this.subtitle,
      this.border = false,
      this.small = false});

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);
    return Padding(
      padding: const EdgeInsets.all(8.0),
      child: Container(
        width: double.infinity,
        decoration: BoxDecoration(
          color: Colors.white,
          border: border ? Border.all(color: colorDivider) : null,
          borderRadius: BorderRadius.circular(8),
        ),
        padding: const EdgeInsets.symmetric(vertical: 15.0),
        child: Container(
          padding: const EdgeInsets.symmetric(horizontal: 16.0),
          child: small ? Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              SvgPicture.asset('assets/icons/ic_error.svg',
                  width: 24, height: 24),
              const SizedBox(width: 12),
              Text(subtitle, style: theme.textTheme.headlineSmall, textAlign: TextAlign.center),
            ],
          ) : Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.start,
            mainAxisSize: MainAxisSize.min,
            children: [
              SvgPicture.asset('assets/icons/ic_error.svg',
                  width: 48, height: 48),
              const SizedBox(height: 30),
              Text(title,
                  style: theme.textTheme.headlineMedium,
                  textAlign: TextAlign.center),
              const SizedBox(height: 12),
              Text(subtitle,
                  style: theme.textTheme.bodySmall, textAlign: TextAlign.center),
            ],
          ),
        ),
      ),
    );
  }
}