TextSetting<T> constructor

TextSetting<T>({
  1. Key? key,
  2. required dynamic settingsKey,
  3. required dynamic title,
  4. dynamic defaultValue,
  5. dynamic subtitle,
  6. Widget? leading,
  7. TextInputType? keyboardType,
  8. bool enabled = true,
  9. bool? obscureText,
  10. String? obscuringCharacter,
  11. List<TextInputFormatter>? inputFormatters,
  12. FormFieldValidator<T>? validator,
  13. String okText = 'OK',
  14. String cancelText = 'Cancel',
  15. bool? autocorrect,
  16. SmartDashesType? smartDashesType,
  17. SmartQuotesType? smartQuotesType,
  18. bool? enableSuggestions,
  19. int? maxLines,
  20. int? minLines,
  21. bool? expands,
  22. int? maxLength,
  23. double? cursorHeight,
  24. Color? cursorColor,
  25. Brightness? keyboardAppearance,
  26. EdgeInsets? scrollPadding,
  27. bool? enableInteractiveSelection,
  28. TextSelectionControls? selectionControls,
  29. SettingChangedCallback<T>? onChanged,
})

Implementation

TextSetting({
  Key? key,
  required settingsKey,
  required title,
  defaultValue,
  subtitle,
  Widget? leading,
  this.keyboardType,
  bool enabled = true,
  this.obscureText,
  this.obscuringCharacter,
  this.inputFormatters,
  this.validator,
  this.okText = 'OK',
  this.cancelText = 'Cancel',
  this.autocorrect,
  this.smartDashesType,
  this.smartQuotesType,
  this.enableSuggestions,
  this.maxLines,
  this.minLines,
  this.expands,
  this.maxLength,
  this.cursorHeight,
  this.cursorColor,
  this.keyboardAppearance,
  this.scrollPadding,
  this.enableInteractiveSelection,
  this.selectionControls,
  SettingChangedCallback<T>? onChanged,
}) : super(
  key: key,
  settingsKey: settingsKey,
  title: title,
  defaultValue: defaultValue,
  subtitle: subtitle,
  enabled: enabled,
  leading: leading,
  onChanged: onChanged
)
{
  if (T != String && T != int && T != double) {
    throw Exception('TextSetting only supports String, int and double as generic types');
  }

  if (subtitle == null) {
    subtitle = defaultValue;
  }
}