keyHeadIconInfo static method

InfoModal keyHeadIconInfo(
  1. String keyTitle,
  2. String valueTitle, {
  3. Widget? headIcon,
  4. double? fontSize,
  5. double? itemSpacing,
  6. TextStyle? keyTextStyle,
  7. TextStyle? valueTextStyle,
  8. bool isArrow = false,
  9. VoidCallback? valueClickCallback,
  10. PairInfoTableConfig? themeData,
})

key的前面有一个自定义的icon icon和文本间距是8

keyTitle 显示的key文案 valueTitle 显示的value文案 headIcon key前面的icon fontSize 文本 isArrow 是否最右侧存在箭头

Implementation

static InfoModal keyHeadIconInfo(
  String keyTitle,
  String valueTitle, {
  Widget? headIcon,
  double? fontSize,
  double? itemSpacing,
  TextStyle? keyTextStyle,
  TextStyle? valueTextStyle,
  bool isArrow = false,
  VoidCallback? valueClickCallback,
  PairInfoTableConfig? themeData,
}) {
  themeData ??= PairInfoTableConfig();
  themeData = BaseThemeConfig.instance
      .getConfig(configId: themeData.configId)
      .pairInfoTableConfig
      .merge(themeData);
  themeData = themeData.merge(PairInfoTableConfig(
      itemSpacing: itemSpacing,
      keyTextStyle: BaseTextStyle(fontSize: fontSize)
          .merge(BaseTextStyle.withStyle(keyTextStyle)),
      valueTextStyle: BaseTextStyle(fontSize: fontSize)
          .merge(BaseTextStyle.withStyle(valueTextStyle))));

  RichTextGenerator keyGen = RichTextGenerator();
  if (headIcon != null) {
    keyGen.addIcon(
        SizedBox(
          height: 12,
          width: 12,
          child: headIcon,
        ),
        alignment: PlaceholderAlignment.top);
    keyGen.addIcon(
        const SizedBox(
          width: 8,
        ),
        alignment: PlaceholderAlignment.middle);
  }

  keyGen.addText(keyTitle,
      textStyle: themeData.keyTextStyle.generateTextStyle());

  return InfoModal(
      keyPart: keyGen.build(),
      valuePart: valueTitle,
      isArrow: isArrow,
      valueClickCallback: valueClickCallback);
}