gpt4 book ai didi

flutter - 如何在按钮的右上角显示可点击的图标?

转载 作者:行者123 更新时间:2023-12-03 04:56:32 24 4
gpt4 key购买 nike

我正在尝试在按钮的右上角获得一个可单击的图标。我尝试将FloatingActionButton添加到行小部件,但只是将其添加到按钮的右侧。我希望它 float 在右上角的按钮上。任何帮助,将不胜感激。我有一个截图,现在看起来如下。

            ButtonTheme (
minWidth: 250.0,
height: 80.0,
buttonColor: Color.fromRGBO(234, 135, 137, 1.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
RaisedButton (
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
side: BorderSide(
color: Colors.transparent,
),
),
child: Text(
'Daily Challenge',
style: TextStyle(
color: Colors.white,
fontSize: 22.0,
fontFamily: 'MuseoSans',
),
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => DailyMedChallenge(uid: user.uid, qidDC: user.qidDC)),
);
},
),
Container(
width: 35.0,
height: 35.0,
child: FloatingActionButton(
child: Icon(
Icons.help,
),
backgroundColor: Colors.grey,
onPressed: () {

},
),
)
],
),
),

how it looks now

最佳答案

您可以使用“堆栈和定位”小部件


ButtonTheme (
minWidth: 250.0,
height: 80.0,
buttonColor: Color.fromRGBO(234, 135, 137, 1.0),
child: Stack(
children: [
RaisedButton (
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
side: BorderSide(
color: Colors.transparent,
),
),
child: Text(
'Daily Challenge',
style: TextStyle(
color: Colors.white,
fontSize: 22.0,
fontFamily: 'MuseoSans',
),
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => DailyMedChallenge(uid: user.uid, qidDC: user.qidDC)),
);
},
),
Positioned( // will be positioned in the top right of the container
top: 0,
right: 0,
child Icon(
Icons.help,
),
)
]
)
),


关于flutter - 如何在按钮的右上角显示可点击的图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60533344/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com