Skip to content

RawChip's avatar uses too many raster resources. #113879

@violet-dev

Description

@violet-dev

Hello! Flutter Developers

Details

I tried to show so many (at least 50>) RawChips on one screen like below. But the raster performance delay was too high.

zxcvzxbxcvbxcvbxcvb

zxcvzxcvzxbzxb

But after many tries, I found that RawChip::avatar is the main cause of this problem.

So, I deleted the avatar property and reimplemented the component with just the label as follows.
Then the raster time disappears completely.

project-violet/violet@8927cc7

xcvbxcvbxcvbxcvb

This code snippet is minimal example of this issue!

import 'package:flutter/material.dart';

void main() {
  runApp(const MaterialApp(home: MyApp()));
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Material(
        child: ListView.builder(
          itemBuilder: (context, index) {
            return item();
          },
        ),
      ),
    );
  }

  item() {
    return Wrap(
      children: [for (var i = 1; i <= 100; i++) chip(i.toString())],
    );
  }

  chip(String index) {
    return RawChip(
      avatar: Text('A'),
      label: Text(index),
    );
  }
}

image

The above source code shows even more strange performance.

Thank you

Logs

[√] Flutter (Channel stable, 3.3.3, on Microsoft Windows [Version 10.0.22000.1098], locale ko-KR)
    • Flutter version 3.3.3 on channel stable at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18a827f393 (3 weeks ago), 2022-09-28 10:03:14 -0700
    • Engine revision 5c984c26eb
    • Dart version 2.18.2
    • DevTools version 2.15.0

[!] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at C:\Users\\AppData\Local\Android\sdk
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.5)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.1.32414.318
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)

[√] IntelliJ IDEA Ultimate Edition (version 2022.1)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2022.1
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[√] VS Code (version 1.72.2)
    • VS Code at C:\Users\\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.50.0

[√] Connected device (4 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 12 (API 32) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.22000.1098]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 106.0.5249.119
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 106.0.1370.47

[√] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listc: performanceRelates to speed or footprint issues (see "perf:" labels)frameworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions