copyAuthStatusToolEntry function

DeveloperToolEntry copyAuthStatusToolEntry({
  1. String? sectionLabel,
})

A DeveloperToolEntry that copies all local authentication status information to the clipboard as formatted text.

Includes device support, biometric hardware availability, and enrolled biometric types. Useful for quick bug reports and sharing device authentication capabilities with team members.

Implementation

DeveloperToolEntry copyAuthStatusToolEntry({String? sectionLabel}) {
  return DeveloperToolEntry(
    title: 'Copy Auth Status',
    sectionLabel: sectionLabel,
    description: 'Copy device auth capabilities to clipboard',
    icon: Icons.copy_all,
    debugInfo: (BuildContext context) async {
      try {
        return await _buildAuthReport();
      } catch (e) {
        return 'Error reading auth status: $e';
      }
    },
    onTap: (BuildContext context) async {
      try {
        final report = await _buildAuthReport();
        await Clipboard.setData(ClipboardData(text: report));
        if (context.mounted) {
          ScaffoldMessenger.of(context).showSnackBar(
            const SnackBar(
              content: Text('Auth status copied to clipboard'),
              duration: Duration(seconds: 2),
            ),
          );
        }
      } catch (e) {
        if (context.mounted) {
          ScaffoldMessenger.of(context).showSnackBar(
            SnackBar(
              content: Text('Failed to copy auth status: $e'),
              duration: const Duration(seconds: 3),
            ),
          );
        }
      }
    },
  );
}