Merge pull request #14 from JoseAlba/mediaquery_breakpoints

Updated breakpoints package to using MediaQuery.sizeOf(context);
This commit is contained in:
Rody Davis
2026-02-16 10:40:59 -08:00
committed by GitHub
2 changed files with 7 additions and 9 deletions
+5 -7
View File
@@ -51,16 +51,14 @@ class Breakpoint {
/// ///
/// Use [Breakpoint.fromConstraints] when the widget does not take up the full screen /// Use [Breakpoint.fromConstraints] when the widget does not take up the full screen
factory Breakpoint.fromMediaQuery(BuildContext context) { factory Breakpoint.fromMediaQuery(BuildContext context) {
final _media = MediaQuery.of(context); final size = MediaQuery.sizeOf(context);
double _width = 359; double width = size.width;
Orientation orientation = Orientation.portrait; final orientation =
size.width > size.height ? Orientation.landscape : Orientation.portrait;
_width = _media.size.width; return _calcBreakpoint(orientation, width);
orientation = _media.orientation;
return _calcBreakpoint(orientation, _width);
} }
static Breakpoint _calcBreakpoint(Orientation orientation, double _width) { static Breakpoint _calcBreakpoint(Orientation orientation, double _width) {
+2 -2
View File
@@ -1,10 +1,10 @@
name: breakpoint name: breakpoint
description: A Flutter plugin to calculate the material design breakpoints. description: A Flutter plugin to calculate the material design breakpoints.
version: 1.3.0 version: 1.3.1
maintainer: Rody Davis (@rodydavis) maintainer: Rody Davis (@rodydavis)
homepage: https://github.com/rodydavis/plugins homepage: https://github.com/rodydavis/plugins
repository: https://github.com/fluttercommunity/breakpoint repository: https://github.com/rodydavis/packages.dart/tree/main/packages/breakpoint
resolution: workspace resolution: workspace
environment: environment: