buildTwoLineInput method

Widget buildTwoLineInput(
  1. BuildContext context
)

Implementation

Widget buildTwoLineInput(BuildContext context) {
  return Container(
    alignment: Alignment.centerLeft,
    color: decoration != null ? null : backgroundColor,
    decoration: decoration,
    child: Stack(
      alignment: Alignment.bottomCenter,
      children: [
        Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Visibility(
              visible: leftLabel != null,
              child: Padding(
                padding: const EdgeInsets.only(left: 16, top: 12),
                child: leftInfoWidth != null
                    ? SizedBox(
                        width: leftInfoWidth,
                        child: TDText(
                          leftLabel,
                          maxLines: 1,
                          font: TDTheme.of(context).fontBodyMedium,
                          fontWeight: FontWeight.w400,
                        ),
                      )
                    : TDText(
                        leftLabel,
                        maxLines: 1,
                        font: TDTheme.of(context).fontBodyMedium,
                        fontWeight: FontWeight.w400,
                      ),
              ),
            ),
            Container(
              padding: const EdgeInsets.only(bottom: 12, top: 7),
              alignment: Alignment.center,
              child: Row(
                mainAxisSize: MainAxisSize.min,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  Visibility(
                    visible: labelWidget != null,
                    child: labelWidget ?? const SizedBox.shrink(),
                  ),
                  Expanded(
                    flex: 1,
                    child: TDInputView(
                      textStyle: textStyle ??
                          TextStyle(color: TDTheme.of(context).fontGyColor1),
                      readOnly: readOnly,
                      autofocus: autofocus,
                      obscureText: obscureText,
                      onEditingComplete: onEditingComplete,
                      onSubmitted: onSubmitted,
                      hintText: hintText,
                      inputType: inputType,
                      onChanged: onChanged,
                      textAlign: textAlign,
                      inputFormatters: inputFormatters,
                      inputDecoration: inputDecoration,
                      isCollapsed: true,
                      maxLines: maxLines,
                      focusNode: focusNode,
                      hintTextStyle: hintTextStyle ??
                          TextStyle(color: TDTheme.of(context).fontGyColor3),
                      cursorColor: cursorColor,
                      textInputBackgroundColor: textInputBackgroundColor,
                      controller: controller,
                      contentPadding: contentPadding ??
                          const EdgeInsets.only(left: 16, right: 16),
                    ),
                  ),
                  Visibility(
                    visible: controller != null && controller!.text.isNotEmpty && needClear,
                    child: GestureDetector(
                      child: Container(
                        margin: const EdgeInsets.only(left: 17.5, right: 16),
                        child: Icon(
                          TDIcons.close_circle_filled,
                          color: clearBtnColor ?? TDTheme.of(context).fontGyColor3,
                        ),
                      ),
                      onTap: onClearTap,
                    ),
                    replacement: Visibility(
                      visible: rightBtn != null,
                      child: GestureDetector(
                        onTap: onBtnTap,
                        child: Container(
                          margin: const EdgeInsets.only(left: 17.5, right: 16),
                          child: rightBtn,
                        ),
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
        const Visibility(
          child: TDDivider(
            margin: EdgeInsets.only(
              left: 16,
            ),
          ),
        ),
      ],
    ),
  );
}