-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
App crashes on latest versions when AnimatedContainer / Container
height is set to 0 and throws uncaught exception 'NSInternalInconsistencyException', reason: 'Transformed points can't form a rect'
#110671
Comments
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
@Altamimi-Dev
Did you get same behavior in previous stable ? |
@darshankawar The
Crash Report iOS simulator
|
We would need this to be able to analyze properly. |
This is a minimal code with the same result of crashing: The use case that we are using it is with a state to start with 0 if an item in a list is not selected once the item in the list is selected it changes the hight to show the BaseBottomSheet as it was working fine with 3.0.5 but once upgraded to 3.3.0 if the value of the hight is set to 0 it crashes on build. import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
AnimatedContainer(
height: 0,
width: MediaQuery.of(context).size.width,
duration: const Duration(milliseconds: 250),
child: const FittedBox(
child: BaseBottomSheet(),
),
)
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
}
class BaseBottomSheet extends StatelessWidget {
const BaseBottomSheet({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Material(
color: Colors.white,
elevation: 5,
child: SizedBox(
height: 55,
width: 266,
child: SingleChildScrollView(
child: Column(
),
),
),
);
}
} |
Thanks for the code sample. Using it on latest master (3.4) and stable (3.3.0), I noticed app crash and throws below log: crash log
Mainly, it throws below error:
The same code works properly in previous stable version (3.0.5), compiles and launches the app as expected:
Changing stable, master flutter doctor -v
Labeling this as a regression since it works in previous stable, but not in latest. |
AnimatedContainer
height is to to 0 and throws uncaught exception 'NSInternalInconsistencyException', reason: 'Transformed points can't form a rect'
AnimatedContainer
height is to to 0 and throws uncaught exception 'NSInternalInconsistencyException', reason: 'Transformed points can't form a rect'
AnimatedContainer
height is to 0 and throws uncaught exception 'NSInternalInconsistencyException', reason: 'Transformed points can't form a rect'
Coming back to this issue and looking at code sample, this doesn't seem to be specific to |
AnimatedContainer
height is to 0 and throws uncaught exception 'NSInternalInconsistencyException', reason: 'Transformed points can't form a rect'
AnimatedContainer / Container
height is to 0 and throws uncaught exception 'NSInternalInconsistencyException', reason: 'Transformed points can't form a rect'
AnimatedContainer / Container
height is to 0 and throws uncaught exception 'NSInternalInconsistencyException', reason: 'Transformed points can't form a rect'
AnimatedContainer / Container
height is set to 0 and throws uncaught exception 'NSInternalInconsistencyException', reason: 'Transformed points can't form a rect'
From Triage: Any updates @hangyujin? |
Framework is sending a zero transform:
|
My change updated a render object to make sure it did not report a clip when it wasn't actually clipping anything - which means some ROs that used to cut off things because of the clip don't do that anymore when they're not actually supposed to. Some RO is trying to hide itself using a zero transform. |
I think we should patch the embedding to tolerate a zero matrix. It may make sense to also patch the framework to avoid sending some of this data to the engine. |
I have a framework side fix for this, working on a test. |
Note that this crash is iOS specific when a11y is enabled. On the simulator, we unconditionally enable a11y logic because we have no good way to detect whether we should or not. |
Can we also catch the case on the ObjC side so we don't run the risk of throwing the exception? |
@chinmaygarde sounds good to me to also add a safety net in iOS embedding. @hangyujin Can you work on adding the safety net? |
Yes, this should be as simple as checking if the transform is a zero transform and then fizzling as if the subtree is hidden. |
lower the priority since the original crash is resolved and the remaining work is nice to have |
We are seeing this crash with Flutter 3.19.3
Happens when VoiceOver is enabled and only on some devices. |
am getting the issue here with flutter 3.3 stable:
it keeps crashing when the BaseBottomSheet is active if i comment out the hight and width, once in the page if i add static values to the width and hight it works with hot reload. When restarting it , it crashes again.
i also tried:
The text was updated successfully, but these errors were encountered: