Repository navigation
Closed
Labels
in triagePresently being triaged by the triage teamPresently being triaged by the triage teamwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
Description
Steps to reproduce
- Create an app with PlatformViewLink and AndroidViewSurface
- Implement in Kotlin SurfaceView(or GLSurfaceView) method onTouchEvent
- Listen to events in that callback
- Press 1 finger on touchscreen, press 2 finger on touchscreen, and release first finger from screen, holding the second finger. After placing first finger against, coordinates from second finger will move to first, and coordinates of second finger will become weirdness(like 4000 or 5000 on x axis and -300 on y axis)
Expected results
After placing first finger back, the pointer 0 should have first finger coords, and second finger should remain without changes
Actual results
After placing first finger against, coordinates from second finger will move to first, and coordinates of second finger will become weirdness(like 4000 or 5000 on x axis and -300 on y axis). I did a little research and it caused by translateMotionEvent, introduced in this commit flutter-team-archive/engine@70de32b . After reverting to 3.22.0 version everything is okay.
Code sample
Code sample
class GameScreen extends StatefulWidget {
@override
_GameScreenState createState() => _GameScreenState();
}
class _GameScreenState extends State<GameScreen> {
static const platform = MethodChannel('com.example.flutterglapp/game');
// Initial UI state
GameUIState _uiState = GameUIState();
@override
void initState() {
super.initState();
// Set up method call handler to listen for JSON updates from Android
platform.setMethodCallHandler((call) async {
if (call.method == 'updateUI') {
final String json = call.arguments;
_handleJsonMessage(json);
}
});
}
// Handle the incoming JSON message and update the UI state
void _handleJsonMessage(String json) {
// Parse the JSON string into a Map
final Map<String, dynamic> data = jsonDecode(json);
// Update the UI state based on the incoming data
setState(() {
_uiState = GameUIState.fromJson(data);
});
}
@override
Widget build(BuildContext context) {
return Container(
child: Stack(
children: [
// GLSurfaceView as the background
GameSurface(),
],
),
);
}
}
class GameSurface extends StatelessWidget {
@override
Widget build(BuildContext context) {
// This is used in the platform side to register the view.
const String viewType = 'gl_surface_view';
// Pass parameters to the platform side.
const Map<String, dynamic> creationParams = <String, dynamic>{};
return PlatformViewLink(
viewType: viewType,
surfaceFactory: (context, controller) {
return AndroidViewSurface(
controller: controller as AndroidViewController,
gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
Factory<OneSequenceGestureRecognizer>(
() => EagerGestureRecognizer(),
),
},
hitTestBehavior: PlatformViewHitTestBehavior.opaque,
);
},
onCreatePlatformView: (params) {
return PlatformViewsService.initSurfaceAndroidView(
id: params.id,
viewType: viewType,
layoutDirection: TextDirection.ltr,
creationParams: creationParams,
creationParamsCodec: const StandardMessageCodec(),
onFocus: () {
params.onFocusChanged(true);
},
)
..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
..create();
},
);
}
}Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.24.3, on macOS 15.0.1 24A348 darwin-arm64, locale
en-US)
• Flutter version 3.24.3 on channel stable at
/Users/admin/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2663184aa7 (6 weeks ago), 2024-09-11 16:27:48 -0500
• Engine revision 36335019a8
• Dart version 3.5.3
• DevTools version 2.37.3
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at /Users/admin/Library/Android/sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/to/macos-android-setup for more details.
[!] Xcode - develop for iOS and macOS (Xcode 16.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16A242d
✗ CocoaPods not installed.
CocoaPods is a package manager for iOS or macOS platform code.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/to/platform-plugins
For installation instructions, see
https://guides.cocoapods.org/using/getting-started.html#installation
[✗] Chrome - develop for the web (Cannot find Chrome executable at
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2024.1)
• 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
17.0.11+0-17.0.11b1207.24-11852314)
[✓] VS Code (version 1.94.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64
• macOS 15.0.1 24A348 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin
• macOS 15.0.1 24A348 darwin-arm64
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 3 categories.Metadata
Metadata
Assignees
Labels
in triagePresently being triaged by the triage teamPresently being triaged by the triage teamwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
Activity
huycozy commentedon Oct 24, 2024
Hi @IamFIR3BALL
This looks similar to #96640 but since you mentioned the introduced commit and workable version 3.22.0 as above, it doesn't seem so.
Can you please also provide this code on native side? It would be appreciated if you could share the sample code in a GitHub repo with opensource license so I can just pull and verify it. Thank you!
github-actions commentedon Nov 14, 2024
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
Thanks for your contribution.
github-actions commentedon Nov 28, 2024
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.