Skip to content

Proposal to add EdgeInsetsDirectional.copyWith #137475

Closed

Description

@Craftplacer

Is there an existing issue for this?

Use case

While trying to make my app RTL-aware, I noticed that it is not possible to simply swap out EdgeInsets with EdgeInsetsDirectional as it lacks the copyWith method, which is necessary for immutable data structures like this one.

Proposal

In flutter/packages/flutter/lib/src/painting/edge_insets.dart

/* ... */
class EdgeInsetsDirectional extends EdgeInsetsGeometry {
  /* ... */
	
  /// Creates a copy of this EdgeInsetsDirectional but with the given
  /// fields replaced with the new values.
  EdgeInsetsDirectional copyWith({
    double? start,
    double? top,
    double? end,
    double? bottom,
  }) {
    return EdgeInsetsDirectional.only(
      start: start ?? this.start,
      top: top ?? this.top,
      end: end ?? this.end,
      bottom: bottom ?? this.bottom,
    );
  }

  /* ... */
}
/* ... */

Activity

  1. added
    in triagePresently being triaged by the triage team
    c: new featureNothing broken; request for a new capability
    frameworkflutter/packages/flutter repository. See also f: labels.
    c: proposalA detailed proposal for a change to Flutter
    and removed
    in triagePresently being triaged by the triage team
    on Oct 30, 2023
  2. changed the title [-]EdgeInsetsDirectional.copyWith[/-] [+]Proposal to add `EdgeInsetsDirectional.copyWith`[/+] on Oct 30, 2023
  3. added
    P3Issues that are less important to the Flutter project
    on Oct 31, 2023
  4. added a commit that references this issue on Nov 1, 2023
    43dc3fc
  5. github-actions commented on Nov 15, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  6. locked as resolved and limited conversation to collaborators on Nov 15, 2023
  7. added
    r: fixedIssue is closed as already fixed in a newer version
    on Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions