Open HidenoriMatsubayashi opened 3 years ago
I could reproduce this issues on macOS.
cc @dkwingsmt
same issue.
reproduced on macOS and web on flutter stable channel 2.2.2 PS in previous versions of flutter (before 2.2.1) this was not present
Any news about this? I'm also experiencing the same issue on macOS when clicking on a SnackBarAction
. This is quite serious as it freezes the app as soon as the action is clicked and the app seems to be running in an infinite loop then.
Hi everyone
This is not actually related to Snackbar
but a general desktop issue but this should be reproducible using other widgets as well and this has been reported few times but the cause was not reproduced or isolated.. Gallery app here is creating the condition that reproduces this issue, using the official Snackbar example doesn't reproduce this issue.
This was reported in https://github.com/flutter/flutter/issues/76325 and the same condition is created using Navigation Rail when we switch between items with mouse https://github.com/flutter/flutter/issues/85383
The issue reproduces with mouse hover like this and cursor icon is changed to disabled, if I move the mouse, the exception is thrown
Source
When we move cursor, renderbinding updates mouse event here and the exception is thrown in mouse_tracker.dart
, assertion fails
stable |
master |
---|---|
❌ | ❌ |
Check flutter doctor -v
outputs for each channel below
✅: No Issue ❌: Issue reproduced
@rydmike mentioned in https://github.com/flutter/flutter/issues/76325#issuecomment-886043215
WidgetsFlutterBinding.ensureInitialized();
doesn't this solve issue
Thanks @TahaTesser, great job with tracking down the cause of this issue 👍🏻
I just noticed I am having this problem too. I'm on linux. writing a desktop app. 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 201 pos 12: '!_debugDuringDeviceUpdate': is not true.
Same issue - when I add a snackbar to my web app and click its action, mouse input is consistently disabled entirely.
Do we know why the issue reproduces in the Flutter Gallery but not in the official Snackbar example? I'd love to find a way to work around this.
Any solution for this issue?
I haven't been able to narrow down exactly what the problem is, but one thing I have noticed is that 99% of the times I get this error, I also have a layout problem (overflow, or whatever).
I've managed to reproduce this with a small code sample. However, it is a bit tricky... using the following code as a starting point, run in a macOS desktop app. Observe that you can scroll up and down, click, drag, etc.
Then wrap the last Text
widget in an Expanded
widget. This will break the layout (which is expected with an Expanded
in a SingleChildScrollView
). However, if you now go and click/scroll around you can nearly always reproduce the problem in this issue.
Note that as part of this last bit of clicking/scrolling, your console will probably also fill with a bunch of "hit test" errors, but it will eventually get "Unhandled Exception: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 201 pos 12: '!_debugDuringDeviceUpdate': is not true"
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
body: Container(
color: Colors.red,
child: SingleChildScrollView(
child: Column(
children: <Widget>[
const SizedBox(height: 100),
const Text('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'),
const SizedBox(height: 100),
const Text('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'),
const SizedBox(height: 100),
Column(
children: const [
Text('Wrap me in an Expanded widget to reproduce'),
SizedBox(height: 100),
],
),
],
),
),
),
),
);
}
}
Note that you can usually reproduce by starting the app fresh including the Expanded
widget I mentioned above. However, what I've found is that when you do that, you get thousands of stacktraces spewing into the log complaining about not being able to hit test something that hasn't been able to be laid out. While I was reproducing this case, I found it was easier to just let it render successfully the first time through (ie. without the Expanded
) and then add in the Expanded
later.
Flutter doctor for me:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.5.2, on macOS 11.5.2 20G95 darwin-x64, locale en-AU)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.61.2)
[✓] Connected device (2 available)
• No issues found!
Any solution for this issue?
This error still happening on macOS any solutions
Got the same error every ALT+TAB action
Don't use complicated animations and shimmer widgets alongwith a streambuilder in Flutter Web and Flutter Desktop in the same space of the container. Don't know why but the graphical updation fails. Probably because the mouse is a different input device unlike touch screens.
Lost many hours for this on flutter web, removing a BottomNavigationBar from my scaffold did the trick
Any solution for this? Still a big issue.
I have the same question. add something delay, it's work for me!
@override
didChangeDependencies() {
super.didChangeDependencies();
Future.delayed(Duration(seconds: 1), () {
WidgetsBinding.instance?.addPersistentFrameCallback((d) {
if (scrollPositionBottom) {
_setStateAndMoreToListViewEnd(updateState: true);
}
});
});
}
Got the same issue when hovering over DraggableScrollableSheet widget, on desktop (windows) version of my app.
[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 206 pos 12: '!_debugDuringDeviceUpdate': is not true.
Still reproduceable on Linux, Flutter 3.
Here is another workaround (in addition to hot-restarting after startup): Place the mouse cursor to the edge of the screen, and then launch the app.
i has some problem this error is accidental occurrence
Same issue here.
Same issue, restart of ide and test application solved it. Btw. I use nvim on linux
I started seeing this error afresh and was able to solve, at least in my case. Adding here in case it helps.
In a page with several elements, a subtree with MouseRegion had an onEnter/onExit event handlers that threw an exception. It made this mouse tracker assertion failure occur. Once the assertion fails; the mouse just won't change according to expected mouse type setting for any of the clickable elements.
I hovered the mouse on a clickable element before it comes on to the problematic MouseRegion one. The cursor was proper and clicking worked.
Once I fixed the exception thrown by onEnter/onExit handlers, everything became alright.
In the case of SnackBar it seems that it is related to the disabling of the button to avoid multiple clicks, so an obvious workaround is just try to bypass that behavior. That can be achieved extending SnackBarAction
(color and style stuff omitted for clarity):
class DummySnackBarAction extends SnackBarAction {
DummySnackBarAction( { required String label, required VoidCallback onPressed } ) : super(
label: label,
onPressed: onPressed,
);
@override
State<DummySnackBarAction> createState() => _DummySnackBarActionState();
}
class _DummySnackBarActionState extends State<DummySnackBarAction> {
@override
Widget build(BuildContext context) => TextButton(
onPressed: () {
widget.onPressed();
ScaffoldMessenger.of(context).hideCurrentSnackBar( reason: SnackBarClosedReason.action );
},
child: Text(widget.label),
);
}
Running my flutter app on MacOS. Getting this issue as soon as I make a mistake in my UI code, causing an error in debug mode. Afterwards I can't use my mouse to click buttons anymore.
Hot restart 'fixes' it but it's annoying to not be able to use flutters hot reload anymore.
Performing hot restart... 1,742ms
Restarted application in 1,743ms.
Error: Assertion failed:
file:///C:/Users/Nweb-Pc/AppData/Local/Pub/Cache/hosted/pub.dev/firebase_core_web-2.1.0/lib/src/firebase_core_web.dart:228:11
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddcruntime/errors.dart 288:49 throw
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 29:3 assertFailed
packages/firebase_core_web/src/firebase_core_web.dart 228:18
initializeApp
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart45:50
I tried all the possible way why I am facing this problem? it's almost a week and am facing the same issue anyone knows what the actual reason is?
Facing the same issue. Using MouseRegion on two text widgets in the container, and hover_card package on that container
This issue is assigned but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!
This issue was assigned to @dkwingsmt but has had no status updates in a long time. To remove any ambiguity about whether the issue is being worked on, the assignee was removed.
Have the same problem while using a FAB and a bottomAppBar. The tests i run i discovery that a has a problem in FAB and BottomAppBar in multiple Screens when running the app in debug mode. When i remove any of this, the bug do not happen anymore. I think that has something to do with the "rebuild" of these widgets.
Sry by the bad english, not native ;-;
This issue is assigned to @dkwingsmt but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!
This issue was assigned to @dkwingsmt but has had no status updates in a long time. To remove any ambiguity about whether the issue is being worked on, the assignee was removed.
The triaged-desktop
label is irrelevant if there is no team-desktop
label or fyi-desktop
label.
Have the same problem while using a FAB and a bottomAppBar. The tests i run i discovery that a has a problem in FAB and BottomAppBar in multiple Screens when running the app in debug mode. When i remove any of this, the bug do not happen anymore. I think that has something to do with the "rebuild" of these widgets.
Sry by the bad english, not native ;-;
Can confirm, just replicated the same issue while debugging on a windows machine, except there was a single screen with both a FAB and a bottomAppBar. Have not tried yet to create the FAB or bottomAppBar after initial screen build.
hello, any update on this?
+1
I always get the following exception when I click the action text on the snackbar, and after that, the Flutter app and mouse becomes unresponsive.
Flutter/OS version
OS: Ubuntu 20.04
Steps to Reproduce
$ git clone https://github.com/flutter/gallery.git $ cd gallery $ flutter run -d linux
https://user-images.githubusercontent.com/62131389/121297248-00db1080-c92d-11eb-831a-59855bc6f6b7.mov
Logs
```console flutter: Observatory listening on http://127.0.0.1:44225/pWpE3J7wl4Q=/ [ERROR:flutter/lib/ui/ui_dart_state.cc(213)] Unhandled Exception: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 201 pos 12: '!_debugDuringDeviceUpdate': is not true. #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39) #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5) #2 MouseTracker._deviceUpdatePhase (package:flutter/src/rendering/mouse_tracker.dart:201:12) #3 MouseTracker.updateWithEvent.