import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:location/resource/colors.gen.dart';

import '../resource/assets.gen.dart';

Decoration getPrimaryBtnDecoration(double radius) {
  return BoxDecoration(
    color: ColorName.colorPrimary,
    borderRadius: BorderRadius.circular(radius),
  );
}

Widget buildCustomAvatarView({required double size, required String avatar}) {
  return SizedBox(
    width: size,
    height: size,
    child: ClipOval(
      child: CachedNetworkImage(imageUrl: avatar, fit: BoxFit.cover),
    ),
  );
}

Widget buildCustomAvatarOrDefaultAvatarView({
  required double size,
  required String? avatar,
  required bool isMine,
}) {
  return avatar != null
      ? buildCustomAvatarView(avatar: avatar, size: size)
      : Image.asset(
          (isMine == true
              ? Assets.images.iconDefaultMineAvatar.path
              : Assets.images.iconDefaultFriendAvatar.path),
          width: size,
          height: size);
}
