Making text field in ChatGPT App from scratch #161848

Hello! I am trying to make a text field similar to that of ChatGPT App as shown below:

Untitledvideo-MadewithClipchamp2-ezgif.com-video-to-gif-converter

I want smooth change in width of text field and hiding of text effect as I click the plus icon in the gif shown below from ChatGPT App:

WhatsAppVideo2025-01-17at21.25.12_f81d47fa-ezgif.com-video-to-gif-converter

I experimented a lot with AnimatedSize and AnimatedContainer by following ChatGPT’s instruction but didn’t work

Plz :pray::pray: help me with these following steps:

  1. Copy the complete code from here
  2. Run the code in Android Studio or VS Code
  3. Fix this part of the code from the complete code(mentioned in step 1) where I declared my Text Field. If necessary fix the complete code. Don’t remove the scrollbar from text field or change the functionality of the code.
// Fix this part of the code in Expanded Widget
        Expanded(child:Padding(
                  padding: EdgeInsets.only(bottom: 10),
                  child: Container(
                      decoration: BoxDecoration(
                      color: Colors.grey[900], // Background color
                      borderRadius: BorderRadius.circular(25), // Rounded corners
                    ),
                    padding: EdgeInsets.symmetric(horizontal: 20),
                    child: RawScrollbar(
                      thumbColor: Colors.white70,
                      thumbVisibility: true,
                      controller: _firstController,
                      child: TextField(

                            onTap: (){
                              setState(() {
                                _showIcons=false;
                              });
                            },
                            scrollController: _firstController,
                            onChanged: _onTextChanged,
                            minLines: 1,
                            maxLines: 5,
                            keyboardType: TextInputType.multiline,
                            style: TextStyle(
                              color: Colors.white, // Input text color
                            ),
                            decoration: InputDecoration(
                              hintText: 'Message',
                              hintStyle: TextStyle(
                                color: Colors.white54, // Hint text color
                              ),
                              border: InputBorder.none, // No border
                            ),
                          ),)
                  ),

             )),
  1. Mention the changes I have to make in my code.

I will be gratefull if someone helped me…:smiling_face_with_tear::smiling_face_with_tear: