Home > Software design >  how to add to the list of dropdowns, the distance between them?
how to add to the list of dropdowns, the distance between them?

Time:06-23

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 ?? [],
  );
 }

CodePudding user response:

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) {})));
  • Related