【发布时间】:2021-11-24 09:09:35
【问题描述】:
示例:
现实:
我希望该图标是“状态”类型的标签,但是如果使用 Positioned,它不会让我把它一直放在左边。
有没有什么方法可以得到想要的结果或者有什么其他的解决方案?
return ConstrainedBox(
constraints: new BoxConstraints(
minHeight: 50, //exemple
minWidth: 100, //exemple
),
child: Container(
decoration: BoxDecoration(
color: Colors.orange,
),
child: Stack(
children: [
Positioned(
left: 0,
top: 0,
child: Transform.rotate(
angle: -45 * pi / 180,
child: Icon(
Icons.arrow_drop_up,
size: 30,
),
),
),
Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"0001",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 30,
color: Colors.white,
),
),
),
),
],
),
),
);
【问题讨论】: