Есть ли способ реализовать повернутый на 90 градусов контейнер, который заполнит пространство, доступное внутри стека? Когда я пытаюсь установить размер дочернего элемента повернутого виджета, кажется, что он все еще ограничен родительским виджетом. Я хотел бы знать, есть ли способ заставить его работать.
Widget build(BuildContext context) {
return Stack(
alignment: Alignment.center,
children: <Widget>[
// something with size to define the size of the stack
Container(
color: Colors.white,
height: 600,
width: 300,
),
Positioned(
child: LayoutBuilder(builder: (context, constraints) {
return SizedBox(
width: constraints.maxHeight,
height: constraints.maxWidth,
child: Transform.rotate(
angle: math.pi / 2,
// this should have height equal to constraints.maxWidth
// and width equal to constraints.maxHeight
// but the height is equal to constraints.maxWidth
// and the width as well
child: Container(color: Colors.black.withOpacity(0.5)),
),
);
}),
),
],
);
}