Skip to content

Instantly share code, notes, and snippets.

@fredgrott
Created December 28, 2025 20:27
Show Gist options
  • Select an option

  • Save fredgrott/4f4bbe865ba9e27ebfc706a478433035 to your computer and use it in GitHub Desktop.

Select an option

Save fredgrott/4f4bbe865ba9e27ebfc706a478433035 to your computer and use it in GitHub Desktop.
window height api calls
final windowHeight = WindowHeight.of(context);
if (windowHeight == WindowHeight.compact) {
// Adapt UI for limited vertical space
}
Widget build(BuildContext context) {
final windowHeight = WindowHeight.of(context);
// This value can change during the app's lifetime
// Adapt your layout based on available vertical space...
}
final windowHeight = WindowHeight.fromHeight(600); // Returns medium
final windowHeight = WindowHeight.fromHeight(1000); // Returns expanded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment