Skip to content

how can i control textfield height? #27838

Closed

Description

@jeckbjy

textfield
textfield1

the default textfield height is too big(the padding of top and bottom too big), i want little size, how can i implementation it?
i known InputDecoration.collapsed can remove the space, but it can't use prefix and suffix.

Activity

  1. added
    c: new featureNothing broken; request for a new capability
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    on Feb 12, 2019
  2. zoechi commented on Feb 12, 2019

    @zoechi
    Contributor

    Please add the output of flutter doctor -v.

  3. added this to the milestone on Feb 12, 2019
  4. rkishan516 commented on Feb 12, 2019

    @rkishan516
    Contributor

    Add it to a Container and adjust the height of Container according to Your requirement

  5. HansMuller commented on Feb 13, 2019

    @HansMuller
    Contributor

    There's work underway to make textfield height more configurable: #27205

  6. chetan2469 commented on Apr 17, 2019

    @chetan2469

    TextField(
    maxLines: 5,
    ),

  7. josquared commented on Jun 13, 2019

    @josquared

    Container(
    Width:32,
    child:textfield(
    )
    )

  8. freesailor commented on Jul 2, 2019

    @freesailor

    Use contentPadding:
    TextField(
    decoration: InputDecoration(
    contentPadding: EdgeInsets.all(8.0),//here your padding
    border: OutlineInputBorder(............

  9. skysukai commented on Jul 18, 2019

    @skysukai

    Add it to a Container and adjust the height of Container according to Your requirement

    It's not work

  10. mudi256 commented on Aug 19, 2019

    @mudi256

    Inside the TextFormField

    decoration: InputDecoration(
    hintText: 'Email',
    contentPadding: new EdgeInsets.symmetric(vertical: 25.0, horizontal: 10.0),
    border: OutlineInputBorder(borderRadius: BorderRadius.circular(32.0)),
    ),

  11. caseyryan commented on Oct 6, 2019

    @caseyryan

    Use contentPadding:
    TextField(
    decoration: InputDecoration(
    contentPadding: EdgeInsets.all(8.0),//here your padding
    border: OutlineInputBorder(............

    This is actually a working solution, thanks!
    Restricting a TextField with a container (as a couple of commenters advised before) has a huge drawback in case of TextFormField with validation, the textfield won't grow if validation fails and that will look really ugly. But using decoration is the correct way to do it

  12. orourkedd commented on Dec 31, 2019

    @orourkedd

    You can control the height using these two properties together in your InputDecoration. For example, if contentPadding is set to EdgeInsets.all(0), the TextField will have no padding at all around the text and will be "short".

    InputDecoration(   
      isDense: true, 
      contentPadding: EdgeInsets.all(10) 
    )
    
  13. mahmoud-eslami commented on Feb 19, 2020

    @mahmoud-eslami

    You can control the height using these two properties together in your InputDecoration. For example, if contentPadding is set to EdgeInsets.all(0), the TextField will have no padding at all around the text and will be "short".

    InputDecoration(   
      isDense: true, 
      contentPadding: EdgeInsets.all(10) 
    )
    

    it worked thx

  14. IvanDev333 commented on Apr 8, 2020

    @IvanDev333

    TextField(
    expands: true,

    will expand the textField to its Container Height

  15. lock commented on Apr 25, 2020

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  16. locked and limited conversation to collaborators on Apr 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: new featureNothing broken; request for a new capabilityframeworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions