Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to remove paddings in the widget #9

Closed
geriby23 opened this issue Apr 16, 2020 · 6 comments
Closed

How to remove paddings in the widget #9

geriby23 opened this issue Apr 16, 2020 · 6 comments

Comments

@geriby23
Copy link

Screenshot 2020-04-17 at 01 22 34

I have 3 search_choices, I noticed that if the widget has loaded list but has no data selected it is without padding(like: select province on the screenshot). If I select some item widget now has padding on the top and bottom(country dropdown on the screen.) And if dropdown doesn't have any data and is disabled it also has top and bottom padding. Is there any possibility to get rid of them and make the same height for all dropdowns?

@lcuis
Copy link
Owner

lcuis commented Apr 17, 2020

Hello @geriby23 ,

Indeed, there is a difference in the padding. Here is a way to work around this:

SearchChoices.single(
        items: items,
        value: selectedIValueSearchChoices_issue_9,
        hint: Padding(
          padding: const EdgeInsets.all(0.0),
          child: Text("Select any",style: TextStyle(fontSize: 16,color: Colors.grey,),),
        ),
        disabledHint: Padding(
          padding: const EdgeInsets.all(0.0),
          child: Text("Disabled",style: TextStyle(fontSize: 16,color: Colors.grey,),),
        ),
        onChanged: selectedIValueSearchChoices_issue_9=="lorem ipsum"?null:(value) {
          setState(() {
            selectedIValueSearchChoices_issue_9 = value;
          });
        },
        selectedValueWidgetFn: (item) {
          return (Padding(
            padding: const EdgeInsets.all(0.0),
            child: Align(
              alignment: Alignment.centerLeft,
                child: Text(item.toString(),style: TextStyle(fontSize: 16,color: Colors.black,),)),
          ));
        },
        style: TextStyle(fontSize: 16),
        underline: Container(
          height: 0.0,
          padding: const EdgeInsets.all(0.0),
          margin: const EdgeInsets.all(0.0),
          decoration: BoxDecoration(
              border:null
          ),
        ),
        isExpanded: true,
      );

I would like to warn you that search_choices is also affected by the menu mode not working on hosted web.

@geriby23
Copy link
Author

Hi @lcuis ! Thanks, it really helped me to get rid of that padding =).
Is this bug something serious? Will there be updated to this library with a working menu?

@lcuis
Copy link
Owner

lcuis commented Apr 17, 2020

My pleasure @geriby23 !

The hosted web menu issue is known and confirmed only recently. It is difficult to investigate and test as it requires the deployment on a hosting solution without debugging. I'm not sure when I will have time to solve it (if it is me solving it).

@lcuis
Copy link
Owner

lcuis commented Apr 17, 2020

Hello @geriby23 ,

I just updated search_choices plugin in GitHub and pub.dev with a fix for the bug that prevented menu to open when on hosted web.

The weird thing is that apparently, passing a list of bool as an argument allows to update the bool from the called function and this updates the value from the calling class perspective in Android+iOS apps, Android Studio web but not hosted web.

I had to replace this listed bool by a fake pointer class (PointerThisPlease) and it now also works on hosted web.

I will also propose an update with this fix on the searchable_dropdown plugin after some testing.

@geriby23
Copy link
Author

I have just read your message on the searchable_dropdown channel. Great job man! So searchble_dropdown is now more reliable? Should I move back to that widget?

@lcuis
Copy link
Owner

lcuis commented Apr 18, 2020

My pleasure!

You can move back to searchable_dropdown but the fix is not yet published to pub.dev . Nor is it merged to the master branch. So, you would have to find a way to get the plugin from the PR which may not be ideal if feasible. Or you can wait for the fix to be merged and deployed there. In the meantime, search_choices should work fine if nothing crazy happens (I have no such plans lately).

@lcuis lcuis closed this as completed Apr 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants