import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';

import '../../../../config/size_config.dart';
import '../../../../widgets/shared/rounded_container_widget.dart';

/*
 *@author: Elham Rababah 
 *@Date:03/6/2020
 *@param:
 *@return:
 *@desc: VitalSignItem
 */
class VitalSignItem extends StatelessWidget {
  const VitalSignItem(
      {Key key,
      @required this.url,
      @required this.des,
      this.lastVal = 'N/A',
      this.unit = '',
      this.height,
      this.width})
      : super(key: key);

  final String url;
  final String des;
  final String lastVal;
  final String unit;

  final double height;
  final double width;

  @override
  Widget build(BuildContext context) {
    return RoundedContainer(
      margin: 0.025 * SizeConfig.realScreenWidth,
      height: 0.14 * SizeConfig.realScreenHeight,
      width: 0.45 * SizeConfig.realScreenWidth,
      child: Container(
        padding: EdgeInsets.all(5),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Expanded(
              flex: 2,
              child: Text(
                des,
                style: TextStyle(
                    fontSize: 1.7 * SizeConfig.textMultiplier,
                    color: Hexcolor('#B8382C'),
                    fontWeight: FontWeight.bold),
              ),
            ),
            Expanded(
              flex: 1,
              child: Column(
                children: <Widget>[
                  Expanded(
                    child: Image.asset(
                      url,
                      height: SizeConfig.heightMultiplier * 7,
                    ),
                  ),
                  Expanded(
                      child: RichText(
                    text: TextSpan(
                      style: TextStyle(color: Colors.black),
                      children: [
                        new TextSpan(text: lastVal),
                        new TextSpan(
                          text: ' ${unit}',
                          style: TextStyle(
                            color: Hexcolor('#B8382C'),
                          ),
                        ),
                      ],
                    ),
                  ))
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}
