Frontend first draft
This commit is contained in:
34
frontend/pweb/lib/widgets/employee/tile.dart
Normal file
34
frontend/pweb/lib/widgets/employee/tile.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
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,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user