From 53feeb6a68122c477ed040864360e5fcfae09c09 Mon Sep 17 00:00:00 2001 From: Dicky Dewantoro Date: Mon, 10 Feb 2020 16:47:06 +0700 Subject: [PATCH] add orientation info --- example/pubspec.lock | 59 +++++++++++++++++++++++++++++++++---- lib/responsive_builder.dart | 5 +++- pubspec.lock | 59 +++++++++++++++++++++++++++++++++---- 3 files changed, 112 insertions(+), 11 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index 187f9c5..0755829 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,13 +1,27 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + archive: + dependency: transitive + description: + name: archive + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.11" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.2" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.3.0" + version: "2.4.0" boolean_selector: dependency: transitive description: @@ -29,6 +43,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.14.11" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.3" cupertino_icons: dependency: "direct main" description: @@ -46,20 +74,27 @@ packages: description: flutter source: sdk version: "0.0.0" + image: + dependency: transitive + description: + name: image + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.4" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.5" + version: "0.12.6" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.7" + version: "1.1.8" path: dependency: transitive description: @@ -74,6 +109,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.0+1" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.0" quiver: dependency: transitive description: @@ -134,7 +176,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.2.11" typed_data: dependency: transitive description: @@ -149,5 +191,12 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.8" + xml: + dependency: transitive + description: + name: xml + url: "https://pub.dartlang.org" + source: hosted + version: "3.5.0" sdks: - dart: ">=2.2.2 <3.0.0" + dart: ">=2.4.0 <3.0.0" diff --git a/lib/responsive_builder.dart b/lib/responsive_builder.dart index 36c9518..c83436b 100644 --- a/lib/responsive_builder.dart +++ b/lib/responsive_builder.dart @@ -9,6 +9,7 @@ enum DeviceScreenType { Mobile, Tablet, Desktop, Watch } /// Contains sizing information to make responsive choices for the current screen class SizingInformation { + final Orientation orientation; final DeviceScreenType deviceScreenType; final Size screenSize; final Size localWidgetSize; @@ -22,6 +23,7 @@ class SizingInformation { bool get isWatch => deviceScreenType == DeviceScreenType.Watch; SizingInformation({ + this.orientation, this.deviceScreenType, this.screenSize, this.localWidgetSize, @@ -29,7 +31,7 @@ class SizingInformation { @override String toString() { - return 'DeviceType:$deviceScreenType ScreenSize:$screenSize LocalWidgetSize:$localWidgetSize'; + return 'DeviceType:$deviceScreenType Orientation: $orientation ScreenSize:$screenSize LocalWidgetSize:$localWidgetSize'; } } @@ -75,6 +77,7 @@ class ResponsiveBuilder extends StatelessWidget { return LayoutBuilder(builder: (context, boxConstraints) { var mediaQuery = MediaQuery.of(context); var sizingInformation = SizingInformation( + orientation: mediaQuery.orientation, deviceScreenType: _getDeviceType(mediaQuery, breakpoints), screenSize: mediaQuery.size, localWidgetSize: diff --git a/pubspec.lock b/pubspec.lock index aebdafa..67a7df1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,13 +1,27 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + archive: + dependency: transitive + description: + name: archive + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.11" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.2" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.3.0" + version: "2.4.0" boolean_selector: dependency: transitive description: @@ -29,6 +43,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.14.11" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.3" flutter: dependency: "direct main" description: flutter @@ -39,20 +67,27 @@ packages: description: flutter source: sdk version: "0.0.0" + image: + dependency: transitive + description: + name: image + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.4" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.5" + version: "0.12.6" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.7" + version: "1.1.8" path: dependency: transitive description: @@ -67,6 +102,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.0+1" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.0" quiver: dependency: transitive description: @@ -120,7 +162,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.2.11" typed_data: dependency: transitive description: @@ -135,5 +177,12 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.8" + xml: + dependency: transitive + description: + name: xml + url: "https://pub.dartlang.org" + source: hosted + version: "3.5.0" sdks: - dart: ">=2.2.2 <3.0.0" + dart: ">=2.4.0 <3.0.0"