cofounderella/lib/components/user_tile.dart

48 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
class UserTile extends StatelessWidget {
final String text;
final String? profileImageUrl;
final void Function()? onTap;
const UserTile({
super.key,
required this.text,
this.profileImageUrl,
required this.onTap,
});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.secondary,
borderRadius: BorderRadius.circular(12),
),
margin: const EdgeInsets.symmetric(vertical: 5, horizontal: 25),
padding: const EdgeInsets.all(20),
child: Row(
children: [
// Profile image
if (profileImageUrl != null && profileImageUrl!.isNotEmpty)
CircleAvatar(
backgroundImage: NetworkImage(profileImageUrl!),
radius: 24,
),
// Icon if profile image is not set
if (profileImageUrl == null || profileImageUrl!.isEmpty)
const Icon(Icons.person),
const SizedBox(width: 20),
// user name
Text(text),
],
),
),
);
}
}