templateTotals function
Totals pinned to the end edge.
Implementation
Widget templateTotals(
TemplateTheme theme, {
required List<(String, String)> rows,
required String totalLabel,
required String total,
}) {
return Align(
alignment: AlignmentDirectional.centerEnd,
child: Container(
width: 220,
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
border: Border.all(color: theme.line),
borderRadius: 4,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
for (final (String label, String value) in rows)
Padding(
padding: const EdgeInsets.only(bottom: 3),
child: Row(
children: <Widget>[
Expanded(
child: Text(
label,
style: TextStyle(fontSize: 9, color: theme.muted),
),
),
Text(value, style: TextStyle(fontSize: 9, color: theme.ink)),
],
),
),
Divider(color: theme.line, height: 8),
Row(
children: <Widget>[
Expanded(
child: Text(
totalLabel,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.bold,
color: theme.accent,
),
),
),
Text(
total,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold,
color: theme.accent,
),
),
],
),
],
),
),
);
}