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",
      )),
    );
  }
}
193
likes
150
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

Documentation

API reference

License

MIT (license)

Dependencies

flutter, universal_platform

More

Packages that depend on sized_context