import 'package:flutter/material.dart';


class PasswordToggleButton extends StatelessWidget {
  const PasswordToggleButton({
    super.key,
    required this.title,
    required this.isExpanded,
    required this.isBusy,
    required this.onToggle,
  });

  final String title;
  final bool isExpanded;
  final bool isBusy;
  final VoidCallback onToggle;

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);
    final iconColor = theme.colorScheme.primary;

    return TextButton.icon(
      onPressed: isBusy
          ? null
          : () {
              onToggle();
            },
      icon: Icon(
        isExpanded ? Icons.lock_open : Icons.lock_outline,
        color: iconColor,
      ),
      label: Text(title, style: theme.textTheme.bodyMedium),
    );
  }
}
