當我想在我的個人資料圖片上移動圖示按鈕時遇到了一些麻煩 我只想使用堆疊將它移動到圖片的右下角 這里有一些我嘗試過的圖片 我想移動我放置的綠色圓圈上的影像按鈕 ,這是我寫的代碼
Center(
child: Column(
children: <Widget>[
Stack(
children: [
Container(
margin: EdgeInsets.only(bottom: defaultSize),
height: defaultSize * 15,
width: defaultSize * 15,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: Colors.white, width: defaultSize * 0.5),
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(
'https://th.bing.com/th/id/OIP.1FbFcWycnyeemiMMsoIJ7gHaF7?w=182&h=145&c=7&r=0&o=5&dpr=1.25&pid=1.7'),
),
),
child: Positioned(
right: 0,
bottom: 0,
child: Container(
child: IconButton(
onPressed: () {}, icon: Icon(Icons.image)),
)),
),
],
),
Text("Nama Kamu Siapa ")
],
uj5u.com熱心網友回復:
錯誤:您的定位小部件是容器的子代。
您必須使其成為堆疊的子項:
Stack(
children: [
Container(
height: 100,
width: 100,
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(
'https://th.bing.com/th/id/OIP.1FbFcWycnyeemiMMsoIJ7gHaF7?w=182&h=145&c=7&r=0&o=5&dpr=1.25&pid=1.7'),
),
),
),
Positioned(
right: 0,
bottom: 0,
child: Icon(Icons.image)),
],
)
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/313894.html
上一篇:我不斷收到“掃描儀無法決議為型別”錯誤。我正在使用Java和VisualStudio,這是針對初學者的Java課程
