import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

// OWNER : Ibrahim albitar
// DATE : 12-04-2020
// DESCRIPTION : Customization for Texts in app

class AppText extends StatefulWidget {
  final String data;
  final Color color;
  final FontWeight fontWeight;
  final double fontSize;
  final String fontFamily;
  final double margin;
  final double marginTop;
  final double marginRight;
  final double marginBottom;
  final double marginLeft;
  final bool visibility;
  final TextAlign textAlign;
  final Color backGroundcolor;
  final TextOverflow textOverflow;
  AppText(this.data,
      {this.color = Colors.black,
      this.fontWeight = FontWeight.normal,
      this.fontSize,
      this.fontFamily = 'WorkSans',
      this.margin,
      this.marginTop = 0,
      this.marginRight = 0,
      this.marginBottom = 0,
      this.marginLeft = 0,
      this.visibility = true,
      this.textAlign,
      this.textOverflow,
      this.backGroundcolor = Colors.white});

  @override
  _AppTextState createState() => _AppTextState();
}

class _AppTextState extends State<AppText> {
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: widget.margin != null
          ? EdgeInsets.all(widget.margin)
          : EdgeInsets.only(
              top: widget.marginTop,
              right: widget.marginRight,
              bottom: widget.marginBottom,
              left: widget.marginLeft),
      child: Text(
        widget.data,
        textAlign: widget.textAlign,
        overflow: widget.textOverflow ?? TextOverflow.clip,
        style: TextStyle(
          color: widget.color,
          fontWeight: widget.fontWeight,
          fontSize: widget.fontSize ?? (SizeConfig.textMultiplier * 2),
          fontFamily: widget.fontFamily,

          // backgroundColor:widget.backGroundcolor
        ),
      ),
    );
  }
}
