Skip to content

Commit 5c740ea

Browse files
authoredMay 30, 2021
Merge pull request #13 from alex-melnyk/feature/bidirectional-opening
Bidirectional opening support added.
2 parents d375bc4 + 7caccc6 commit 5c740ea

File tree

6 files changed

+17
-5
lines changed

6 files changed

+17
-5
lines changed
 

‎CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.2.0
2+
3+
* Closing drawer with open ration 1.0 fixed.
4+
* Bidirectional opening support added.
5+
16
## 1.1.0
27

38
* Animation improvements.

‎README.md

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ An advanced drawer widget, that can be fully customized with size, text, color,
1717
|`animationDuration`|Animation duration|*Duration*|300ms|
1818
|`animationCurve`|Animation curve|*Curve*|Curves.easeInOut|
1919
|`childDecoration`|Child container decoration|*BoxDecoration*|Shadow, BorderRadius|
20+
|`animateChildDecoration`|Indicates that [childDecoration] might be animated or not.|*bool*|true|
21+
|`rtlOpening`|Opening from Right-to-left.|*bool*|false|
2022

2123
## Preview
2224
| Preview Tap | Preview Gesture |

‎example/pubspec.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ packages:
2626
path: ".."
2727
relative: true
2828
source: path
29-
version: "1.1.0"
29+
version: "1.2.0"
3030
meta:
3131
dependency: transitive
3232
description:

‎lib/src/state.dart

Whitespace-only changes.

‎lib/src/widget.dart

+8-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class AdvancedDrawer extends StatefulWidget {
1313
this.animationCurve,
1414
this.childDecoration,
1515
this.animateChildDecoration = true,
16+
this.rtlOpening = false,
1617
}) : super(key: key);
1718

1819
/// Child widget. (Usually widget that represent a screen)
@@ -43,6 +44,9 @@ class AdvancedDrawer extends StatefulWidget {
4344
/// NOTICE: It may cause animation jerks.
4445
final bool animateChildDecoration;
4546

47+
/// Opening from Right-to-left.
48+
final bool rtlOpening;
49+
4650
@override
4751
_AdvancedDrawerState createState() => _AdvancedDrawerState();
4852
}
@@ -103,7 +107,7 @@ class _AdvancedDrawerState extends State<AdvancedDrawer>
103107

104108
final screenTranslateTween = Tween<Offset>(
105109
begin: Offset(0, 0),
106-
end: Offset(maxOffset, 0),
110+
end: Offset(widget.rtlOpening ? -maxOffset : maxOffset, 0),
107111
).animate(widget.animationCurve != null
108112
? CurvedAnimation(
109113
parent: _animationController,
@@ -215,8 +219,9 @@ class _AdvancedDrawerState extends State<AdvancedDrawer>
215219

216220
final diff = (_freshPosition - _startPosition!).dx;
217221

218-
_animationController.value =
219-
_offsetValue + diff / (screenSize.width * widget.openRatio);
222+
_animationController.value = _offsetValue +
223+
(diff / (screenSize.width * widget.openRatio)) *
224+
(widget.rtlOpening ? -1 : 1);
220225
}
221226

222227
void _handleDragEnd(DragEndDetails details) {

‎pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_advanced_drawer
22
description: An advanced drawer widget, that can be fully customized with size, text, color, radius of corners.
3-
version: 1.1.0
3+
version: 1.2.0
44
homepage: https://github.com/alex-melnyk/flutter_advanced_drawer
55
repository: https://github.com/alex-melnyk/flutter_advanced_drawer
66
issue_tracker: https://github.com/alex-melnyk/flutter_advanced_drawer/issues

0 commit comments

Comments
 (0)