ExpansionTile children will refreshing after click TextField - Flutter

118 views Asked by At
 child: Column(
                        children: [
                          ExpansionTile(
                            title: Text("Task Overview",
                                style:
                                    TextStyle(fontWeight: FontWeight.bold)),
                            // key: PageStorageKey<Task>(Task),
                            maintainState: true,

                            children: <Widget>[
                              Task(),
                            ],
                          ),
                        ],
                      ),

**** below code is the Task Widget part****

            TextField(
              controller: textcontroller,
         
              style: const TextStyle(color: Colors.black),
              cursorColor: Colors.black,
              onChanged: (value) {
                searchResult(value);
              },
              decoration: InputDecoration(
                hintText: "Search",
                hintStyle:
                    const TextStyle(fontSize: 14, color: Colors.black),
               
                suffixIcon: const Icon(Icons.search, color: Colors.black),
                focusedBorder: OutlineInputBorder(
                  borderRadius: BorderRadius.circular(10),
                  borderSide: const BorderSide(
                    color: Colors.black,
                    width: 2.0,
                  ),
                ),
                enabledBorder: OutlineInputBorder(
                  borderRadius: BorderRadius.circular(10),
                  borderSide: const BorderSide(
                    style: BorderStyle.none,
                  ),
                ),
                // filled: true,
              ),
            ),

enter image description here

Guys, I have a question about the ExpansionTile, When I tap the search text field it will close the children, even I use "maintainState" still not working, is there any solution to keep the children open?

0

There are 0 answers