Andrii Havrylyak
Andrii Havrylyak

Reputation: 675

how to add to the list of dropdowns, the distance between them?

I have a widget, I have a dropdown in mine depending on the amount of data in the map. But the problem is these dropdowns appear very close to each other, is it possible to add the distance between them ?? Список дропдаунів вмене знадоиться в змінній "list ".

  Widget _buildAdditionFields(SimpleOrderStates state) {
if (state.isAdditionsProgress) {
  return const Padding(
    padding: EdgeInsets.all(Margins.small),
    child: PlatformProgressIndicator(),
  );
} else {

  var containsVariants = state.additionEntity?.hasVariants ?? false;
  var name = state.additionEntity?.name ?? '';
  var options = state.additionEntity
      ?.getAddition(0)
      ?.dropdownItems;
  print(state.additionEntity?.selectedVariants);
     var list = state.additionEntity?.selectedVariants
      .mapIndexed(
          (index, addition) =>
          _buildDropdownField(
              text: '',
              enabled: true,
              progress: false,
              dropdownOptions: [],
              focusNode: FocusNode(),
              applySelected: true,
              action: SvgPicture.asset(Img.dropdownArrow),
              labelText: addition!["additionName"],
              dropdownItemSelected: (item) {
                BlocProvider.of<SimpleOrderBloc>(context).add(
                    SimpleOrderDropdownMenuAdditionItemSelectedEvent(item));
              },
              textChanged: (text) {}
          ),


     ).toList();

     if(state.next != null){
       list?.add(_buildDropdownField(
           text: '',
           enabled: true,
           progress: false,
           dropdownOptions:options ?? [],
           focusNode: FocusNode(),
           applySelected: true,
           action: SvgPicture.asset(Img.dropdownArrow),
           labelText: name,
           dropdownItemSelected: (item) {
             BlocProvider.of<SimpleOrderBloc>(context).add(
                 SimpleOrderDropdownMenuAdditionItemSelectedEvent(item));
           },
           textChanged: (text) {}
       ),);

     }

  return Column(
    children: list ?? [],
  );
 }

Upvotes: 0

Views: 52

Answers (1)

Prabhakaran
Prabhakaran

Reputation: 1544

Wrap your drop-down widget with padding. in your case you need

padding: EdgeInsets.symmetric(4)

list?.add(
  Container(
     padding: EdgeInsets.symmetric(vertical: 8),
     child: _buildDropdownField(
       text: '',
       enabled: true,
       progress: false,
       dropdownOptions:options ?? [],
       focusNode: FocusNode(),
       applySelected: true,
       action: SvgPicture.asset(Img.dropdownArrow),
       labelText: name,
       dropdownItemSelected: (item) {
         BlocProvider.of<SimpleOrderBloc>(context).add(
            SimpleOrderDropdownMenuAdditionItemSelectedEvent(item));
       },
       textChanged: (text) {})));

Upvotes: 1

Related Questions