keyOrValueTitleText method

Widget keyOrValueTitleText(
  1. bool isKey,
  2. String text, {
  3. bool isValueAlign = true,
  4. bool isArrow = false,
  5. required PairInfoTableConfig themeData,
})

Implementation

Widget keyOrValueTitleText(bool isKey, String text,
    {bool isValueAlign = true,
    bool isArrow = false,
    required PairInfoTableConfig themeData}) {
  bool isSingle;
  if (isArrow) {
    isSingle = true;
  } else {
    isSingle = !isValueAlign;
  }

  String show;
  if (text.isEmpty) {
    if (isKey) {
      show = '--:';
    } else {
      show = '--';
    }
  } else {
    show = text;
  }

  Widget keyOrValue = Text(
    show,
    overflow: isSingle ? TextOverflow.ellipsis : TextOverflow.clip,
    maxLines: isSingle ? 1 : null,
    style: isKey
        ? themeData.keyTextStyle.generateTextStyle()
        : themeData.valueTextStyle.generateTextStyle(),
  );
  return keyOrValue;
}