Skip to content

Commit

Permalink
Merge pull request #22 from robiness/allow_negativ_doubles
Browse files Browse the repository at this point in the history
Allow text field values for DoubleFieldConfigurator to be negativ
  • Loading branch information
robiness authored Oct 31, 2023
2 parents e6f6b11 + fea3352 commit efdf32f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/src/field_configurators/double_field_configurator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class DoubleFieldConfigurationWidget extends StatefulConfigurationWidget<double?
}

class _DoubleFieldConfigurationWidgetState extends State<DoubleFieldConfigurationWidget> {

late final TextEditingController _controller;

@override
Expand All @@ -57,7 +56,7 @@ class _DoubleFieldConfigurationWidgetState extends State<DoubleFieldConfiguratio
text: widget.configurator.value.toString(),
);
widget.configurator.addListener(() {
if(widget.configurator.value == null) {
if (widget.configurator.value == null) {
_controller.text = '';
}
});
Expand All @@ -69,7 +68,7 @@ class _DoubleFieldConfigurationWidgetState extends State<DoubleFieldConfiguratio
return FieldConfiguratorInputField(
controller: _controller,
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp('[0-9,.]')),
FilteringTextInputFormatter.allow(RegExp('-?[0-9.,]')),
],
onChanged: (value) {
final replacedComma = value.replaceAll(',', '.');
Expand Down

0 comments on commit efdf32f

Please sign in to comment.