TKeyValue.chip constructor

TKeyValue.chip(
  1. String key,
  2. String? text, {
  3. dynamic chipIcon,
  4. Color? color,
  5. Color? background,
  6. Color? textColor,
  7. TVariant? type,
  8. TSize size = TChipSize.sm,
  9. VoidCallback? onTap,
  10. Widget? trailing,
  11. BorderRadius? chipBorderRadius,
  12. Widget? icon,
  13. double? width,
  14. Alignment? alignment,
  15. double? minWidth,
  16. double? maxWidth,
})

Creates a key-value item for displaying a chip using TChip.

Implementation

factory TKeyValue.chip(
  String key,
  String? text, {
  dynamic chipIcon,
  Color? color,
  Color? background,
  Color? textColor,
  TVariant? type,
  TSize size = TChipSize.sm,
  VoidCallback? onTap,
  Widget? trailing,
  BorderRadius? chipBorderRadius,
  Widget? icon,
  double? width,
  Alignment? alignment,
  double? minWidth,
  double? maxWidth,
}) {
  Widget? widget;
  if (text != null && text.isNotEmpty) {
    widget = TChip(
      text: text,
      icon: chipIcon,
      trailing: trailing,
      color: color,
      background: background,
      textColor: textColor,
      type: type,
      size: size,
      onTap: onTap,
      borderRadius: chipBorderRadius,
    );
  }
  return TKeyValue(
    key,
    value: text,
    widget: widget,
    icon: icon,
    width: width,
    alignment: alignment,
    minWidth: minWidth,
    maxWidth: maxWidth,
  );
}