Round totals on dashboard
This commit is contained in:
parent
e7375b07d3
commit
ca553df99f
|
|
@ -67,9 +67,11 @@ class _EntityListTileState extends State<EntityListTile> {
|
|||
includeEdit: true,
|
||||
client: entityClient),
|
||||
isSaving: false,
|
||||
color: state.prefState.enableDarkMode
|
||||
? Colors.white
|
||||
: Theme.of(context).accentColor,
|
||||
color: isFilteredBy
|
||||
? (state.prefState.enableDarkMode
|
||||
? Colors.white
|
||||
: Theme.of(context).accentColor)
|
||||
: null,
|
||||
entity: widget.entity,
|
||||
onSelected: (context, action) => widget.onEntityActionSelected != null
|
||||
? widget.onEntityActionSelected(context, widget.entity, action)
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ class InvoiceItemListTile extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final String cost =
|
||||
formatNumber(invoiceItem.cost, context, clientId: invoice.clientId);
|
||||
final String cost = formatNumber(invoiceItem.cost, context,
|
||||
clientId: invoice.clientId, roundToPrecision: false);
|
||||
final String qty = formatNumber(invoiceItem.quantity, context,
|
||||
clientId: invoice.clientId, formatNumberType: FormatNumberType.double);
|
||||
final localization = AppLocalization.of(context);
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ String formatNumber(
|
|||
FormatNumberType formatNumberType = FormatNumberType.money,
|
||||
bool showCurrencyCode,
|
||||
bool zeroIsNull = false,
|
||||
bool roundToPrecision = true,
|
||||
}) {
|
||||
if ((zeroIsNull || formatNumberType == FormatNumberType.input) &&
|
||||
value == 0) {
|
||||
|
|
@ -106,6 +107,10 @@ String formatNumber(
|
|||
return '';
|
||||
}
|
||||
|
||||
if (formatNumberType == FormatNumberType.money) {
|
||||
value = round(value, currency.precision);
|
||||
}
|
||||
|
||||
String thousandSeparator = currency.thousandSeparator;
|
||||
String decimalSeparator = currency.decimalSeparator;
|
||||
bool swapCurrencySymbol = currency.swapCurrencySymbol;
|
||||
|
|
|
|||
Loading…
Reference in New Issue