flutter / flutter/flutter

[image] Proposal to allow `errorBuilder` to be of type `Widget?` instead of `Widget`

Open
#156,460 0 comments 0 reactions 0 assignees View on GitHub
a: images c: new feature c: proposal framework P3 team-framework triaged-framework
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.