【发布时间】:2020-11-02 15:45:25
【问题描述】:
以下是包含堆栈和一些定位小部件的代码。
Stack(
children: [
Positioned(
top: 50,
bottom: 0,
left: 30,
child: Text(
'Mon-Sat',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
Positioned(
top: 70,
bottom: 0,
left: 30,
child: Text(
'11:00 PM',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
Positioned(
top: 0,
bottom: 0,
left: 0,
right: 0,
child: Image.asset(Images.calendar),
),
],
)
现在这个 UI 代码在特定的 6 英寸屏幕上运行良好,但在较小的屏幕上,定位的元素会改变它们的位置(如预期的那样)。
那么,我如何在不同的屏幕尺寸上处理这个定位元素
【问题讨论】: