dropdown_button2 icon indicating copy to clipboard operation
dropdown_button2 copied to clipboard

When the window size changes, the pop-up layer position is incorrect

Open srnrider53 opened this issue 1 year ago • 3 comments
trafficstars

image

srnrider53 avatar Feb 22 '24 09:02 srnrider53

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

andrySD avatar Mar 26 '24 01:03 andrySD

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!

srnrider53 avatar Mar 26 '24 04:03 srnrider53

Same issue

adonisRodxander avatar Mar 27 '24 00:03 adonisRodxander

@AhmedLSayed9 Is this bug getting fixed?

ankitgitac avatar May 20 '24 07:05 ankitgitac

Any update?

adonisRodxander avatar May 20 '24 18:05 adonisRodxander

This has been fixed at v3.0.0-beta.16

AhmedLSayed9 avatar May 25 '24 21:05 AhmedLSayed9

in v3.0.0-beta.22 I still see this issue

Suraj-Smartcache avatar Aug 21 '25 12:08 Suraj-Smartcache

@Suraj-Smartcache Can you reproduce it with the sample above?

AhmedLSayed9 avatar Aug 21 '25 15:08 AhmedLSayed9

@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 avatar Aug 22 '25 11:08 Suraj-Smartcache

@Suraj-Smartcache Can you reproduce it using version 3.0.0-beta.16 ?

AhmedLSayed9 avatar Aug 22 '25 17:08 AhmedLSayed9

@AhmedLSayed9 yes the same behaviour is present in both 3.0.0-beta.16 and 3.0.0-beta.22

Suraj-Smartcache avatar Aug 23 '25 03:08 Suraj-Smartcache

@Suraj-Smartcache Can you check again using version 3.0.0-beta.23?

AhmedLSayed9 avatar Aug 26 '25 18:08 AhmedLSayed9

@AhmedLSayed9 its working perfectly in 3.0.0-beta.23. Thanks!

Suraj-Smartcache avatar Aug 28 '25 11:08 Suraj-Smartcache