import 'package:flutter/material.dart';

import 'package:provider/provider.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 TopUpButton extends StatelessWidget{
  const TopUpButton({super.key});

  @override
  Widget build(BuildContext context) {
    final loc = AppLocalizations.of(context)!;
    return ElevatedButton(
      style: ElevatedButton.styleFrom(
        shadowColor: null,
        elevation: 0,
      ),
      onPressed: () {
        final wallet = context.read<WalletsProvider>().selectedWallet;
        if (wallet == null) {
          ScaffoldMessenger.of(context).showSnackBar(
            SnackBar(content: Text(loc.noWalletSelected)),
          );
          return;
        }
        context.pushToWalletTopUp(returnTo: PayoutDestination.editwallet);
      },
      child: Text(loc.topUpBalance),
    );
  }
}
