0

Hello everyone i've made a map with 2 dropdowns, they work but i got this issue i cant seem to get rid of.

When the names of the selected items are too long i get an overflow.

I dont know what to do about it, hope someone can help me with this :)

Widget:

Theme(
                                  data: ThemeData.light().copyWith(
                                    primaryColor: azulTuti,
                                    accentColor: azulTuti,
                                    colorScheme: ColorScheme.light(
                                        primary: azulTuti),
                                    buttonTheme: ButtonThemeData(
                                        textTheme: ButtonTextTheme.primary),
                                  ),
                                  child: FindDropdown(
                                    searchBoxDecoration: InputDecoration(
                                        hintText: "Seleccione un local"),
                                    selectedItem: selected_local,
                                    items: locales,
                                    key: UniqueKey(),
                                    onChanged: (local) {
                                      if (local != "Seleccione un local") {
                                        setState(() {
                                          selected_local = local;
                                          chooseLocal = true;
                                          zoomMarker(selected_local);
                                        });
                                      }
                                    },
                                  )),

What i get:

enter image description here

2 Answers 2

1

We can define dropdownBuilder. Please add the following code inner FindDropdown Widget.

dropdownBuilder: (context, selectedItem) {
  return Container(
    padding: EdgeInsets.all(8),
    decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(4),
        color: Colors.white),
    child: Row(
      children: [
        Expanded(
          child: Text(
            selectedItem.toString(),
            style: TextStyle(color: Colors.black),
          ),
        ),
        SizedBox(width: 8),
        Icon(Icons.arrow_drop_down),
      ],
    ),
  );
},

screenshot

Sign up to request clarification or add additional context in comments.

Comments

1

you might wanna use this it will keep your text in one line and scrollable

                    Expanded( 
                      child: Container(
                         child:SingleChildScrollView(
                            scrollDirection: Axis.horizontal,
                            child: Text(
                              "--",),
                         ),
                      ),
                    )

1 Comment

Your answer worked but i prefer Mardel's answer, 1+ cause was useful :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.