flutter / flutter/flutter-intellij

[flutter_tooling] Refactor `EdgeInsets.all()` & `EdgeInsets.symmetric()` to `EdgeInsets.only()` & `EdgeInsets.symmetric()`

Open
#6,913 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
2k
Forks
356
Avg merge
1d 11h
Merged PRs (30d)
27

Description

### Problem

While programming it is very common that users will create a padding in all direction, and then later decide that in one direction it should be different. You then need to manually change all to only and manually fill in `top`, `bottom`, `left`, `right`.
The refactor tooling that adds a padding automatically uses `EdgeInsets.all()` by default, so it's very common when you want to add padding in one direction, you have to manually change the named constructor and set the correct variables.

https://github.com/flutter/flutter/assets/75931499/00cf5c2e-6e99-4c43-870b-ea40bcc71f41

### Proposal

A refactor option built into the flutter tooling that would provide the options to refactor:

- `EdgeInsets.all(10)`

to

- `EdgeInsets.symmetric(vertical: 10.0, horizontal: 10)`
- `EdgeInsets.only(right: 10, left: 10,top: 10,bottom: 10)`

&

- `EdgeInsets.symmetric(vertical: 10.0, horizontal: 10)`

to

- `EdgeInsets.only(right: 10, left: 10,top: 10,bottom: 10)`

Something Like this:

![Screensho 115529 (0-00-00-00)](https://github.com/dart-lang/sdk/assets/75931499/12dfe6b3-1a57-4973-bec8-1637341d5937)

Contributor guide

Open the contributing guide

Research direction

The issue names no files, tests, or entry points. Start by locating the Flutter tooling refactors that handle EdgeInsets.all() and EdgeInsets.symmetric(); done means offering conversions to EdgeInsets.symmetric() and EdgeInsets.only() with the requested arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
flutter, java
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.