import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/widgets/local_text.dart';
import 'package:flutter/material.dart';

Widget itemTitle(BuildContext context, String textKey) {
  return Padding(
    padding: const EdgeInsets.only(left: 18.0, top: 25, bottom: 5),
    child: Text(
      AppTranslations.of(context).text(textKey),
      style: TextStyle(
          fontWeight: FontWeight.bold, fontSize: 18, color: Colors.black),
    ),
  );
}

Widget subItemTitle(BuildContext context, String textKey, {IconData iconData}) {
  return Padding(
    padding: const EdgeInsets.only(left: 0, top: 0, bottom: 0),
    child: Row(
      children: [
        Icon(
          iconData,
          color: primaryColor,
        ),
        SizedBox(width: 10),
        Text(
          AppTranslations.of(context).text(textKey),
          style: TextStyle(
              fontWeight: FontWeight.w700, fontSize: 15, color: primaryColor),
        ),
      ],
    ),
  );
}

Widget contactItem(BuildContext context, String text, IconData iconData,
    {Function() onTap, String labelKey}) {
  return Material(
    child: Padding(
      padding: const EdgeInsets.only(left: 18.0, bottom: 10, right: 18),
      child: Container(
        decoration: BoxDecoration(
          border: Border.all(color: Colors.grey, width: 0.8),
          borderRadius: BorderRadius.all(
              Radius.circular(5.0) //         <--- border radius here
              ),
        ),
        child: InkWell(
            onTap: () => onTap != null ? onTap() : null,
            child: SingleChildScrollView(
              scrollDirection: Axis.horizontal,
              child: Row(
                children: <Widget>[
                  Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: Icon(
                      iconData,
                      color: primaryColor,
                    ),
                  ),
                  Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      labelKey == null
                          ? Container()
                          : Padding(
                              padding: EdgeInsets.fromLTRB(10, 10, 10, 0),
                              child: LocalText(context, labelKey,
                                  color: primaryColor,
                                  fontWeight: FontWeight.w500,
                                  fontSize: 18),
                            ),
                      Padding(
                        padding: const EdgeInsets.all(8.0),
                        child: Text(
                          text == null ? "" : text,
                          overflow: TextOverflow.ellipsis,
                          maxLines: 5,
                          style: TextStyle(
                            fontSize: 14.0,
                          ),
                        ),
                      ),
                    ],
                  ),
                  SizedBox(
                    width: 5,
                  ),
                  onTap == null
                      ? Container()
                      : Icon(
                          Icons.open_in_new,
                          color: Colors.grey,
                          size: 15,
                        )
                ],
              ),
            )),
      ),
    ),
  );
}
