build method

  1. @override
Widget build(
  1. BuildContext context,
  2. Card content
)
override

Builds the layout widget tree for the given content item.

This method is called by the content system to render the content item with the specified layout.

Implementation

@override
Widget build(BuildContext context, vf.Card content) {
  final user = vyuh.auth.currentUser;
  if (user.isUnknown) {
    return _UnknownUserCard(content: content);
  }

  return Card.outlined(
    child: Padding(
      padding: const EdgeInsets.all(8.0),
      child: Row(
        children: [
          CircleAvatar(
            radius: 64,
            foregroundImage:
                user.photoUrl != null ? NetworkImage(user.photoUrl!) : null,
            child: user.photoUrl == null ? const Icon(Icons.person) : null,
          ),
          const SizedBox(
              width: 16), // Add some space between the avatar and the text
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text.rich(TextSpan(
                  text: 'User: ',
                  children: [
                    TextSpan(
                        text: user.name ?? 'N/A',
                        style: const TextStyle(fontWeight: FontWeight.bold)),
                  ],
                )),
                Text('Email: ${user.email ?? 'N/A'}'),
                Text('Phone: ${user.phoneNumber ?? 'N/A'}'),
                Row(
                  children: [
                    Text('Method: ${user.loginMethod.label()}'),
                    const SizedBox(width: 8),
                    Icon(user.loginMethod.icon(), size: 24),
                  ],
                ),
                _LogoutButton(content: content),
              ],
            ),
          ),
        ],
      ),
    ),
  );
}