mirror of
https://github.com/flutter/flutter
synced 2024-10-13 11:42:54 +00:00
Add a EdgeInsetsDirectional.all constructor similar to EdgeInsets.all (#76542)
This commit is contained in:
parent
90c66f5db3
commit
9ce3f76c53
|
@ -663,6 +663,22 @@ class EdgeInsetsDirectional extends EdgeInsetsGeometry {
|
|||
this.bottom = 0.0,
|
||||
});
|
||||
|
||||
/// Creates insets where all the offsets are `value`.
|
||||
///
|
||||
/// {@tool snippet}
|
||||
///
|
||||
/// Typical eight-pixel margin on all sides:
|
||||
///
|
||||
/// ```dart
|
||||
/// const EdgeInsetsDirectional.all(8.0)
|
||||
/// ```
|
||||
/// {@end-tool}
|
||||
const EdgeInsetsDirectional.all(double value)
|
||||
: start = value,
|
||||
top = value,
|
||||
end = value,
|
||||
bottom = value;
|
||||
|
||||
/// An [EdgeInsetsDirectional] with zero offsets in each direction.
|
||||
///
|
||||
/// Consider using [EdgeInsets.zero] instead, since that object has the same
|
||||
|
|
|
@ -54,6 +54,8 @@ void main() {
|
|||
test('EdgeInsets.resolve()', () {
|
||||
expect(const EdgeInsetsDirectional.fromSTEB(10.0, 20.0, 30.0, 40.0).resolve(TextDirection.ltr), const EdgeInsets.fromLTRB(10.0, 20.0, 30.0, 40.0));
|
||||
expect(const EdgeInsetsDirectional.fromSTEB(99.0, 98.0, 97.0, 96.0).resolve(TextDirection.rtl), const EdgeInsets.fromLTRB(97.0, 98.0, 99.0, 96.0));
|
||||
expect(const EdgeInsetsDirectional.all(50.0).resolve(TextDirection.ltr), const EdgeInsets.fromLTRB(50.0, 50.0, 50.0, 50.0));
|
||||
expect(const EdgeInsetsDirectional.all(50.0).resolve(TextDirection.rtl), const EdgeInsets.fromLTRB(50.0, 50.0, 50.0, 50.0));
|
||||
expect(const EdgeInsetsDirectional.only(start: 963.25).resolve(TextDirection.ltr), const EdgeInsets.fromLTRB(963.25, 0.0, 0.0, 0.0));
|
||||
expect(const EdgeInsetsDirectional.only(top: 963.25).resolve(TextDirection.ltr), const EdgeInsets.fromLTRB(0.0, 963.25, 0.0, 0.0));
|
||||
expect(const EdgeInsetsDirectional.only(end: 963.25).resolve(TextDirection.ltr), const EdgeInsets.fromLTRB(0.0, 0.0, 963.25, 0.0));
|
||||
|
|
Loading…
Reference in a new issue