import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';

import '../globals.dart';
import '../services/auth_service.dart';

Widget? buildCurrentProfileButton(BuildContext context) {
  final service = getIt<AccountsService>();
  if (!service.loggedIn) {
    return null;
  }

  return Builder(builder: (context) {
    return IconButton(
        onPressed: () {
          Scaffold.of(context).openDrawer();
        },
        icon: CachedNetworkImage(imageUrl: service.currentProfile.avatar));
  });
}
