import 'dart:ffi';

import 'package:doctor_app_flutter/config/size_config.dart';

import '../shared/rounded_container_widget.dart';
import 'package:flutter/material.dart';
import '../shared/app_texts_widget.dart';

class DashboardItemIconText extends StatefulWidget {
  final IconData icon;
  final String value;
  final String label;
  final Color backgroundColor;
  final bool showBorder;
  final Color borderColor;
  final double titleFontSize;
  final Color titleFontColor;
  final Color valueFontColor;
  final double valueFontSize;
  final Color iconColor;
// OWNER : Ibrahim albitar
// DATE : 05-04-2020
// DESCRIPTION : Custom widget for dashboard items has texts and icons widgets

  DashboardItemIconText(this.icon, this.value, this.label,
      {this.backgroundColor = Colors.white,
      this.showBorder = false,
      this.titleFontSize = 12,
      this.valueFontSize = 26,
      this.valueFontColor = Colors.white,
      this.titleFontColor = Colors.white,
      this.iconColor = Colors.white,
      this.borderColor = Colors.white});
  @override
  _DashboardItemTextsState createState() => _DashboardItemTextsState();
}

class _DashboardItemTextsState extends State<DashboardItemIconText> {
  @override
  Widget build(BuildContext context) {
    return new RoundedContainer(
      margin: 10,
      child: Stack(
        children: <Widget>[
          Align(
              alignment: FractionalOffset.topLeft,
              child: Container(
                padding: EdgeInsets.all(10),
                child: Icon(
                  widget.icon,
                  size: SizeConfig.textMultiplier * 2.8,
                  color: widget.iconColor,
                ),
              )),
          Align(
              alignment: FractionalOffset.bottomRight,
              child: Container(
                  padding: EdgeInsets.all(10),
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.end,
                    crossAxisAlignment: CrossAxisAlignment.end,
                    children: <Widget>[
                      AppText(
                        widget.value,
                        color: widget.valueFontColor,
                        fontSize: widget.valueFontSize,
                      ),
                      AppText(
                        widget.label,
                        color: widget.titleFontColor,
                        fontSize: widget.titleFontSize,
                      ),
                    ],
                  ))),
        ],
      ),
      backgroundColor: widget.backgroundColor,
      showBorder: widget.showBorder,
      borderColor: widget.borderColor,
    );
  }
}
