import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.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/features/blood_donation/models/cities_model.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';

class CityListItem extends StatelessWidget {
  final CitiesModel cityModel;

  late AppState appState;

  CityListItem({super.key, required this.cityModel});

  @override
  Widget build(BuildContext context) {
    appState = getIt.get<AppState>();
    return DecoratedBox(
      decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
        color: AppColors.whiteColor,
        borderRadius: 20.h,
        hasShadow: false,
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              spacing: 8.h,
              children: [hospitalName],
            ),
          ),
          Transform.flip(
            flipX: appState.isArabic(),
            child: Utils.buildSvgWithAssets(
              icon: AppAssets.forward_arrow_icon,
              iconColor: AppColors.blackColor,
              width: 40.h,
              height: 40.h,
              fit: BoxFit.contain,
            ),
          ),
        ],
      ).paddingSymmetrical(16.h, 16.h),
    );
  }

  Widget get hospitalName => Row(
        children: [
          Expanded(
            child: (appState.isArabic() ? cityModel.descriptionN : cityModel.description)!.toText16(color: AppColors.textColor, isBold: true),
          )
        ],
      );
}
