import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.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(
        children: [
          Text(
            "Ingresar dinero en el wallet",
            style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
          ),
          Row(
            spacing: 10,
            children: [
              Expanded(
                child: TextField(
                  decoration: InputDecoration(
                    labelText: "Cantidad",
                    hintText: "0€",
                    border: OutlineInputBorder(),
                  ),
                  keyboardType: TextInputType.number,
                  inputFormatters: [FilteringTextInputFormatter.digitsOnly],
                ),
              ),
              FilledButton(
                onPressed: () => {},
                style: ButtonStyle(
                  backgroundColor: WidgetStatePropertyAll<Color>(
                    theme.getColorFor(ThemeCode.buttonPrimary),
                  ),
                ),
                child: Text("Ingresar"),
              ),
            ],
          ),
          Align(
            alignment: Alignment.topLeft,
            child: Text("Máximo que puedes añadir: $max€"),
          ),
        ],
      ),
    );
  }
}
