我在方法内部使用Buttontheme。当我尝试使用Theme数据更改按钮的颜色时,它显示一条错误消息,表明无法在方法内部使用themedata可以有人建议我如何更改按钮的颜色Buttontheme或其他方法。
这是我的代码:
Widget _signInEmailButton() {
return ButtonTheme(
minWidth: 325,
child: OutlineButton(
splashColor: Colors.grey,
onPressed: () {
signInWithGoogle().whenComplete(() {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) {
return FirstScreen();
},
),
);
});
},
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(60)),
highlightElevation: 0,
borderSide: BorderSide(color: Colors.grey),
child: Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Flexible(
flex: 1,
child: Image(image: AssetImage("Assets/email_logo.png"), height: 35.0)),
Expanded(
flex: 1,
child: Padding(
padding: const EdgeInsets.only(left: 10),
child: Text(
'Sign in with Email',
style: TextStyle(
fontSize: 15,
color: Colors.grey,
),
),
),
),
],
),
),
),
);
}