flutter - 如何在颤动中将容器定位在列内
问题描述
我是新手,我正在尝试将我的 RaisedButton 小部件移动到屏幕的左下角。我在stackoverflow上尝试了几乎所有现有的解决方案,但没有一个有效!
以上是我想要放置按钮的位置的屏幕截图
这是我的代码,
class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Material(
color: Colors.black87,
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
child: Text(
"${divStuff()}",
style: TextStyle(
color: Colors.white,
fontSize: 120.0,
fontFamily:
'PIXymbols', //PIXymbols Digit Clocks W90 Bd from onlinewebfonts.com
),
),
alignment: Alignment.center,
),
Container(
child: RaisedButton(
onPressed: _launchURL,
child: new Text('Learn More'),
),
),
],
),
),
);
}
}
解决方案
只需像这样使用 Align 小部件:
class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Material(
color: Colors.black87,
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"${divStuff()}",
style: TextStyle(
color: Colors.white,
fontSize: 120.0,
fontFamily:
'PIXymbols', //PIXymbols Digit Clocks W90 Bd from onlinewebfonts.com
),
),
alignment: Alignment.center,
),
Align( //The align widget
alignment : Alignment.bottomLeft,
child: RaisedButton(
onPressed: _launchURL,
child: new Text('Learn More'),
),
),
],
),
),
);
}
}
推荐阅读
- mps - 如何在 Jetbrains MPS 中的节点上运行撤消操作?
- javascript - 数据表复选框问题
- d3.js - 页面重新加载后 D3 缩放不适用于当前鼠标坐标
- node.js - 在快速会话中自动刷新会话
- laravel - 如何将当前登录用户显示到页面 laravel?
- mysql - 实现禁止重复用户名的触发器
- drupal-modules - 如何在drupal 8的模块安装页面中包含图标
- xamarin.forms - SonarQube 分析问题 Line is out of range for
- spring-boot - Keycloak 与 Spring Boot 的集成
- python - 构造一个类来展平python列表