You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter中Card阴影与BackdropFilter模糊效果异常问题求助

Flutter中Card阴影与BackdropFilter模糊效果异常问题求助

大家好,我跟着教程视频一步步实现这个天气应用的UI,视频里的Card阴影和模糊效果都显示正常,但我完全照着操作后,效果却不对,有没有大佬能帮我看看哪里出问题了?

下面是我的代码:

class WeatherScreen extends StatelessWidget {

const WeatherScreen({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: const Text(
'Weather App',
style: TextStyle(fontWeight: FontWeight.bold),
),
actions: [
IconButton(onPressed: () {}, icon: const Icon(Icons.refresh))
],
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
//main card
SizedBox(
width: double.infinity,
child: Card(
elevation: 2,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
child: const Padding(
padding: EdgeInsets.all(16.0),
child: Column(
children: [
Text(
'20 °C',
style: TextStyle(
fontSize: 32, fontWeight: FontWeight.bold),
),
SizedBox(
height: 16,
),
Icon(
Icons.cloud,
size: 64,
),
SizedBox(
height: 16,
),
Text(
'Rain',
style: TextStyle(fontSize: 20),
),
],
),
),
),
),
),
SizedizedBox(
height: 20,
),
//weather cards
Placeholder(
fallbackHeight: 150,
),
SizedBox(
height: 20,
),
//additional information
Placeholder(
fallbackHeight: 150,
),
],
),
),
);
}
}

视频里的Card阴影清晰,模糊效果也正常显示,但我这边的效果却异常,有没有人能帮我排查下原因?

备注:内容来源于stack exchange,提问作者paliokha7

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.21 09:48:13