getResponsiveWidget method

  1. @override
Widget getResponsiveWidget(
  1. BuildContext context,
  2. ScreenType screenType,
  3. double scale
)
override

Implementation

@override
Widget getResponsiveWidget(BuildContext context, ScreenType screenType, double scale) {

    double fontSize = 0.0;
    double? newFontSize;

    TextStyle defaultStyle = DefaultTextStyle.of(context).style;
    TextStyle responsiveStyle = DefaultTextStyle.of(context).style;

    if(has('style')) {
      responsiveStyle = get('style');
    }

    if(responsiveStyle.fontSize != null) {
      fontSize = responsiveStyle.fontSize!;
    } else {
      fontSize = defaultStyle.fontSize!;
    }

    newFontSize = fontSize * scale;

    responsiveStyle = responsiveStyle.copyWith(fontSize: newFontSize);

    return TextField(
        key : get('key'),
        controller : get('controller'),
        focusNode : get('focusNode'),
        decoration : get('decoration'),
        keyboardType : get('keyboardType'),
        textInputAction : get('textInputAction'),
        textCapitalization : get('textCapitalization'),
        style : responsiveStyle,
        strutStyle : get('strutStyle'),
        textAlign : get('textAlign'),
        textAlignVertical : get('textAlignVertical'),
        textDirection : get('textDirection'),
        readOnly : get('readOnly'),
        toolbarOptions : get('toolbarOptions'),
        showCursor : get('showCursor'),
        autofocus : get('autofocus'),
        obscuringCharacter : get('obscuringCharacter'),
        obscureText : get('obscureText'),
        autocorrect : get('autocorrect'),
        smartDashesType : get('smartDashesType'),
        smartQuotesType : get('smartQuotesType'),
        enableSuggestions : get('enableSuggestions'),
        maxLines : get('maxLines'),
        minLines : get('minLines'),
        expands : get('expands'),
        maxLength : get('maxLength'),
        maxLengthEnforcement : get('maxLengthEnforcement'),
        onChanged : get('onChanged'),
        onEditingComplete : get('onEditingComplete'),
        onSubmitted : get('onSubmitted'),
        onAppPrivateCommand : get('onAppPrivateCommand'),
        inputFormatters : get('inputFormatters'),
        enabled : get('enabled'),
        cursorWidth : get('cursorWidth'),
        cursorHeight : get('cursorHeight'),
        cursorRadius : get('cursorRadius'),
        cursorColor : get('cursorColor'),
        selectionHeightStyle : get('selectionHeightStyle'),
        selectionWidthStyle : get('selectionWidthStyle'),
        keyboardAppearance : get('keyboardAppearance'),
        scrollPadding : get('scrollPadding'),
        dragStartBehavior : get('dragStartBehavior'),
        enableInteractiveSelection : get('enableInteractiveSelection'),
        selectionControls : get('selectionControls'),
        onTap : onTap,
        mouseCursor : get('mouseCursor'),
        buildCounter : get('buildCounter'),
        scrollController : get('scrollController'),
        scrollPhysics : get('scrollPhysics'),
        autofillHints : get('autofillHints'),
        clipBehavior : get('clipBehavior'),
        restorationId : get('restorationId'),
        enableIMEPersonalizedLearning : get('enableIMEPersonalizedLearning'),
    );
}