Validation 颤振验证器没有返回任何内容

Validation 颤振验证器没有返回任何内容,validation,authentication,google-app-engine,flutter,dart,Validation,Authentication,Google App Engine,Flutter,Dart,这是我的signup.dart文件代码: 这是一个错误。 但我只是想看到在文本字段的下面显示一个错误,但它没有显示任何内容。 谁能说我做错了什么 import 'package:flutter/material.dart'; class SignupPage extends StatefulWidget { @override _SignupPageState createState() => _SignupPageState(); } class _SignupPageSta

这是我的signup.dart文件代码:

这是一个错误。 但我只是想看到在文本字段的下面显示一个错误,但它没有显示任何内容。 谁能说我做错了什么

import 'package:flutter/material.dart';

class SignupPage extends StatefulWidget {
  @override
  _SignupPageState createState() => _SignupPageState();
}

class _SignupPageState extends State<SignupPage> {
  final formkey = new GlobalKey<FormState>();
  registered() {
    print("validation form...$formkey");
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
        resizeToAvoidBottomPadding: false,
        body: Column(crossAxisAlignment: CrossAxisAlignment.start, children: <
            Widget>[
          Container(
            child: Stack(
              children: <Widget>[
                Container(
                  padding: EdgeInsets.fromLTRB(15.0, 110.0, 0.0, 0.0),
                  child: Text(
                    'Qeydiyyat',
                    style:
                        TextStyle(fontSize: 60.0, fontWeight: FontWeight.bold),
                  ),
                ),
              ],
            ),
          ),
          SizedBox(height: 30.0),
          Container(
              padding: EdgeInsets.only(top: 35.0, left: 20.0, right: 20.0),
              child: Form(
                key: formkey,
                child: Column(
                  children: <Widget>[
                    TextFormField(
                      decoration: InputDecoration(
                          labelText: 'E-Poçt',
                          labelStyle: TextStyle(
                              fontFamily: 'Montserrat',
                              fontWeight: FontWeight.bold,
                              color: Colors.grey),
                          // hintText: 'EMAIL',
                          // hintStyle: ,
                          focusedBorder: UnderlineInputBorder(
                              borderSide: BorderSide(color: Colors.green))),
                      validator: (val) {
                        return "sea";
                      },
                    ),
                    SizedBox(height: 10.0),
                    TextFormField(
                      keyboardType: TextInputType.text,
                      decoration: InputDecoration(
                          labelText: 'Şifrə ',
                          labelStyle: TextStyle(
                              fontFamily: 'Montserrat',
                              fontWeight: FontWeight.bold,
                              color: Colors.grey),
                          focusedBorder: UnderlineInputBorder(
                              borderSide: BorderSide(color: Colors.green))),
                      obscureText: true,
                      validator: (val) {
                        return "sea";
                      },
                    ),
                    SizedBox(height: 10.0),
                    TextFormField(
                      decoration: InputDecoration(
                          labelText: 'Ad Soyad',
                          labelStyle: TextStyle(
                              fontFamily: 'Montserrat',
                              fontWeight: FontWeight.bold,
                              color: Colors.grey),
                          focusedBorder: UnderlineInputBorder(
                              borderSide: BorderSide(color: Colors.green))),
                      validator: (val) {
                        return "sea";
                      },
                    ),
                    SizedBox(height: 50.0),
                    Container(
                        height: 40.0,
                        child: RaisedButton(
                          color: Colors.blue,
                          onPressed: registered,
                          shape: RoundedRectangleBorder(
                            side: BorderSide(color: Colors.blue),
                            borderRadius: BorderRadius.circular(50),
                          ),
                          child: Center(
                            child: Text(
                              'Qeydiyyat',
                              style: TextStyle(
                                  color: Colors.white,
                                  fontWeight: FontWeight.bold,
                                  fontFamily: 'Montserrat'),
                            ),
                          ),
                        )),
                    SizedBox(height: 20.0),
                    Container(
                      height: 40.0,
                      child: RaisedButton(
                        color: Colors.red,
                        disabledColor: Colors.transparent,
                        shape: RoundedRectangleBorder(
                          side: BorderSide(color: Colors.blue),
                          borderRadius: BorderRadius.circular(50),
                        ),
                        child: InkWell(
                          onTap: () {
                            Navigator.of(context).pop();
                          },
                          child: Center(
                            child: Text('Daxil ol',
                                style: TextStyle(
                                    color: Colors.blue,
                                    fontWeight: FontWeight.bold,
                                    fontFamily: 'Montserrat')),
                          ),
                        ),
                      ),
                    ),
                  ],
                ),
              )),
        ]));
  }
}
导入“包装:颤振/材料.省道”;
类SignupPage扩展StatefulWidget{
@凌驾
_SignupPageState createState()=>\u SignupPageState();
}
类_SignupPageState扩展状态{
final formkey=new GlobalKey();
注册(){
打印(“验证表…$formkey”);
}
@凌驾
小部件构建(构建上下文){
归还新脚手架(
resizeToAvoidBottomPadding:false,
正文:列(crossAxisAlignment:crossAxisAlignment.start,子项:<
小部件>[
容器(
子:堆栈(
儿童:[
容器(
填充:来自LTRB(15.0、110.0、0.0、0.0)的边缘设置,
子:文本(
“Qeydiyyat”,
风格:
TextStyle(fontSize:60.0,fontWeight:fontWeight.bold),
),
),
],
),
),
尺寸箱(高度:30.0),
容器(
填充:仅限边缘设置(顶部:35.0,左侧:20.0,右侧:20.0),
孩子:表格(
key:formkey,
子:列(
儿童:[
TextFormField(
装饰:输入装饰(
标签文字:“E-Poçt”,
标签样式:文本样式(
fontFamily:“蒙特塞拉特”,
fontWeight:fontWeight.bold,
颜色:颜色。灰色),
//hintText:“电子邮件”,
//辛茨泰尔:,
FocusedOrder:下划线输入边框(
borderSide:borderSide(颜色:Colors.green)),
验证器:(val){
回归“海”;
},
),
尺寸箱(高度:10.0),
TextFormField(
键盘类型:TextInputType.text,
装饰:输入装饰(
labelText:“如果”,
标签样式:文本样式(
fontFamily:“蒙特塞拉特”,
fontWeight:fontWeight.bold,
颜色:颜色。灰色),
FocusedOrder:下划线输入边框(
borderSide:borderSide(颜色:Colors.green)),
蒙昧文字:对,
验证器:(val){
回归“海”;
},
),
尺寸箱(高度:10.0),
TextFormField(
装饰:输入装饰(
标签文字:“Ad Soyad”,
标签样式:文本样式(
fontFamily:“蒙特塞拉特”,
fontWeight:fontWeight.bold,
颜色:颜色。灰色),
FocusedOrder:下划线输入边框(
borderSide:borderSide(颜色:Colors.green)),
验证器:(val){
回归“海”;
},
),
尺寸箱(高度:50.0),
容器(
身高:40.0,
孩子:升起按钮(
颜色:颜色,蓝色,
已注册,
形状:圆形矩形边框(
侧边:边框侧边(颜色:Colors.blue),
边界半径:边界半径。圆形(50),
),
儿童:中心(
子:文本(
“Qeydiyyat”,
样式:TextStyle(
颜色:颜色,白色,
fontWeight:fontWeight.bold,
fontFamily:“蒙特塞拉特”),
),
),
)),
尺寸箱(高度:20.0),
容器(
身高:40.0,
孩子:升起按钮(
颜色:颜色,红色,
disabledColor:Colors.transparent,
形状:圆形矩形边框(
侧边:边框侧边(颜色:Colors.blue),
边界半径:边界半径。圆形(50),
),
孩子:InkWell(
onTap:(){
Navigator.of(context.pop();
},
儿童:中心(
child:Text('Daxil ol',
样式:TextStyle(
颜色:颜色,蓝色,
fontWeight:fontWeight.bold,
fontFamily:“蒙特塞拉特”),
),
),
),
),
],
),
)),
]));
}
}
这是一个错误。 但我只是想看到在文本字段的下面显示一个错误,但它没有显示任何内容。
有人能说出我做错了什么吗?

如果要进行验证工作,请自动将TextField的autoValidate属性设置为true。否则,如果您想在事件发生后验证此按钮,您可以使用c
import 'package:flutter/material.dart';

class SignupPage extends StatefulWidget {
  @override
  _SignupPageState createState() => _SignupPageState();
}

class _SignupPageState extends State<SignupPage> {
  final formkey = new GlobalKey<FormState>();
  registered() {
    print("validation form...$formkey");
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
        resizeToAvoidBottomPadding: false,
        body: Column(crossAxisAlignment: CrossAxisAlignment.start, children: <
            Widget>[
          Container(
            child: Stack(
              children: <Widget>[
                Container(
                  padding: EdgeInsets.fromLTRB(15.0, 110.0, 0.0, 0.0),
                  child: Text(
                    'Qeydiyyat',
                    style:
                        TextStyle(fontSize: 60.0, fontWeight: FontWeight.bold),
                  ),
                ),
              ],
            ),
          ),
          SizedBox(height: 30.0),
          Container(
              padding: EdgeInsets.only(top: 35.0, left: 20.0, right: 20.0),
              child: Form(
                key: formkey,
                child: Column(
                  children: <Widget>[
                    TextFormField(
                      decoration: InputDecoration(
                          labelText: 'E-Poçt',
                          labelStyle: TextStyle(
                              fontFamily: 'Montserrat',
                              fontWeight: FontWeight.bold,
                              color: Colors.grey),
                          // hintText: 'EMAIL',
                          // hintStyle: ,
                          focusedBorder: UnderlineInputBorder(
                              borderSide: BorderSide(color: Colors.green))),
                      validator: (val) {
                        return "sea";
                      },
                    ),
                    SizedBox(height: 10.0),
                    TextFormField(
                      keyboardType: TextInputType.text,
                      decoration: InputDecoration(
                          labelText: 'Şifrə ',
                          labelStyle: TextStyle(
                              fontFamily: 'Montserrat',
                              fontWeight: FontWeight.bold,
                              color: Colors.grey),
                          focusedBorder: UnderlineInputBorder(
                              borderSide: BorderSide(color: Colors.green))),
                      obscureText: true,
                      validator: (val) {
                        return "sea";
                      },
                    ),
                    SizedBox(height: 10.0),
                    TextFormField(
                      decoration: InputDecoration(
                          labelText: 'Ad Soyad',
                          labelStyle: TextStyle(
                              fontFamily: 'Montserrat',
                              fontWeight: FontWeight.bold,
                              color: Colors.grey),
                          focusedBorder: UnderlineInputBorder(
                              borderSide: BorderSide(color: Colors.green))),
                      validator: (val) {
                        return "sea";
                      },
                    ),
                    SizedBox(height: 50.0),
                    Container(
                        height: 40.0,
                        child: RaisedButton(
                          color: Colors.blue,
                          onPressed: registered,
                          shape: RoundedRectangleBorder(
                            side: BorderSide(color: Colors.blue),
                            borderRadius: BorderRadius.circular(50),
                          ),
                          child: Center(
                            child: Text(
                              'Qeydiyyat',
                              style: TextStyle(
                                  color: Colors.white,
                                  fontWeight: FontWeight.bold,
                                  fontFamily: 'Montserrat'),
                            ),
                          ),
                        )),
                    SizedBox(height: 20.0),
                    Container(
                      height: 40.0,
                      child: RaisedButton(
                        color: Colors.red,
                        disabledColor: Colors.transparent,
                        shape: RoundedRectangleBorder(
                          side: BorderSide(color: Colors.blue),
                          borderRadius: BorderRadius.circular(50),
                        ),
                        child: InkWell(
                          onTap: () {
                            Navigator.of(context).pop();
                          },
                          child: Center(
                            child: Text('Daxil ol',
                                style: TextStyle(
                                    color: Colors.blue,
                                    fontWeight: FontWeight.bold,
                                    fontFamily: 'Montserrat')),
                          ),
                        ),
                      ),
                    ),
                  ],
                ),
              )),
        ]));
  }
}