Skip to content

Commit

Permalink
fix: generate playlist page max width
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Aug 15, 2023
1 parent c69f81e commit 4adf695
Show file tree
Hide file tree
Showing 2 changed files with 276 additions and 255 deletions.
37 changes: 25 additions & 12 deletions lib/extensions/constrains.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
import 'package:flutter/widgets.dart';

// ignore: constant_identifier_names
const Breakpoints = (
xs: 480.0,
sm: 640.0,
md: 820.0,
lg: 1024.0,
xl: 1280.0,
);

extension ContainerBreakpoints on BoxConstraints {
bool get isXs => biggest.width <= 480;
bool get isSm => biggest.width > 480 && biggest.width <= 640;
bool get isMd => biggest.width > 640 && biggest.width <= 820;
bool get isLg => biggest.width > 820 && biggest.width <= 1024;
bool get isXl => biggest.width > 1024 && biggest.width <= 1280;
bool get is2Xl => biggest.width > 1280;
bool get isXs => biggest.width <= Breakpoints.xs;
bool get isSm =>
biggest.width > Breakpoints.xs && biggest.width <= Breakpoints.sm;
bool get isMd =>
biggest.width > Breakpoints.sm && biggest.width <= Breakpoints.md;
bool get isLg =>
biggest.width > Breakpoints.md && biggest.width <= Breakpoints.lg;
bool get isXl =>
biggest.width > Breakpoints.lg && biggest.width <= Breakpoints.xl;
bool get is2Xl => biggest.width > Breakpoints.xl;

bool get smAndUp => isSm || isMd || isLg || isXl || is2Xl;
bool get mdAndUp => isMd || isLg || isXl || is2Xl;
Expand All @@ -20,12 +33,12 @@ extension ContainerBreakpoints on BoxConstraints {
}

extension ScreenBreakpoints on MediaQueryData {
bool get isXs => size.width <= 480;
bool get isSm => size.width > 480 && size.width <= 640;
bool get isMd => size.width > 640 && size.width <= 820;
bool get isLg => size.width > 820 && size.width <= 1024;
bool get isXl => size.width > 1024 && size.width <= 1280;
bool get is2Xl => size.width > 1280;
bool get isXs => size.width <= Breakpoints.xs;
bool get isSm => size.width > Breakpoints.xs && size.width <= Breakpoints.sm;
bool get isMd => size.width > Breakpoints.sm && size.width <= Breakpoints.md;
bool get isLg => size.width > Breakpoints.md && size.width <= Breakpoints.lg;
bool get isXl => size.width > Breakpoints.lg && size.width <= Breakpoints.xl;
bool get is2Xl => size.width > Breakpoints.xl;

bool get smAndUp => isSm || isMd || isLg || isXl || is2Xl;
bool get mdAndUp => isMd || isLg || isXl || is2Xl;
Expand Down
Loading

0 comments on commit 4adf695

Please sign in to comment.