sized_context 1.0.0+4 copy "sized_context: ^1.0.0+4" to clipboard
sized_context: ^1.0.0+4 copied to clipboard

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",
      )),
    );
  }
}
194
likes
150
points
33
downloads

Publisher

verified publishergskinner.com

Weekly Downloads

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, universal_platform

More

Packages that depend on sized_context