Skip to content

Commit

Permalink
Merge pull request #32 from alex-melnyk/bugfix/drawer_stuck_on_drag_end
Browse files Browse the repository at this point in the history
Bugfix/drawer stuck on drag end
  • Loading branch information
alex-melnyk authored Apr 3, 2022
2 parents 3a2c1f9 + 0b685ee commit 11c4d49
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.3.2

* Drawer stuck on back drag fixed.

## 1.3.1

* The openScale parameter added to manage child scale.
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
<string>9.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
17 changes: 12 additions & 5 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0"
collection:
dependency: transitive
description:
Expand All @@ -26,14 +26,21 @@ packages:
path: ".."
relative: true
source: path
version: "1.3.1"
version: "1.3.2"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.7.0"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -52,6 +59,6 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.1"
sdks:
dart: ">=2.12.0 <3.0.0"
dart: ">=2.14.0 <3.0.0"
2 changes: 2 additions & 0 deletions lib/src/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ class AdvancedDrawerController extends ValueNotifier<AdvancedDrawerValue> {
/// Shows drawer.
void showDrawer() {
value = AdvancedDrawerValue.visible();
notifyListeners();
}

/// Hides drawer.
void hideDrawer() {
value = AdvancedDrawerValue.hidden();
notifyListeners();
}

/// Toggles drawer.
Expand Down
10 changes: 4 additions & 6 deletions lib/src/widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ class _AdvancedDrawerState extends State<AdvancedDrawer>
late final Animation<Decoration> _childDecorationAnimation;
late double _offsetValue;
late Offset _freshPosition;
Offset? _startPosition;
bool _captured = false;
Offset? _startPosition;

@override
void initState() {
super.initState();

_controller = widget.controller ?? AdvancedDrawerController();
_controller.addListener(handleControllerChanged);
_controller.addListener(_handleControllerChanged);

_animationController = widget.animationController ??
AnimationController(
Expand Down Expand Up @@ -135,7 +135,6 @@ class _AdvancedDrawerState extends State<AdvancedDrawer>
color: Colors.transparent,
child: Stack(
children: <Widget>[
// -------- DRAWER
Align(
alignment: widget.rtlOpening
? Alignment.centerRight
Expand All @@ -151,7 +150,6 @@ class _AdvancedDrawerState extends State<AdvancedDrawer>
),
),
),
// -------- CHILD
SlideTransition(
position: _childSlideAnimation,
textDirection:
Expand Down Expand Up @@ -216,7 +214,7 @@ class _AdvancedDrawerState extends State<AdvancedDrawer>
);
}

void handleControllerChanged() {
void _handleControllerChanged() {
_controller.value.visible
? _animationController.forward()
: _animationController.reverse();
Expand Down Expand Up @@ -268,7 +266,7 @@ class _AdvancedDrawerState extends State<AdvancedDrawer>

@override
void dispose() {
_controller.removeListener(handleControllerChanged);
_controller.removeListener(_handleControllerChanged);

if (widget.controller == null) {
_controller.dispose();
Expand Down
15 changes: 11 additions & 4 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0"
collection:
dependency: transitive
description:
Expand All @@ -34,13 +34,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.7.0"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -59,6 +66,6 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.1"
sdks:
dart: ">=2.12.0 <3.0.0"
dart: ">=2.14.0 <3.0.0"
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_advanced_drawer
description: An advanced drawer widget, that can be fully customized with size, text, color, radius of corners.
version: 1.3.1
version: 1.3.2
homepage: https://github.com/alex-melnyk/flutter_advanced_drawer
repository: https://github.com/alex-melnyk/flutter_advanced_drawer
issue_tracker: https://github.com/alex-melnyk/flutter_advanced_drawer/issues
Expand Down

0 comments on commit 11c4d49

Please sign in to comment.