/* 
 * This file is part of Stack Wallet.
 * 
 * Copyright (c) 2023 Cypher Stack
 * All Rights Reserved.
 * The code is distributed under GPLv3 license, see LICENSE file for details.
 * Generated by Cypher Stack on 2023-05-26
 *
 */

import 'package:flutter/material.dart';
import 'paynym_bot.dart';
import '../../../themes/stack_colors.dart';
import '../../../utilities/format.dart';
import '../../../utilities/text_styles.dart';
import '../../../utilities/util.dart';
import '../../../widgets/custom_buttons/paynym_follow_toggle_button.dart';

class PaynymCard extends StatefulWidget {
  const PaynymCard({
    super.key,
    required this.walletId,
    required this.label,
    required this.paymentCodeString,
  });

  final String walletId;
  final String label;
  final String paymentCodeString;

  @override
  State<PaynymCard> createState() => _PaynymCardState();
}

class _PaynymCardState extends State<PaynymCard> {
  final isDesktop = Util.isDesktop;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: isDesktop
          ? const EdgeInsets.symmetric(
              vertical: 16,
              horizontal: 20,
            )
          : const EdgeInsets.all(12),
      child: Row(
        children: [
          PayNymBot(
            size: 36,
            paymentCodeString: widget.paymentCodeString,
          ),
          const SizedBox(
            width: 12,
          ),
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  widget.label,
                  style: isDesktop
                      ? STextStyles.desktopTextExtraExtraSmall(context)
                          .copyWith(
                          color: Theme.of(context)
                              .extension<StackColors>()!
                              .textFieldActiveText,
                        )
                      : STextStyles.w500_14(context),
                ),
                const SizedBox(
                  height: 2,
                ),
                Text(
                  Format.shorten(widget.paymentCodeString, 12, 5),
                  style: isDesktop
                      ? STextStyles.desktopTextExtraExtraSmall(context)
                      : STextStyles.w500_14(context).copyWith(
                          color: Theme.of(context)
                              .extension<StackColors>()!
                              .textSubtitle1,
                        ),
                ),
              ],
            ),
          ),
          PaynymFollowToggleButton(
            walletId: widget.walletId,
            paymentCodeStringToFollow: widget.paymentCodeString,
          ),
        ],
      ),
    );
  }
}