Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not Focus TexField #30

Open
NaosFr opened this issue Apr 10, 2020 · 8 comments
Open

Can not Focus TexField #30

NaosFr opened this issue Apr 10, 2020 · 8 comments
Labels
bug Something isn't working

Comments

@NaosFr
Copy link

NaosFr commented Apr 10, 2020

Hello !

I have a probleme, i can't focus a TextField after used Navigator.push()

I have an example :

https://www.youtube.com/watch?v=ppQUZIc8e7s&feature=youtu.be

InnerDrawer(
   scaffold: Stack(
        children: <Widget>[
          TabBarView(
            physics: NeverScrollableScrollPhysics(),
            controller: _pageController,
            children: <Widget>[
              MainKomitScreen(),
              MainSearchScreen(), // TEXTFIELD INSIDE THIS WIDGET
              MainInboxScreen(),
            ]
          ),
    ),
)

if you have an idea why 😇

@NaosFr
Copy link
Author

NaosFr commented Apr 11, 2020

update:

the Problem is from FocusScope

child: RepaintBoundary(
                          child: FocusScope(
                            node: _focusScopeNode,
                            child: _scaffold()),
                        )),

if i remove FocusScope i dont have the problem !

@Dn-a
Copy link
Owner

Dn-a commented Apr 11, 2020

hi @NicolasCELLA, have you tried to follow this example FocusNode Example? You should create a FocusNode to pass to the text field, and invoke the requestFocus () method in the InnerDrawer callback

@NaosFr
Copy link
Author

NaosFr commented Apr 11, 2020

Yes of course ! But if you look the end of the video ! I can't tab inside the textField !
When a don't use your Widget this working and when inside your Widget i remove

FocusScope(
                            node: _focusScopeNode,

This working ! I dont know why but maybe in your widget something is not unfocused !

@Dn-a Dn-a added the bug Something isn't working label Apr 11, 2020
@Dn-a
Copy link
Owner

Dn-a commented Apr 28, 2020

@NicolasCELLA I removed focusScope, at the moment it seems to work properly even without. try it and let me know.

Dn-a added a commit that referenced this issue Apr 28, 2020
@NaosFr
Copy link
Author

NaosFr commented Apr 28, 2020

Yes this work very well ! But why focusScope why used ? It's was important ? Because a don't see difference without

@Dn-a
Copy link
Owner

Dn-a commented Apr 28, 2020

@NicolasCELLA it is used to move the focus between one widget and another. It didn't work because I forgot to enter a parameter node: _focusScopeNode.
Among other things, I had to put it as a wrapper for the child widgets and not for the scaffold.
Try version 0.5.5 + 2 and let me know

@NaosFr
Copy link
Author

NaosFr commented Apr 29, 2020

This version work fine 👌 ! But i have a recommandation for your widget :
The possibility of unfocus or not !

Actually :
https://www.youtube.com/watch?v=ynb7kHHsdNI

without :

FocusScope(node: _focusScopeNode, child: _animatedChild()),

but with only :

 _animatedChild()

result:
https://www.youtube.com/watch?v=qKtGlzeNw2M

@Dn-a
Copy link
Owner

Dn-a commented May 13, 2020

@NicolasCELLA could you show the source code that creates this problem? I have made several tests and it behaves correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants