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",
      )),
    );
  }
}
195
likes
40
points
12
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

License

MIT (license)

Dependencies

flutter, universal_platform

More

Packages that depend on sized_context