Skip to content

Instantly share code, notes, and snippets.

@eernstg
Last active October 23, 2024 10:15
Show Gist options
  • Save eernstg/8e68effb6600ef4d796cbf6d65260803 to your computer and use it in GitHub Desktop.
Save eernstg/8e68effb6600ef4d796cbf6d65260803 to your computer and use it in GitHub Desktop.
static extension EdgeInsetsGeometryExtensions on EdgeInsetsGeometry {
// Forward to EdgeInsets:
const factory EdgeInsetsGeometry.fromLTRB = EdgeInsets.fromLTRB;
const factory EdgeInsetsGeometry.all = EdgeInsets.all;
const factory EdgeInsetsGeometry.only = EdgeInsets.only;
const factory EdgeInsetsGeometry.symmetric = EdgeInsets.symmetric;
static const zero = EdgeInsets.only();
// Forward to EdgeInsetsDirectional:
const factory EdgeInsetsGeometry.fromSTEB = EdgeInsetsDirectional.fromSTEB;
const factory EdgeInsetsGeometry.onlyDirectional = EdgeInsetsDirectional.only;
const factory EdgeInsetsGeometry.symmetricDirectional = EdgeInsetsDirectional.symmetric;
const factory EdgeInsetsGeometry.allDirectional = EdgeInsetsDirectional.all;
static const zeroDirectional = EdgeInsetsDirectional.only();
}
@eernstg
Copy link
Author

eernstg commented Oct 23, 2024

We could also allow this:

static extension EdgeInsetsGeometryExtensions on EdgeInsetsGeometry {
  // Forward to EdgeInsets:
  const factory .fromLTRB = EdgeInsets.fromLTRB;
  const factory .all = EdgeInsets.all;
  const factory .only = EdgeInsets.only;
  const factory .symmetric = EdgeInsets.symmetric;

  static const zero = EdgeInsets.only();

  // Forward to EdgeInsetsDirectional:
  const factory .fromSTEB = EdgeInsetsDirectional.fromSTEB;
  const factory .onlyDirectional = EdgeInsetsDirectional.only;
  const factory .symmetricDirectional = EdgeInsetsDirectional.symmetric;
  const factory .allDirectional = EdgeInsetsDirectional.all;

  static const zeroDirectional = EdgeInsetsDirectional.only();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment