如何解决如何在Flutter中的小部件内对齐按钮
尝试做一些小改变而不必支付开发人员费用...。我想将按钮对准屏幕底部,但似乎只能将其放在可滚动文本区域内。它必须显示在屏幕上,以便观看者不必滚动即可查看按钮。
Widget showEveryday2Card() {
return FlipCard(
onFlip: () => _sound.playLocal("shuffle.mp3"),direction: FlipDirection.HORIZONTAL,// default
//front: Image.asset('images/cards/24.png'),front: Container(
color: Colors.white,child: Align(
alignment: Alignment.center,child: Image.asset('images/cards/24.png'),),back: Container(
color: Colors.white,child: Stack(children: <Widget>[
Positioned.fill(
child: Align(
alignment: Alignment.center,child: Image.asset('images/cards/cardbacks/back24.png'),Center(
child: Container(
padding: EdgeInsets.only(
top: (MediaQuery.of(context).size.height > 800)
? 20
: (MediaQuery.of(context).size.height > 700) ? 10 : 0),height: 0.5 * MediaQuery.of(context).size.height,width: 0.8 * MediaQuery.of(context).size.width,child: Center(
child: CupertinoScrollbar(
isAlwaysShown: true,controller: _controller,child: ListView(children: <Widget>[
Text(
"Scrollable text",style: TextStyle(
fontFamily: 'GillSansMT',fontWeight: FontWeight.normal,color: Colors.black,fontSize: (MediaQuery.of(context).size.height > 900)
? 30
: 14,new RaisedButton(
onpressed: () {
Navigator.pop(context);
},child: Text('Go back!'),)
]),]),);
}
如果您能指出正确的方向,我将不胜感激。
谢谢!
解决方法
return FlipCard(
onFlip: () => _sound.playLocal("shuffle.mp3"),direction: FlipDirection.HORIZONTAL,// default
//front: Image.asset('images/cards/24.png'),front: Container(
color: Colors.white,child: Align(
alignment: Alignment.center,child: Image.asset('images/cards/24.png'),),back: Container(
color: Colors.white,child: Stack(children: <Widget>[
Positioned.fill(
child: Align(
alignment: Alignment.center,child: Image.asset('images/cards/cardbacks/back24.png'),Center(
child: Container(
padding: EdgeInsets.only(
top: (MediaQuery.of(context).size.height > 800)
? 20
: (MediaQuery.of(context).size.height > 700)
? 10
: 0),height: 0.5 * MediaQuery.of(context).size.height,width: 0.8 * MediaQuery.of(context).size.width,// Made some changes here
child: Column(children: [
Expanded(
child: CupertinoScrollbar(
isAlwaysShown: true,controller: _controller,child: ListView(children: <Widget>[
Text("Scrollable text" * 1000,style: TextStyle(
fontFamily: 'GillSansMT',fontWeight: FontWeight.normal,color: Colors.black,fontSize:
(MediaQuery.of(context).size.height > 900)
? 30
: 14,))
])),// SizedBox(height: 10),// Uncomment if you need some space
RaisedButton(
onPressed: () {
Navigator.pop(context);
},child: Text('Go back!'),)
]),]),);
尝试用此代码替换功能主体。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。