import 'dart:ui';

import 'package:electronic_assistant/utils/expand.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';

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

Widget createPopupDivider(
    {Color color = const Color(0xFFF6F6F6), double height = 1}) {
  return Divider(color: color, height: height);
}

Widget createNormalPopupItem(String title, {VoidCallback? onItemClick}) {
  return GestureDetector(
    onTap: onItemClick,
    child: Container(
      color: Colors.transparent,
      padding: EdgeInsets.symmetric(horizontal: _itemPadding),
      height: _itemHeight,
      child: Align(
        alignment: Alignment.centerLeft,
        child: Text(
          title,
          style: TextStyle(
            fontSize: 14.sp,
            color: ColorName.primaryTextColor,
          ),
        ),
      ),
    ),
  );
}

GestureDetector createDeletePopupItem(VoidCallback? onDelete) {
  return GestureDetector(
    onTap: () {
      onDelete?.call();
    },
    child: Container(
      color: Colors.transparent,
      padding: EdgeInsets.symmetric(horizontal: _itemPadding),
      height: _itemHeight,
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Text(
            StringName.talkDelete.tr,
            style: TextStyle(color: '#F5574E'.toColor(), fontSize: 14.sp),
          ),
          const Spacer(),
          SizedBox(
              width: 20.w,
              height: 20.w,
              child: Assets.images.iconTalkDelete.image())
        ],
      ),
    ),
  );
}

final _itemHeight = 52.h;
final _itemPadding = 14.w;
