Текстовое поле Flutter Cupertino перестраивает страницу, когда сфокусировано - PullRequest
0 голосов
/ 09 апреля 2019

Я использовал на одной странице без каких-либо проблем, но теперь я пытаюсь реализовать с помощью виджета нижней вкладки, и когда я касаюсь, поле текстового поля фокусируется и перестраивается без каких-либо сообщений об ошибках или предупреждений.

есть GIF, который описывает, с чем я сталкиваюсь http://www.giphy.com/gifs/Rf4SAqekKuvXFTSn6U

//here is my cupertino textfield that i have widgetized to use it many //places

Widget build(BuildContext context) {

    return Container(
      height: 48,
      padding: EdgeInsets.only(left: 8, right: 8, top: 6, bottom: 6),
      child: Form(
        child: CupertinoTextField(
          key: CustomSearchBar._orderFormKey,
          placeholder: this.widget.placeholder,
          cursorColor: Colors.black,
          maxLines: 1,
          controller: this.widget.controller,
          focusNode: this.widget.focusNode,
          maxLength: 10,
          suffixMode: OverlayVisibilityMode.editing,
          prefix: Padding(
            padding: const EdgeInsets.only(right: 2, left: 8),
            child: Icon(
              Icons.search,
              size: 20,
              color: Colors.black54,
            ),
          ),
          onSubmitted: this.widget.onSubmitted,
          textInputAction: TextInputAction.search,
          suffix: Padding(
            padding: EdgeInsets.only(left: 0, right: 0),
            child: IconButton(
              icon: Icon(
                Icons.cancel,
                color: Colors.black38,
                size: 20,
              ),
              onPressed: this.widget.onClearPressed,
              padding: EdgeInsets.all(0),
              splashColor: Colors.transparent,
              iconSize: 20,

              highlightColor: Colors.transparent,
            ),
          ),
          decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(16),
              border: Border.all(color: Colors.black26)),
        ),
      ),
    );


     }




    /*and this one is where i call the textfield widget on the upper code*/

    Widget build(BuildContext context) {
        return Scaffold(
          resizeToAvoidBottomPadding: false,
          drawer: HomeDrawer(),
          body: Container(
            width: double.infinity,
            height: double.infinity,
            child: Column(
              children: <Widget>[
                CustomSearchBar(
                  controller: _searchTextController,
                  focusNode: _searchFocusNode,
                  onSubmitted: (String text) {
                    if (text.length > 0 && text.isNotEmpty) {
                      setState(
                        () {
                          searchText = text.trim();
                          searchOffers();
                        },
                      );
                    }
                  },
                  placeholder: 'Birşeyler yazın ve ara butonuna dokunun',
                  onClearPressed: () {
                    _searchFocusNode.unfocus();
                    _searchTextController.clear();
                    queryDetails = '';
                    getOffers();
                  },
                ),
                _queryDetails(),
                Expanded(
                  child: _renderPage(),
                ),
              ],
            ),
          ),
        );
   }
...