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