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

Flutter iOS端Svg图标与AppBar标题偶发不渲染问题求助

Flutter iOS端偶发AppBar标题与SVG图标不渲染问题

问题详情

  • 仅iOS端会偶发出现AppBar内标题文字和SVG图标不渲染的情况,Android端无任何异常
  • 多个页面均存在该问题(各页面AppBar的实现代码不同)
  • 运行时控制台无报错信息,此问题已持续数月

示例页面AppBar代码

appBar: AppBar(
      toolbarHeight: 60,
      backgroundColor: Colors.white,
      surfaceTintColor: Colors.white,
      automaticallyImplyLeading: false,
      centerTitle: false,
      titleSpacing: 12,
      leadingWidth: 40, // or slightly more depending on your icon size
      leading: Padding(
        padding: EdgeInsets.only(left: 16),
        child: InkWell(
          highlightColor: Colors.transparent,
          onTap: () {
            context.pop();
          },
          child: Transform.rotate(
            angle: 180 * (3.1415926535 / 180),
            child: SvgPicture.asset(
              'assets/images/chevron-right.svg',
              colorFilter:
                  ColorFilter.mode(Helper.iconColor, BlendMode.srcIn),
              fit: BoxFit.contain,
            ),
          ),
        ),
      ),
      // leadingWidth: 24,
      title: Padding(
        padding: EdgeInsets.only(left: 0.w),
        child: Text(
          widget.projectName,
          style: TextStyle(
              letterSpacing: -0.3,
              color: Helper.baseBlack,
              fontSize: 18,
              fontWeight: FontWeight.w500),
        ),
      ),
      actions: [
        if (MediaQuery.of(context).size.width < 500)
          Padding(
            padding: EdgeInsets.only(right: 16.w),
            child: InkWell(
              highlightColor: Colors.transparent,
              child: list
                  ? SvgPicture.asset('assets/images/grid_view.svg')
                  : SvgPicture.asset('assets/images/list_view.svg'),
              onTap: () {
                setState(() => list = !list);
              },
            ),
          ),
      ],
    ),

问题截图

iOS端AppBar渲染异常截图


内容的提问来源于stack exchange,提问作者Hadi Khan

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.13 02:41:08