Closed
Description
Steps to Reproduce
- Execute
flutter run
on the code sample. - Tap Show SnackBar
Expected results:
In Flutter 2.8.1 this only blurred the Snackbar.
Actual results:
In Flutter 2.10.0 the entire screen is blurred.
The issue seems to have been introduced with this change that removed ClipRect from Snackbar.
https://github.com/flutter/flutter/pull/94811/files
Without this ClipRect I haven't found a way to get this same behaviour in our app.
Code sample
import 'dart:ui';
import 'package:flutter/material.dart';
void main() {
runApp(const SnackBarDemo());
}
class SnackBarDemo extends StatelessWidget {
const SnackBarDemo({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'SnackBar Demo',
home: Scaffold(
appBar: AppBar(
title: const Text('SnackBar Demo'),
),
body: const SnackBarPage(),
),
);
}
}
class SnackBarPage extends StatelessWidget {
const SnackBarPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Center(
child: ElevatedButton(
onPressed: () {
final snackBar = SnackBar(
content: const BlurSnackbar(),
action: SnackBarAction(
label: 'Undo',
onPressed: () {
},
),
);
ScaffoldMessenger.of(context).showSnackBar(snackBar);
},
child: const Text('Show SnackBar'),
),
);
}
}
class BlurSnackbar extends StatelessWidget {
const BlurSnackbar({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
height: 16,
color: Colors.transparent,
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 20.0, sigmaY: 20.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
Icon(
Icons.cloud_off,
),
SizedBox(width: 8.0),
Text('Snackbar')
],
),
),
);
}
}
Logs
I didn't run these but can provide if needed. They didn't seem needed for this issue.
flutter run --verbose
flutter analyze
flutter doctor -v
Metadata
Metadata
Assignees
Labels
It was better in the past than it is nowAffects or could affect many people, though not necessarily a specific customer.flutter/packages/flutter/material repository.Found to occur in 2.10Found to occur in 2.11flutter/packages/flutter repository. See also f: labels.The issue has been confirmed reproducible and is ready to work onIssue is closed as already fixed in a newer version
Type
Projects
Status
Done (PR merged)