'How do I decrease the border width of the text form field?

enter image description here

enter image description here

I need to reduce the width of my border side in TextField. How can I do that?

final emailNameField = TextFormField(
      autofocus: false,
      controller: emailEditingController,
      keyboardType: TextInputType.emailAddress,
      validator: (email) => email != null && !EmailValidator.validate(email)
          ? "Enter a valid Email"
          : null,
      onSaved: (email) {
        emailEditingController.text = '$email';
      },
      textInputAction: TextInputAction.next,
      decoration: const InputDecoration(
          prefixIcon: Icon(Icons.mail),
          contentPadding: EdgeInsets.fromLTRB(20, 15, 20, 15),
          prefixIconColor: Colors.red,
          border: OutlineInputBorder(
              borderRadius: BorderRadius.only(),
              borderSide: BorderSide(width: 1)),
          hintText: 'Email '),
    );

    //password field
    final passwordNameField = TextFormField(
        autofocus: false,
        controller: passwordEditingController,
        obscureText: true,
        onSaved: (value) {
          passwordEditingController.text = 'value';
        },
        textInputAction: TextInputAction.done,
        decoration: const InputDecoration(
            prefixIcon: Icon(Icons.vpn_key),
            contentPadding: EdgeInsets.fromLTRB(200, 15, 20, 15),
            prefixIconColor: Colors.red,
            border: OutlineInputBorder(
                borderSide: const BorderSide(
                    width: 2, color: Color.fromARGB(26, 204, 32, 32))),
            hintText: 'Password ',
            suffixIcon: Icon(Icons.remove_red_eye_rounded)));



Solution 1:[1]

You can wrap parent Card widget padding or just use margin property for outside spacing, and wrap Column widget with padding to provide inner spacing.

Card(
  //for out side or wrap with padding widget
  margin: const EdgeInsets.all(8.0), 
  color: Colors.cyanAccent,

  // for inner spaciing
  child: Padding(
    // replace 16 with your desire padding value
    // padding: const EdgeInsets.all(16.0),
    padding:
        EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 16),
    child: Column(
      children: [
        TextField(),
        //...
      ],
    ),
  ),
)

More about Padding and Card.

Solution 2:[2]

You can achieve that through decoration property, here is a sample. Pay attention that there is more than one type of borders styling you can apply.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yeasin Sheikh
Solution 2 Sinan Ammar