how to align TextField text with suffixicons in flutter

130 views Asked by At

I am trying to align textformfield text with the suffixicons of textformfield in flutter, I have tried properties like content padding and padding only bottom but didn't work.

enter image description here

1

There are 1 answers

0
Mihir Panchasara On

Here is an example code.

Container(
                margin: EdgeInsets.fromLTRB(20, 10, 20, 20),
                decoration: BoxDecoration(
                  gradient: LinearGradient(colors: [Color.fromRGBO(228, 228, 231, 0.4), Color.fromRGBO(228, 228, 231, 0.32)]),
                  borderRadius: new BorderRadius.all(Radius.circular(12.0)),
                  border: Border.all(width: 1, color: Color.fromRGBO(218, 218, 218, 1)),
                ),
                child: Row(
                  crossAxisAlignment: CrossAxisAlignment.end,
                  children: [
                    Container(
                      child: IconButton(
                        onPressed: (){
                        },
                        icon: SvgPicture.asset("assets/images/emoji_icon.svg"),
                      ),
                    ),
                    Flexible(
                      child: Container(
                        width: double.infinity,
                        child: TextFormField(
                          decoration: InputDecoration(
                              contentPadding: EdgeInsets.fromLTRB(10, 15, 5, 15),
                              isDense: true,
                              border: InputBorder.none,
                              hintText: buildTranslate(context, "type_your_message"),//"Type your message",
                              hintStyle: TextStyle(
                                  color: Color.fromRGBO(155, 155, 155, 1),
                                  fontSize: 16 * MediaQuery.of(context).textScaleFactor,
                                  fontWeight: FontWeight.w400
                              )
                          ),
                          controller: msgController,
                          maxLines: 6,
                          minLines: 1,
                          onFieldSubmitted: (value) {
                            if (value.isNotEmpty) {

                            } else {

                            }
                          },
                          onChanged: (value){
                            if(msgController.text.isEmpty){
                              
                            }else{
                              
                            }
                          },
                        ),
                      ),
                    ),
                    Container(
                      child:IconButton(
                        onPressed: (){

                        },
                        icon: SvgPicture.asset("assets/images/attach_icon.svg"),
                      ),
                    ),
                    Container(
                      child: IconButton(
                        onPressed:  (){
                          
                        },
                        icon: SvgPicture.asset(
                            "assets/images/send_icon.svg",
                          color: MyColors.themeBlue,
                        ),
                      ),
                    )
                  ],
                ),
              ),