So far my Flutter app turned out to work fine on Android and iOS in production(on different devices), but last week I got a complaint about the app crashing on an iPhone X. I tried to reproduce this bug on a iPhone X simulator but in debug mode it does not happen and there are no errors in the error logs. The crash happens after opening a dialog, so I think it's a layout error:
void showDialogWithoutContext(String title, String message) {
if (navigatorKey.currentContext != null) {
showDialog(
context: navigatorKey.currentContext as BuildContext,
builder: (BuildContext context) => BlurryDialog(title, message));
}
}
Code of the BlurryDialog widget:
class BlurryDialog extends StatefulWidget {
String title;
String content;
BlurryDialog(this.title, this.content, {Key? key}) : super(key: key);
@override
State<BlurryDialog> createState() => _BlurryDialogState();
}
class _BlurryDialogState extends State<BlurryDialog> {
TextStyle textStyle = const TextStyle(color: Colors.black);
@override
Widget build(BuildContext context) {
return BackdropFilter(
filter: ImageFilter.blur(sigmaX: 6, sigmaY: 6),
child: AlertDialog(
title: Text(widget.title, style: textStyle),
content: Text(widget.content, style: textStyle),
actions: <Widget>[
TextButton(
child: const Text("Close"),
onPressed: () {
Navigator.of(context).pop();
},
),
],
));
}
}
Is there a way I can reproduce the grey screen on a iPhone X simulator? Or does somebody see a problem in my code?
Thank you in advance!