0 Question: Flutter cupertino textfield reconstruit la page une fois la mise au point effectuée

question créée à Tue, Apr 9, 2019 12:00 AM

J'ai utilisé une seule page sans aucun problème, mais je tente maintenant de l'implémenter avec le widget bottomtabbar et lorsque je touche le champ de zone de texte se concentre et est reconstruit sans aucun message d'erreur ni avertissement.

il y a un gif qui décrit ce que je fais face 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(),
                ),
              ],
            ),
          ),
        );
   }
    
0
0 réponses                              0                         
source placée ici