buildUserActionsSection function

Widget buildUserActionsSection(
  1. BuildContext context
)

Builds the logout and debug buttons section. Only visible when user is logged in.

Implementation

Widget buildUserActionsSection(BuildContext context) {
  return FutureBuilder<String?>(
    future: getWebId(),
    builder: (context, snapshot) {
      final isLoggedIn = snapshot.data != null && snapshot.data!.isNotEmpty;
      if (!isLoggedIn) return const SizedBox.shrink();

      return Column(
        children: [
          Center(
            child: TextButton.icon(
              onPressed: () async {
                // Close settings dialog first.
                Navigator.pop(context);

                // Then handle logout.
                await SolidAuthHandler.instance.handleLogout(context);
              },
              icon: const Icon(Icons.logout, size: 18),
              label: const Text('Logout'),
              style: TextButton.styleFrom(foregroundColor: Colors.red.shade400),
            ),
          ),
          const SizedBox(height: 8),

          // DEBUG: Delete encryption keys from server.
          Center(
            child: TextButton.icon(
              onPressed: () => deleteEncryptionKeys(context),
              icon: const Icon(Icons.delete_forever, size: 18),
              label: const Text('Delete Encryption Keys (DEBUG)'),
              style: TextButton.styleFrom(
                foregroundColor: Colors.orange.shade700,
              ),
            ),
          ),
        ],
      );
    },
  );
}