【发布时间】:2020-07-31 10:49:26
【问题描述】:
我想做一个提交按钮进行注册,但每次添加 onPressed 时都会出错,这是代码:
Widget _submitButton() {
return Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.symmetric(vertical: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(5)),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey.shade200,
offset: Offset(2, 4),
blurRadius: 5,
spreadRadius: 2)
],
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [Color(0xff03a9f4), Color(0xff81d4fa)])),
child: Text(
'Register Now',
style: TextStyle(fontSize: 20, color: Colors.white),
),
);
}
我应该改变什么以使代码正常工作?我想用这个按钮连接到firebase
【问题讨论】:
-
你能分享一下 onPressed() 代码
-
onPressed: () { if (_formKey.currentState.validate()) { registerToFb(); } },
-
您是如何以及在何处添加 onPressed 的?
-
样式后),)
-
看看我的回答是否对你有帮助
标签: flutter