searchable_dropdown icon indicating copy to clipboard operation
searchable_dropdown copied to clipboard

Searchbox Padding

Open Badouu opened this issue 2 years ago • 6 comments

Hello,

I'm using the version : dropdown_search: ^5.0.3. The top padding is to large. It's look like an issue. How can I manage it ?

Thanks

Capture d’écran 2022-09-28 à 13 17 59

Badouu avatar Sep 28 '22 13:09 Badouu

in which mode ?

salim-lachdhaf avatar Sep 28 '22 15:09 salim-lachdhaf

In this mode : PopupPropsMultiSelection.modalBottomSheet

Badouu avatar Sep 28 '22 15:09 Badouu

use .bottomSheet or try to update your Flutter SDK (the issue seems corrected with the last SDK). if you are not using MultiSelection mode use PopupProps istead of PopupPropsMultiSelection

salim-lachdhaf avatar Sep 28 '22 15:09 salim-lachdhaf

Thanks for the quick response. Flutter has been updated. It works for Android but not for iOS.

  • iOS : Capture d’écran 2022-09-29 à 01 20 11

  • Android : Capture d’écran 2022-09-29 à 01 33 24

Badouu avatar Sep 29 '22 01:09 Badouu

please past a simple example to analyse the issue

salim-lachdhaf avatar Sep 29 '22 11:09 salim-lachdhaf

Here is the code :

Widget _customPopupItemBuilderSubActivity(
    BuildContext context,
    SubActivityModel? item,
    bool isSelected,
  ) {
    return Container(
      margin: EdgeInsets.symmetric(horizontal: 8),
      decoration: !isSelected
          ? null
          : BoxDecoration(
              border: Border.all(color: Theme.of(context).primaryColor),
              borderRadius: BorderRadius.circular(5),
              color: Colors.white,
            ),
      child: ListTile(
        selected: isSelected,
        title: Text(item?.name ?? ''),
      ),
    );
  }

DropdownSearch<SubActivityModel>(
            key: _formKey,
            onChanged: (value) {
              if (value != null) {
                print(value.name);
                setState(() {
                  personalInformationData!['domainActivity'] =
                      value.code as String;
                  personalInformationValidation['domainActivity'] = false;
                });
              }
            },
            asyncItems: (String? filter) async {
              return await _subActivities;
            },
            popupProps: PopupPropsMultiSelection.bottomSheet(
              showSelectedItems: true,
              itemBuilder: _customPopupItemBuilderSubActivity,
              showSearchBox: true,
            ),
            compareFn: (item, sItem) {
              return item.name == sItem.name;
            },
            dropdownDecoratorProps: DropDownDecoratorProps(
              dropdownSearchDecoration: InputDecoration(
                labelText: 'Activité *',
                errorText: personalInformationValidation['domainActivity']
                        as bool
                    ? RegisterPersonnalDataValidator.domainActivity(
                        personalInformationData!['domainActivity'] as String)
                    : null,
                filled: true,
                fillColor: Colors.white,
                contentPadding: EdgeInsets.only(left: 0, top: 13, bottom: 15),
              ),
            ),
          ),

Badouu avatar Sep 29 '22 17:09 Badouu

I've got same issue can anyone solved this?

emrgry avatar Nov 22 '22 21:11 emrgry

Facing the same issue, any update on this?

iam-amanxz avatar Dec 02 '22 10:12 iam-amanxz

I thaught it might be the container, but it's something else.

popupProps: PopupProps.modalBottomSheet(
  containerBuilder: (context, popupWidget) {
    return Container(
      color: Colors.redAccent,
      child: popupWidget,
    );
  },
),

iam-amanxz avatar Dec 02 '22 10:12 iam-amanxz

I did some tests and the problem seems to be related to the margin applied to the ModalBottomSheet container:

return Container(
   margin: EdgeInsets.only(
     bottom: viewInsetsBottom,
     top: viewPaddingTop,
   ),
   child: _popupWidgetInstance(),
);

The widget is displayed correctly by removing the margin.

manueltag avatar Dec 16 '22 09:12 manueltag