Skip to content

Instantly share code, notes, and snippets.

@aklehm
aklehm / measure_util.dart
Created October 24, 2023 07:21
Util to measure the size of a flutter widget before build.
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
/// Small utility to measure a widget before actually putting it on screen.
///
/// This can be helpful e.g. for positioning context menus based on the size they will take up.
///
/// NOTE: Use sparingly, since this takes a complete layout and sizing pass for the subtree you
/// want to measure.
///