import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/main/model/language_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class DisplayText extends StatelessWidget {
  final String text;
  final String labelTextKey;
  final IconData iconData;
  final int maxLines;
  final bool withBorder;
  final Color borderColor;
  final Widget icon;

  const DisplayText({
    Key key,
    this.text,
    this.labelTextKey,
    this.iconData,
    this.maxLines = 1,
    this.withBorder = false,
    this.borderColor,
    this.icon,
  }) : super(key: key);
  @override
  Widget build(BuildContext context) {
    var languageModel = Provider.of<LanguageModel>(context);

    var labelStyle = languageModel.isEng
        ? TextStyle(
            color: Colors.black54,
          )
        : TextStyle(color: Colors.black54, fontFamily: "Myanmar3");
    var textStyle = languageModel.isEng
        ? TextStyle(
            color: primaryColor,
          )
        : TextStyle(color: primaryColor, fontFamily: "Myanmar3");

    return Padding(
      padding: const EdgeInsets.only(top: 8.0, bottom: 8),
      child: Row(
        children: [
          iconData == null
              ? icon == null ? Container() : icon
              : Padding(
                  padding: const EdgeInsets.only(
                      left: .0, right: 15.0, top: 8.0, bottom: 8.0),
                  child: Icon(
                    iconData,
                    color: primaryColor,
                  ),
                ),
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                labelTextKey == null
                    ? Container()
                    : Text(
                        AppTranslations.of(context).text(labelTextKey),
                        style: labelStyle,
                      ),
                text == null
                    ? Container()
                    : Text(
                        text,
                        style: textStyle,
                      ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
