我在FlexibleSpaceBar
添加按钮时遇到问题。出于某种原因,它总是被禁用。我已经尝试了FlatButton
和RaisedButton
,但两者都出现了同样的问题。如果我将它放在我页面上的其他位置,该按钮可以正常工作
这是代码:
new SliverAppBar(
backgroundColor: new Color.fromRGBO(253, 61, 98, 0.9),
floating: false,
expandedHeight: _appBarHeight,
actions: <Widget>[
new IconButton(
icon: new Icon(Icons.search),
onPressed: () => Navigator.of(context).push(new MaterialPageRoute(builder: (BuildContext context) => new FriendSearchPage())),
),
new IconButton(icon: new Icon(Icons.settings), onPressed: null)
],
pinned: true,
leading: new Icon(Icons.person),
title: new Text("Your Profile"),
flexibleSpace: new FlexibleSpaceBar(
background: new Stack(
fit: StackFit.expand,
children: <Widget>[
new Center(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Padding(padding: new EdgeInsets.only(top: 50.0),),
new Container(
height: 100.0,
width: 100.0,
decoration: new BoxDecoration(
borderRadius: new BorderRadius.circular(100.0),
border: new Border.all(color: Colors.white70)
),
child: new Icon(Icons.person, size: 70.0, color: Colors.white,),
),
new Padding(padding: new EdgeInsets.only(top: 20.0)),
new Text(_firstName + " " +_lastName, style: new TextStyle(color: Colors.white),),
new Padding(padding: new EdgeInsets.only(top: 20.0)),
////////////////////////////////////////////////////////
new FlatButton( // !!!! Disabled? !!!!
child: new Text("Copy Friend ID"),
onPressed: () {
showDialog(
context: context,
child: new Text("ok")
);
}
)
],
),
),
new Stack(
children: <Widget>[
new Container(
decoration: new BoxDecoration(
gradient: new LinearGradient(
colors: <Color>[
new Color.fromRGBO(253, 61, 98, 0.4),
new Color.fromRGBO(253, 94, 65, 0.2)
],
begin: const Alignment(0.0, 0.6),
end: const Alignment(0.0, -1.0),
)
),
),
],
)
],
),
),
),