ErrorSnackBar constructor

ErrorSnackBar({
  1. Key? key,
  2. required String message,
  3. required BuildContext context,
})

Take in parameter the message and the context

Implementation

ErrorSnackBar(
    {super.key, required this.message, required BuildContext context})
    : super(
        behavior: SnackBarBehavior.floating,
        duration: const Duration(seconds: 2),
        padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
        backgroundColor: AppColors.red400,
        shape: RoundedRectangleBorder(
          side: const BorderSide(color: AppColors.red500, width: 2),
          borderRadius: BorderRadius.circular(64),
        ),
        content: Row(children: [
          Container(
            height: 48,
            width: 48,
            decoration: const BoxDecoration(
              color: AppColors.red600,
              shape: BoxShape.circle,
            ),
            child: const Icon(BootstrapIcons.exclamation_triangle,
                color: Colors.white),
          ),
          const SizedBox(width: 16),
          Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
            const Text("Une erreur est survenue",
                style: TextStyle(
                    fontSize: 14,
                    fontFamily: 'Poppins',
                    fontWeight: FontWeight.bold)),
            Text(message,
                style: const TextStyle(fontFamily: 'Poppins', fontSize: 12)),
          ]),
        ]),
      );