flutter / flutter/devtools

Incorrect diagnosis of RepaintBoundary usefulness in Widget inspector DevTool

Đang mở
#9,186 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
P2 screen: inspector
Ngôn ngữ chính
Dart
Star
1.7k
Fork
404
Merge trung bình
6 ngày 17 giờ
Pull request đã merge (30 ngày)
18

Mô tả

### 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện mẫu Dart được cung cấp trong Widget inspector DevTool và kiểm tra kết quả về tính hữu ích của RepaintBoundary sau mười lần chạm. Hoàn tất khi xác định được liệu chẩn đoán được báo cáo có không chính xác hay không, đồng thời ghi lại hành vi quan sát được và kết quả mong đợi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
dart, flutter
Lĩnh vực
devtools
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
30/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.