如何解决如何使用堆栈和列中的位置
需要在Raw中调整Flatbutton和IconButton的位置。在下面的代码中如何使用 Stack 和 Positioned 。是否可以在此代码中应用堆栈并定位?
return MaterialApp(
home: Scaffold(
body: Column(children: [
FlatButton( // `need to position in bottom right side`
color: Colors.green,textColor: Colors.black,padding: EdgeInsets.all(8.0),onPressed: () {},child: Text(
'Save',style: TextStyle(fontSize: 20.0),)),Row(
mainAxisAlignment: MainAxisAlignment.center,crossAxisAlignment: CrossAxisAlignment.center,children: <Widget>[
Expanded(
child: GestureDetector(
child: IconButton( // `need to position in center`
icon: Icon(Icons.mic),color: Colors.black,iconSize: 50,onPressed: () async {
startRecord();
}),),Expanded(
child: GestureDetector(
child: IconButton( // `need to position in bottom center'
icon: Icon(Icons.pause),onPressed: () {
pauseRecord();
},RecordMp3.instance.status == RecordStatus.PAUSE
? Expanded(
child: GestureDetector(
child: IconButton(
icon: Icon(Icons.play_arrow),onPressed: () {
resumeRecord();
},)
: SizedBox(),Expanded(
child: GestureDetector(
child: IconButton(
icon: Icon(Icons.stop),onPressed: () {
stopRecord();
},],Padding(
padding: const EdgeInsets.only(top: 20.0),child: Text(
statusText,style: TextStyle(color: Colors.red,fontSize: 20),isComplete && recordFilePath != null
? Expanded(
child: GestureDetector(
child: IconButton( // `need to position in between bottom and middle`
icon: Icon(Icons.play_circle_filled),onPressed: () {
play();
}),)
: SizedBox(),]),);
需要将Flatbutton放在右下方。需要将Iconbuttons放置在中间和底部之间的中间位置。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。