我创建了一个用于背景的SVG图像,但它需要一些时间才能加载。问题是:当它尚未加载时,所有小部件都会随机出现。我只需要在图像加载完成后使用loader来显示页面小部件。 代码如下:
Scaffold(
appBar: const _CustomNotificationAppBar(),
body: isFinished
? SingleChildScrollView(
child: Stack(
children: [
//notification background
Opacity(
opacity: 0.42,
child: SvgPicture.asset(
'assets/images/notification_background.svg',
),
),
IconButton(
icon: const Icon(
Icons.notifications_active_outlined,
),
onPressed: () {})),
],
),
)
: const Center(
child: CircularProgressIndicator(),
),
);