breakpoint_base 0.1.1 copy "breakpoint_base: ^0.1.1" to clipboard
breakpoint_base: ^0.1.1 copied to clipboard

A base class to define Flutter breakpoint properties and helpers.

example/main.dart

// ignore_for_file: avoid_print

import 'package:breakpoint_base/breakpoint_base.dart';
import 'package:flutter/material.dart';

void main() {
  final breakpoint = Breakpoint(
    orientation: Orientation.landscape,
    width: 720,
  );

  print({
    'width': breakpoint.width,
    'orientation': breakpoint.orientation,
    'expanded': breakpoint.expanded,
    'size': breakpoint.size,
    'columns': breakpoint.columns,
    'gutter': breakpoint.gutter,
  }.toString());
}

class Breakpoint extends BreakpointBase {
  Breakpoint({required Orientation orientation, required double width})
      : super(orientation: orientation, width: width);

  @override
  LayoutSize get size => findValue({
        0: LayoutSize.small,
        800: LayoutSize.medium,
        1600: LayoutSize.large,
      });

  @override
  double get gutter => findValue({0: 16, 800: 24, 1600: 50});

  // Add one more property
  bool get expanded => orientation == Orientation.landscape || width >= 1600;
}
1
likes
160
points
25
downloads

Publisher

unverified uploader

Weekly Downloads

A base class to define Flutter breakpoint properties and helpers.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on breakpoint_base