34 lines
969 B
Dart
34 lines
969 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:pshared/models/account/account.dart';
|
|
|
|
import 'package:pweb/widgets/employee/avatar/widget.dart';
|
|
|
|
import 'package:pweb/generated/i18n/app_localizations.dart';
|
|
|
|
|
|
class EmployeeTile extends StatelessWidget {
|
|
final String name;
|
|
final String? avatarUrl;
|
|
final double? avatarRadius;
|
|
final Widget? trailing;
|
|
|
|
const EmployeeTile({super.key, required this.name, this.avatarUrl, this.avatarRadius, this.trailing});
|
|
|
|
factory EmployeeTile.fromEmployee({
|
|
required BuildContext context,
|
|
Account? employee,
|
|
double? avatarRadius
|
|
}) => EmployeeTile(
|
|
name: employee?.name ?? AppLocalizations.of(context)!.unknown,
|
|
avatarUrl: employee?.avatarUrl,
|
|
avatarRadius: avatarRadius,
|
|
);
|
|
|
|
@override
|
|
Widget build(BuildContext context) => ListTile(
|
|
leading: EmployeeAvatar(avatarUrl: avatarUrl, employeeName: name, radius: avatarRadius),
|
|
title: Text(name),
|
|
trailing: trailing,
|
|
);
|
|
} |