import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';

class WelcomeWidget extends StatelessWidget {
  final String name;
  final String imageUrl;
  final VoidCallback? onTap;

  const WelcomeWidget({
    super.key,
    required this.name,
    required this.imageUrl,
    this.onTap,
  });

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: onTap,
      borderRadius: BorderRadius.circular(30),
      child: Row(
        mainAxisSize: MainAxisSize.min,
        spacing: 8.h,
        children: [
          Image.asset(imageUrl, width: 40, height: 40),
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            spacing: 4.h,
            mainAxisSize: MainAxisSize.min,
            children: [
              "Welcome".needTranslation.toText14(color: AppColors.greyTextColor, height: 1, weight: FontWeight.w500),
              Row(
                spacing: 4.h,
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisSize: MainAxisSize.min,
                children: [
                  Flexible(child: name.toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1, height: 1)),
                  const Icon(Icons.keyboard_arrow_down, size: 20, color: Colors.black),
                ],
              ),
            ],
          ).expanded,
        ],
      ),
    );
  }
}
