[Flutter/dart] Make sure that Stack does not break part of the widget
phenomenon
You can use the Stack () widget in flutter to stack another widget on top of one. However, if the upper widget protrudes from the lower widget, the protruding part will be interrupted.
Stack(
children: [
CircleAvatar(
child: Icon(Icons.person),
),
Positioned(
top: -8,
left: 20,
child:
Icon(
Icons.brightness_1,
color: Colors.red,
)
)
],
)
Solution
Set the overflow property of Stack to Overflow.visible.
With this, the protruding part will be displayed without interruption.
Stack(
overflow: Overflow.visible, //←this!
children: [
CircleAvatar(
child: Icon(Icons.person),
),
Positioned(
top: -8,
left: 20,
child:
Icon(
Icons.brightness_1,
color: Colors.red,
)
)
],
)
Recent Posts
See AllWhat want to do I want to create an input form using TextField. For example, if the input content is a monetary amount, I would like to...
What want to do There is a variable that remain unchanged once the initial value is determined. However, it cannot be determined yet when...
What want to do As the title suggests. Place two widgets in one line on the screen One in the center of the screen and the other on the...
Comentarios