我有一个FlatButton。单击按钮时,我不希望启动突出显示。我尝试将初始颜色更改为透明,但这没有用。这是我的FlatButton的代码。
Widget button = new Container(
child: new Container(
padding: new EdgeInsets.only(bottom: 20.0),
alignment: Alignment.center,
child: new FlatButton(
onPressed: () {
_onClickSignInButton();
},
splashColor: Colors.transparent,
child: new Stack(
alignment: Alignment.center,
children: <Widget>[
new Image.asset('images/1.0x/button1.png',
),
new Text("SIGN IN",
style: new TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 16.0
),
)
],
),
),
),
);
Run Code Online (Sandbox Code Playgroud) 码:
new Container(
alignment: FractionalOffset.center,
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
new FlatButton(
child: new Text('Don\'t have an account?', style: new TextStyle(color: Color(0xFF2E3233))),
),
new FlatButton(
child: new Text('Register.', style: new TextStyle(color: Color(0xFF84A2AF), fontWeight: FontWeight.bold),),
onPressed: moveToRegister,
)
],
),
),
Run Code Online (Sandbox Code Playgroud)
这是结果:https:
//www.dropbox.com/s/sxklyutyvbbura8/Screenshot_20181104-150928.png?dl = 0
如何确定两个FlatButton
元素并排,屏幕宽度中心之间没有空间?
有什么想法如何从 Flutter PopupmenuButton 中删除巨大的填充吗?像ShrinkWrap 或者甚至可以使用的替代小部件之类的东西?它破坏了我的元素的对齐。
我尝试将其设置padding
为 0 但完全没有效果。
padding: EdgeInsets.all(0)
Run Code Online (Sandbox Code Playgroud)
如何减少按钮之间的间距?
您可以看到应用程序栏上的四个按钮占用了很多空间,我尝试过行。但没有工作
AppBar(
backgroundColor: Colors.deepOrange,
iconTheme: new IconThemeData(color: Colors.white),
title: Text(
titleString,
style: TextStyle(color: Colors.white),
),
actions: <Widget>[
IconButton(
icon: Icon(
Icons.search,
color: Colors.white,
),
//iconSize: 20,
onPressed: null,
),
IconButton(
icon: Icon(
Icons.notifications_none,
color: Colors.white,
),
// iconSize: 20,
onPressed: null,
),
//Add more icon here
],
);
Run Code Online (Sandbox Code Playgroud)