import 'package:flutter/material.dart';

import 'package:pweb/utils/logout.dart';

import 'package:pweb/generated/i18n/app_localizations.dart';


class LogoutTile extends StatelessWidget {
  const LogoutTile({
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    return ListTile(
      leading: const Icon(Icons.logout),
      title: Text(AppLocalizations.of(context)!.navigationLogout),
      onTap: () => _logout(context),
    );
  }

  Future<void> _logout(BuildContext context) async {
    Navigator.pop(context); 
    await logoutUtil(context);
  }
}
