import 'package:flutter/material.dart';

import 'package:provider/provider.dart';

import 'package:pshared/provider/accounts/employees.dart';

import 'package:pweb/widgets/employee/tile.dart';


class EmployeeTileProvider extends StatelessWidget {
  final String? employeeRef;
  final double? avatarRadius;
  final Widget? trailing;

  const EmployeeTileProvider({super.key, required this.employeeRef, this.avatarRadius, this.trailing});

  @override
  Widget build(BuildContext context) => Consumer<EmployeesProvider>(builder: (context, provider, _) {
    if (provider.isLoading) return const Center(child:  CircularProgressIndicator());
    return EmployeeTile.fromEmployee(
      context: context, 
      employee: provider.getEmployee(employeeRef), 
      avatarRadius: avatarRadius,
    );
  });
}