getTitleAndDescription method

Widget getTitleAndDescription(
  1. TUIThemeData theme
)

Implementation

Widget getTitleAndDescription(TUIThemeData theme) {
  TextStyle titleTextStyle = theme.typography.body7.copyWith(
    color: theme.colors.onSurface,
  );

  TextStyle descriptionTextStyle = theme.typography.body8.copyWith(
    color: theme.colors.inputTextDim,
  );

  Text titleWidget = Text(
    title,
    overflow: TextOverflow.ellipsis,
    style: titleTextStyle,
  );

  List<Widget> titleAndDescription = [titleWidget];

  Text descriptionWidget = Text(
    description,
    overflow: TextOverflow.ellipsis,
    style: descriptionTextStyle,
  );

  if (description.isNotEmpty) {
    titleAndDescription.add(descriptionWidget);
  }

  return Expanded(
    child: Padding(
      padding: const EdgeInsets.all(8.0),
      child: SizedBox(
        height: 60,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisAlignment: MainAxisAlignment.center,
          children: titleAndDescription,
        ),
      ),
    ),
  );
}