[image] Proposal to allow `errorBuilder` to be of type `Widget?` instead of `Widget`
- Dominant language
- Dart
- Stars
- 179k
- Forks
- 31.1k
- PR merge metrics
- PR metrics pending
Description
### Use case
Let's consider the following case:
```dart
OverflowBar(
spacing: 20,
overflowSpacing: 20,
overflowAlignment: OverflowBarAlignment.center,
children: [
Image.network(
image,
width: 50,
height: 50,
errorBuilder: (_, __, ___) {
return const SizedBox.shrink()
},
),
...widgets,
],
)
```
When the parsing of an image fails, the error builder will return a shrink box. The spacing of the overflowbar will add an empty space in the front.
### Proposal
Allow errorBuilder to be of type Widget? instead of Widget so this problem can be solved.
There is currently no other way to implement it if you want to have an OverflowBar.
Contributor guide
Research direction
Start with the Image.network errorBuilder API and the OverflowBar example in the issue. Check how a failed image currently contributes its replacement widget to OverflowBar spacing, then verify that allowing a nullable return removes the empty space; add or update coverage for the proposed behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100