import 'package:chat/data/constants.dart';
import 'package:flutter/material.dart';

class KeyboardIcon extends StatelessWidget {
  final int iconCode;
  final VoidCallback onTap;
  final bool isSelect;
  final int selectIconCode;
  final double size;
  KeyboardIcon(
      {this.iconCode, this.onTap, this.isSelect = false, this.selectIconCode,this.size = 28});

  @override
  Widget build(BuildContext context) {
    var color = isSelect ? Color(0xFF0A80F3) : Color(0xFF797A7C);
    var code;
    if (selectIconCode == null) {
      code = iconCode;
    } else {
      code = isSelect ? selectIconCode : iconCode;
    }
    return InkWell(
        child: Icon(
          IconData(code, fontFamily: Constants.IconFontFamily),
          color: color,
          size: size,
        ),
        onTap: onTap);
  }
}