import 'dart:ui';

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

import '../shared/app_texts_widget.dart';

// OWNER : Ibrahim albitar
// DATE : 08-04-2020
// DESCRIPTION : Custom Drawer item for app.

class DrawerItem extends StatefulWidget {
  final String title;
  final String subTitle;
  final IconData icon;
  final Color color;

  DrawerItem(this.title, this.icon, {this.color, this.subTitle = ''});

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

class _DrawerItemState extends State<DrawerItem> {
  @override
  Widget build(BuildContext context) {
    return Container(
        margin: EdgeInsets.only(top: 5, bottom: 5, left: 10, right: 10),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Icon(
              widget.icon,
              color: widget.color ?? Colors.black87,
              size: SizeConfig.imageSizeMultiplier * 5,
            ),
            Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                AppText(
                  widget.title,
                  color: widget.color ?? Colors.black,
                  // fontWeight: FontWeight.bold,
                  margin: 5,
                  fontSize: SizeConfig.textMultiplier * 2.3,
                ),
                AppText(
                  widget.subTitle,
                  visibility: !widget.subTitle.isNullOrEmpty(),
                  color: widget.color ?? Colors.black,
                  marginLeft: 5,
                  fontSize: SizeConfig.textMultiplier * 2.5,
                ),
              ],
            ),
          ],
        ));
  }
}
