Skip to content

Commit cdb7689

Browse files
committed
♻️ refactor(example): wrap threshold marker in Positioned.fill
Ensure the grid mode threshold marker properly fills its parent container by wrapping LayoutBuilder in Positioned.fill. This improves layout consistency and prevents potential positioning issues during scale operations.
1 parent 8ee94ec commit cdb7689

1 file changed

Lines changed: 25 additions & 17 deletions

File tree

example/lib/pages/scalable_flexbox_page.dart

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -400,23 +400,31 @@ class _ScalableFlexboxPageState extends State<ScalableFlexboxPage>
400400
),
401401
),
402402
// Mode switch threshold marker
403-
LayoutBuilder(
404-
builder: (context, constraints) {
405-
final thresholdFraction =
406-
(_gridModeThreshold -
407-
_scaleController.minExtent) /
408-
(_scaleController.maxExtent -
409-
_scaleController.minExtent);
410-
return Positioned(
411-
left: constraints.maxWidth * thresholdFraction - 1,
412-
top: 0,
413-
bottom: 0,
414-
child: Container(
415-
width: 2,
416-
color: NeoBrutalism.orange,
417-
),
418-
);
419-
},
403+
Positioned.fill(
404+
child: LayoutBuilder(
405+
builder: (context, constraints) {
406+
final thresholdFraction =
407+
(_gridModeThreshold -
408+
_scaleController.minExtent) /
409+
(_scaleController.maxExtent -
410+
_scaleController.minExtent);
411+
return Stack(
412+
children: [
413+
Positioned(
414+
left:
415+
constraints.maxWidth * thresholdFraction -
416+
1,
417+
top: 0,
418+
bottom: 0,
419+
child: Container(
420+
width: 2,
421+
color: NeoBrutalism.orange,
422+
),
423+
),
424+
],
425+
);
426+
},
427+
),
420428
),
421429
],
422430
),

0 commit comments

Comments
 (0)