import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; class ListItem extends StatelessWidget { final IconData icon; final Function onTap; final Color color; final Color iconColor; final bool disabled; final bool arrowIcon; final double arrowIconSize; final Color arrowIconColor; final EdgeInsets padding; final Widget itemContent; final BoxDecoration decoration; ListItem( {Key key, this.icon, this.iconColor, this.disabled: false, this.onTap, this.color, this.arrowIcon = false, this.padding, this.itemContent, this.arrowIconColor, this.arrowIconSize = 20, this.decoration}) : super(key: key); @override Widget build(BuildContext context) { return IgnorePointer( ignoring: disabled, child: Container( decoration: decoration != null ? decoration : BoxDecoration(), child: InkWell( onTap: () { if (onTap != null) onTap(); }, child: Padding( padding: padding != null ? padding : const EdgeInsets.symmetric(horizontal: 24.0, vertical: 16.0), child: Row( children: [ if (icon != null) Icon( icon, color: iconColor ?? (color ?? Theme.of(context).primaryColor), size: 19, ), if (icon != null) SizedBox(width: 18.0), Opacity(opacity: 0.8, child: itemContent), if (arrowIcon) Expanded(child: Container()), if (arrowIcon) Icon( EvaIcons.chevronRight, color: arrowIconColor != null ? arrowIconColor : Colors.grey[500], size: arrowIconSize, ) ], ), ), ), ), ); } }