Skip to content

Commit

Permalink
[chore] rename padding extensions (#3)
Browse files Browse the repository at this point in the history
* [chore] rename padding extensions

* update readme
  • Loading branch information
nank1ro authored May 23, 2023
1 parent b632cb0 commit 38130dd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.0

- Rename `horizontal` to `paddingHorizontal` and so on

## 1.0.0+1

- Update README
Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,19 @@ You can also add padding easily
```dart
// before
Padding(padding: EdgeInsets.symmetric(horizontal: 16))
),
// now
Padding(padding: 16.horizontal())
Padding(padding: 16.paddingHorizontal())
```

All the edge insets available are:

- all
- horizontal
- vertical
- top
- left
- right
- bottom
- paddingAll
- paddingHorizontal
- paddingVertical
- paddingTop
- paddingLeft
- paddingRight
- paddingBottom

### TextStyles

Expand Down
16 changes: 8 additions & 8 deletions lib/src/sizes_ext.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,24 @@ class _Sizes {
/// Converts a [num] into an [EdgeInsets]
extension PaddingNum on num {
/// Creates insets where all the offsets are `value`.
EdgeInsets all() => EdgeInsets.all(toDouble());
EdgeInsets paddingAll() => EdgeInsets.all(toDouble());

/// Creates insets with symmetric horizontal offsets.
EdgeInsets horizontal() => EdgeInsets.symmetric(horizontal: toDouble());
EdgeInsets paddingHorizontal() =>
EdgeInsets.symmetric(horizontal: toDouble());

/// Creates insets with symmetric vertical offsets.
EdgeInsets vertical() => EdgeInsets.symmetric(vertical: toDouble());
EdgeInsets paddingVertical() => EdgeInsets.symmetric(vertical: toDouble());

/// Creates insets with only the top value.
EdgeInsets top() => EdgeInsets.only(top: toDouble());
EdgeInsets paddingTop() => EdgeInsets.only(top: toDouble());

/// Creates insets with only the left value.
EdgeInsets left() => EdgeInsets.only(left: toDouble());
EdgeInsets paddingLeft() => EdgeInsets.only(left: toDouble());

/// Creates insets with only the right value.
EdgeInsets right() => EdgeInsets.only(right: toDouble());
EdgeInsets paddingRight() => EdgeInsets.only(right: toDouble());

/// Creates insets with only the bottom value.
EdgeInsets bottom() => EdgeInsets.only(bottom: toDouble());
EdgeInsets paddingBottom() => EdgeInsets.only(bottom: toDouble());
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: awesome_flutter_extensions
description: >
A Flutter Extension to remove boilerplate when accessing
ancestor context properties
version: 1.0.0+1
version: 1.1.0
homepage: https://bestofcode.dev
repository: https://github.com/nank1ro/awesome_flutter_extensions

Expand Down

0 comments on commit 38130dd

Please sign in to comment.