percent static method

TextDynamicInput<double> percent({
  1. required String hintText,
  2. double? initialValue,
  3. ValueChanged<double?>? onChanged,
  4. bool enabled = true,
  5. String? errorText,
})

Implementation

static TextDynamicInput<double> percent({
  required String hintText,
  double? initialValue,
  ValueChanged<double?>? onChanged,
  bool enabled = true,
  String? errorText,
}) {
  return TextDynamicInput<double>(
    hintText: hintText,
    initialValue: _toPercent(initialValue),
    onChanged: (value) {
      if (onChanged == null) return;
      onChanged(_fromPercent(value));
    },
    enabled: enabled,
    formatters: [DecimalFormatter()],
    keyboardType: const TextInputType.numberWithOptions(decimal: true),
    decoration: InputDecoration(
      suffixIcon: const Icon(Icons.percent),
      suffixIconColor: SepteoColors.blue.shade900,
    ),
    errorText: errorText,
  );
}