我有一個小部件作為徽章。但是當我想在它上面添加白色邊框時,我不知道為什么它也有另一種顏色。我假設它來自堆疊。但是我該如何解決呢?為了說清楚:
我不希望我的邊框上有那個藍色輪廓。
我的小部件:
Stack(
children: [
CircleNotification(
backgroundColor: ColorService.purpleHalfOpacityBackground,
icon: SvgPicture.asset(
AssetService.boldChatBubbleIcon,
),
radius: 32,
),
Positioned(
left: 30,
top: 25,
child: Stack(children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
border: Border.all(color: Colors.white, width: 3),
),
child: CircleNotification(
backgroundColor: ColorService.halfOpacityBlue,
icon: SvgPicture.asset(
AssetService.cameraSvg,
),
radius: 32,
),
),
Positioned(
child: Container(
padding: const EdgeInsets.all(5),
decoration: BoxDecoration(
//When i add that border its coming with outline
--> border: Border.all(color: Colors.white, width: 2),
color: ColorService.blueTitleColor,
shape: BoxShape.circle,
),
child: const Text("1",
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.white,
fontSize: 13,
)),
),
right: 0,
top: 0,
)
]),
),
],
),
uj5u.com熱心網友回復:
它實際上是顫振中的一個錯誤,請參閱這個問題。
您可以做的是用另一個將您的邊框顏色作為背景和邊框顏色的容器包裝您的容器:
child: DecoratedBox(
decoration: BoxDecoration(
border: Border.all(color: Colors.white, width: 2),
color: Colors.white, // <- The background is the same color as the border.
shape: BoxShape.circle,
),
child: Container(
padding: const EdgeInsets.all(5),
decoration: BoxDecoration( // <- You don't need any border here.
color: ColorService.blueTitleColor,
shape: BoxShape.circle,
),
child: // ...
),
)
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/471126.html