mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 11:36:24 +00:00
Bump version to 0.12.3 (#382)
* Bump version to 0.12.3 * Updates for ios * Fix for float / decimal field * Cleanup simpleNumberString * Increment build number
This commit is contained in:
parent
925966c627
commit
08ebc34730
5 changed files with 38 additions and 15 deletions
|
|
@ -476,6 +476,8 @@ class APIFormField {
|
|||
// Construct a floating point numerical input field
|
||||
Widget _constructFloatField() {
|
||||
|
||||
double initial = double.tryParse(value.toString()) ?? 0;
|
||||
|
||||
return TextFormField(
|
||||
decoration: InputDecoration(
|
||||
labelText: required ? label + "*" : label,
|
||||
|
|
@ -484,7 +486,7 @@ class APIFormField {
|
|||
helperStyle: _helperStyle(),
|
||||
hintText: placeholderText,
|
||||
),
|
||||
initialValue: simpleNumberString(double.tryParse(value.toString()) ?? 0),
|
||||
initialValue: simpleNumberString(initial),
|
||||
keyboardType: TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||
validator: (value) {
|
||||
|
||||
|
|
|
|||
|
|
@ -58,10 +58,17 @@ void debug(dynamic msg) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Simplify string representation of a floating point value
|
||||
* Basically, don't display fractional component if it is an integer
|
||||
*/
|
||||
String simpleNumberString(double number) {
|
||||
// Ref: https://stackoverflow.com/questions/55152175/how-to-remove-trailing-zeros-using-dart
|
||||
|
||||
return number.toStringAsFixed(number.truncateToDouble() == number ? 0 : 1);
|
||||
if (number.toInt() == number) {
|
||||
return number.toInt().toString();
|
||||
} else {
|
||||
return number.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue