import 'package:flutter/material.dart';

import 'package:provider/provider.dart';
import 'package:pweb/models/wallet.dart';

import 'package:pweb/pages/payment_page/methods/widget.dart';
import 'package:pweb/pages/payment_page/wallet/wigets.dart';
import 'package:pweb/providers/payment_methods.dart';


class PaymentConfigPage extends StatelessWidget {
  final Function(Wallet) onWalletTap;

  const PaymentConfigPage({super.key, required this.onWalletTap});

  @override
  Widget build(BuildContext context) {
    final provider = context.watch<PaymentMethodsProvider>();

    if (provider.isLoading) {
      return const Center(child: CircularProgressIndicator());
    }

    if (provider.error != null) {
      return Center(child: Text('Error: ${provider.error}'));
    }

    return Column(
      children: [
        MethodsWidget(),
        Expanded(
          child: WalletWidgets(onWalletTap: onWalletTap),
        ),
      ],
    );
  }
}