import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

class DepositBlock extends ConsumerWidget {
  final double max;

  const DepositBlock({super.key, required this.max});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final theme = ref.watch(themePortProvider);

    return Container(
      padding: EdgeInsets.all(20),
      decoration: BoxDecoration(
        color: theme.getColorFor(ThemeCode.backgroundPrimary),
        borderRadius: BorderRadius.all(Radius.circular(20)),
      ),
      margin: EdgeInsets.only(top: 10),
      child: Column(
        spacing: 24,
        children: [
          Align(
            alignment: Alignment.centerLeft,
            child: Text(
              "Ingresar dinero en el wallet",
              style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
            ),
          ),
          Column(
            spacing: 16,
            children: [
              Row(
                spacing: 16,
                children: [
                  Expanded(
                    child: CustomTextField(
                      label: "Cantidad",
                      hint: "0€",
                      numeric: true,
                    ),
                  ),
                  Align(
                    alignment: Alignment.bottomRight,
                    child: PrimaryButton(
                      onPressed: () => {},
                      text: "Ingresar",
                      color: theme.getColorFor(ThemeCode.buttonPrimary),
                      padding: 24,
                    ),
                  )
                ],
              ),
              Align(
                alignment: Alignment.topLeft,
                child: Row(
                  spacing: 4,
                  children: [
                    Icon(Icons.info_outline, size: 16),
                    Text("Máximo que puedes añadir: $max€"),
                  ],
                )
              ),
            ],
          )
        ],
      ),
    );
  }
}
