问题描述
你好, 我需要帮助解决这个问题。我不知道。我在哪里可以找到此选项以删除此按钮之间的空格。
我刚刚开始学习 Flutter
带有按钮的部分代码:
class LoginScreen extends StatefulWidget {
@override
_LoginScreenState createState() => _LoginScreenState();
}
class _LoginScreenState extends State<LoginScreen> {
Widget _bulidLoginFacebook() {
return Container(
padding: EdgeInsets.symmetric(
vertical: 10,),width: double.infinity,child: RaisedButton(
onpressed: () => print('Facebook Login'),padding: EdgeInsets.all(10),shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),color: Color(0xFF3b5998),child: RichText(
text: TextSpan(
children: [
TextSpan(
text: 'Zaloguj się z ',style: TextStyle(color: ColoRSS.white,letterSpacing: 1.5,fontSize: 13,fontFamily: 'OpenSans'),WidgetSpan(
child: Icon(
Icons.add,size: 14,color: Colors.white,TextSpan(
text: ' FACEBOOK',style: TextStyle(color: Colors.white,],);
}
Widget _bulidLoginGoogle() {
return Container(
padding: EdgeInsets.symmetric(
vertical: 5,child: RaisedButton(
onpressed: () => print('Google Login'),padding: EdgeInsets.all(1),color: Color(0xFFde5246),TextSpan(
text: ' GOOGLE',);
}
这是我尝试使用谷歌登录和 Facebook 登录创建登录页面的截图
解决方法
将按钮的 materialTapTargetSize
设置为 shrinkWrap
RaisedButton(
onPressed: onPressed,child: child,materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,),
,
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: <Widget>[
Container(
height: double.infinity,width: double.infinity,decoration: BoxDecoration(
color: Colors.white,Container(
height: double.infinity,child: SingleChildScrollView(
physics: AlwaysScrollableScrollPhysics(),padding: EdgeInsets.symmetric(
horizontal: 60,vertical: 40
),child: Column(
mainAxisAlignment: MainAxisAlignment.center,children: <Widget>[
Image.asset(
'assets/logofl.png',SizedBox(
height: 5,_bulidEmailTF(),_bulidPasswordTF(),_bulidForgotPasswordBtn(),_bulidLoginButton(),_bulidRegistrationTF(),SizedBox(
height: 30,_bulidLine(),SizedBox(
height: 20,_bulidLoginFacebook(),_bulidLoginGoogle(),],);
}
}