-
Notifications
You must be signed in to change notification settings - Fork 27.1k
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
ReorderableListView breaks position of PopupMenuButton #47013
Comments
didn't know that there's a annoyance label 😂👍 Gesendet von meinem Pixel 2 XL mit FastHub |
Could be related to #31683. |
I have the same issue. This issue may be related: #26360 A workaround is to set
|
Thannks @yemel ❤️ . I solved it with: Theme(
data: Theme.of(context).copyWith(highlightColor: Colors.transparent),
child: PopupMenuButton(
initialValue: 0,
offset: Offset(0, 50),
... |
I am also having this issue, and for some reason, that workaround isn't working for me. |
@kjmj I encountered, that these workarounds depend on how much items you want to display in your PopUp. You have to play around with 50,...100...150... in y-Offset. |
Hi, I'm removing the |
Very nice reproducible code sample is here #25084 |
I have the same problem now, seems that it has not been fixed still |
Can some of the Flutter team help us here? @iapicca |
I summon @TahaTesser doctor[✓] Flutter (Channel master, 1.22.0-10.0.pre.121, on Linux, locale en_US.UTF-8)
• Flutter version 1.22.0-10.0.pre.121 at /home/francesco/development/flutter_master
• Framework revision 6c1a29e54c (15 hours ago), 2020-09-09 20:05:05 -0400
• Engine revision 564367b297
• Dart version 2.10.0 (build 2.10.0-107.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /usr/lib/Android
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = /usr/lib/Android
• ANDROID_SDK_ROOT = /usr/lib/Android
• Java binary at: /usr/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_265-8u265-b01-0ubuntu2~18.04-b01)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
• cmake version 3.10.2
• ninja version 1.8.2
• pkg-config version 0.29.1
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
[✓] Connected device (3 available)
• Linux (desktop) • linux • linux-x64 • Linux
• Web Server (web) • web-server • web-javascript • Flutter Tools
• Chrome (web) • chrome • web-javascript • Google Chrome 85.0.4183.102
! Doctor found issues in 1 category. |
code sample import 'package:flutter/material.dart';
void main() => runApp(MyApp());
const title = "PopupMenuButton test";
class MyItem {
MyItem(this.icon, this.title);
final IconData icon;
final String title;
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: title,
theme: ThemeData(
primarySwatch: Colors.pink,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
List<MyItem> _sampleItems;
bool _reorderable;
@override
void initState() {
super.initState();
_reorderable = true;
_sampleItems = [
MyItem(Icons.ac_unit, "Item 1"),
MyItem(Icons.access_alarm, "Item 2"),
MyItem(Icons.accessibility, "Item 3"),
MyItem(Icons.accessible, "Item 4"),
];
}
Widget _buildOptions(MyItem item) {
return PopupMenuButton(
itemBuilder: (BuildContext context) {
return [
new PopupMenuItem(child: new Text("edit"), value: "edit"),
new PopupMenuItem(child: new Text("delete"), value: "delete"),
];
},
onSelected: (selected) async {
await showDialog(
context: context,
builder: (BuildContext context) {
return SimpleDialog(
title: Text(selected),
contentPadding: EdgeInsets.all(25.0),
children: <Widget>[
Text("Item [${item.title}], Operation [$selected].")
],
);
});
},
);
}
Widget _buildListTile(BuildContext context, MyItem item) {
return ListTile(
key: Key(item.title),
leading: Icon(item.icon),
title: Text(item.title),
trailing: _buildOptions(item),
);
}
Widget _buildReorderableListView(BuildContext context) {
return ReorderableListView(
children: _sampleItems
.map((MyItem item) => _buildListTile(context, item))
.toList(),
onReorder: (oldIndex, newIndex) {
setState(() {
if (newIndex > _sampleItems.length) newIndex = _sampleItems.length;
if (oldIndex < newIndex) newIndex--;
MyItem item = _sampleItems[oldIndex];
_sampleItems.remove(item);
_sampleItems.insert(newIndex, item);
});
},
);
}
Widget _buildListView(BuildContext context) {
return ListView(
children: _sampleItems
.map((MyItem item) => _buildListTile(context, item))
.toList(),
);
}
Widget _buildSwitch(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(_reorderable ? "Using ReorderableListView" : "Using ListView"),
Switch.adaptive(
value: _reorderable,
onChanged: (bool value) => setState(() => _reorderable = value)),
],
);
}
Widget _buildBody(BuildContext context) {
return Container(
padding: EdgeInsets.all(10.0),
child: Column(
children: <Widget>[
_buildSwitch(context),
Expanded(
child: _reorderable
? _buildReorderableListView(context)
: _buildListView(context)),
],
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(title)),
body: _buildBody(context),
);
}
}
flutter doctor -v[✓] Flutter (Channel master, 1.22.0-10.0.pre.137, on Mac OS X 10.15.6 19G2021,
locale en-GB)
• Flutter version 1.22.0-10.0.pre.137 at
/Users/tahatesser/Code/flutter_master
• Framework revision 37e2013774 (4 hours ago), 2020-09-11 04:05:02 -0400
• Engine revision bdaac368f8
• Dart version 2.10.0 (build 2.10.0-115.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/tahatesser/Code/sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = /Users/tahatesser/Code/sdk
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.7)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.7, Build version 11E801a
• CocoaPods version 1.9.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 49.0.2
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.49.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.14.1
[✓] Connected device (3 available)
• macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.6 19G2021
• Web Server (web) • web-server • web-javascript • Flutter Tools
• Chrome (web) • chrome • web-javascript • Google Chrome 85.0.4183.102
• No issues found! |
/cc @HansMuller |
CC @darrenaustin |
Thank you sooo much @HansMuller |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Steps to Reproduce
ReorderableListView
Target Platform: Android / iOS / Web
Target OS version/browser: macOS Catalina / Chrome
Devices: iOS Simulator (iPhone 11 Pro Max) / Android 10 (Pixel 3 XL)
Logs
Logs
Analyze
Analyze
Doctor
Doctor
The text was updated successfully, but these errors were encountered: