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 TextFormField(
        key : get('key'),
        controller : get('controller'),
        initialValue : get('initialValue'),
        focusNode : get('focusNode'),
        decoration : get('decoration'),
        keyboardType : get('keyboardType'),
        textCapitalization : get('textCapitalization'),
        textInputAction : get('textInputAction'),
        style : responsiveStyle,
        strutStyle : get('strutStyle'),
        textDirection : get('textDirection'),
        textAlign : get('textAlign'),
        textAlignVertical : get('textAlignVertical'),
        autofocus : get('autofocus'),
        readOnly : get('readOnly'),
        toolbarOptions : get('toolbarOptions'),
        showCursor : get('showCursor'),
        obscuringCharacter : get('obscuringCharacter'),
        obscureText : get('obscureText'),
        autocorrect : get('autocorrect'),
        smartDashesType : get('smartDashesType'),
        smartQuotesType : get('smartQuotesType'),
        enableSuggestions : get('enableSuggestions'),
        maxLengthEnforcement : get('maxLengthEnforcement'),
        maxLines : get('maxLines'),
        minLines : get('minLines'),
        expands : get('expands'),
        maxLength : get('maxLength'),
        onChanged : onChanged,
        onTap : onTap,
        onEditingComplete : onEditingComplete,
        onFieldSubmitted : onFieldSubmitted,
        onSaved : onSaved,
        validator : get('validator'),
        inputFormatters : get('inputFormatters'),
        enabled : get('enabled'),
        cursorWidth : get('cursorWidth'),
        cursorHeight : get('cursorHeight'),
        cursorRadius : get('cursorRadius'),
        cursorColor : get('cursorColor'),
        keyboardAppearance : get('keyboardAppearance'),
        scrollPadding : get('scrollPadding'),
        enableInteractiveSelection : get('enableInteractiveSelection'),
        selectionControls : get('selectionControls'),
        buildCounter : get('buildCounter'),
        scrollPhysics : get('scrollPhysics'),
        autofillHints : get('autofillHints'),
        autovalidateMode : get('autovalidateMode'),
        scrollController : get('scrollController'),
        restorationId : get('restorationId'),
        enableIMEPersonalizedLearning : get('enableIMEPersonalizedLearning'),
    );
}