From efb4bf3349b88239c71972fe98d4d1ed51662d32 Mon Sep 17 00:00:00 2001 From: Kuldip Date: Thu, 29 Sep 2022 16:04:16 +0530 Subject: [PATCH] icon position inverse field added --- example/pubspec.lock | 49 +++++++++++++++++++------------------------- lib/src/base.dart | 10 +++++++-- pubspec.lock | 49 +++++++++++++++++++------------------------- 3 files changed, 50 insertions(+), 58 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index 658080b..3e6ffa7 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -21,28 +21,21 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" cupertino_icons: dependency: "direct main" description: @@ -56,7 +49,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -87,21 +80,28 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.12" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.2" shrink_sidemenu: dependency: "direct main" description: @@ -120,7 +120,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -141,34 +141,27 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.3" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" + version: "0.4.12" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.2" sdks: - dart: ">=2.15.0 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" diff --git a/lib/src/base.dart b/lib/src/base.dart index 2cdb99c..ede9715 100644 --- a/lib/src/base.dart +++ b/lib/src/base.dart @@ -28,6 +28,8 @@ enum SideMenuType { class SideMenu extends StatefulWidget { final int _inverse; + final int _closeIconPositionInverse; + /// Widget that should be enclosed in sidemenu /// /// generally a [Scaffold] and should not be `null` @@ -109,9 +111,11 @@ class SideMenu extends StatefulWidget { this.type = SideMenuType.shrikNRotate, this.maxMenuWidth = 275.0, bool inverse = false, + bool closeIconPositionInverse = false, this.onChange, }) : assert(maxMenuWidth > 0), _inverse = inverse ? -1 : 1, + _closeIconPositionInverse = closeIconPositionInverse ? -1 : 1, super(key: key); static SideMenuState? of(BuildContext? context) { @@ -123,6 +127,8 @@ class SideMenu extends StatefulWidget { bool get inverse => _inverse == -1; + bool get closeIconPositionInverse => _closeIconPositionInverse == -1; + @override SideMenuState createState() { if (type == SideMenuType.shrikNRotate) @@ -168,8 +174,8 @@ abstract class SideMenuState extends State { return widget.closeIcon != null ? Positioned( top: statusBarHeight, - left: widget.inverse ? null : 0, - right: widget.inverse ? 0 : null, + left: widget.closeIconPositionInverse ? null : 0, + right: widget.closeIconPositionInverse ? 0 : null, child: IconButton( icon: widget.closeIcon!, onPressed: closeSideMenu, diff --git a/pubspec.lock b/pubspec.lock index 03307d6..e15edce 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -21,35 +21,28 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -66,21 +59,28 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.12" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.2" sky_engine: dependency: transitive description: flutter @@ -92,7 +92,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -113,34 +113,27 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.3" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" + version: "0.4.12" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.2" sdks: - dart: ">=2.14.0 <3.0.0" + dart: ">=2.17.0-0 <3.0.0"