0

I have a login screen using rxdart library when typing keyboard dismissing. because of the rebuild the ConnectionState of StreamBuilder in iOS build of flutter.

Widget handleLogin() {
    return StreamBuilder(
        stream: lgbloc.loginData,
        builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
          print(snapshot.connectionState);
          if (snapshot.hasError ) {
            isClick = false;
            _controller.reverse();
            Timer(Duration(seconds: 3), (){snapshot.hasError.toString();});
            return setLoginText();
          }
          else {
            _skLoginModel = snapshot.data;
            if(_skLoginModel != null){
              if (_skLoginModel.user != null){
                isClick = false;
                _controller.reverse();
                initBloc.saveData(_skLoginModel.user);
                return loginFinish();
              }
              else if (_skLoginModel.error != null && _skLoginModel.error.isNotEmpty){
                _controller.reverse();
                Timer(Duration(milliseconds: 500), (){
                  showInSnackBar(_skLoginModel.error);
                  _skLoginModel.error = null;
                  isClick = false;
                });
                return setLoginText();
              }
              else{
                if(isClick){
                  _controller.forward();
                  return setLoading();
                }
                else{
                  _controller.reverse();
                  return setLoginText();
                }
              }
            }
            else {
              _controller.reverse();
              return setLoginText();
            }
          }

        });
  }

I expect still keyboard showing.

Sunny
  • 3,134
  • 1
  • 17
  • 31

1 Answers1

0

I had the same issue these days, which got solved (here only the Route Problem is shown).

The textfield has some Issues with Routes and Stream Builders, my final solution was to wrap the StreamBuilder into one Widget, which i kept in State. (Like the bottom widget in the example). Then this widget calls depending on the snapshot.data different Widgets.

In these clean widgets (no Streambuilders etc) my TextFields lived.

Markus Hein
  • 604
  • 7
  • 14