import 'package:flutter/material.dart';

import 'package:provider/provider.dart';

import 'package:pshared/models/payment/type.dart';
import 'package:pshared/provider/payment/wallets.dart';

import 'package:pweb/app/router/payout_routes.dart';
import 'package:pweb/widgets/sidebar/destinations.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 walletsProvider = context.read<WalletsProvider>();
        final wallet = walletsProvider.selectedWallet;
        
        if (wallet != null) {
          context.pushToPayment(
            paymentType: PaymentType.wallet,
            returnTo: PayoutDestination.editwallet,
          );
        }
      },
      child: Text(loc.payoutNavSendPayout),
    );
  }
}
