import 'package:flutter/material.dart';

import 'package:provider/provider.dart';

import 'package:pweb/providers/page_selector.dart';
import 'package:pweb/providers/wallets.dart';

import 'package:pweb/generated/i18n/app_localizations.dart';


class SendPayoutButton extends StatelessWidget {
  const SendPayoutButton({super.key});

  @override
  Widget build(BuildContext context) {
    final loc = AppLocalizations.of(context)!;
    return ElevatedButton(
      style: ElevatedButton.styleFrom(
        shadowColor: null,
        elevation: 0,
      ),
      onPressed: () {
        final pageSelectorProvider = context.read<PageSelectorProvider>();
        final walletsProvider = context.read<WalletsProvider>();
        final wallet = walletsProvider.selectedWallet;
        
        if (wallet != null) {
          pageSelectorProvider.startPaymentFromWallet(wallet);
        }
      },
      child: Text(loc.payoutNavSendPayout),
    );
  }
}
