import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';

class VitalSignItem extends StatelessWidget {
  final String des;
  final String lastVal;
  final String unit;
  final String imagePath;
  final double height;
  final double width;

  const VitalSignItem(
      {Key key,
      @required this.des,
      this.lastVal = 'N/A',
      this.unit = '',
      this.height,
      this.width,
      @required this.imagePath})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return RoundedContainer(
      // margin: 0.025 * SizeConfig.realScreenWidth,
      // height: 0.15 * SizeConfig.realScreenHeight,
      // width: 0.45 * SizeConfig.realScreenWidth,
      child: Container(
        padding: EdgeInsets.all(5),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Expanded(
              child: Container(
                padding: EdgeInsets.only(top: 8),
                child: Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: <Widget>[
                    Expanded(
                      child: Container(
                        padding: EdgeInsets.only(left: 8, right: 8),
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          mainAxisAlignment: MainAxisAlignment.start,
                          children: [
                            AppText(
                              "$lastVal",
                              fontFamily: 'Poppins',
                              fontSize: SizeConfig.textMultiplier * 1.4,
                              fontWeight: FontWeight.w800,
                              margin: 0,
                            ),
                            Expanded(
                              child: AppText(
                                "$unit",
                                fontFamily: 'Poppins',
                                fontSize: SizeConfig.textMultiplier * 1.2,
                                fontWeight: FontWeight.w700,
                                color: HexColor('#B8382C'),
                                margin: 0,
                              ),
                            ),
                          ],
                        ),
                      ),
                    ),
                    Container(
                        child: Image.asset(
                      imagePath,
                      width: 40,
                      height: 40,
                    ))
                  ],
                ),
              ),
            ),
            Container(
              width: double.infinity,
              child: Align(
                alignment: Alignment.topLeft,
                child: Container(
                  margin: EdgeInsets.only(left: 5, right: 5),
                  child: AppText(
                    "$des",
                    fontFamily: 'Poppins',
                    fontSize: SizeConfig.textMultiplier * 1.3,
                    fontWeight: FontWeight.w600,
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
