gpt4 book ai didi

渲染时抖动 SVG 延迟

转载 作者:行者123 更新时间:2023-12-04 12:29:38 27 4
gpt4 key购买 nike

我将图像显示为 SVG 文件和文本。
出于某种原因,svg 图像的渲染速度比屏幕的其余部分慢,从而导致延迟,这对用户体验不利。
这种延迟正常吗?我该怎么做才能让整个屏幕同时呈现?

Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset(
'lib/assets/muslim_coloc_logo.svg',
height: 40.0,
width: 40.0,
),
SizedBox(width: 2.0,),
RichText(
text: TextSpan(children: [
TextSpan(
text: 'uslim',
style: MC_titleWhite,
),
TextSpan(
text: 'Coloc',
style: MC_titleWhite50,
),
]),
),
],
),
enter image description here

最佳答案

您可以使用 PreCachePicture,它对我有用:

Future.wait([
precachePicture(
ExactAssetPicture(SvgPicture.svgStringDecoder, 'assets/my_icon.svg'),
null,
),
precachePicture(
ExactAssetPicture(SvgPicture.svgStringDecoder, 'assets/my_asset.svg'),
null,
),
]);
您需要在之前的屏幕小部件中执行此操作,例如在您的 中主 ,例如

关于渲染时抖动 SVG 延迟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66872111/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com