import 'dart:ui';

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

///
class DrawerItem extends StatefulWidget {
  final String title;
  final String subTitle;
  final IconData icon;
  final Color textColor;
  final Color iconColor;
  final bool bottomLine;
  final bool sideArrow;
  DrawerItem(this.title, this.icon,
      {this.textColor = Colors.black,
      this.iconColor = Colors.black87,
      this.subTitle = '',
      this.bottomLine = true,
      this.sideArrow = 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: Icon(
                    widget.icon,
                    color: widget.iconColor,
                    size: SizeConfig.imageSizeMultiplier * 5,
                  )),
              Expanded(
                  flex: 7,
                  child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: <Widget>[
                        Texts(
                          widget.title,
                          color: widget.textColor,
                          fontSize: SizeConfig.textMultiplier * 2.3,
                        ),
                        widget.subTitle != ''
                            ? Texts(
                                widget.subTitle,
                                color: widget.textColor,
                                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())
            ],
          ),
        ));
  }
}
