mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-12-28 13:58:51 +00:00
41 lines
943 B
Dart
41 lines
943 B
Dart
import 'package:comunic/models/user.dart';
|
|
import 'package:comunic/ui/widgets/account_image_widget.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
/// Simple user tile
|
|
///
|
|
/// Basically this only shows the name of the user + its account image
|
|
///
|
|
/// @author Pierre HUBERT
|
|
|
|
typedef OnUserTap = void Function(User);
|
|
|
|
class SimpleUserTile extends StatelessWidget {
|
|
final User user;
|
|
final OnUserTap onTap;
|
|
final Widget trailing;
|
|
final String subtitle;
|
|
|
|
const SimpleUserTile({
|
|
Key key,
|
|
this.user,
|
|
this.onTap,
|
|
this.trailing,
|
|
this.subtitle,
|
|
}) : assert(user != null),
|
|
super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ListTile(
|
|
onTap: onTap == null ? null : () => onTap(user),
|
|
leading: AccountImageWidget(
|
|
user: user,
|
|
),
|
|
title: Text(user.fullName),
|
|
subtitle: subtitle == null ? null : Text(subtitle),
|
|
trailing: trailing,
|
|
);
|
|
}
|
|
}
|