每个孩子必须布置一次相关的引起错误的小部件为:脚手架

问题描述

我开始使用flutter进行工作,之前没有任何错误..但是当我单击热重启时,出现了错误,并且出现了两个错误:

  1. 状态不佳:没有元素
  2. 每个孩子必须布置一次。

所以我想问大家,也许有人可以向我解释为什么我会得到这个错误,这是什么意思,以及如何消除它。

当我开始运行我的应用程序时,只显示了“全名”字段,“电话号码”字段就消失了。

好,所以我有这样的代码:

  String phoneNo,phoneName,smssent,verificationId;

  get verifiedSuccess => null;

  Future<void> verfiyPhone() async {
    final PhoneCodeAutoRetrievalTimeout autoRetrieve = (String verId) {
      this.verificationId = verId;
    };
    final PhoneCodeSent smsCodeSent = (String verId,[int forceCodeResent]) {
      this.verificationId = verId;
      smsCodeDialoge(context).then((value) {
        print("Code Sent");
      });
    };
    final PhoneVerificationCompleted verifiedSuccess = (AuthCredential auth) {};
    final PhoneVerificationFailed verifyFailed = (FirebaseAuthException e) {
      //(AuthException e)
      print('${e.message}');
    };
    await FirebaseAuth.instance.verifyPhoneNumber(
      phoneNumber: phoneNo,timeout: const Duration(seconds: 5),verificationCompleted: verifiedSuccess,verificationFailed: verifyFailed,codeSent: smsCodeSent,codeAutoRetrievalTimeout: autoRetrieve,);
  }

  Future<bool> smsCodeDialoge(BuildContext context) {
    return showDialog(
        context: context,barrierDismissible: false,builder: (BuildContext context) {
          return new AlertDialog(
            title: Text('Enter OTP'),content: TextField(
              onChanged: (value) {
                this.smssent = value;
              },),contentPadding: EdgeInsets.all(10.0),actions: <Widget>[
              FlatButton(
                onPressed: () {
                  User currentUser = FirebaseAuth.instance.currentUser;
                  //FirebaseAuth.instance.currentUser.then(){
                  if (currentUser != null) {
                    //user!=null
                    Navigator.of(context).pop();
                    Navigator.push(
                      context,MaterialPageRoute(
                          builder: (context) => ManagementScreen()),);
                  } else {
                    Navigator.of(context).pop();
                    signIn(smssent);
                  }
                },child: Text(
                  'Done',style: TextStyle(color: Colors.black),],);
        });
  }

  Future<void> signIn(String smsCode) async {
    final AuthCredential credential = PhoneAuthProvider.getCredential(
      verificationId: verificationId,smsCode: smsCode,);

    await FirebaseAuth.instance.signInWithCredential(credential).then((user) {
      Navigator.push(
        context,MaterialPageRoute(
          builder: (context) => ManagementScreen(),);
    }).catchError((e) {
      print(e);
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        elevation: 0,title: Text('Phone Setup',style: TextStyle(color: Colors.grey,fontStyle: FontStyle.italic)),backgroundColor: Colors.transparent,body: Column(
        // mainAxisAlignment: MainAxisAlignment.center,children: <Widget>[
          Padding(
            padding: const EdgeInsets.only(top: 30,left: 14),child: Container(
              child: Text('Make it easy for friends to join you on Clipstream.',style: TextStyle(fontSize: 16)),Padding(
            padding: const EdgeInsets.all(16.0),child: TextFormField(
              keyboardType: TextInputType.name,onChanged: (value) {
                setState(() {
                  this.phoneName = value;
                });
              },decoration: InputDecoration(
                labelText: "Full name",border: new OutlineInputBorder(
                  borderRadius: new BorderRadius.circular(0.0),borderSide: new BorderSide(),IntlPhoneField(
               decoration: InputDecoration(
                 labelText: 'Phone Number',border: OutlineInputBorder(
                   borderSide: BorderSide(),keyboardType: TextInputType.number,initialCountryCode: 'IN',onChanged: (value) {
                 setState(() {
                   this.phoneNo = value as String;
                 });
               },

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...