Skip to content

Commit

Permalink
feat(app): only render table rows for better alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Sep 20, 2024
1 parent 9666d3f commit 46a39f2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/lib/common/models/drug/drug_inhibitors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ String _inhibitionTooltipText(
}${displayConfig.partSeparator}$inhibitorsString';
}

Table _drugInteractionTemplate(
Widget _drugInteractionTemplate(
BuildContext context,
String tooltipText,
_DisplayConfig displayConfig,
Expand Down Expand Up @@ -291,7 +291,7 @@ String inhibitionTooltipText(
return tooltipText;
}

Table buildDrugInteractionInfo(
Widget buildDrugInteractionInfo(
BuildContext context,
List<GenotypeResult> genotypeResults,
{ required String? drug }
Expand Down
29 changes: 18 additions & 11 deletions app/lib/common/widgets/annotation_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,30 @@ class TableRowDefinition {
final String? tooltip;
}

Table buildTable(
Widget buildTable(
List<TableRowDefinition> rowDefinitions,
{
TextStyle? style,
bool boldHeader = true,
}
) {
return Table(
defaultColumnWidth: IntrinsicColumnWidth(),
children: rowDefinitions.mapIndexed((index, rowDefinition) => _buildRow(
rowDefinition.key,
rowDefinition.value,
style ?? PharMeTheme.textTheme.bodyMedium!,
boldHeader: boldHeader,
isLast: index == rowDefinitions.length - 1,
tooltip: rowDefinition.tooltip,
)).toList(),
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: rowDefinitions.mapIndexed(
(index, rowDefinition) => Table(
defaultColumnWidth: IntrinsicColumnWidth(),
children: [
_buildRow(
rowDefinition.key,
rowDefinition.value,
style ?? PharMeTheme.textTheme.bodyMedium!,
boldHeader: boldHeader,
isLast: index == rowDefinitions.length - 1,
tooltip: rowDefinition.tooltip,
),
],
),
).toList(),
);
}

Expand Down

0 comments on commit 46a39f2

Please sign in to comment.