dropdown_button2
dropdown_button2 copied to clipboard
When the window size changes, the pop-up layer position is incorrect
This is a minimal example where you can reproduce this issue:
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const DropdownMenuExample());
}
class DropdownMenuExample extends StatelessWidget {
const DropdownMenuExample({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
useMaterial3: true,
colorSchemeSeed: Colors.green,
),
home: Scaffold(
body: Center(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
DropdownButton2<int>(
buttonStyleData: const ButtonStyleData(
padding: EdgeInsets.zero,
),
onChanged: (value) {},
items: [
for (int i = 1; i <= 5; i++)
DropdownMenuItem<int>(
value: i,
child: Text(i.toString()),
),
],
),
],
),
),
),
),
);
}
}
And this is the current behavior:
Screencast from 25-03-24 21:21:13.webm
Proposal: Closing the menu immediately changes the screen size.
This is how the Flutter DropdownMenu behaves:
This is a minimal example where you can reproduce this issue:
import 'package:dropdown_button2/dropdown_button2.dart'; import 'package:flutter/material.dart'; void main() { runApp(const DropdownMenuExample()); } class DropdownMenuExample extends StatelessWidget { const DropdownMenuExample({super.key}); @override Widget build(BuildContext context) { return MaterialApp( theme: ThemeData( useMaterial3: true, colorSchemeSeed: Colors.green, ), home: Scaffold( body: Center( child: Padding( padding: const EdgeInsets.symmetric(vertical: 20), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ DropdownButton2<int>( buttonStyleData: const ButtonStyleData( padding: EdgeInsets.zero, ), onChanged: (value) {}, items: [ for (int i = 1; i <= 5; i++) DropdownMenuItem<int>( value: i, child: Text(i.toString()), ), ], ), ], ), ), ), ), ); } }And this is the current behavior:
Screencast.from.25-03-24.21.21.13.webm Proposal: Closing the menu immediately changes the screen size.
This is how the Flutter DropdownMenu behaves:
Screencast.from.25-03-24.21.38.44.webm
ok. thx!
Same issue
@AhmedLSayed9 Is this bug getting fixed?
Any update?
This has been fixed at v3.0.0-beta.16
in v3.0.0-beta.22 I still see this issue
@Suraj-Smartcache Can you reproduce it with the sample above?
@AhmedLSayed9
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const DropdownMenuExample());
}
class DropdownMenuExample extends StatelessWidget {
const DropdownMenuExample({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true, colorSchemeSeed: Colors.green),
home: Scaffold(
body: Center(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
DropdownButton2<int>(
buttonStyleData: const ButtonStyleData(
padding: EdgeInsets.zero,
),
onChanged: (value) {},
items: [
for (int i = 1; i <= 5; i++)
DropdownItem<int>(value: i, child: Text(i.toString())),
],
),
],
),
),
),
),
);
}
}
UI:
https://github.com/user-attachments/assets/3955e458-7bb4-40e4-9917-6315b1b95363
@Suraj-Smartcache Can you reproduce it using version 3.0.0-beta.16 ?
@AhmedLSayed9 yes the same behaviour is present in both 3.0.0-beta.16 and 3.0.0-beta.22
@Suraj-Smartcache
Can you check again using version 3.0.0-beta.23?
@AhmedLSayed9 its working perfectly in 3.0.0-beta.23. Thanks!