I am trying to position a Chip
in the top right of a CircleAvatar
similar to the below, but cant seem to be able to move it
SizedBox(
width: 50,
height: 50,
child: Stack(
children: [
CircleAvatar(
radius: 50,
backgroundColor: Colors.indigo,
child: Stack(
children: const [
Align(
alignment: Alignment.topRight,
child: Chip(
label: Text('7'),
side: BorderSide(
color: Colors.white,
width: 1,
)),
)
],
),
),
],
),
),
You do not require nested
Stack
and you are missing the heirarchy in placing the widgets. And setmaterialTapTargetSize
toMaterialTapTargetSize.shrinkWrap
which will remove the default padding around the chip. And force it to shrink to its sizeMistake in your code:
Correct code:
Try the following code:
Output: