Comments (5)
I've tested it and buttonDecoration is applied on the button when using Android's back button.
Could you please share a sample example that produce this issue?
from dropdown_button2.
Hi, thanks you for your quick response.
Here is a simplified version of my Dropdown Widget :
class DropdownWidget extends StatefulWidget {
final List<String> values;
final String? value;
final Function(String?)? onChanged;
const DropdownWidget({
Key? key,
required this.values,
required this.value,
required this.onChanged,
}) : super(key: key);
@override
State<DropdownWidget> createState() => _DropdownWidgetState();
}
class _DropdownWidgetState extends State<DropdownWidget> {
bool _isDropdownOpen = false;
@override
Widget build(BuildContext context) {
return DropdownButtonHideUnderline(
child: DropdownButton2(
isExpanded: true,
value: widget.value,
onChanged: widget.onChanged,
onMenuStateChange: (isOpen) {
setState(() {
_isDropdownOpen = isOpen;
});
},
//Items
itemPadding: EdgeInsets.zero,
items: widget.values.map((String type) {
return DropdownMenuItem<String>(
value: type,
child: Text(type),
);
}).toList(),
//Button
buttonHeight: 50.0,
buttonPadding: const EdgeInsets.symmetric(horizontal: 14),
buttonDecoration: BoxDecoration(
borderRadius: _isDropdownOpen
? BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(10),
)
: BorderRadius.circular(10),
color: AppColors.white,
),
//Dropdown
dropdownDecoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(10),
bottomRight: Radius.circular(10),
),
color: AppColors.white,
),
dropdownPadding: EdgeInsets.zero,
dropdownElevation: 0,
dropdownMaxHeight: 250,
scrollbarAlwaysShow: true,
),
);
}
}
To reproduce :
1 - Open dropdown, close by tapping anywhere outside the dropdown. All good.
2 - Open dropdown, close using Android back button. The button ends up with the dropdownDecoration.
The issue probably comes from the usage of onMenuStateChanged.
Does onMenuStateChanged have the same behaviour when dropdown is closed via back button/other ways ?
from dropdown_button2.
Screen.Recording.2022-07-18.at.6.04.53.PM.mov
I've tried your sample code and couldn't reproduce the issue.
onMenuStateChange
triggers when the dropdown menu route get removed whatever the way.
from dropdown_button2.
Indeed !
You made me try on an emulator and the issue is gone.
However, even on an empty project (just like you), the issue persists on my physical Android device.
I'll leave it as is for now and investigate later, but I guess the issue is not related to your package.
Thank you for your time <3
I suppose the issue can be closed for now ? I'll reopen if needed
from dropdown_button2.
I've never noticed this issue on my old physical Android device (using iPhone now). so, It might be related to your device.
You should try to test it on another device that might help finding if the issue related to some device?
Alright! I'll close this for now. Feel free to re-open if needed.
from dropdown_button2.
Related Issues (20)
- The menus need to be fully displayed, and after selection, the overflow needs to be replaced with ellipsis (...).
- Horizontal line issue under DropdownButtonFormField2 HOT 1
- Example 4 | Multi Select Dropdown HOT 1
- searchData not working in release app (show grey blank dropdown container) this code HOT 1
- Failed assertion: line 991 pos 11 ... There shoiuld be exactly one item with DropdownButtons ...
- somehow i delet class of DropdownButton2 class ,i dont know how to ReCreate or ReAdd it please Share me Solution @AhmedLSayed HOT 1
- Disable dropdown button HOT 1
- button have a shadow
- Using DropdownButton2 above the Navigator
- update selected value when menu is closed.
- Why can't find dropdownSeparator
- Can't change thumb color
- Conflicting paddings in MenuItemStyleData, DropDownStyleData, and ButtonStyleData HOT 11
- Can't open dialog on menu item tap HOT 1
- overlayColor has no effect HOT 6
- Searching item.child not working on release mode but in debug mode run successfully. HOT 1
- `DropdownButtonFormField2` doesn't hide its underline. HOT 1
- How to set MouseCursor
- When the window size changes, the pop-up layer position is incorrect HOT 5
- DropDown button 2 latest beta fails with empty dropdown HOT 3
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.