1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-29 08:16:28 +00:00
comunicmobile/lib/ui/tiles/simple_user_tile.dart

41 lines
943 B
Dart
Raw Normal View History

2019-04-27 12:40:27 +00:00
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;
2019-04-27 14:23:08 +00:00
final Widget trailing;
2021-03-13 09:48:59 +00:00
final String subtitle;
2019-04-27 12:40:27 +00:00
2021-03-13 09:48:59 +00:00
const SimpleUserTile({
Key key,
this.user,
this.onTap,
this.trailing,
this.subtitle,
}) : assert(user != null),
2019-04-27 12:40:27 +00:00
super(key: key);
@override
Widget build(BuildContext context) {
return ListTile(
onTap: onTap == null ? null : () => onTap(user),
leading: AccountImageWidget(
user: user,
),
title: Text(user.fullName),
2021-03-13 09:48:59 +00:00
subtitle: subtitle == null ? null : Text(subtitle),
2019-04-27 14:23:08 +00:00
trailing: trailing,
2019-04-27 12:40:27 +00:00
);
}
}