tezvyn:

LayoutBuilder versus MediaQuery for responsive widgets

Source: interviewadvanced

WHAT IT TESTS: knowing layout constraints versus screen metrics. OUTLINE: MediaQuery reports the whole window; LayoutBuilder gives the parent's actual constraints. RED FLAG: claiming they are interchangeable for sizing nested components.

WHAT IT TESTS: whether you distinguish global screen metrics from local box constraints. ANSWER OUTLINE: MediaQuery.of(context) returns full-window size, padding and insets, useful for app-wide breakpoints. LayoutBuilder rebuilds with the exact constraints the parent passes down, so it adapts a widget to its slot, not the screen. RED FLAG: using MediaQuery to size a widget sitting inside a constrained panel, split view or dialog, where window width is far larger than the space actually available.

Read the original → interview

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

LayoutBuilder versus MediaQuery for responsive widgets · Tezvyn