当snapshot.hasData调用RaisedButton默认情况下处于禁用状态,但是即使有数据也永远不会启用。此行为仅在ios中,在android中有效。
StreamBuilder(
stream: bloc.submitValid,
builder: (context, snapshot) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 100.0),
margin: EdgeInsets.only(bottom: 20.0),
child: RaisedButton(
color: grey,
onPressed: snapshot.hasData ? bloc.submit : null,
child: Text(
'LOGIN',
style: TextStyle(
color: white
),
),
),
);
});