[英]how to give space between two buttons in flutter?
i'm using two buttons in my application which is been used inside a method separately.but i'm not able to given enough space between those two buttons,can someone look into it please.我在我的应用程序中使用了两个按钮,它们分别在一个方法中使用。但是我无法在这两个按钮之间留出足够的空间,有人可以查看一下吗?
here's my code:这是我的代码:
child: Center(
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlutterLogo(size: 150),
SizedBox(height: 50),
_signInButton(),
_signInFbButton()
],
),
),
),
);
}
Widget _signInButton() {
return Container(
child: OutlineButton(
splashColor: Colors.grey,
onPressed: () {
signInWithGoogle().whenComplete(() {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) {
return FirstScreen();
},
),
);
});
},
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(40)),
highlightElevation: 0,
borderSide: BorderSide(color: Colors.grey),
child: Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Column(
children: <Widget>[
Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image(image: AssetImage("Assets/google_logo.png"), height: 35.0),
Padding(
padding: const EdgeInsets.only(left: 10),
child: Text(
'Sign in with Google',
style: TextStyle(
fontSize: 20,
color: Colors.grey,
}
Widget _signInFbButton() {
return Container(
child: OutlineButton(
splashColor: Colors.grey,
onPressed: () {
signInWithGoogle().whenComplete(() {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) {
return FirstScreen();
},
),
);
});
},
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(40)),
highlightElevation: 0,
borderSide: BorderSide(color: Colors.grey),
child: Container(
child: Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Column(
children: <Widget>[
Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image(image: AssetImage("Assets/facebook-logo.png"), height: 35.0),
Padding(
padding: const EdgeInsets.only(left: 10),
child: Text(
'Sign in with Google',
style: TextStyle(
fontSize: 20,
color: Colors.grey,
Here's my screenshot of what im trying to do i'm creating a sign in page using google sign-in and facebook sign-in这是我正在尝试使用谷歌登录和 Facebook 登录创建登录页面的屏幕截图
You can wrap _signInFbButton()
widget with Padding
and provide top padding per your requirement.您可以使用
Padding
包装_signInFbButton()
小部件并根据您的要求提供顶部填充。 Working code below:工作代码如下:
_signInButton(),
Padding(
padding: EdgeInsets.only(top: 5),
child: _signInFbButton())
Hope this answers your question.希望这能回答你的问题。
Why don't you try what you have already?你为什么不试试你已经拥有的东西? the
SizedBox
to achieve that, SizedBox
来实现这一点,
_signInButton(),
SizedBox(height: 16),//<----
_signInFbButton()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.