您可以将
Stack
与 Positioned.fill
和 Align
小部件一起使用,如下所示:
Column(
children: [
Stack(
clipBehavior: Clip.none,
children: [
SizedBox(
width: 300,
height: 200,
child: Card(
color: Colors.yellow,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),
),
),
Positioned.fill(
top: -40,
child: Align(
alignment: Alignment.topCenter,
child: Container(
width: 100,
height: 100,
decoration: const BoxDecoration(
color: Colors.white, shape: BoxShape.circle),
child: Align(
alignment: Alignment.center,
child: Container(
width: 90,
height: 90,
decoration: const BoxDecoration(
color: Colors.orange, shape: BoxShape.circle),
child: const Align(
alignment: Alignment.center,
child: Icon(
Icons.check,
size: 50,
),
),
),
),
),
),
)
],
),
],
),