Skip to content

Commit

Permalink
updated PC methods to reflect Dart conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
akshathjain committed Jan 25, 2020
1 parent 376cda5 commit 80fce1a
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 18 deletions.
62 changes: 50 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,59 @@
#### Fixes
- Addressed issue #69: Used a FadeTransition to handle opacity changes (as per Flutter documentation)
- Cleaned up `PanelController` code to make maintenance easier
- Added clearer assert statements and messages to indicate why calling `PanelController` methods would fail before attaching the `PanelController`.

#### Features
- Addressed issues #17, #55, #60: Added the ability to link / nested the scroll position of the panel content with the position of the panel (i.e. infinite scrolling).
- Added the `panelBuilder` property that's required to implement the nested scrolling as described above.
- Added an `isAttached` property to the `PanelController` to indicate whether or not the `PanelController` is attached to an instance of the `SlidingUpPanel`

#### Breaking Changes
- The following `PanelController` methods now return `Future<void>` instead of void:
- `close`
- `open`
- `hide`
- `show`
- `animatePanelToPosition`
The following `PanelController` methods now return `Future<void>` instead of void:
- `close`
- `open`
- `hide`
- `show`
- `animatePanelToPosition`

The following `PanelController` methods have changed to Dart setters/getters to better reflect Dart language conventions:
- `setPanelPosition()` -> `panelPosition` [as a setter]
- `getPanelPosition()` -> `panelPosition` [as a getter]
- `isPanelAnimating()` -> `isPanelAnimating`
- `isPanelOpen()` -> `isPanelOpen`
- `isPanelClosed()` -> `isPanelClosed`
- `isPanelShown()` -> `isPanelShown`


For example, here's how you would have previously used `setPanelPosition()` and `getPanelPosition()` vs. how you would now use the `panelPosition` property:
```dart
// OLD, no longer supported
print(pc.getPanelPosition()); // print a value between 0.0 and 1.0
pc.setPanelPosition(0.5); // sets the panelPosition to 0.5
```

```dart
// NEW
print(pc.panelPosition); // print a value between 0.0 and 1.0
pc.panelPosition = 0.5; // sets the panelPosition to 0.5
```

And here's how you would have previously called `isPanelAnimating()` vs. how you would now call `isPanelAnimating`.
```dart
panelController.isPanelAnimating(); // OLD, no longer supported
```
```dart
panelController.isPanelAnimating; // NEW
```


#### Documentation
- Updated the documentation to reflect changes
- Updated example to use nested scrolling




<br><br>
## [0.3.6] - [September 25, 2019]

#### Fixes
Expand All @@ -33,7 +65,7 @@
- Updated the documentation to reflect fixes



<br><br>
## [0.3.5] - [August 31, 2019]

#### Features
Expand All @@ -43,7 +75,7 @@
- Updated the documentation to reflect new features



<br><br>
## [0.3.4] - [April 16, 2019]

#### Features
Expand All @@ -53,7 +85,7 @@
- Updated the documentation to reflect new features



<br><br>
## [0.3.3] - [April 6, 2019]

#### Features
Expand All @@ -63,13 +95,15 @@
- Updated the documentation to reflect new features



<br><br>
## [0.3.2] - [April 5, 2019]

#### Documentation
- Fixed problem where images would wrap on pub (instead of displaying on one line)



<br><br>
## [0.3.1] - [April 5, 2019]

#### Features
Expand All @@ -83,6 +117,7 @@



<br><br>
## [0.3.0] - April 2, 2019

#### Features
Expand Down Expand Up @@ -111,7 +146,7 @@
- Added an explanation about nesting the `Scaffold` when displaying a backdrop



<br><br>
## [0.2.0] - April 1, 2019

Added the backdrop feature:
Expand All @@ -126,18 +161,21 @@ Other changes:



<br><br>
## [0.1.2] - March 31, 2019

- Updated documentation to be more comprehensive



<br><br>
## [0.1.1] - March 31, 2019

- Added a CHANGELOG file



<br><br>
## [0.1.0] - March 31, 2019

This is the initial release of the sliding_up_panel package. This includes features such as
Expand Down
12 changes: 6 additions & 6 deletions lib/src/panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ class PanelController{
/// Sets the panel position (without animation).
/// The value must between 0.0 and 1.0
/// where 0.0 is fully collapsed and 1.0 is completely open.
void setPanelPosition(double value){
set panelPosition(double value){
assert(isAttached, "PanelController must be attached to a SlidingUpPanel");
assert(0.0 <= value && value <= 1.0);
_panelState._panelPosition = value;
Expand All @@ -555,35 +555,35 @@ class PanelController{
/// as a decimal between 0.0 and 1.0
/// where 0.0 is fully collapsed and
/// 1.0 is full open.
double getPanelPosition(){
double get panelPosition{
assert(isAttached, "PanelController must be attached to a SlidingUpPanel");
return _panelState._panelPosition;
}

/// Returns whether or not the panel is
/// currently animating.
bool isPanelAnimating(){
bool get isPanelAnimating{
assert(isAttached, "PanelController must be attached to a SlidingUpPanel");
return _panelState._isPanelAnimating;
}

/// Returns whether or not the
/// panel is open.
bool isPanelOpen(){
bool get isPanelOpen{
assert(isAttached, "PanelController must be attached to a SlidingUpPanel");
return _panelState._isPanelOpen;
}

/// Returns whether or not the
/// panel is closed.
bool isPanelClosed(){
bool get isPanelClosed{
assert(isAttached, "PanelController must be attached to a SlidingUpPanel");
return _panelState._isPanelClosed;
}

/// Returns whether or not the
/// panel is shown/hidden.
bool isPanelShown(){
bool get isPanelShown{
assert(isAttached, "PanelController must be attached to a SlidingUpPanel");
return _panelState._isPanelShown;
}
Expand Down

0 comments on commit 80fce1a

Please sign in to comment.