Skip to content

How to align label and content while still having a left padding #174

@lewinpauli

Description

@lewinpauli

image

Is there a parameter that I am missing to make the content align with the label while still having a left padding?

The content padding seems to have a much larger impact on the content than on the label right now.

dropdown_button2 version: 2.3.7

My code:

 DropdownButtonFormField2(
      value: "content1",
      autovalidateMode: AutovalidateMode.always,
      validator: (value) => value == null ? "Please select something" : null,
      isExpanded: false,
      isDense: true,
      buttonStyleData: ButtonStyleData(
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(10),
        ),
      ),
      dropdownStyleData: DropdownStyleData(
        padding: EdgeInsets.only(left: 0, right: 0, top: 0, bottom: 0),
        //openInterval: Interval(0, 1), //timing of the dropdown open animation
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(10),
        ),
      ),
      // menuItemStyleData: MenuItemStyleData(
      //   padding: EdgeInsets.only(left: 10, right: 10, top: 0, bottom: 0),
      // ),
      decoration: InputDecoration(
        floatingLabelAlignment: FloatingLabelAlignment.start,
        floatingLabelBehavior: FloatingLabelBehavior.always,
        alignLabelWithHint: false,
        isDense: true,
        contentPadding: const EdgeInsets.only(
            left: 10, right: 0, top: 14, bottom: 14), //padding of label and content

        labelText: "I am a label",
        border: OutlineInputBorder(borderRadius: BorderRadius.circular(10.0)),
      ),
      items:
          ["content1", "content2"].map((e) => DropdownMenuItem(value: e, child: Text(e))).toList()),
                            

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestguidanceQuestion that needs advice or information.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions