181186 - Criar PDV Android para rodar em maquinas P.O.S.

This commit is contained in:
felipe.franca committed 2026-11-17 17:43:00 -03:00
commit c9983cbad5
204 files changed
+11453

No files matched your search

@@ -0,0 +1,24 @@
class CurrencyFormatter {
CurrencyFormatter._();
static String formatBrl(int? minorUnits) {
if (minorUnits == null) return 'Preço indisponível';
final negative = minorUnits < 0;
final value = minorUnits.abs();
final whole = value ~/ 100;
final cents = (value % 100).toString().padLeft(2, '0');
final groupedWhole = _groupThousands(whole.toString());
final sign = negative ? '-' : '';
return '${sign}R\$ $groupedWhole,$cents';
}
static String _groupThousands(String digits) {
final groups = <String>[];
for (var end = digits.length; end > 0; end -= 3) {
final start = end - 3 < 0 ? 0 : end - 3;
groups.insert(0, digits.substring(start, end));
}
return groups.join('.');
}
}