how to remove empty space under TextFormField

Viewed 24

Example

as you can see, there is a big empty space under UnderBoder, I dont know why it exists and how to remove?

here is my code:

TextFormField(
                        initialValue:
                            controller.eventTitle ?? widget.event.eventTitle,
                        textAlign: TextAlign.center,
                        style: mediumTextStyle(textColor: AppColors.sadColor),
                        // controller: _eventTitleController,
                        onChanged: (val) {
                          controller.getEventTitle(val);
                        },
                        decoration: InputDecoration(
                          isDense: true,
                          border: InputBorder.none,
                          contentPadding:
                              EdgeInsets.only(left: 16, top: 16, bottom: 8),
                          hintText: 'Event title *',
                          errorStyle: standardTextStyle(
                              textColor: AppColors.sadWarningColor),
                          hintStyle: standardTextStyle(
                              textColor: AppColors.sadColor.withOpacity(0.8)),
                        ),
                      ),

Thank you for your explanation!

1 Answers

Change the

from

 contentPadding: EdgeInsets.only(left: 16, top: 16, bottom: 8),

to

 contentPadding: EdgeInsets.only(left: 16, top: 0, bottom: 0, right: 16),

Full code

           TextFormField(
                    initialValue:
                        controller.eventTitle ?? widget.event.eventTitle,
                    textAlign: TextAlign.center,
                    style: mediumTextStyle(textColor: AppColors.sadColor),
                    // controller: _eventTitleController,
                    onChanged: (val) {
                      controller.getEventTitle(val);
                    },
                    decoration: InputDecoration(
                      isDense: true,
                      border: InputBorder.none,
                      contentPadding:
                EdgeInsets.only(left: 16, top: 0, bottom: 0, right: 16),
                      hintText: 'Event title *',
                      errorStyle: standardTextStyle(
                          textColor: AppColors.sadWarningColor),
                      hintStyle: standardTextStyle(
                          textColor: AppColors.sadColor.withOpacity(0.8)),
                    ),
                  ),
Related