Отзывчивый контейнер во флаттере

#flutter #flutter-layout #bloc

Вопрос:

У меня есть один дочерний вид прокрутки с дочерним контейнером, высоту и ширину которого я определил
Проблема в том, что когда я нажимаю на текстовое поле, кнопка скрыта/не поднимается. Как сделать так, чтобы высота реагировала?

введите описание изображения здесь

    @override
  Widget build(BuildContext context) {
    _width = MediaQuery.of(context).size.width;
    _height = MediaQuery.of(context).size.height;
    return SingleChildScrollView(
      controller: _scrollController,
      child: Container(
        width: _width,
        height: _height,
        child: Form(
          key: _formKey,
          child: Column(
            mainAxisSize: MainAxisSize.max,
            children: <Widget>[
              Expanded(
                child: StreamBuilder(
                  stream: userBloc.user$,
                  builder: (BuildContext context, AsyncSnapshot snapshot) {
                    User user = snapshot?.data;
                    String maskedEmail = _getMaskedEmail(user);
                    return Column(
                      children: <Widget>[
                        widget.instruction != null
                            ? Container(
                                padding: GenericAssets.paddingSymV10,
                                child: Text(
                                  widget.instruction,
                                  style: GenericAssets.defaultText,
                                  textAlign: TextAlign.center,
                                ))
                            : Container(),
                        (maskedEmail?.isNotEmpty ?? false)
                            ? Column(
                                children: <Widget>[
                                  Padding(
                                    padding: GenericAssets.paddingSymV10,
                                    child: Text(
                                        S.of(context).strProvideMaskedEmail,
                                        style: GenericAssets.defaultText,
                                        textAlign: TextAlign.center),
                                  ),
                                  Padding(
                                    padding: GenericAssets.paddingSymV10,
                                    child: Text(maskedEmail,
                                        style: GenericAssets.defaultText,
                                        textAlign: TextAlign.center),
                                  )
                                ],
                              )
                            : Container(),
                        Container(
                          child: TextFormField(
                            style: GenericAssets.defaultText18,
                            controller: _emailController,
                            focusNode: _emailFocusNode,
                            keyboardType: TextInputType.emailAddress,
                            inputFormatters: [LowerCaseTextFormatter()],
                            decoration: InputDecoration(
                                labelText:
                                    S.of(context).fieldEmail.toUpperCase(),
                                labelStyle: GenericAssets.textFormLabel,
                                contentPadding:
                                    GenericAssets.textFormFieldSpacing),
                            validator: (value) {
                              if (value.isEmpty) {
                                return S.of(context).msgTextFieldMandatory(
                                    S.of(context).fieldEmail);
                              }

                              if (!isEmail(value) ||
                                  !HelperFunctions.isPatternValid(
                                      ProjectConstants.emailPattern, value)) {
                                return S.of(context).msgPleaseEnterAValidValue(
                                    S.of(context).fieldEmail);
                              }
                              return null;
                            },
                          ),
                        ),
                        Padding(
                          padding: GenericAssets.paddingSymV5,
                          child: PasswordField(
                            _passwordController,
                            checkFormat: false,
                            showPassword: true,
                            focusNode: _passwordFocusNode,
                          ),
                        )
                      ],
                    );
                  },
                ),
              ),
              FullWidthButton(
                S.of(context).strLogin,
                () async {
                  LoggerService.log(
                      LogEventType.ButtonPress,
                      LogDetails(
                          buttonName: 'Login', displayName: 'Login Screen'));
                  if (_formKey.currentState.validate()) {
                    widget.onSubmit(context, widget.authenticationManager,
                        _passwordController.text, _emailController.text);
                  }
                },
              ),
              InkWell(
                onTap: onForgotPassword,
                child: Padding(
                  padding: GenericAssets.padding10,
                  child: Text(
                    S.of(context).strForgotPassword,
                    style: GenericAssets.footNoteLink,
                  ),
                ),
              ),
              InkWell(
                onTap: onResetApp,
                child: Padding(
                  padding: GenericAssets.padding10,
                  child: Text(
                    S.of(context).btnResetApplication,
                    style: GenericAssets.footNoteLink,
                  ),
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
 

Я хочу показать кнопки и другие виджеты, когда отображается клавиатура.
Это виджет, из которого я его вызываю

 @override
  Widget build(BuildContext context) {
 
    return WillPopScope(
      onWillPop: () => HelperFunctions.logBackpress('Login Screen'),
      child: Scaffold(
        appBar: AppBar(title: AppBarTitle(S.of(context).strLogin)),
        body: StreamBuilder(
          stream: manager.loginState$,
          builder: (BuildContext context, AsyncSnapshot snapshot) {
            bool isLoading = snapshot?.data?.isLoading ?? false;
            return Stack(
              children: <Widget>[
                LoginForm(onSubmit, authenticationManager: manager),
                LoadingIndicator(isLoading)
              ],
            );
          },
        ),
      ),
    );
  }
 

введите описание изображения здесь

Комментарии:

1. можете ли вы поделиться своим полным кодом?

2. Я добавил код

3. Я думаю, что вы объявите виджет столбца ниже в представлении SingleChildScrollView

4. @VincentDaveNavaresTe как уже сказал Равиндра, попробуйте использовать виджет столбца, это должно исправить, если вы разместите его правильно

5. По-прежнему не работает.