-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
PointerUpEvent.buttons
needs to document what it represents more clearly
#110448
Comments
Hi @cswxzx please provide a minimal, reproducible example and the output of |
Correct the error description:
|
I can see you're using an older version of Flutter. Could you upgrade to the latest master and confirm if the issue still persists? |
Flutter doctor (Master)
Logs
|
Tirage reportI can reproduce this issue on all desktop platforms as well as web. From the source, looks like Vesions reproducible on
InfoCode Sampleimport 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
void main() => runApp(
const MaterialApp(
home: IndexPage(title: 'Demo'),
),
);
class IndexPage extends StatefulWidget {
const IndexPage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State createState() => _IndexPageState();
}
class _IndexPageState extends State<IndexPage> {
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
backgroundColor: const Color(0xFF181818),
),
body: Listener(
//behavior: HitTestBehavior.opaque,
onPointerDown: (PointerDownEvent event) {
if (event.buttons == kPrimaryMouseButton) {
print('##############, onPointerDown, kPrimaryMouseButton');
} else if (event.buttons == kSecondaryMouseButton) {
print('##############, onPointerDown, kSecondaryMouseButton');
} else {
print('##############, onPointerDown, button=${event.buttons}');
}
},
onPointerUp: (PointerUpEvent event) {
if (event.buttons == kPrimaryMouseButton) {
print('##############, onPointerUp, kPrimaryMouseButton');
} else if (event.buttons == kSecondaryMouseButton) {
print('##############, onPointerUp, kSecondaryMouseButton');
} else {
print('##############, onPointerUp, button=${event.buttons}');
}
},
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
Text(
'You have pushed the button this many times:',
),
],
),
),
),
floatingActionButton: const FloatingActionButton(
onPressed: null,
tooltip: 'Increment',
child: Icon(Icons.add),
),
);
}
} Logs
Flutter Doctor (Windows)
|
PointerUpEvent
buttons state is incorrect on Listener
PointerUpEvent
buttons state is incorrect on Listener
PointerUpEvent.buttons
state is incorrect on Listener
(Desktop Triage) We think the problem here is one of documentation. The |
PointerUpEvent.buttons
state is incorrect on Listener
PointerUpEvent.buttons
needs to document what it represents more clearly
I think buttons should represent which button, whether it's pressed or popped. |
When the right mouse button is pressed, the buttons in
PointerDownEvent
arekSecondaryMouseButton
, but the buttons inPointerUpEvent
arekPrimaryMouseButton
.The text was updated successfully, but these errors were encountered: