import 'dart:ui';

import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:flutter/material.dart';

///
class DrawerItem extends StatefulWidget {
  final String title;
  final String subTitle;
  final icon;
  final Color textColor;
  final Color iconColor;
  final bool bottomLine;
  final bool sideArrow;
  final Widget count;
  final bool isImageIcon;
  DrawerItem(this.title, this.icon,
      {this.textColor,
      this.iconColor,
      this.subTitle = '',
      this.bottomLine = true,
      this.count,
      this.sideArrow = false,
      this.isImageIcon = false});

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

class _DrawerItemState extends State<DrawerItem> {
  @override
  Widget build(BuildContext context) {
    return Container(
        decoration: widget.bottomLine == true
            ? BoxDecoration(
                border: Border(
                bottom: BorderSide(
                  //                   <--- left side
                  color: Colors.grey[200],
                  width: 1.0,
                ),
              ))
            : BoxDecoration(),
        child: Padding(
          padding: EdgeInsets.all(10),
          child: Row(
            children: <Widget>[
              Expanded(
                  flex: 1,
                  child: widget.isImageIcon == true
                      ? widget.icon
                      : Icon(
                          widget.icon,
                          color: widget.iconColor == null
                              ? Theme.of(context).textTheme.bodyText1.color
                              : widget.iconColor,
                          size: SizeConfig.imageSizeMultiplier * 5,
                        )),
              Expanded(
                  flex: 7,
                  child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: <Widget>[
                        Row(
                          children: [
                            AppText(
                              widget.title,
                              fontSize: SizeConfig.textMultiplier * 2.3,
                            ),
                            widget.count ?? SizedBox(),
                          ],
                        ),
                        widget.subTitle != ''
                            ? AppText(
                                widget.subTitle,
                                fontSize: SizeConfig.textMultiplier * 2.5,
                              )
                            : SizedBox(),
                      ])),
              widget.sideArrow == true
                  ? Expanded(
                      flex: 1,
                      child:
                          Icon(Icons.keyboard_arrow_right, color: Colors.red))
                  : Expanded(flex: 1, child: SizedBox()),
            ],
          ),
        ));
  }
}
