You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Draggable drags on left, right and middle mouse buttons. I just want left button #89962
Hi @sgehrman, Thanks for filing the issue. I am able to reproduce the issue the draggable item can be dragged with left, right and the center wheel as well reproducible on the latest stable and the master channel.
code sample
/// Flutter code sample for Draggable// The following example has a [Draggable] widget along with a [DragTarget]// in a row demonstrating an incremented `acceptedData` integer value when// you drag the element to the target.import'package:flutter/material.dart';
voidmain() =>runApp(constMyApp());
/// This is the main application widget.classMyAppextendsStatelessWidget {
constMyApp({Key? key}) :super(key: key);
staticconstString _title ='Flutter Code Sample';
@overrideWidgetbuild(BuildContext context) {
returnMaterialApp(
title: _title,
home:Scaffold(
appBar:AppBar(title:constText(_title)),
body:constMyStatefulWidget(),
),
);
}
}
/// This is the stateful widget that the main application instantiates.classMyStatefulWidgetextendsStatefulWidget {
constMyStatefulWidget({Key? key}) :super(key: key);
@overrideState<MyStatefulWidget> createState() =>_MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.class_MyStatefulWidgetStateextendsState<MyStatefulWidget> {
int acceptedData =0;
@overrideWidgetbuild(BuildContext context) {
returnRow(
mainAxisAlignment:MainAxisAlignment.spaceEvenly,
children:<Widget>[
Draggable<int>(
// Data is the value this Draggable stores.
data:10,
child:Container(
height:100.0,
width:100.0,
color:Colors.lightGreenAccent,
child:constCenter(
child:Text('Draggable'),
),
),
feedback:Container(
color:Colors.deepOrange,
height:100,
width:100,
child:constIcon(Icons.directions_run),
),
childWhenDragging:Container(
height:100.0,
width:100.0,
color:Colors.pinkAccent,
child:constCenter(
child:Text('Child When Dragging'),
),
),
),
DragTarget<int>(
builder: (
BuildContext context,
List<dynamic> accepted,
List<dynamic> rejected,
) {
returnContainer(
height:100.0,
width:100.0,
color:Colors.cyan,
child:Center(
child:Text('Value is updated to: $acceptedData'),
),
);
},
onAccept: (int data) {
setState(() {
acceptedData += data;
});
},
),
],
);
}
}
flutter doctor -v
[✓] Flutter (Channel stable, 2.5.0, on macOS 11.5.2 20G95 darwin-arm, locale en-GB)
• Flutter version 2.5.0 at /Users/mahesh/Documents/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4cc385b4b8 (6 days ago), 2021-09-07 23:01:49 -0700
• Engine revision f0826da7ef
• Dart version 2.14.0
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/mahesh/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• ANDROID_HOME = /Users/mahesh/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
[✓] IntelliJ IDEA Community Edition (version 2021.2.1)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 60.1.4
• Dart plugin version 212.5080.8
[✓] VS Code (version 1.59.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.26.0
[✓] Connected device (4 available)
• Redmi K20 Pro (mobile) • d9dac45d • android-arm64 •
Android 11 (API 30)
• iPhone 12 Pro Max (mobile) • 5430F628-A903-402C-A635-D55D7E6EEFCA • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS
11.5.2 20G95 darwin-arm
• Chrome (web) • chrome • web-javascript • Google
Chrome 93.0.4577.63
• No issues found!
[✓] Flutter (Channel master, 2.6.0-1.0.pre.103, on macOS 11.5.2 20G95 darwin-arm, locale en-GB)
• Flutter version 2.6.0-1.0.pre.103 at /Users/mahesh/Documents/flutter_master
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2c30b252a5 (2 weeks ago), 2021-08-27 23:26:03 -0400
• Engine revision ca52647cd2
• Dart version 2.15.0 (build 2.15.0-65.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/mahesh/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• ANDROID_HOME = /Users/mahesh/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.5.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.10.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
[✓] IntelliJ IDEA Community Edition (version 2021.2.1)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 60.1.4
• Dart plugin version 212.5080.8
[✓] VS Code (version 1.59.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.26.0
[✓] Connected device (4 available)
• Redmi K20 Pro (mobile) • d9dac45d • android-arm64 • Android 11 (API 30)
• iPhone 12 Pro Max (mobile) • 5430F628-A903-402C-A635-D55D7E6EEFCA • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 11.5.2 20G95
darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome
93.0.4577.63
• No issues found!
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 flutter doctor -v and a minimal reproduction of the issue.
Activity
evandrmb commentedon Sep 13, 2021
Hi, could you tell me if this wouldn't solve your problem?
HansMuller commentedon Sep 13, 2021
CC @dkwingsmt
sgehrman commentedon Sep 14, 2021
maheshj01 commentedon Sep 14, 2021
Hi @sgehrman, Thanks for filing the issue. I am able to reproduce the issue the draggable item can be dragged with left, right and the center wheel as well reproducible on the latest stable and the master channel.
code sample
flutter doctor -v
Code sample taken from docs.
Also, I couldn't find any docs specifying how to configure mouse events.
Edited: This is also applicable for LongPressDraggable
bernaferrari commentedon Sep 19, 2022
I made a really simple PR that fixes this.
github-actions commentedon Mar 4, 2023
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
flutter doctor -vand a minimal reproduction of the issue.