sized_context 0.2.1+1 copy "sized_context: ^0.2.1+1" to clipboard
sized_context: ^0.2.1+1 copied to clipboard

outdated

Access MediaQuery sizing info directly on the context, also adds some helper methods for sizing and layout.

example/lib/main.dart

import 'dart:ui';

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

void main() => runApp(MaterialApp(home: Demo()));

class Demo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    print(window.physicalSize);

    return Material(
      child: Center(
          child: Text(
        "${context.isLandscape}, \n"
        "${context.sizePx},\n"
        "${context.widthPx},\n"
        "${context.heightPx},\n"
        "${context.diagonalPx},\n"
        "${context.sizeInches},\n"
        "${context.widthInches},\n"
        "${context.heightInches},\n"
        "${context.diagonalInches},\n"
        "${context.widthPct(.1)},\n"
        "${context.heightPct(.1)},\n"
        "${context.sizeInches},\n"
        "${context.mq.padding},\n",
      )),
    );
  }
}
185
likes
40
pub points
95%
popularity

Publisher

verified publishergskinner.com

Access MediaQuery sizing info directly on the context, also adds some helper methods for sizing and layout.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter, universal_platform

More

Packages that depend on sized_context