Comments (11)
Check the decoration
parameter of DropdownButtonFormField2 at Example 7, you've to disable the horizontal padding there.
from dropdown_button2.
from dropdown_button2.
Unfortunately, this doesn’t work with the prefixIcon 😕
Can you explain more please? Maybe a sample can help.
from dropdown_button2.
from dropdown_button2.
I mean a working sample that has zero horizontal padding at decoration
parameter.
from dropdown_button2.
from dropdown_button2.
In InputDecoration of DropdownbuttonFormField2, there is no horizontal padding in the example I provided above. The issue is that the padding in MenuItemStyleData is passed to ButtonStyleData (when the value is selected and displayed).
…
On Fri, 9 Feb 2024 at 19:38, Ahmed Elsayed @.> wrote: I mean a working sample that has zero horizontal padding at decoration parameter. — Reply to this email directly, view it on GitHub <#237 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXOUCPBNALXMYY6OWACZVPLYSZUJFAVCNFSM6AAAAABDBNL4IGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZWGQZDGNJSHA . You are receiving this because you authored the thread.Message ID: @.>
Add contentPadding: EdgeInsets.zero
to InputDecoration
and start from there.
from dropdown_button2.
from dropdown_button2.
from dropdown_button2.
Alright, when you've null buttonWidth & dropdownWidth, all menu horizontal padding will be added to the button padding so that menu width adapts to max items width with padding properly.
The thing is that the padding will be added to the content of the form field without the prefixIcon. It's the same behavior as Flutter's form fields IIRC.
You have too much padding because the prefix icon has constraints. Updating your code with the following:
prefixIcon: Padding(
padding: const EdgeInsetsDirectional.only(start: 30),
child: const Icon(
Icons.transgender_outlined,
color: Colors.red,
),
),
prefixIconConstraints: const BoxConstraints(),
will align the prefix icon with the menu items properly, but will also include padding of 30 between the prefix and the button content which is expected as discussed above.
It's not a perfect solution i know.
I'm thinking of adding a property to ButtonStyleData
to control whether to include menu padding into the button or not (will default to true). When it's set to false, you've to handle the padding at the button on your own and also the menu can't dynamically match button's size when both buttonWidth & dropdownWidth are null (Note to myself: You've to add menu padding to the menu size in that case).
from dropdown_button2.
from dropdown_button2.
Related Issues (20)
- How can i create menu items with exactly height for each element
- Not possible to have label, text and dropdown values all aligned with OutlineInputBorder HOT 2
- Show selected item when page initialized HOT 6
- onChanged doesn't work when using multiValueListenable HOT 2
- DropdownButtonFormField2 initial value HOT 2
- barrierCoversButton: false property not working
- Not resetting the search querry before reopening the menu breaks the dropdown menu scroll position calculation algorithm
- The package interferes with TextField HOT 1
- Being able to set the errorText HOT 1
- Ink splashes get displayed over search widget HOT 2
- Disable focus on DropdownItem HOT 11
- How to wrap TapRegion with groupID around DropdownButtonFormField2 to track TapInside / TapOutside with other TapRegions
- Add an ability to override comparator function HOT 21
- The border does not change to red on validation error HOT 5
- On mobile once keyboard open it's pushing the dropdown to top HOT 6
- Use onMenuStateChange & FocusNode for TextField not working
- How to change disabled style?
- Please add label text property
- Update icon property of 'IconStyleData'.
- Restricting the scrollable list, with last item sticky HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dropdown_button2.