showSafaehTextInput function

Future<String?> showSafaehTextInput({
  1. required BuildContext context,
  2. required String title,
  3. required String doneLabel,
  4. String? hint,
  5. String initialValue = '',
  6. int maxLines = 1,
  7. int? maxLength,
  8. bool obscureText = false,
  9. TextInputType? keyboardType,
  10. TextInputAction? textInputAction,
  11. List<TextInputFormatter>? inputFormatters,
  12. bool autocorrect = true,
  13. bool enableSuggestions = true,
  14. ValueChanged<String>? onChanged,
  15. String? cancelLabel,
  16. SafaehTitleBuilder? titleBuilder,
  17. double railWidthOf(
    1. BuildContext context
    )?,
  18. SafaehTransition? fadeScale,
  19. SafaehTransition? slideUp,
  20. SafaehPhoneSheetPlacement phonePlacement = SafaehPhoneSheetPlacement.bottom,
  21. double? tabletBreakpoint,
  22. Duration? motion,
  23. Curve? enterCurve,
  24. Curve? exitCurve,
  25. double? maxWidth,
  26. double? maxHeight,
  27. bool barrierDismissible = true,
  28. bool useRootNavigator = true,
  29. bool showTitleInBody = true,
  30. SafaehRouteOptions? route,
})

Adaptive text field. Returns the trimmed value, or null if dismissed.

Hosts pass doneLabel / cancelLabel — no .tr() here.

Implementation

Future<String?> showSafaehTextInput({
  required BuildContext context,
  required String title,
  required String doneLabel,
  String? hint,
  String initialValue = '',
  int maxLines = 1,
  int? maxLength,
  bool obscureText = false,
  TextInputType? keyboardType,
  TextInputAction? textInputAction,
  List<TextInputFormatter>? inputFormatters,
  bool autocorrect = true,
  bool enableSuggestions = true,
  ValueChanged<String>? onChanged,
  String? cancelLabel,
  SafaehTitleBuilder? titleBuilder,
  double Function(BuildContext context)? railWidthOf,
  SafaehTransition? fadeScale,
  SafaehTransition? slideUp,
  SafaehPhoneSheetPlacement phonePlacement = SafaehPhoneSheetPlacement.bottom,
  double? tabletBreakpoint,
  Duration? motion,
  Curve? enterCurve,
  Curve? exitCurve,
  double? maxWidth,
  double? maxHeight,
  bool barrierDismissible = true,
  bool useRootNavigator = true,
  bool showTitleInBody = true,
  SafaehRouteOptions? route,
}) {
  return showSafaeh<String?>(
    context: context,
    title: title,
    titleBuilder: titleBuilder,
    maxWidth: maxWidth,
    maxHeight: maxHeight,
    barrierDismissible: barrierDismissible,
    tabletBreakpoint: tabletBreakpoint,
    motion: motion,
    enterCurve: enterCurve,
    exitCurve: exitCurve,
    railWidthOf: railWidthOf,
    fadeScale: fadeScale,
    slideUp: slideUp,
    phonePlacement: phonePlacement,
    useRootNavigator: useRootNavigator,
    paintPhoneTitle: !showTitleInBody,
    route: route,
    child: SafaehTextInputSheet(
      title: title,
      doneLabel: doneLabel,
      hint: hint,
      initialValue: initialValue,
      maxLines: maxLines,
      maxLength: maxLength,
      obscureText: obscureText,
      keyboardType: keyboardType,
      textInputAction: textInputAction,
      inputFormatters: inputFormatters,
      autocorrect: autocorrect,
      enableSuggestions: enableSuggestions,
      onChanged: onChanged,
      cancelLabel: cancelLabel,
      showTitleInBody: showTitleInBody,
      titleBuilder: titleBuilder,
      tabletBreakpoint: tabletBreakpoint,
    ),
  );
}