INNER CODE UNIT · Dart

LayoutProvider

dreautall/waterfly-iii · lib/layout.dart:27

class LayoutProvider with ChangeNotifier {
  ScreenSize? _currentSize;
  ScreenSize get currentSize => _currentSize!;

  ScreenSize getSize(double width, double height) {
    if (width < 600 || height < 600) {
      return .compact;
    } else if (width < 840) {
      return .medium;
    } else {
      return .expanded;
    }
  }

  ScreenSize fromContext(BuildContext context) => getSize(
    MediaQuery.sizeOf(context).width,
    MediaQuery.sizeOf(context).height,
  );

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…