0

we're trying to do a dropdownbutton in flutter that has the arrow icon static all the way to the right of the button. We've tried doing isExpanded, but that just makes the text and icon dissapear from the box. We don't know what we're doing wrong.

Here is the code for our button:

                              padding:
                                  const EdgeInsets.only(left: 30, right: 30),
                              //VIKTIG
                              child: DropdownButtonHideUnderline(
                                child: DropdownButton(
                                  hint: Text(
                                    chosenActivity == null
                                    //TODO: Hint text "aktivitet" i mitten av knappen?
                                        ? 'Välj aktivitet'
                                        : chosenActivity.name,
                                    style: Styles.h5,
                                     textAlign: TextAlign.center,
                                  ),
                                  //isExpanded: false,
                                  value: dropdownvalue,
                                  items: _activities.map((Activity activity) {
                                    return DropdownMenuItem(
                                      value: activity,
                                      child: Text(activity.name),
                                    );
                                  }).toList(),
                                  // After selecting the desired option,it will
                                  // change button value to selected value
                                  onChanged: (Object? newValue) {
                                    setState(() {
                                      chosenActivity = newValue!;
                                    });
                                    print(chosenActivity.name);
                                  },
                                  icon: const Padding(
                                      //Icon at tail, arrow bottom is default icon
                                      padding: EdgeInsets.only(left: 30),
                                      child: Icon(
                                        Icons.arrow_circle_down_sharp,
                                        color: Colors.black,
                                      )),
                                  iconEnabledColor: Colors.white,
                                  //Icon color
                                  style: const TextStyle(
                                      //te
                                      color: Colors.black, //Font color
                                      fontSize:
                                          20 //font size on dropdown button
                                      ),
                                ),
                              ),
                            ), 

We want the icon to be here without it moving:


  [1]: https://i.stack.imgur.com/0tQ1b.png



Sorry if this is unclear,
Thanks!

0 Answers0