flutter / flutter/devtools

Incorrect diagnosis of RepaintBoundary usefulness in Widget inspector DevTool

Open
#9,186 0 comments 0 reactions 0 assignees View on GitHub
P2 screen: inspector
Dominant language
Dart
Stars
1.7k
Forks
404
Avg merge
6d 17h
Merged PRs (30d)
18

Description

### Description

I was watching [this part](https://youtu.be/PONvNV3u1Wg?si=l0AIiVsPY70pzKP4&t=2201) of a talk at by Craig Labenz where he explains about `RepaintBoundary` and gives an example of where not to use it. Later, he explains how to use the Widget inspector DevTool to diagnose whether a `RepaintBoundary` is useful.

I ran the code snippet and the DevTool says it's useful. That has to be a bug, right?


### Code sample

Code sample

```dart
import 'package:flutter/material.dart';

void main() {
runApp(const MainApp());
}

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

@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Scaffold(body: Center(child: Body())),
);
}
}

class Body extends StatefulWidget {
const Body({super.key});

@override
State createState() => _BodyState();
}

class _BodyState extends State {
Color color = Colors.red;
@override
Widget build(BuildContext context) {
return SizedBox(
width: 200,
height: 200,
child: GestureDetector(
onTap: () => setState(() {
if (color == Colors.red) {
color = Colors.blue;
} else {
color = Colors.red;
}
}),
child: ColoredBox(
color: color,
child: RepaintBoundary(child: ColoredBox(color: color)),
),
),
);
}
}

```


### DevTool screenshot (see highlighted area):
This is after 10 taps on the tappable widget.

Image

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided Dart sample in the Widget inspector DevTool and inspect the RepaintBoundary usefulness result after ten taps. Done means determining whether the reported diagnosis is incorrect and documenting the observed behavior and expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.